State:Closed|icon_bug|icon_nuke|database:public|Resolution:Works For Me|TargetRelease:11.0v1|BugID:263220|
Problem summary
Match Selected Position (animated) feature will not always key matches for each frame with an animated snap. Differences in results occur between 10.5v1 and 10.0v5.
Customer reported version
nuke.10.0v4
Customer reported platform
10.09
Steps to reproduce
1. Open Nuke
2. Create a Cube node
3. Animate the cube to translate and rotate across 100 frames
4. Copy the following to the script editor and run:
import nuke
import nukescripts.snap3d
def snapToPointsAnim( node=None, mode='t'):
'''
Animated versions of the three default snapping funtions in the axis menu
args:
node - node to snap
mode - which mode. Available modes are: 't' to match translation, 'tr', to match translation ans rotation, 'trs' to match translation, rotation and scale. default: 't'
'''
node = node or nuke.thisNode()
if mode not in ( 't', 'tr', 'trs' ):
raise ValueError, 'mode must be "t", "tr" or "trs"'
# KNOB MAP
knobs = dict( t=['translate'], tr=['translate', 'rotate'], trs=['translate', 'rotate','scaling'] )
# SNAP FUNCTION MAP
snapFn = dict( t=nukescripts.snap3d.translateToPoints,
tr=nukescripts.snap3d.translateRotateToPoints,
trs=nukescripts.snap3d.translateRotateScaleToPoints )
# SET REQUIRED KNOBS TO BE ANIMATED
for k in knobs[ mode ]:
node[ k ].clearAnimated()
node[ k ].setAnimated()
# GET FRAME RANGE
fRange = nuke.getInput( 'Frame Range', '%s-%s' % ( nuke.root().firstFrame(), nuke.root().lastFrame() ))
if not fRange:
return
# DO THE WORK
tmp = nuke.nodes.CurveTool() # HACK TO FORCE PROPER UPDATE. THIS SHOULD BE FIXED
for f in nuke.FrameRange( fRange ):
nuke.execute( tmp, f, f )
snapFn[ mode ](node)
nuke.delete( tmp ) # CLEAN UP THE HACKY BIT
5. Copy the following to the script editor and run:m = nuke.menu( 'Axis' )
m.addCommand( 'Snap/Match selected position (animated)', lambda: snapToPointsAnim( mode='t' ) )
6. Create an Axis nodeWe're sorry to hear that
Please tell us why