PDA

View Full Version : scriptNode self-referencing


Galakgorr
01-17-2009, 03:41 AM
this is a simple question in regards to a complex problem... i'm going to post the whole thing just in case anybody sees an easier way to do this.

i'm using a scriptJob to activate an IK/FK snap switch. when a certain controller's attribute is changed, the scriptJob fires and makes all the necessary adjustments. i'm placing a scriptNode in the scene to activate the scriptJob upon opening the scene. this is no big deal.

however, scriptNodes don't update with namespaces when a file is referenced. because of this, i can't directly name any objects in the scene and assume that they'll be the correct name. to prevent this from being a problem, i'm using a series of message attributes that connect the switch controller to all of the necessary nodes that it needs to know about.

here's the catch: when i'm defining the scriptJob, how can i point to the switch controller without knowing its name? i could connect the scriptNode to the controller using a message attribute, but then, how can i ask the scriptNode to list its own connections? basically, is there an equivalent in MEL to actionscript's "this" for objects to reference themselves? or is there another way around this?

musi
08-16-2009, 08:21 PM
I have exactly the sme problem, keep going in circles again and again, and would be very happy if somebody has an answer to this...

isoparmB
08-17-2009, 03:38 AM
http://forums.cgsociety.org/showthread.php?f=89&t=466696&highlight=expression+refer

You can try that thread. It involves the same problem, only in the context of expressions. The solution is old and is kind of made redundant because you can use a default object in an expression to solve it, but the method might be the one you're looking for in your case. It involves searching for a particularly named object and inquiring whether that object's custom ID attribute matches the one in the scriptNode/Expression, thus identifying it. You might want to revise it though with the ls -recursive solution, reduces the number of name spaces you have to write to a particular search list.

CGTalk Moderation
08-17-2009, 03:38 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.