Hello,
I stumbled upon a Maya scriptjob problem that I can’t find a fix for. After doing some reading, an old thread mentions a similar problem here: http://forums.cgsociety.org/showthread.php?t=743020
What I am trying to do is to write a space switching scriptjob. (is it the best way to deal with no-pop space switching?). I write code daily, but never use scriptjobs, and this one got me stuck for too long. Here is my situation:
I have an enum attribute with the list of spaces, and a list of attributes that correspond to the values of the enum list. The switch works fine at first… but if you set keys, and hit the playback button, the scriptjob gets executed almost each time you hit the stop button.
In the example from the referenced post, his scriptjob sets a key each time you hit stop.
In my case, when changing the enum value, my scriptjob checks the attr that has a value of 1, if it’s the same, it’s does nothing; if it’s different, I have a pop-up confirmBox giving 3 options: [switch and set key], [switch without setting key], [cancel].
It’s good because I can cancel it, but it’s annoying to see it each time I hit play. (and I have 4 space switchers - for each limb - so I get the popup 4 times)
Keys are set to the attributes, so when you go and press stop on a frame where they match, it’s fine, but if you press stop where the attribute doesn’t match the enumList, the script is triggered so I get the popup.
Is there a way to have the scriptjob executed really only on ‘attributechange’ by user? Is there a way to ignore the timeline/playback?
I hope I can get a solution here. Again, I have the option to ‘Cancel’, so it’s not breaking anything in the scene, it’s just very frustrating.
Thank you,
P.