anybody familiar with blind data editors and exporters supported by maya for instance

if i still have your attention or anyones. so i modified the objexporter to do some of the things i wanted it to. i should already know this i guess, but i can’t get it to compile without a “main” function. like all the other plugins do. and with the main function obviously maya wont recognize the intitialize and uninitialize functions so i don’t get far. i’ve tried everything. the project settings and code are all in the exact same format as all plugins… i’ve read through the maya docs. i haven’t a clue what stone i’ve left unturned. its late i’m burned out. if someone can drop me a clue i’d realy apreciate it.
sincerely,

Michael

ps: i guess i could just jump to the stand alone app with the main function but i’d rather get aquainted with the plugin format first i think. oiii the room is unjulating.

[This message has been edited by wildeyedboyfromfreecloud (edited 02-20-2002).]

a dll requires dllMain(), this is defined in one of the maya headers (maya/MFnPlugin.h i think) The only functions you have to define are initialisePlugin & uninitialisePlugin. These functions are required to be exported in the project settings, that should be it. You should of sourse include maya/MFnPlugin.h . . .

sorry to be a bother. of course MFnPugin and what not are in there. but there is presumably a windows library file that spits this out at link if i dont have a “main” function:

LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main

also none off the plugins included a dllMain function. presumably it is defined in one of the maya headers as i think you’d stated.

sorry. i just loaded into another plugin file and it worked ok. i don’t know what is wrong in my workspace. i’ve really looked at every option at least 20 times.

well btw do you know what the mel script should look like to utilize an MPxFileTranslator object. or maybe i could look into the customizable GUI support. thanks

michael

i gotta race off too school. apreciate it.

[This message has been edited by wildeyedboyfromfreecloud (edited 02-21-2002).]

sorry i was so rude. thanks for the advice jwatte,m i really apreciate it.

Originally posted by jwatte:
The Maya SDK should contain sample exporters that you can start from. I say “should” because I don’t have Maya experience beyond looking at their web site http://www.aliaswavefront.com/en/WhatWeDo/maya/see/solutions/m_builder.shtml (3DSMax comes with several exporter samples, as does Blender)

oi, is it laundry time already???
later

Sorry I haven’t replied for a bit, lot of work on…

the following is a list of all lib’s I link to:

Foundation.lib Image.lib OpenMaya.lib OpenMayaAnim.lib OpenMayaUI.lib XSICore.lib XSIFtk.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

in addition, the following must be specified in the Project Options box under the Link tab of the settings dialog:

/export:initializePlugin /export:uninitializePlugin

the following pre-processor definitions are used under the C/C++ tab :

WIN32,_DEBUG,_WINDOWS,_MBCS,NT_PLUGIN,_WINDLL,_AFXDLL,_CONSOLE

that should be all you need.

In addition, if you want to debug your plug-in, you need to do the following :

  1. In the Debug tab of the project settings specify the “Executable for debug session” to as C:/AW/Maya4.0/bin/maya.exe (or wherever you maya is located)

  2. change the catagory to “Additional Dlls” and add the path to your compiled plugin under the local name bit.

You should now be able to place breakpoints and stuff through your plugin code.

In response to the file format question, I think the most flexible is a chunk based format where each data chunk has any number of child chunks of varying size. The xsi file format or the DirectX X file are both pretty good examples and worth checking out.

I tend to use a more limited file format myself. I specify data in following sections in the file :

  1. All Textures first
  2. All Materials next because they reference the textures
  3. “Shapes”, ie any Geometry, Lights, Cameras, Curves, Nurbs, etc. These may or may not reference the materials defined before hand.
  4. Transforms in a hierarchical structure. Each transform can have a set of child transforms, and a list of the shapes that are parented under it. The shape list is just names or indices to the shape list that appeared previously, this allows for geometry instancing.
  5. Any expressions, skin weights, animation curves etc.

The reason for this ordering is so that I can load the file sequentually and will always know that if say, a mesh uses a certain material, the material will have already been loaded. It means the scene hierarchy can be constructed as the file is loaded rather than building up refernces afterwards. Seems abit more logical to me…

don’t worry about it.
yeah i’m halfway familiar with chunks. that is the format the 3ds files are in… so kinda put the maya project on the back burner for the meantime. i got a little stuck. i loaded my exporter in and i was trying to get it to work like OBJexport. whereas you click on export in the file dropdown.

i modified this mel script file that the objexport plugin referenced that created the GUI. but i couldn’t get my pulgin to link with it. i’m not sure if maya builds it automatically for all file translator plugins. or well the whole project just got anoying and i was burning to much time on it. here is the GUI building mel file. it doesn’t work if i just pop it in the command prompt the way i want it to. i’m trying not to sound too juvenile. but boy is this a headache. all i did initially is modify the objexporter to export the necesary data for volumetric shadowing. here is the mel cript.

// $RCSfile: objExportOptions.mel $ $Revision: /main/1 $

global proc int AvalonExportOptions ( string $parent,
string $action,
string $initialSettings,
string $resultCallback )
//
// Description:
// This script posts the OBJ file translator options.
// The optionsString is of the form:
// varName1=value1;varName2=value2;…
//
// Parameters:
// $parent - the elf parent layout for this options layout. It is
// always a scrollLayout.
// $action - the action that is to be performed with this invokation
// of this proc. Valid options are:
// “query” - construct the options string and pass it
// to the resultCallback.
// “post” - post all the elf controls.
// $initialSettings - the current options string in effect at the
// time this script is invoked.
// $resultCallback -
// This is the proc to be called with the result string.
// resultCallback ( string $optionsString )
//
// Returns:
// 1 if successfull.
// 0 otherwise.
//
{
int $bResult;
string $currentOptions;
string $optionList[];
string $optionBreakDown[];
int $index;

if ($action == "post") {
	setParent $parent;

	columnLayout -adj true objTypeCol;
		radioButtonGrp
			-l "Groups"
			-nrb 2 -cw3 175 75 75
			-la2 "On" "Off" objGroups;
		radioButtonGrp
			-l "Point groups"
			-nrb 2	-cw3 175 75 75
			-la2 "On" "Off" objPtGroups;
		radioButtonGrp
			-l "Materials"
			-nrb 2	-cw3 175 75 75
			-la2 "On" "Off" objMaterials;
		radioButtonGrp
			-l "Smoothing"
			-nrb 2	-cw3 175 75 75
			-la2 "On" "Off" objSmoothing;
		radioButtonGrp
			-l "Normals"
			-nrb 2	-cw3 175 75 75
			-la2 "On" "Off" objNormals;
		radioButtonGrp
			-l "Shadows"
			-nrb 2	-cw3 175 75 75
			-la2 "On" "Off" objShadows;
            
            
            				
	// Now set to current settings.
	$currentOptions = $initialSettings;
	if (size($currentOptions) > 0) {
		tokenize($currentOptions, ";", $optionList);
		for ($index = 0; $index < size($optionList); $index++) {
			tokenize($optionList[$index], "=", $optionBreakDown);

			if ($optionBreakDown[0] == "groups") {
				if ($optionBreakDown[1] == "0") {
					radioButtonGrp -e -sl 2 objGroups;
				} else {
					radioButtonGrp -e -sl 1 objGroups;
				}
			} else if ($optionBreakDown[0] == "ptgroups") {
				if ($optionBreakDown[1] == "0") {
					radioButtonGrp -e -sl 2 objPtGroups;
				} else {
					radioButtonGrp -e -sl 1 objPtGroups;
				}
			} else if ($optionBreakDown[0] == "materials") {
				if ($optionBreakDown[1] == "0") {
					radioButtonGrp -e -sl 2 objMaterials;
				} else {
					radioButtonGrp -e -sl 1 objMaterials;
				}
			} else if ($optionBreakDown[0] == "smoothing") {
				if ($optionBreakDown[1] == "0") {
					radioButtonGrp -e -sl 2 objSmoothing;
				} else {
					radioButtonGrp -e -sl 1 objSmoothing;
				}
			} else if ($optionBreakDown[0] == "normals") {
				if ($optionBreakDown[1] == "0") {
					radioButtonGrp -e -sl 2 objNormals;
				} else {
					radioButtonGrp -e -sl 1 objNormals;
				}
			} else if ($optionBreakDown[0] == "shadows") {
				if ($optionBreakDown[1] == "0") {
					radioButtonGrp -e -sl 2 objShadows;
				} else {
					radioButtonGrp -e -sl 1 objShadows;
				}
			}
		}
	}
	$result = 1;

} else if ($action == "query") {

	if (`radioButtonGrp -q -sl objGroups` == 1) {
		$currentOptions = $currentOptions + "groups=1";
	} else {
		$currentOptions = $currentOptions + "groups=0";
	}

	if (`radioButtonGrp -q -sl objPtGroups` == 1) {
		$currentOptions = $currentOptions + ";ptgroups=1";
	} else {
		$currentOptions = $currentOptions + ";ptgroups=0";
	}

	if (`radioButtonGrp -q -sl objMaterials` == 1) {
		$currentOptions = $currentOptions + ";materials=1";
	} else {
		$currentOptions = $currentOptions + ";materials=0";
	}

	if (`radioButtonGrp -q -sl objSmoothing` == 1) {
		$currentOptions = $currentOptions + ";smoothing=1";
	} else {
		$currentOptions = $currentOptions + ";smoothing=0";
	}


	if (`radioButtonGrp -q -sl objNormals` == 1) {
		$currentOptions = $currentOptions + ";normals=1";
	} else {
		$currentOptions = $currentOptions + ";normals=0";
	}


	if (`radioButtonGrp -q -sl objShadows` == 1) {
		$currentOptions = $currentOptions + ";shadows=1";
	} else {
		$currentOptions = $currentOptions + ";shadows=0";
	}

	eval($resultCallback+" \""+$currentOptions+"\"");
	$result = 1;
} else {
	$bResult = 0;
}

return $bResult;

}

sorry bout the drag. the translator is loaded in so i can go to export and choose it as an export type. but then i get this error in the maya status report bar

rror: Cannot link to “AvalonExportOptions”. Check number and types of arguments expected on procedure definition.

i apreciate the help but don’t let yourself get stressed out over me. its not worth it i’m sure. thanks

michale

[This message has been edited by wildeyedboyfromfreecloud (edited 02-27-2002).]

Don’t let Maya programming get you down. I don’t have Maya (never used it) so I haven’t done any programming with it. I have on the other hand written a couple max plugins. Initially for model loading I started by using the ASE Ascii Exporter that comes with max (the SDK actually has the complete source as well) and then I would parse the ASE file into my own format. Carmack actually did that for Quake 3 (before it went skeletal). Eventually trying to parse the ASE became a big pain in the ass. With a big model/scene the ASE can get really large and I only wanted a very small subset of what it exported. ASE exports almost everything that is in the MAX file (in terms of raw data at least). I finally got sick of it and started looking at writing MAX plugins. After the initial compiling/linking problems from Microsoft’s out of date libraries/headers (the ones that ship with VC++ 6.0 are WRONG !!!) things got easier. Max plugins are all very similar to write and I found that after a week I got it all working. Currently I am still working on my exporter plugin. Trying to add some extra functionality (vertex weights). Gonna try to do some nice skeleton based animation. This should be fun to watch.

Anyway, I know this didn’t really answer any of your questions but I thought it might be nice to tell the world of my experience with max plugins and the max sdk. All in all the more i use it the more I give it 2 thumbs up, it works and works well. (:

It seems the more I read on writing plugins for my the development setup is almost Identical to max. It seems that its jus the way that Maya exposes the innards of itself are a little more messy. And life goes on.

Happy Coding.

[This message has been edited by Devulon (edited 03-01-2002).]

Originally posted by wildeyedboyfromfreecloud:
[b]don’t worry about it.
yeah i’m halfway familiar with chunks. that is the format the 3ds files are in… so kinda put the maya project on the back burner for the meantime. i got a little stuck. i loaded my exporter in and i was trying to get it to work like OBJexport. whereas you click on export in the file dropdown.

i modified this mel script file that the objexport plugin referenced that created the GUI. but i couldn’t get my pulgin to link with it. i’m not sure if maya builds it automatically for all file translator plugins. or well the whole project just got anoying and i was burning to much time on it. here is the GUI building mel file. it doesn’t work if i just pop it in the command prompt the way i want it to. i’m trying not to sound too juvenile. but boy is this a headache. all i did initially is modify the objexporter to export the necesary data for volumetric shadowing. here is the mel cript.

// RCSfile: objExportOptions.mel Revision: /main/1

global proc int AvalonExportOptions ( string $parent,
string $action,
string $initialSettings,
string $resultCallback )
//
// Description:
// This script posts the OBJ file translator options.
// The optionsString is of the form:
// varName1=value1;varName2=value2;…
//
// Parameters:
// $parent - the elf parent layout for this options layout. It is
// always a scrollLayout.
// $action - the action that is to be performed with this invokation
// of this proc. Valid options are:
// “query” - construct the options string and pass it
// to the resultCallback.
// “post” - post all the elf controls.
// $initialSettings - the current options string in effect at the
// time this script is invoked.
// $resultCallback -
// This is the proc to be called with the result string.
// resultCallback ( string $optionsString )
//
// Returns:
// 1 if successfull.
// 0 otherwise.
//
{
int $bResult;
string $currentOptions;
string $optionList;
string $optionBreakDown;
int $index;

if ($action == “post”) {
setParent $parent;

  columnLayout -adj true objTypeCol;
  	radioButtonGrp
  		-l "Groups"
  		-nrb 2 -cw3 175 75 75
  		-la2 "On" "Off" objGroups;
  	radioButtonGrp
  		-l "Point groups"
  		-nrb 2	-cw3 175 75 75
  		-la2 "On" "Off" objPtGroups;
  	radioButtonGrp
  		-l "Materials"
  		-nrb 2	-cw3 175 75 75
  		-la2 "On" "Off" objMaterials;
  	radioButtonGrp
  		-l "Smoothing"
  		-nrb 2	-cw3 175 75 75
  		-la2 "On" "Off" objSmoothing;
  	radioButtonGrp
  		-l "Normals"
  		-nrb 2	-cw3 175 75 75
  		-la2 "On" "Off" objNormals;
  	radioButtonGrp
  		-l "Shadows"
  		-nrb 2	-cw3 175 75 75
  		-la2 "On" "Off" objShadows;
            
            
            				
  // Now set to current settings.
  $currentOptions = $initialSettings;
  if (size($currentOptions) > 0) {
  	tokenize($currentOptions, ";", $optionList);
  	for ($index = 0; $index < size($optionList); $index++) {
  		tokenize($optionList[$index], "=", $optionBreakDown);
  		if ($optionBreakDown[0] == "groups") {
  			if ($optionBreakDown[1] == "0") {
  				radioButtonGrp -e -sl 2 objGroups;
  			} else {
  				radioButtonGrp -e -sl 1 objGroups;
  			}
  		} else if ($optionBreakDown[0] == "ptgroups") {
  			if ($optionBreakDown[1] == "0") {
  				radioButtonGrp -e -sl 2 objPtGroups;
  			} else {
  				radioButtonGrp -e -sl 1 objPtGroups;
  			}
  		} else if ($optionBreakDown[0] == "materials") {
  			if ($optionBreakDown[1] == "0") {
  				radioButtonGrp -e -sl 2 objMaterials;
  			} else {
  				radioButtonGrp -e -sl 1 objMaterials;
  			}
  		} else if ($optionBreakDown[0] == "smoothing") {
  			if ($optionBreakDown[1] == "0") {
  				radioButtonGrp -e -sl 2 objSmoothing;
  			} else {
  				radioButtonGrp -e -sl 1 objSmoothing;
  			}
  		} else if ($optionBreakDown[0] == "normals") {
  			if ($optionBreakDown[1] == "0") {
  				radioButtonGrp -e -sl 2 objNormals;
  			} else {
  				radioButtonGrp -e -sl 1 objNormals;
  			}
  		} else if ($optionBreakDown[0] == "shadows") {
  			if ($optionBreakDown[1] == "0") {
  				radioButtonGrp -e -sl 2 objShadows;
  			} else {
  				radioButtonGrp -e -sl 1 objShadows;
  			}
  		}
  	}
  }
  $result = 1;

} else if ($action == “query”) {

  if (`radioButtonGrp -q -sl objGroups` == 1) {
  	$currentOptions = $currentOptions + "groups=1";
  } else {
  	$currentOptions = $currentOptions + "groups=0";
  }
  if (`radioButtonGrp -q -sl objPtGroups` == 1) {
  	$currentOptions = $currentOptions + ";ptgroups=1";
  } else {
  	$currentOptions = $currentOptions + ";ptgroups=0";
  }
  if (`radioButtonGrp -q -sl objMaterials` == 1) {
  	$currentOptions = $currentOptions + ";materials=1";
  } else {
  	$currentOptions = $currentOptions + ";materials=0";
  }
  if (`radioButtonGrp -q -sl objSmoothing` == 1) {
  	$currentOptions = $currentOptions + ";smoothing=1";
  } else {
  	$currentOptions = $currentOptions + ";smoothing=0";
  }
  if (`radioButtonGrp -q -sl objNormals` == 1) {
  	$currentOptions = $currentOptions + ";normals=1";
  } else {
  	$currentOptions = $currentOptions + ";normals=0";
  }
  if (`radioButtonGrp -q -sl objShadows` == 1) {
  	$currentOptions = $currentOptions + ";shadows=1";
  } else {
  	$currentOptions = $currentOptions + ";shadows=0";
  }
  eval($resultCallback+" \""+$currentOptions+"\"");
  $result = 1;

} else {
$bResult = 0;
}

return $bResult;
}

sorry bout the drag. the translator is loaded in so i can go to export and choose it as an export type. but then i get this error in the maya status report bar

rror: Cannot link to “AvalonExportOptions”. Check number and types of arguments expected on procedure definition.

i apreciate the help but don’t let yourself get stressed out over me. its not worth it i’m sure. thanks

michale

[This message has been edited by wildeyedboyfromfreecloud (edited 02-27-2002).][/b]

When you resister the file translator in the plugin you specify the script name for the export option GUI, ie,

const char *const objOptionScript = “objExportOptions”;
const char *const objDefaultOptions =
“groups=1;”
“ptgroups=1;”
“materials=1;”
“smoothing=1;”
“normals=1;”
;

MStatus initializePlugin( MObject obj )
{
MFnPlugin plugin( obj, “Alias|Wavefront”, “3.0”, “Any”);

// Register the translator with the system
return plugin.registerFileTranslator( "OBJexport", "none",
                                      ObjTranslator::creator,
                                      (char *)objOptionScript,
                                      (char *)objDefaultOptions );                                        

}

the script name “objExportOptions” must contain a global proc with exactly the same name for maya to run the script, in this case “objExportOptions”. By the looks of your script it should work, I’m guessing that the problem must be that it isn’t in one of the script directorys.

Try putting it in the

"my documents\maya\4.0\scripts"

directory. Maya should automatically source it from there. The only actions it should perform are the “post” action where it creates the user interface using the optionString to determine what the settings should be for the controls, and “query” where you construct a string that is passed into your writer function of the plugin which you can then split up to determine the options set by the user.

Just ask if there’s anything else you need help on.

Rob.

yep, that was it. got it in 2 secs aftter reading your directory suggestion. i don’t know whether to be happy or sad, after i deliberated over it for like an hour a week ago. well any progress is good progress. i’ve been doing a lot of cool stuff. right now i implementing ROAM into my pseudo random terrain engine. and i will probably get back on maya as soon as that cat is in the bag. so if i have any issues. you will see this familar post bumped back on top of the forum. apreciate all the help.
deeply indebted,

Michael

Originally posted by Devulon:
[b]Don’t let Maya programming get you down. I don’t have Maya (never used it) so I haven’t done any programming with it. I have on the other hand written a couple max plugins. Initially for model loading I started by using the ASE Ascii Exporter that comes with max (the SDK actually has the complete source as well) and then I would parse the ASE file into my own format. Carmack actually did that for Quake 3 (before it went skeletal). Eventually trying to parse the ASE became a big pain in the ass. With a big model/scene the ASE can get really large and I only wanted a very small subset of what it exported. ASE exports almost everything that is in the MAX file (in terms of raw data at least). I finally got sick of it and started looking at writing MAX plugins. After the initial compiling/linking problems from Microsoft’s out of date libraries/headers (the ones that ship with VC++ 6.0 are WRONG !!!) things got easier. Max plugins are all very similar to write and I found that after a week I got it all working. Currently I am still working on my exporter plugin. Trying to add some extra functionality (vertex weights). Gonna try to do some nice skeleton based animation. This should be fun to watch.

Anyway, I know this didn’t really answer any of your questions but I thought it might be nice to tell the world of my experience with max plugins and the max sdk. All in all the more i use it the more I give it 2 thumbs up, it works and works well. (:

It seems the more I read on writing plugins for my the development setup is almost Identical to max. It seems that its jus the way that Maya exposes the innards of itself are a little more messy. And life goes on.

Happy Coding.

[This message has been edited by Devulon (edited 03-01-2002).][/b]

i apreciate the words of incouragement. i suppose it is just a right of passage. its good to know i’m not the only one suffering. just kidding. yeah maya is rather dastardly. i wish i had a system i could load max on to. mayas inards are like a convoluted spider web of madness, no i’m just kidding actually its rather beautiful in its sensibility. its a good intro into working with very interdependent data structures like dependancy graphs and what not. but yeah it seems like somewhere they could have made it easier. its not as much working with the classes and architecture which are quite nice. but just the beuracracy and some of the little quirks that are waiting to trip you up and leave you with that… oh, thats all i had to do… feeling. its cool to know someone who has been there done that. otherwise , well lets just say i’m glad i don’t feel the necesity to fenture into uncharted territory with respect to this matter. but yeah i’m sure some good will come of it all. i hope.
sincerely

Michael

If it makes you feel any better, I’m banging my head against the table with it as well. Think exporting’s bad? try importing stuff!!

There are a few areas that are a lot less convoluted, such as coding your own shaders and such. Thats where the API makes a lot more sense, In fact the worst area with it the importing/exporting stuff. Dammit.