I know you can directly connect two attributes with the connection editor or mel script, but what I can't figure out is how to connect them with some condition/expression which is evaluated each time the attributes are changed
i have one attribute that is in degrees rotation and i want to connect it to another attribute which is in radians rotation, so i need a way to evaluate a script to convert the values.
I could do this in 3ds max by wiring parameters and it let you type some maxscript to be evalated for the returned value.
Replies
The other way is using an expression. Expressions can slow down your scene if you're not careful. A simple deg/rad-conversion shouldn't be a problem though.
In the channelbox, select an attribute and go to the edit menu > expressions. Add for example:
pCube1.rotateX = pCube2.rotateX*3.14159265358979/180;
This will take the value from pCube2.rotateX and convert it to radians. The other way is creating the expression via MEL-script. In the MEL window do the following;
This example uses a conversion procedure instead. Just change the line expression -s "YOUR CODE HERE" to modify the expression. Type help expression in the MEL window if you want to know more about the create expression procedure.
p.s.
I probably mixed up the deg<->rad conversion math, doesn't matter though. As long as you know the proper function for it.
d.s.