PDA

View Full Version : An example on how to use DependsOn


Justin1967
06-15-2007, 05:46 PM
Hi,

I'm following CGA's tutorial Intermediate Rigging DVD 2. In the lesson Extracting Rotations I have to select the upper arm twist bone and add a script controller to it. The dependsOn statement needs to be used. I am using Max 9 and I am getting an error. I have read the Max Script Reference and I says:

THIS IS OBSOLETE IN 3DS MAX 8. ASSIGN NODES TO USER VARIABLES INSTEAD.
dependsOn was used with scripted controllers in versions prior to 3ds Max 8 to enable interactive update of scripted controllers when the code in them depends on other objects in the scene. Place a call to dependsOn in the controller script somewhere (usually at the top), with a list of objects on which the controller depends. Interactive changes to any of these objects will cause the object containing the script controller to also update.

Will someone please give an example on how to re-write this code:

dependsOn $bone17 $Point21

rot=($bone17.transform * inverse $Point21.transform).rotation as eulerAngles
degToRad -rot.x

Thanks.

Justin

eek
06-15-2007, 09:55 PM
p0 = $bone17 (node variable)
p1 = $bone21 (node variable)




degtorad -((p0.transform * inverse p1.transform).rotation as eulerAngles).x

PEN
06-18-2007, 08:45 PM
If you have the forth DVD skip to the last couple of chapters. I believe that I cover the changes that were done to max that will make two things obsolete in what you are doing.

First off you don't use dependsOn any more in script controllers. If you notice the script controller dialog is quit different then it was in Max 6 when I did those DVD's. In Max 9 you add variables and then attach those variables to nodes or tracks. This way the script controller is not name dependent.

Another thing is you don't need the script controller in the first place. There is now a helper called Expose Transform Helper that extracts transform data from an object as compared to another. You can expose the rotation of the joint or object that will be the driver and then wire the driven to the expose transform helpers exposed values.

CGTalk Moderation
06-18-2007, 08:45 PM
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.