View Full Version : Newbie question - custom attributes

06 June 2005, 08:38 AM
Hi guys,

I'm quite new to mel, I have something relatively simple.

I'd like to create a custom attribute that through an expression, would drive the y positive position of one object,
and the y negative position of another simultaneously as I middle click drag the attribute from left to right.

Now here is the tricky part, I don't want it to simply take over control of the specified channels. I want it to add to the current position, so that I can freely transform the y position of the objects, but add to the end value with the help of that attribute.

Could anyone shed some light on this? Much appreciated.


06 June 2005, 07:21 PM
here is an example (probly a bad one)

not using mel but just some nodes

the controles are on the circle but you could use an extra node to controle the y if you wanted to move it independently and thne have an offset or wahtever


just run this in your script editor and it will creat the example

sphere -p 0 0 0 -ax 1 0 0 -ssw 0 -esw 360 -r 0.15 -d 3 -ut 0 -tol 0.01 -s 8 -nsp 4 -ch 1;objectMoveCommand;

sphere -p 0 0 0 -ax 1 0 0 -ssw 0 -esw 360 -r 0.15 -d 3 -ut 0 -tol 0.01 -s 8 -nsp 4 -ch 1;objectMoveCommand;

circle -n Controle -c 0 0 -1 -nr 1 0 0 -sw 360 -r 0.115 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1; objectMoveCommand;

addAttr -ln Spheres_Y -at double |Controle;

setAttr -e -keyable true |Controle.Spheres_Y;

addAttr -ln Sphere_1_Offset -at double |Controle;

setAttr -e -keyable true |Controle.Sphere_1_Offset;

addAttr -ln Sphere_2_Offset -at double |Controle;

setAttr -e -keyable true |Controle.Sphere_2_Offset;

shadingNode -asUtility plusMinusAverage;

connectAttr -force Controle.Spheres_Y plusMinusAverage1.input1D[0];

connectAttr -force Controle.Sphere_1_Offset plusMinusAverage1.input1D[1];

connectAttr -force plusMinusAverage1.output1D |nurbsSphere1.translateY;

shadingNode -asUtility plusMinusAverage;

connectAttr -force Controle.Spheres_Y plusMinusAverage2.input1D[0];

connectAttr -force Controle.Sphere_2_Offset plusMinusAverage2.input1D[1];

shadingNode -asUtility multiplyDivide;

setAttr "multiplyDivide1.input2X" -1;

connectAttr -force plusMinusAverage2.output1D multiplyDivide1.input1X;

connectAttr -force multiplyDivide1.outputX |nurbsSphere2.translateY;

08 August 2005, 08:50 PM
is there some reason you can't/don't want to use a set driven key? the nice thing about them is that they're addititive, which sounds like what you need.


CGTalk Moderation
08 August 2005, 08:50 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.