actually you can just create single function then pass the 'state' argument contain value of True or False. so delete the unlockNode.py and modify lockNode.py :edit the 'def lockNode()' part as follow :
Code:
import nuke
def lockknob(nodes,state):
for node in nodes :
allknobs=node.allKnobs()
for knob in allknobs:
knob.setEnabled(state)
nuke.toNode(node.name()).setSelected(False)
nuke.toNode(node.name()).setSelected(True)e)
def lockNode(state):
a=nuke.selectedNodes()
lockknob(a,not state)
then for menu:
Code:
import lockNode
menuBar.addCommand('Edit/Node/lockNode', 'lockNode.lockNode(True)', 'ctrl+l')
menuBar.addCommand('Edit/Node/unlockNode', 'lockNode.lockNode(False)', 'shift+l')
i use 'not state' insted of 'state' . U can use 'state' also if u want and inverse the logic. But i'm doing this way to make the function() readable , means :
--> lockNode(TRUE) is like saying : yes, TRUE.. i want to Lock the Node.
--> lockNode(FALSE) is like saying : no/FALSE... do not lock the Node.
cheers