Skip to content

Instantly share code, notes, and snippets.

@BenMcEwan
Created May 9, 2018 05:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BenMcEwan/4df3f64e69e06c6ec5259557e6bc531d to your computer and use it in GitHub Desktop.
Save BenMcEwan/4df3f64e69e06c6ec5259557e6bc531d to your computer and use it in GitHub Desktop.
# --------------------------------------------------------------
# setComment.py
# Version: 1.0.0
# Last Updated: January 11th, 2018
# --------------------------------------------------------------
# --------------------------------------------------------------
# USAGE:
#
# Sets Meta+C shortcut to change a node's label
# Add this to your menu.py
# --------------------------------------------------------------
def setComment():
selectedNode = nuke.selectedNode()
oldComment = selectedNode.knob('label').value()
newComment = nuke.getInput('Node comment',oldComment)
# If the user has hit 'Cancel', use the previous comment rather than wiping it
if newComment == None:
selectedNode.knob('label').setValue(oldComment)
else:
selectedNode.knob('label').setValue(newComment)
# Add to edit menu
nuke.menu('Nuke').addCommand( 'Edit/Set Node Label', setComment, "meta+c")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment