View Full Version : Simple script
ankheilw 08-22-2009, 12:45 PM Hello all,
I am looking to do something which is probably pretty simple, but I don't know where to start. I need a mell script to copy the values of an object and then paste them on another. I'm trying to create a script for a character that mirrors arm placement from one side of a character to the other, but if someone can just help me with the syntax of copying and pasting attribute values from one object to another, that should be enough.
Thanks in advance.
Woody
|
|
Serashi
08-22-2009, 09:27 PM
Hey,
I just did a similar script, for mirroring a pose.
i used the following:
//grabbing values
float $L_IK_ArmTX = getAttr ("L_ArmIK_Control.tx");
float $L_IK_ArmTY = getAttr ("L_ArmIK_Control.ty");
float $L_IK_ArmTZ = getAttr ("L_ArmIK_Control.tz");
//setting new values on other side
setAttr R_ArmIK_Control.tx $L_IK_ArmTX;
setAttr R_ArmIK_Control.ty $L_IK_ArmTY;
setAttr R_ArmIK_Control.tz $L_IK_ArmTZ;
you can also place the values in an array using xform. the way i did it works for my setup, with freezed transformations etc, but xform: "all values are specified in transformation coordinates. (attribute-space) " - Maya Help
so hope some of this will get you to your solution
Stein
ankheilw
08-22-2009, 10:00 PM
Stein, you rock!
I adjusted it to fit with the fk as well. Here is the resulting script if anyone else is looking. Again, thanks so much, it is such as easy thing, but I never knew the syntax.
//Shoulder - grabbing values
float $L_FK_ShoulderRX = getAttr ("L_ShoulderFK_ctrl.rx");
float $L_FK_ShoulderRY = getAttr ("L_ShoulderFK_ctrl.ry");
float $L_FK_ShoulderRZ = getAttr ("L_ShoulderFK_ctrl.rz");
//Shoulder - setting new values on other side
setAttr R_ShoulderFK_ctrl.rx $L_FK_ShoulderRX;
setAttr R_ShoulderFK_ctrl.ry $L_FK_ShoulderRY;
setAttr R_ShoulderFK_ctrl.rz $L_FK_ShoulderRZ;
//Elbow - grabbing values
float $L_FK_ElbowRX = getAttr ("L_ElbowFK_ctrl.rx");
float $L_FK_ElbowRY = getAttr ("L_ElbowFK_ctrl.ry");
float $L_FK_ElbowRZ = getAttr ("L_ElbowFK_ctrl.rz");
//Elbow - setting new values on other side
setAttr R_ElbowFK_ctrl.rx $L_FK_ElbowRX;
setAttr R_ElbowFK_ctrl.ry $L_FK_ElbowRY;
setAttr R_ElbowFK_ctrl.rz $L_FK_ElbowRZ;
//Hand - grabbing values
float $L_FK_HandRX = getAttr ("L_HandFK_ctrl.rx");
float $L_FK_HandRY = getAttr ("L_HandFK_ctrl.ry");
float $L_FK_HandRZ = getAttr ("L_HandFK_ctrl.rz");
//Hand - setting new values on other side
setAttr R_HandFK_ctrl.rx $L_FK_HandRX;
setAttr R_HandFK_ctrl.ry $L_FK_HandRY;
setAttr R_HandFK_ctrl.rz $L_FK_HandRZ;
Serashi
08-22-2009, 10:13 PM
Cool. Glad to hear it solved your question.
CGTalk Moderation
08-22-2009, 10:13 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.