lockNode for nuke
lockNode.py
This code allow user to lock the nodes knob. Once you lock the knobs, then you cant modify any sliders until you un-lock the knobs. This will save you from any accident changes. Hope this will help you guys.
Latest version support to write the info to your nuke script. So it will always locked if you close your nuke script and re-open it. I have used some cheat method to keep the node locked while user save their nuke script. I have tested many times and haven't faced any issues. Let me know if you faced any issues.
steps:
right mouse click on node property panel. You will get options 'lock_knobs' and 'unlock_knobs'.
Select 'lock_knobs'. This code will lock will the knobs and put Node_Locked text into node label. So user can easily identify the locked knob in UI.
If user selects 'unlock_knob'. This code will return knobs to active and remove the Node_Locked text from label.
Save your nuke script with nodes locked. Close nuke and re-open the script. You can find the locked node still locked.
mail to satheesrev@gmail.com for any bugs & reports.
copy paste below lines into your menu.py.
import lockNode
propertiesmenu = nuke.menu("Properties")
propertiesmenu.addSeparator()
propertiesmenu.addCommand('lock_knobs', "lockNode.lock_knobs()")
propertiesmenu.addCommand('unlock_knobs', "lockNode.unLoc k_knobs()")
propertiesmenu.addSeparator()
propertiesmenu.addCommand('lock_knobs', "lockNode.lock_knobs()")
propertiesmenu.addCommand('unlock_knobs', "lockNode.unLoc k_knobs()")
def oc():
nodes = nuke.allNodes()
for selNode in nodes:
allknobs=selNode.allKnobs()
label = selNode['label'].getValue()
if 'Node_Locked' in label:
for knob in allknobs:
knob.setEnabled(False)
for a in nuke.allNodes('Group'):
for node in a.nodes():
allknobs=node.allKnobs()
label = node['label' ].getValue()
if 'Node_Locked' in label:
for knob in allknobs:
knob.setEnabled(False)
nuke.addOnScriptLoad(oc)
nuke.addOnCreate(oc)
Here is the python code:
download lockNode.py
Comments
Post a Comment