comp_V01

Gui_Disabler

Jan 3rd, 2020
100
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set cut_paste_input [stack 0]
  2. version 10.0 v3
  3. Group {
  4. inputs 0
  5. name Gui_Disabler
  6. selected true
  7. xpos -518
  8. ypos -311
  9. addUserKnob {20 disabler l Disabler}
  10. addUserKnob {22 add_nodes l "Add Selected" T "disabler = nuke.thisNode()\n\nnuke.thisNode().end()\n\nexpr1='''\n\[python -exec \{\ndisabler = nuke.toNode(\"'''\n\nexpr2 = disabler.name()\n\nexpr3='''\")\n\nif disabler\[\"disable\"].getValue() == 0:\n ret = 0\nelse:\n if disabler\[\"disable_nodes\"].getValue() == 0:\n ret = 0\n else:\n ret = 1\n\}]\[python ret]\n'''\nexpr = expr1 + expr2 + expr3\n\n\nfor n in nuke.selectedNodes():\n\n if n.name() != \"Heavy_Disabler\":\n\n if n.name() in disabler\[\"nodeList\"].value():\n\n pass\n\n else:\n\n n\[\"disable\"].setExpression(expr,0)\n\n if n\[\"label\"].getValue() == \"\":\n n\[\"label\"].setValue(n\[\"label\"].getValue() + \"linked to disabler\")\n\n else:\n n\[\"label\"].setValue(n\[\"label\"].getValue() + \"\\nlinked to disabler\")\n\n if disabler\[\"nodeList\"].value() == \"no nodes connected\":\n\n disabler\[\"nodeList\"].setValue(n.name())\n\n else:\n disabler\[\"nodeList\"].setValue(str(disabler\[\"nodeList\"].value()) + \"\\n\" + n.name())" +STARTLINE}
  11. addUserKnob {22 remove_nodes l "Remove Selected" -STARTLINE T "disabler = nuke.thisNode()\n\nnuke.thisNode().end()\n\n\nfor n in nuke.selectedNodes():\n\n if n.name() in disabler\[\"nodeList\"].value():\n\n n\[\"disable\"].setExpression(\"\",0)\n n\[\"disable\"].setAnimated(0)\n\n oldList = disabler\[\"nodeList\"].value()\n newList = oldList.replace(n.name(), \"\") \n disabler\[\"nodeList\"].setValue(newList)\n \n disabler\[\"nodeList\"].setValue(disabler\[\"nodeList\"].value().replace(\"\\n\\n\", \"\\n\"))\n\n nodeList = disabler\[\"nodeList\"].value()\n\n if len(nodeList) != 0:\n\n firstChar = (repr(nodeList\[0]))\n\n if firstChar == repr(\"\\n\"):\n\n disabler\[\"nodeList\"].setValue(nodeList\[1:])\n\n lastChar = (repr(nodeList\[-1]))\n\n print lastChar\n\n if lastChar == repr(\"\\n\"):\n\n disabler\[\"nodeList\"].setValue(nodeList\[0:-1])\n\n print (repr(disabler\[\"nodeList\"].value()))\n\n if \"\\nlinked to disabler\" in n\[\"label\"].getValue():\n\n n\[\"label\"].setValue(n\[\"label\"].getValue().replace(\"\\nlinked to disabler\", \"\"))\n\n else:\n\n n\[\"label\"].setValue(n\[\"label\"].getValue().replace(\"linked to disabler\", \"\"))\n\n\nif disabler\[\"nodeList\"].value() == \"\":\n disabler\[\"nodeList\"].setValue(\"no nodes connected\")\n"}
  12. addUserKnob {26 ""}
  13. addUserKnob {20 connectedNodes l "Connected Nodes" n 1}
  14. addUserKnob {26 nodeList l "" +STARTLINE T "no nodes connected"}
  15. addUserKnob {20 endGroup n -1}
  16. addUserKnob {20 info l Info}
  17. addUserKnob {26 tooltip l "" +STARTLINE T "Use the two buttons in the \"Disabler\" tab to connect \nthe selected nodes to this disabler. \n\nDisable this node to disable all connected nodes.\n\nWhen rendering in batch mode all connected nodes are enabled.\nTo change this behaviour use the button below.\n"}
  18. addUserKnob {26 ""}
  19. addUserKnob {22 toggle_batch_enable l "Effect nodes in batch" T "knob = nuke.thisNode()\[\"disable_nodes\"]\n\nstate = knob.animation(0).expression()\n\nif state == \"\$gui\":\n knob.setExpression(\"1\")\n nuke.thisKnob().setLabel(\"Don´t effect nodes in batch\")\n nuke.thisNode()\[\"batch_mode\"].setValue(\"~ Currently no difference between gui and batch.\")\n \n\nelse:\n knob.setExpression(\"\$gui\")\n nuke.thisKnob().setLabel(\"Effect nodes in batch\")\n nuke.thisNode()\[\"batch_mode\"].setValue(\"~ Disabled nodes are currently enabled in batch.\")\n" +STARTLINE}
  20. addUserKnob {26 batch_mode l "" -STARTLINE T "~ Disabled nodes are currently enabled in batch."}
  21. addUserKnob {26 ""}
  22. addUserKnob {26 copyright l "" +STARTLINE T "copyright 2018 Marcel Pichert | Gui_Disabler V1.0"}
  23. addUserKnob {6 disable_nodes l INVISIBLE +INVISIBLE +STARTLINE}
  24. disable_nodes {{"\$gui" x1 1}}
  25. }
  26. Output {
  27. inputs 0
  28. name Output1
  29. xpos 28
  30. ypos 160
  31. }
  32. end_group
RAW Paste Data