def setupCallbacks(): """ Utility function to add all callbacks for plugins in this suite. """ for pluginName in constants.LAYER_ALCHEMY_PLUGIN_NAMES: nuke.addAutolabel(_autolabel, nodeClass=pluginName) pass
def DotLabel(): # get the node node = nuke.thisNode() if node.Class() == "Dot": # user's label input value if node['label'].value() == '': currentVal = node['label'].value() else: currentVal = ('<align=left>' + node['label'].value()) # if dot has input if node.inputs() == 1: # if input is hidden if node['hide_input'].value() == 1: autoLabel = ('<b><i>' + nuke.tcl("value this.input.name") + '</i></b>' + '\n' + currentVal) else: autoLabel = currentVal else: autoLabel = currentVal return autoLabel nuke.addAutolabel(DotLabel, nodeClass='Dot')
n = m.addMenu("Snap") n.addCommand("Match selection position", "nukescripts.snap3d.translateToPoints(nuke.selectedNode())") n.addCommand( "Match selection position, orientation", "nukescripts.snap3d.translateRotateToPoints(nuke.selectedNode())") n.addCommand( "Match selection position, orientation, size", "nukescripts.snap3d.translateRotateScaleToPoints(nuke.selectedNode())") del m del n del isLinux ################################################################ # non-menu stuff: # # The stuff that lives here can't run in render mode or is # pointless to run in render mode, so this way it only gets run # if the GUI is starting up. # Restore the default layout (number 1) nuke.restoreWindowLayout(1) # back-compatibility handling of autolabel. Load any autolabel.py we # find and then register it so nuke.autolabel() calls it. User can # override this by defining another version somewhere # earlier in your NUKE_PATH, for instance $HOME/.nuke/menu.py. from autolabel import autolabel nuke.addAutolabel(autolabel)
nuke.thisKnob().name()) nuke.addOnUserCreate(_cb, ("onUserCreate")) nuke.addOnCreate(_cb, ("onCreate")) nuke.addOnScriptLoad(_cb, ("onScriptLoad")) nuke.addOnScriptSave(_cb, ("onScriptSave")) nuke.addOnScriptClose(_cb, ("onScriptClose")) nuke.addOnDestroy(_cb, ("onDestroy")) nuke.addKnobChanged(_cbk, ("knobChanged")) nuke.addUpdateUI(_cb, ("updateUI")) nuke.addAutolabel(_cb, ("autolabel")) nuke.addBeforeRender(_cb, ("beforeRender")) nuke.addBeforeFrameRender(_cb, ("beforeFrameRender")) nuke.addAfterFrameRender(_cb, ("afterFrameRender")) nuke.addAfterRender(_cb, ("afterRender")) nuke.addFilenameFilter(lambda s: nuke.tprint("filenameFilter('" + s + "')"))
def register_autolabel(self): nuke.addAutolabel(self.create_autolabel)
if node.Class() == "Grade": # sets autolabel to node name autoLabel = node.name() # check if values are zero'ed or not BP = ('BP' if node['blackpoint'].value() != 0 else None) WP = ('WP' if node['whitepoint'].value() != 1 else None) Lift = ('Lift' if node['black'].value() != 0 else None) Gain = ('Gain' if node['white'].value() != 1 else None) Multiply = ('Multiply' if node['multiply'].value() != 1 else None) Offset = ('Offset' if node['add'].value() != 0 else None) Gamma = ('Gamma' if node['gamma'].value() != 1 else None) # creates list knobs = [BP, WP, Lift, Gain, Multiply, Offset, Gamma] # if value inside list != None, add to autoLabel for knob in knobs: if knob != None: autoLabel = autoLabel + '\n' + knob # adds custom user label if exists if node['label'].value(): autoLabel = autoLabel + '\n' + node['label'].value() return autoLabel nuke.addAutolabel(GradeLabel, nodeClass='Grade')
def add_autolabel(): """Add custom autolabel. """ LOGGER.info('增强节点标签') nuke.addAutolabel(custom_autolabel)