View Full Version : problem with execute command and attribute
Konata 08-01-2009, 10:16 PM Hi all! :)
How can I execute a command when one attribute is changed?
And other question. When I select a object.. for example: ball_geo_Lf_LegA, how can I detect the side of the object (Lf or Rt) and rename with the inverse side?
For example: ball_geo_Lf_LegA -> ball_geo_Rt_LegA or ball_jnt_Rt_fk -> ball_jnt_Lf_fk
Thanks! :)
|
|
praburaj
08-04-2009, 08:05 AM
Hi konata,
You can use scriptJob command for triggering a command when an attribute is changed....
For more help have look in to Maya documentation or MEL command reference....
Credo
08-04-2009, 10:32 AM
If you just want to toggle the naming of the left and right side then you can do that using "match" and "substitute".
The following code should work if you have one object selected:
string $RT = "_Rt_";
string $LT = "_Lf_";
string $sel[] = `ls -sl -fl`;
if (`match $RT $sel[0]` != "")
{
print "\nrenaming right to left";
rename $sel[0] (`substitute $RT $sel[0] $LT`);
}
else if (`match $LT $sel[0]` != "")
{
print "\nrenaming left to right";
rename $sel[0] (`substitute $LT $sel[0] $RT`);
}
CGTalk Moderation
08-04-2009, 10:32 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.