PDA

View Full Version : How can I get the attribute by the MEL


rogercg
04-13-2005, 11:18 AM
I am now working with the animation setup, and the problems come.
I need the attribute of the node, which was "world rotate pivot".
and i need the attribute contral another object.
can anyone help about this.

cpan
04-13-2005, 11:36 AM
let see if i got it...
you have an object and you want it's world rotate pivot xyz translation to be connected to another attribute?

if this is what you want you can write an expression like this:

float $transl[] = `xform -q -ws -r obj1`; // -ws means worldspace and -r rotation. type `help xform` in commandline to see if it's so, cuz i'm saying from my memory :cool:

// now use the $transl on whatever you want. here's an example:
myObj.translateX = $transl[0]; // x
myObj.translateY = $transl[1]; // y
myObj.translateZ = $transl[2]; // z


hope it helps

~yashu

fred22
04-13-2005, 12:25 PM
Or if you are talking about changing the rotate pivot of an object so that it matches another object.
You can use push the "insert" key and change it manually, or use similar code to the previous post.....


xform -ws -a -rp 0 2 0

This will change your rotate pivot to y +2 but if you need to get the pivot of the other object and change the current objectss pivot....

// Select the object you wish to align the pivot to first then the object whose pivot you are changing
string $selection[] = `ls -sl`;
select $selection[0];
$rotPiv = `xform -q -ws -rp`;
select -clear;
select $selection[1];
xform -ws -rp $rotPiv[0] $rotPiv[1] $rotPiv[2];
clear $rotPiv;

To set it back just use the menu command Modify--->Center Pivot or
xform -cp;

Xform is a great tool!

hope this helps

rogercg
04-14-2005, 08:04 AM
Thanks a lot. Both of you do the great help. And I can handle the problem now.

CGTalk Moderation
04-14-2005, 08:04 AM
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.