Source code for nukescripts.animation

# Copyright (c) 2009 The Foundry Visionmongers Ltd.  All Rights Reserved.

import nuke_internal as nuke

[docs]def animation_loop(): p = nuke.Panel("Loop") p.addSingleLineInput("First frame of loop:", 1) p.addSingleLineInput("Last frame of loop:", nuke.animationEnd()) result = p.show() if result: anim = nuke.animations() for i in anim: loopstart = p.value("First frame of loop:") loopend = p.value("Last frame of loop:") nuke.animation(i, "expression", ("curve(((frame-"+loopstart+")%("+loopend+"-"+loopstart+"+1))+"+loopstart+")",))
[docs]def animation_negate(): anim = nuke.animations() for i in anim: expr = "-("+nuke.animation(i, "expression")+")" nuke.animation(i, "expression", (expr,))
[docs]def animation_reverse(): a = nuke.animations() for i in a: anim = nuke.animation(i, "expression") if anim is not None and anim == "curve(first_frame+last_frame-frame)": nuke.animation(i, "expression", ("curve",)) else: nuke.animation(i, "expression", ("curve(first_frame+last_frame-frame)",))