Created
May 9, 2018 05:46
-
-
Save BenMcEwan/4df3f64e69e06c6ec5259557e6bc531d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -------------------------------------------------------------- | |
# 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