[Maya] Maya ASCII file format question

Is the order of commands in an MA file consistent? If I pop open a few I see that each listed command is grouped, meaning that first you get all the file calls, the requires, later comes all createNode, and so on. I want to write some functions to parse portions of an MA file and it be would faster if I knew that all commands of the same type will be listed consecutively, so I didn’t have to look through the entire file looking for createNode commands, and instead could stop parsing once I’ve reach the first non-createNode call after the first.

Thoughts?

I think they are grouped to take advantage of selection order - create a node then set attrs on that, etc… Connects come last so they can leverage existing node and attribute name combos. Thus:


createNode lightLinker -s -n "lightLinker1";
	setAttr -s 2 ".lnk";
	setAttr -s 2 ".slnk";

or


createNode ilrOptionsNode -s -n "TurtleRenderOptions";
lockNode -l 1 ;

Right. I was more curious if all commands of a certain type are always listed consecutively, or if I have to parse the full file to find all createNode commands.

This is the only official resource I was able to find (nothing for later versions, though I can’t imagine it has changed much if at all): Autodesk Maya Online Help

I’ve never been able to optimize that kind of parsing. As soon as you think you’ve tracked down all the possible ways a bit of ASCII will appear in a .ma file, you find an exception. The biggest issue for me has always been dealing with reference edits in their encapsulated/quoted string. shudders

Yeah things were going smoothly until referencing came into the picture (though isn’t that always the case?)