Wrote a small script to quickly disable or enable certain nodes in your DAG which are heavy to compute or u just don't want them to process while working . Just type the words "_disable" without the quotations marks at the end of the name of the node/nodes you want to disable and run this script.
def disable_all(): nukescripts.clear_selection_recursive() nuke.selectAll() nodeList=nuke.selectedNodes() for n in nodeList: nodeClass=n.Class() exception=str(nodeClass) try: n['disable'].setValue(True) except: print("This %s node doesn't have a disable knob so skipping it"%(exception)) def enable_all(): nukescripts.clear_selection_recursive() nuke.selectAll() nodeList=nuke.selectedNodes() for n in nodeList: nodeClass=n.Class() exception=str(nodeClass) try: n['disable'].setValue(False) except: print("This %s node doesn't have a disable knob so skipping it"%(exception)) def disabled_labeled(): nukescripts.clear_selection_recursive() nuke.selectAll() nodeList=nuke.selectedNodes() for n in nodeList: exception=str(nodeClass) tuple=n.name() tuplelen=len(tuple)-8 tupleseperate=tuple[tuplelen:] if tupleseperate=='_disable': try: n['disable'].setValue(True) except: print("This %s node doesn't have a disable knob so skipping it"%(exception)) def enabled_labeled(): nukescripts.clear_selection_recursive() nuke.selectAll() nodeList=nuke.selectedNodes() for n in nodeList: exception=str(nodeClass) tuple=n.name() tuplelen=len(tuple)-8 tupleseperate=tuple[tuplelen:] if tupleseperate=='_disable': try: n['disable'].setValue(False) except: print("This %s node doesn't have a disable knob so skipping it"%(exception)) try: userInput=(nuke.getInput("Type from following list to disable your choice of nodes \n\n"+ "1.Disable all \n\n"+"2.Enable all\n\n"+"3.Disable node marked with '_disable'\n\n"+"4.Enable node marked with '_disable'"+"\n\n")) userInput=int(userInput) except: print("Not a valid or empty choice") if userInput==1: disable_all() elif userInput==2: enable_all() elif userInput==3: disabled_labeled() elif userInput==4: enabled_labeled() else: nuke.message("Wrong choice or empty choice")
Comments