python nuke.frame() delay? is it a bug?

hi, i’m turned into this wierd problem. This is suppose to be very simple script. i attach the .nk file. So in that file i create a single ‘dot’ node (name : framecontrol). add custom pyscript button(name : nextframe). then use this code for that button :

Code:

curfrm = nuke.frame()
newcurfrm=curfrm+1
nuke.frame(newcurfrm)


so when user press this button, it wil jump 1 frame ahead (same like ‘next frame’ function button). So pressing 10 times will jump to 10 frames. It’s so easy. But i have tried this code , type in the script editor like this :

Code:

x=1
while x<11:
  nuke.toNode('framecontrol').knob('nextframe').execute()
  x=x+1


so i’m just confused why this doesn’t work well, suppose to jump 10 frames , but i got only 1 frame jump. I inspect , this has something to do with nuke.frame() which has delay in processing??? so fast iterate/loop is too fast for nuke.frame() to follow?? this is wierd. Try to modify code like this :

Code:

x=1
while x<11:
  nuke.toNode('framecontrol').knob('nextframe').execute()
  message('jump')
  x=x+1


now it’s working fine, it jumps 10 frame as we also have to close every single pop-up window of course, i just simulate this to give ‘delay’ for the script so the nuke.frame() can ‘follow’. Well, i don’t know exactly what happen. Anyone can help me. I don’t know it’s bug or something wrong with my code? any issue with cpu core? If someone can give some good explaination?

Attached Files
File Type: nk framecontrol.nk (2.9 KB)
No Responses to “python nuke.frame() delay? is it a bug?”

Post a Comment