How to copy values from one attribute to another on the same object


#1

Hi, I am trying to copy values from Joint Orient to Rotation on the same joint. How should I go about it.

This is as far I could go.

[B]string $SelectedOBJ[] = ls -sl ;

float $RotationalVALx = getAttr $SelectedOBJ.rotateX;

[/B]

Any help would be much appreciated.

Thanks…


#2

Have a look at “setAttr”.


#3

Got it atlast :bounce:

string $SelectedArrayOBJ[] = ls -sl ;
string $SelectedOBJ = $SelectedArrayOBJ[0];

float $RotationalVALX = getAttr $SelectedOBJ.rotateX;
float $RotationalVALY = getAttr $SelectedOBJ.rotateY;
float $RotationalVALZ = getAttr $SelectedOBJ.rotateZ;

setAttr ($SelectedOBJ + “.jointOrientX”) $RotationalVALX;
setAttr ($SelectedOBJ + “.jointOrientY”) $RotationalVALY;
setAttr ($SelectedOBJ + “.jointOrientZ”) $RotationalVALZ;


#4
string $joint[] = `ls -sl`;
float $val[] = `getAttr ($joint[0] + ".rotate")`;
setAttr ($joint[0] + ".jointOrient") $val[0] $val[1] $val[2];

#5

there is also copyAttr function but it never worked for me


#6

Thanks for the script denisT