Package nukescripts :: Module animation
[hide private]
[frames] | no frames]

Source Code for Module nukescripts.animation

 1  # Copyright (c) 2009 The Foundry Visionmongers Ltd.  All Rights Reserved. 
 2   
 3  import nuke 
 4   
5 -def animation_loop():
6 p = nuke.Panel("Loop") 7 p.addSingleLineInput("First frame of loop:", 1) 8 p.addSingleLineInput("Last frame of loop:", nuke.animationEnd()) 9 result = p.show() 10 if result: 11 anim = nuke.animations() 12 for i in anim: 13 loopstart = p.value("First frame of loop:") 14 loopend = p.value("Last frame of loop:") 15 nuke.animation(i, "expression", ("curve(((frame-"+loopstart+")%("+loopend+"-"+loopstart+"+1))+"+loopstart+")",))
16 17
18 -def animation_move():
19 pass
20 21 #uplevel #0 { 22 # set am_x "x" 23 # set am_y "y" 24 #} 25 #proc animation_move {} { 26 # global am_x am_y am_dy am_ldy 27 # # fail if no selected points: 28 # animation selected test 29 # while 1 { 30 # if [catch {panel "Move Animation keys" { 31 # {x am_x} 32 # {y am_y} 33 # {slope am_dy} 34 # {"left slope" am_ldy} 35 # }}] return 36 # if [catch {animation selected move x $am_x y $am_y dy $am_dy ldy $am_ldy} result] { 37 # alert $result 38 # } else break 39 # } 40 #} 41 42
43 -def animation_negate():
44 anim = nuke.animations() 45 for i in anim: 46 expr = "-("+nuke.animation(i, "expression")+")" 47 nuke.animation(i, "expression", (expr,))
48 49
50 -def animation_reverse():
51 a = nuke.animations() 52 for i in a: 53 anim = nuke.animation(i, "expression") 54 if anim is not None and anim == "curve(first_frame+last_frame-frame)": 55 nuke.animation(i, "expression", ("curve",)) 56 else: 57 nuke.animation(i, "expression", ("curve(first_frame+last_frame-frame)",))
58