简体   繁体   中英

Set shortcut for Dot Node in Nuke

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)

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(), '.')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM