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.
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:
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