tips,tricks & geekie stuff

FRAMEHOLD FROM CURRENT FRAME

tl;dr:A useful tweak to the “FrameHold” node that set by default its “frame” knob to the current frame in the timeline.

By the time I´m writing this, probably everyone has its own version of such a simple, yet day-to-day usefull tweak of a tool. Nonetheless, a couple of weeks ago a college of mine asked me to modify the “FrameHold” node so that, whenever we create one, it gets its “first_frame” knob automatically set to the frame in the timeline it is created. This imply some people could still benefit from reading this :)
My implementation of such a thing consists of a mini function that is passed to an “addOnUserCreate” callback as callable argument whenever a “FrameHold” node is created.

important: make sure to copy this code somewhere in your meny.py file to make it work. Enjoy!

snippet
.__autor__ Boris Martinez 

# function to be passed later on to a addOnUserCreate callback.
def frame_hold_to_frame():
    node = nuke.thisNode()
    curr_frame = nuke.frame()
    frame = node['first_frame'].setValue(curr_frame)
	return curr_frame
# addOnUserCreate callback.
nuke.addOnUserCreate(frame_hold_to_frame,nodeClass ="FrameHold")