Python - Scriptjob trigger loop (DisplayLayer change)

Python - Scriptjob trigger loop (DisplayLayer change)

Anonymous
Not applicable
655 Views
2 Replies
Message 1 of 3

Python - Scriptjob trigger loop (DisplayLayer change)

Anonymous
Not applicable

Heyya folks,
  I have a scriptjob setup to trigger on event "timeChanged" - which then switches displayLayer visibilies according to rules.   

  The problem:   cmds.setAttr(displalayerXX.visibility)   also triggers "timeChanged" event !?
 
so,  a loop issue there.  It's got me thoroughly stumped.  Any ideas  ?

0 Likes
656 Views
2 Replies
Replies (2)
Message 2 of 3

mcw0
Advisor
Advisor

Set your scriptJob to only run once.  Then after switching visibility, create the scriptJob again to runOnce.

0 Likes
Message 3 of 3

Anonymous
Not applicable

Thank you for the feedback mcw0 🙂   That was one of the first approaches I tried, but ended up with another oddity:

pseudo:
    (runOnce, -ie:killed)
    SetLayerX.visibility 1
    numberedScriptJob = scriptJob:  runOnce, parent window, event:timeChanged

   Still loops (frantically).  Almost as if the newly spawned scripJob is being evaluated after the layer visibility (triggering a timeChanged event again etc).

   I'm going to have to examine the code again, I must have made some form of obvious error.

0 Likes