Notifications
Clear all

[Closed] #MaxObjectTab vs Script Controller. Which is faster?

OK, I’ve setup a rig (three guesses as to which one!) that stores objects as node variables on a script controller. I have scripts on custom attributes that call upon these objects to do various things (eg. IK/FK snap).
I’ve found that this object with the few hundred or so stored nodes in it, it is slowing down the manipulation of the rig too much.
Before I commit to the laborious process of ripping up the rig without knowing whether it’ll truly be a benefit, I thought I would ask the experts here if they know more about it.
Would it speed up the rig to store all of the nodes in a #maxobjecttab array in a custom attribute? Aren’t the #maxobjecttab and script controller node storage systems based on the same weak referencing setup?
Also, with the script controller I could recall a specific node by calling upon the script controller’s variable by name. How do I recall specific nodes in a #maxobjecttab array when I don’t think I can rely on index values as the array won’t always having the same objects in the same order?
:¬/

16 Replies
 PEN

Try out the maxObjectTab as I store hundreds of objects in them. I usualy have the entire rig stored in one. Can’t wait to see the next rig from you.

OK Paul, I’ll give it a shot.
So how do you extract specific nodes from your maxobjecttab array?
:¬)

hey brad,
you assign nodes like so

blah = nodetransformmonitor node:obj forwardtransformchangemsgs:false
append $.maxobjcettab blah

then you can use $.maxobjcettab[?].node to get the node

cheers,
mark

 PEN

I have a tutorial on my site that shows it as well. http://paulneale.com/tutorials/Scripting/weakReferences/weakReferences.htm

Thanks guys. That’s all cool but what I really want to know is if the array changes its order and the objects in the array change their names in the scene, how can I draw upon specific objects? Going by index number and by name I don’t think will work.
The good thing about the script controller method I had was that the variables within it didn’t change. The nodes could change their names and some variables would be empty until I assigned a node to them but the list of variable would always be the same. I could call upon the node by the variable’s name (eg. $.position.controller.getvarvalue “master_control”).
:¬\

 rdg

You could use #maxTabArray (?) to store a lookuptable which part of you rig is stored at which index of the maxObjectTab. Everytime the objectTab changes you would update the lookuptable.
ie: the knee is stored at index 1 of the lookup which could point to another index of the objectTab like 5:

$.maxobjcettab[$lookupTab[1]].node
would be the same as
$.maxobjcettab[5].node

if the node changes to index 9 – you can update the lookup in the same step as adding it to your list/inteface:

$.maxobjcettab[$lookupTab[1]].node
would now point to:
$.maxobjcettab[9].node

Until maxscript supports hashes or associative array this could be a way.

What I would be interested in is:
where in your rig to you store the customattribute?
Int the example PEN posted, would I link the three spherees to the box and use the box as ‘master control object’ ?

Georg

 PEN

I do this even simpler and store waht I need in different arrays or variables. Like the root node is in it’s own maxObject variable. All the FK controls for the right arm are stored in a maxObjectTab array, they are in the oder that I need them. Does that sort of set up work for you. Another way to handle it if you don’t want to go the root of a lookup table is to use another method that you can find in many of my rigs. I have a CA def attached to each of the objects in the rig at the root. This holds information about the object, what it is for and what it belongs to. I have a classID that I give to the character as a whole, all objects in a given rig have the same ID. I can then set flags to tell it that it is a control object that will get animation on it. Also I store what object is its mirror object is and how it is to be mirrored.

 rdg

This doesn’t sound simpler at a first look …
But I guess it is – as soon as I understand it.

I think the lookup-Method would only be practicable in some sort of “generic rig” setup:
The rig you described is a fixed rig where the nodes don’t change in an unexpected way.

What does the classID do?
I know it is used to differentiate between plugins for example.
Is this only for internal control or do you do stuff like:
getByClassID to get all nodes that belong to the rig?

this holds information about the object, what it is for and what it belongs to.

Does this mean you store stuff like “I am turning left” or “I have this speed” or “I am in phase 1 of 2” in this CAdefs?

I hope you don’t mind me asking this stuff…

Georg

 PEN

This isn’t nessesarily simpler, just another solution that gave me lots of flexability. It is a way to mark objects in some way so that you don’t have to rely on names, classes of objects or hierarchy to know what the object is and what it belongs to.

The classID is just a value that is stored so that the names can be completely messed up and I still know which parts go with which character, again not having to rely on hierarchy or anything else. This value is set by the TD when they set up the rig. I have a scripted modifier that controls the whole set up, it is placed on all the controls for the character and through it you can add all the parts of the rig to it. As that is done the the def that I’m talking about is added to the root of all the nodes and the classID is set. You can then go about managing each of the parts, what they are and how they are to be used.

I guess you could store the kind of imformation that you are talking about as well, not sure what it would be used for but anything is possible. Doing this has given me character rigs that are more knowledgable about them selves…so to speak. I can even have a delete character button on the character rig for instance. I don’t have to store the left arm in a left arm array as I also have name identifiers stored in the def as well if I want. So I can have part names for instance. If the def has the property control object set and leftFKArm in the name prop that is stored I know exactly what it is. This could be changed by the user but I don’t provide a UI unless you are in edit mode for the modifier.

Page 1 / 2