View Full Version : Script Job trigger problem

12 December 2012, 12:30 PM
Hi everyone,
I'm using a script job to switch spaces and its working as it should. The only problem I have is that It not only activates when I change the attribute value but maya will also go through all the scriptjobs when I stop playback animation.
What shoul I do to prevent this from happening? I've tried adding -attribute change function and killing the scribjob in the end. Either i'm doing it wrong or its not working.

This is the code:

global proc L_arm_IKFKSwitch(){
$switchNumbers[] = {"IK", "FK"};
int $switchVal =
`getAttr("L_switch_CTRL.Switch") `;

print $switchVal;

// Get IK joint positions
$IKRot_L_UpperArm[] = `xform -q -ws -ro "IK_L_upperArm_JNT"`;
float $IKRot_L_lowerArm[] = `xform -q -ws -ro
float $IKRot_L_Ankle[] = `xform -q -ws
-ro "IK_L_frontAnkle_JNT"`;

// Get FK joint and rot
float $FKRot_L_Ankle[] =
`xform -q -ws -ro "L_footIKHelper_LOC"`;
float $FKPos_L_Ankle[] =
`xform -q -ws -rp "L_footIKHelper_LOC"`;
float $FKPos_L_Pole[] = `xform
-q -ws -rp "L_armPoleHelper_LOC"`;

if ($switchVal == 1){
rotate -a -ws
$IKRot_L_UpperArm[0] $IKRot_L_UpperArm[1] $IKRot_L_UpperArm[2]
rotate -a -ws $IKRot_L_lowerArm[0]
$IKRot_L_lowerArm[1] $IKRot_L_lowerArm[2] "L_elbow_FK_CTRL";
rotate -a -ws $IKRot_L_Ankle[0] $IKRot_L_Ankle[1]
$IKRot_L_Ankle[2] "L_ankle_FK_CTRL";

if ($switchVal == 0){
move -rpr
$FKPos_L_Ankle[0] $FKPos_L_Ankle[1] $FKPos_L_Ankle[2] "L_IK_frontFoot_CTRL";
rotate -a -ws $FKRot_L_Ankle[0] $FKRot_L_Ankle[1]
$FKRot_L_Ankle[2] "L_IK_frontFoot_CTRL";
move -rpr
$FKPos_L_Pole[0] $FKPos_L_Pole[1] $FKPos_L_Pole[2] "L_armIK_pole_CTRL";

12 December 2012, 06:16 PM
The most important info here is missing:

How did you set up your scriptJob?? With -event, with -attributeChanged, with a condition?

CGTalk Moderation
12 December 2012, 06:16 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.