Set shortcut for Dot Node in Nuke

518 views Asked by At

I have written code and run it successfully in script editor inside nuke which is to create dot node and set to the selected node label and name automatic , my problem now that I can't set shortcut to new preset I created for the new dot ,I want to set shortcut for dot with this preset, Thanks. code :

inputNode = nuke.selectedNode()
z=(nuke.defaultNodeColor(nuke.selectedNode().Class()))
inputColor= inputNode.knob('tile_color').value()
inputLabel= inputNode.knob('name').getValue()
dot=nuke.createNode('Dot')
dot.knob('tile_color').setValue(int(z))
dot.knob('label').setValue(inputLabel)
1

There are 1 answers

1
Erwan Leroy On BEST ANSWER

You can overwrite the menu entry for the Dot with your custom code (which I left unmodified within the function):

def my_dot():
    inputNode = nuke.selectedNode()
    z=(nuke.defaultNodeColor(nuke.selectedNode().Class()))
    inputColor= inputNode.knob('tile_color').value()
    inputLabel= inputNode.knob('name').getValue()
    dot=nuke.createNode('Dot')
    dot.knob('tile_color').setValue(int(z))
    dot.knob('label').setValue(inputLabel)

nuke.menu('Nodes').addCommand('Other/Dot', lambda:my_dot(), '.')