There is a reverse curve option in the animation menu and attached is an 
adaption I made if your curve is shorter than the shot length.
Might help

add this sort of thing to your menu.py

# ANIMATION ITEMS----------------------------------------#
m=nuke.menu('Animation').findItem('Predefined')
m.addCommand('Reverse curve', 'nuke.load("animation_curve_reverse"), 
animation_curve_reverse()')



Howard





________________________________
From: Ivan Busquets <ivanbusqu...@gmail.com>
To: Nuke user discussion <nuke-users@support.thefoundry.co.uk>
Sent: Thu, 3 March, 2011 23:27:26
Subject: Re: [Nuke-users] Reverse animation curves

If you only need to reverse your stabilization, you may try leaving the Read at 
the original speed, then adding a Retime node set to "reverse" right after your 
transform node and rendering that out as your new, reversed and stabilized 
plate.

You could also reverese the anim curves using the "curve(frame)" syntax. You 
could create a start_frame and an end_frame knobs to specify the range of the 
original anim, and then type this as an expression in your translation and 
rotation knobs.

curve(-frame + end_frame+start_frame)





On Thu, Mar 3, 2011 at 3:01 PM, Darren Coombes <dar...@resolutiondesign.com.au> 
wrote:

Hi all, is there a way to reverse animation curves for a transform node?
>
>I have an input image which was a little shaky and I had hand stabilized the 
>footage with a transform node using keyframes in translation and rotation. Now 
>I 
>need to reverse the direction of the footage, but also need to reverse the 
>animation curve to match the footage. Any suggestions?
>
>Thanks.
>
>Darren Coombes
>
>darren.coom...@me.com
>0418 631 079_______________________________________________
>Nuke-users mailing list
>Nuke-users@support.thefoundry.co.uk
>http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>
# Copyright (c) 2009 Howard Jones  All Rights Reserved.

import nuke

def animation_curve_reverse():

  panel = nuke.Panel("Reverse Curve")
  panel.addSingleLineInput("First frame of curve:", int(nuke.animationStart()))
  panel.addSingleLineInput("Last frame of curve:", int(nuke.animationEnd()))
  result=panel.show()                 #shows the panel and also assigns a variable 'result' to it


  if result:                                    # works if Ok selected - not if cancel
    a = nuke.animations()				#picks up selected animation curves
    for i in a:						#loops through each curve and changes each one
      curveStart = panel.value("First frame of curve:")
      curveEnd = panel.value("Last frame of curve:")
      expr = "curve("+curveStart+"+"+curveEnd+"-frame)"          #formula for reverse
      nuke.animation(i, "expression", (expr,))                              # adjusts curve
#    nuke.message('curve reversed')                 #adds a message to the result - annoying so commented out
_______________________________________________
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Reply via email to