1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- def guiFarm():
-
- disableAll = 'for i in nuke.allNodes():\n\tfor k in i.knobs():\n\t\tif i.knob(k).name() == "knobName2":\n\t\t\tknobName = i.knob("knobName2").value()\n\t\t\ti.knob(knobName).clearAnimated()\n\t\t\ti.knob("GUIFarmEnabled").setValue(False)'
-
- enableAll = 'for i in nuke.allNodes():\n\tfor k in i.knobs():\n\t\tif i.knob(k).name() == "knobName2":\n\t\t\tknobName = i.knob("knobName2").value()\n\t\t\ti.knob(knobName).setExpression("$gui?gui:farm")\n\t\t\ti.knob("GUIFarmEnabled").setValue(True)'
-
- disableThis = 'nuke.thisNode()[nuke.thisNode()["knobName2"].value()].clearAnimated()\nnuke.thisNode()["GUIFarmEnabled"].setValue(False)'
-
- enableThis = 'nuke.thisNode()[nuke.thisNode()["knobName2"].value()].setExpression("$gui?gui:farm")\nnuke.thisNode()["GUIFarmEnabled"].setValue(True)'
-
- if nuke.thisNode().knob('GUIFarm'):
-
- nuke.message('GUI/Farm already exists')
-
- else:
-
- knobName = nuke.thisKnob().name()
-
- nuke.selectedNode().addKnob(nuke.Tab_Knob('GUIFarm', 'GUI/Farm'))
- nuke.selectedNode().addKnob(nuke.String_Knob('knobName2', 'Knob name'))
- nuke.selectedNode().addKnob(nuke.Int_Knob('gui'))
- nuke.selectedNode().addKnob(nuke.Int_Knob('farm'))
- nuke.selectedNode().addKnob(nuke.PyScript_Knob('enableThis', 'Enable'))
- nuke.selectedNode().addKnob(nuke.PyScript_Knob('disableThis', 'Disable'))
-
- nuke.selectedNode().addKnob(nuke.Text_Knob("globalSettings","Global Settings"))
-
- nuke.selectedNode().addKnob(nuke.PyScript_Knob('enableAll', 'Enable all'))
- nuke.selectedNode().addKnob(nuke.PyScript_Knob('disableAll', 'Disable all'))
-
- nuke.selectedNode().addKnob(nuke.Text_Knob("divider2",""))
-
-
- nuke.selectedNode().addKnob(nuke.Boolean_Knob('GUIFarmEnabled'))
-
- nuke.selectedNode().knob('knobName2').setValue(knobName)
- nuke.selectedNode().knob('knobName2').setEnabled(False)
- nuke.selectedNode().knob(knobName).setExpression('$gui?gui:farm')
- nuke.selectedNode().knob('enableThis').setValue(enableThis)
- nuke.selectedNode().knob('disableThis').setValue(disableThis)
- nuke.selectedNode().knob('disableAll').setValue(disableAll)
- nuke.selectedNode().knob('enableAll').setValue(enableAll)
- nuke.selectedNode().knob('GUIFarmEnabled').setValue(True)
- nuke.selectedNode().knob('GUIFarmEnabled').setVisible(False)
-
-
- def previewOn():
-
- for i in nuke.allNodes():
- for k in i.knobs():
- if i.knob(k).name() == "knobName2" and i.knob("GUIFarmEnabled").value() == True:
- knobName = i.knob("knobName2").value()
- i.knob(knobName).setExpression("farm")
-
-
- def previewOff():
-
- for i in nuke.allNodes():
- for k in i.knobs():
- if i.knob(k).name() == "knobName2" and i.knob("GUIFarmEnabled").value() == True:
- knobName = i.knob("knobName2").value()
- i.knob(knobName).setExpression("$gui?gui:farm")
|