PDA

View Full Version : scripting of expressions and addAttrs


tymznd
04-03-2003, 12:49 AM
I am writing a script that is creating an attribute and I want to link that attribute to another attribute within the script.

I want the relationship between the two to be adjusted by a multiplication of .1
so that 5 becomes .5

Questions:
Are expressions tied to objects somehow?? I guess I am confused with the Expression editor. Usually I write general expressions so everytime I pull up the expression editor I filter it to show by "expression name" vs. "object name".... when would you use the "object name" view?

Given the goal above, should I instead be using the connection editor? I have zero experience with that... from the looks of it there is no way to adj the values as they go across??

Hugh
04-03-2003, 03:13 AM
I would definately use the connection editor for this....

Well, a combination of the connection editor and a HyperShader node (Multiply/Divide)

The following code will work:
(the variables should be self explanatory.... I've made the Y translate be 0.1 * the X translate)


string $multName = "myMultNode";
string $inputAttr = "nurbsSphere1.translateX";
string $outAttr = "nurbsSphere1.translateY";
int $factor = 0.1;

shadingNode -asUtility multiplyDivide -name $multName;
connectAttr -f $inputAttr ($multName+".input1X");
connectAttr -f ($multName+".outputX") $outAttr;
setAttr ($multName+".input2X") $factor;


hope it helps...

tymznd
04-03-2003, 05:55 AM
:bowdown: MASSIVE!:bowdown:

worked perfectly :applause:

CGTalk Moderation
01-14-2006, 08:00 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.