mennalur
12-21-2012, 10:46 AM
Hi everyone,
I created this script job and it does exactly what I want it to do. The only thing is.. it executes when I stop animation playback. I've tried setting the script job on demand but this didnt help because it stopped doing anything.
How do I prevent this from happening? Should I add an kind of kill comands?
global proc L_arm_spaceSwitch(){ global string $L_arm_switch_space = "L_switch_CTRL.Space";
string $L_arm_switch_control ="L_switch_CTRL";
string $L_arm_object_control = "L_armIK_null_GRP";
string $L_arm_attribute;
string $selection[] = {"World", "L_shoulder", "Hips", "Custom"};
int $ParentVal = `getAttr $L_arm_switch_space`;
float $PosDP[] = `xform -q -ws -rp $L_arm_object_control`;
float $RotDP[] = `xform -q -ws -ro $L_arm_object_control`;
int $i=0;
for ($i = 0; $i < 4; $i++){
setAttr ($L_arm_switch_control+"."+$selection[$i]) 0;
}
setAttr ($L_arm_switch_control+"."+$selection[$ParentVal]) 1;
move -rpr $PosDP[0] $PosDP[1] $PosDP[2] $L_arm_object_control;
rotate -a -ws $RotDP[0] $RotDP[1] $RotDP[2] $L_arm_object_control;
print "L_arm_spaceSwitch = ";
print $selection[$ParentVal];
print "\n";
}
I created this script job and it does exactly what I want it to do. The only thing is.. it executes when I stop animation playback. I've tried setting the script job on demand but this didnt help because it stopped doing anything.
How do I prevent this from happening? Should I add an kind of kill comands?
global proc L_arm_spaceSwitch(){ global string $L_arm_switch_space = "L_switch_CTRL.Space";
string $L_arm_switch_control ="L_switch_CTRL";
string $L_arm_object_control = "L_armIK_null_GRP";
string $L_arm_attribute;
string $selection[] = {"World", "L_shoulder", "Hips", "Custom"};
int $ParentVal = `getAttr $L_arm_switch_space`;
float $PosDP[] = `xform -q -ws -rp $L_arm_object_control`;
float $RotDP[] = `xform -q -ws -ro $L_arm_object_control`;
int $i=0;
for ($i = 0; $i < 4; $i++){
setAttr ($L_arm_switch_control+"."+$selection[$i]) 0;
}
setAttr ($L_arm_switch_control+"."+$selection[$ParentVal]) 1;
move -rpr $PosDP[0] $PosDP[1] $PosDP[2] $L_arm_object_control;
rotate -a -ws $RotDP[0] $RotDP[1] $RotDP[2] $L_arm_object_control;
print "L_arm_spaceSwitch = ";
print $selection[$ParentVal];
print "\n";
}
