Newbie question - custom attributes

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  06 June 2005
Smile Newbie question - custom attributes

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
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

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.

- Jason Nystrom
- If I wasn't so stupid, I'd be a genius...
  08 August 2005
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 04:08 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.