def knob_after_render(self): """ after write render :return: """ # nuke.knobDefault("Write.afterRender", "command.run_readFromWrite()") nuke.knobDefault("Write.afterRender", "")
def run(): #print 'blanking the project_directory' nuke.knobDefault('Root.project_directory', '') # Get the repository root path = GetRepositoryRoot() if path != "": path += "/submission/Nuke/Main" path = path.replace("\\", "/") # Add the path to the system path if path not in sys.path: print "Appending \"" + path + "\" to system path to import SubmitNukeToDeadline module" sys.path.append(path) # Import the script and call the main() function try: import SubmitNukeToDeadline SubmitNukeToDeadline.SubmitToDeadline(path) except: print traceback.format_exc() nuke.message( "The SubmitNukeToDeadline.py script could not be found in the Deadline Repository. Please make sure that the Deadline Client has been installed on this machine, that the Deadline Client bin folder is set in the DEADLINE_PATH environment variable, and that the Deadline Client has been configured to point to a valid Repository." ) else: nuke.message( "The SubmitNukeToDeadline.py script could not be found in the Deadline Repository. Please make sure that the Deadline Client has been installed on this machine, that the Deadline Client bin folder is set in the DEADLINE_PATH environment variable, and that the Deadline Client has been configured to point to a valid Repository." )
def add_knob_default(node, knob, default): '''Add a knob default for a given node''' knob_default = {'node': node, 'knob': knob, 'default': default} nuke.knobDefault(u'{node}.{knob}'.format(**knob_default), '{default}'.format(**knob_default)) LOG.debug(u'Added knob default: {node}.{knob} = {default}'.format( **knob_default))
def knob_show_frame(self): """ show frame range on knob :return: """ nuke.knobDefault("Read.label", "<font size=\"3\" color =#548DD4><b> Frame range :</b></font> " "<font color = red>[value first] - [value last] </font>")
def register_viewers(also_remove="default"): """Registers the a viewer process for each display device/view, and sets the default viewer process. ``also_remove`` can be set to either: - "default" to remove the default sRGB/rec709 viewer processes - "all" to remove all processes - "none" to leave existing viewer processes untouched """ if also_remove not in ("default", "none", "all"): raise ValueError( "also_remove should be set to 'default', 'none' or 'all'") if also_remove == "default": nuke.ViewerProcess.unregister('rec709') nuke.ViewerProcess.unregister('sRGB') nuke.ViewerProcess.unregister('None') elif also_remove == "all": # Unregister all processes, including None, which should be defined in config.ocio for curname in nuke.ViewerProcess.registeredNames(): nuke.ViewerProcess.unregister(curname) # Formats the display and transform, e.g "Film1D (sRGB)" DISPLAY_UI_FORMAT = "%(view)s (%(display)s)" import PyOpenColorIO as OCIO config = OCIO.GetCurrentConfig() # For every display, loop over every view for display in config.getDisplays(): for view in config.getViews(display): # Register the node nuke.ViewerProcess.register(name=DISPLAY_UI_FORMAT % { 'view': view, "display": display }, call=nuke.nodes.OCIODisplay, args=(), kwargs={ "display": display, "view": view, "layer": "all" }) # Get the default display and view, set it as the default used on Nuke startup defaultDisplay = config.getDefaultDisplay() defaultView = config.getDefaultView(defaultDisplay) nuke.knobDefault( "Viewer.viewerProcess", DISPLAY_UI_FORMAT % { 'view': defaultView, "display": defaultDisplay })
def resetToDefault(): ''' reset to standard knob default value ''' n = nuke.thisNode() k = nuke.thisKnob() k.setValue(k.defaultValue()) nuke.knobDefault("{node}.{knob}".format(node=n.Class(), knob=k.name()), "{val}".format(val=k.defaultValue())) updateKnobInit(n.Class(),k.name(),"","del")
def resetToDefault(): ''' reset to standard knob default value ''' n = nuke.thisNode() k = nuke.thisKnob() k.setValue(k.defaultValue()) nuke.knobDefault("{node}.{knob}".format(node=n.Class(), knob=k.name()), "{val}".format(val=k.defaultValue())) updateKnobInit(n.Class(), k.name(), "", "del")
def createDefault(): ''' create custom knobDefault value ''' n = nuke.thisNode() k = nuke.thisKnob() #set default for current nuke session nuke.knobDefault("{node}.{knob}".format(node=n.Class(), knob=k.name()), "{val}".format(val=k.value())) # set updateKnobInit(n.Class(),k.name(),k.value(),"write")
def register_viewers(also_remove = "default"): """Registers the a viewer process for each display device/view, and sets the default viewer process. ``also_remove`` can be set to either: - "default" to remove the default sRGB/rec709 viewer processes - "all" to remove all processes - "none" to leave existing viewer processes untouched """ if also_remove not in ("default", "none", "all"): raise ValueError("also_remove should be set to 'default', 'none' or 'all'") if also_remove == "default": nuke.ViewerProcess.unregister('rec709') nuke.ViewerProcess.unregister('sRGB') elif also_remove == "all": # Unregister all processes, but retain the useful "None" option for curname in nuke.ViewerProcess.registeredNames(): nuke.ViewerProcess.unregister(curname) nuke.ViewerProcess.register( name = "None", call = nuke.nodes.ViewerProcess_None, args = ()) # Formats the display and transform, e.g "Film1D (sRGB)" DISPLAY_UI_FORMAT = "%(view)s (%(display)s)" import PyOpenColorIO as OCIO config = OCIO.GetCurrentConfig() # For every display, loop over every view for display in config.getDisplays(): for view in config.getViews(display): # Register the node nuke.ViewerProcess.register( name = DISPLAY_UI_FORMAT % {'view': view, "display": display}, call = nuke.nodes.OCIODisplay, args = (), kwargs = {"display": display, "view": view}) # Get the default display and view, set it as the default used on Nuke startup defaultDisplay = config.getDefaultDisplay() defaultView = config.getDefaultView(defaultDisplay) nuke.knobDefault( "Viewer.viewerProcess", DISPLAY_UI_FORMAT % {'view': defaultView, "display": defaultDisplay})
def createDefault(): ''' create custom knobDefault value ''' n = nuke.thisNode() k = nuke.thisKnob() #set default for current nuke session nuke.knobDefault("{node}.{knob}".format(node=n.Class(), knob=k.name()), "{val}".format(val=k.value())) # set updateKnobInit(n.Class(), k.name(), k.value(), "write")
def preferencesOverride(): import nuke #nuke.toNode('preferences')['diskCacheGB'].setValue(25) nuke.toNode('preferences')['maxPanels'].setValue(1) nuke.toNode('preferences')['UIAnimatedColor'].setValue(0x88e0eff) nuke.toNode('preferences')['ArrowColorElbow'].setValue(0xffff0000) nuke.toNode('preferences')['ArrowColorLeft'].setValue(0x4f0000ff) nuke.toNode('preferences')['ArrowColorRight'].setValue(0) nuke.toNode('preferences')['ArrowColorUp'].setValue(0x540000ff) nuke.toNode('preferences')['InputArrowSize'].setValue(18) nuke.toNode('preferences')['LeftInputArrowSize'].setValue(10) nuke.toNode('preferences')['OutputArrowSize'].setValue(10) nuke.toNode('preferences')['ArrowheadLength'].setValue(10) nuke.toNode('preferences')['ArrowheadWidth'].setValue(10) nuke.toNode('preferences')['ArrowWidth'].setValue(4) nuke.toNode('preferences')['AlreadyQueuedItemColor'].setValue(0x4f0000ff) nuke.knobDefault('preferences.AlreadyQueuedItemColor', '0x4f0000ff') nMajor = nuke.NUKE_VERSION_MAJOR if nMajor > 6: nuke.toNode('preferences')['goofy_foot'].setValue(0) nuke.toNode('preferences')['viewer_handle_pick_size'].setValue(15) #nuke.toNode('preferences')['DfltBezAutokey'].setValue(0) nuke.toNode('preferences')['UIRotoPointColor'].setValue(0xff0000ff) nuke.toNode('preferences')['UIRotoCurveColor'].setValue(0xffff00ff) nuke.toNode('preferences')['UIRotoTransformJackColor'].setValue( 0xbc00ff) nuke.toNode('preferences')['UICacheframeColor'].setValue(0xffff00ff) #nuke.toNode('preferences')['UIRotoLockedColor'].setValue(0xcccccfff) nuke.toNode('preferences')['UISplineWarperSrcStippled'].setValue(0) nuke.toNode('preferences')['UISplineWarperDstStippled'].setValue(0) nuke.toNode('preferences')['UISplineWarperASourceColor'].setValue( 0xffff00ff) nuke.toNode('preferences')['UISplineWarperBSourceColor'].setValue( 0xffffff) nuke.toNode('preferences')['UISplineWarperADestColor'].setValue( 0x606000ff) nuke.toNode('preferences')['UISplineWarperBDestColor'].setValue( 0x4259ff) nuke.toNode( 'preferences')['UISplineWarperCorrespondenceColor'].setValue(1) nuke.toNode('preferences')['UISplineWarperDstStippled'].setValue( 0xff8400ff) nuke.toNode('preferences')['UISplineWarperBoundaryColor'].setValue( 0xffffffff)
def ocio_populate_viewer(remove_nuke_default=True): """Registers the a viewer process for each display/transform, and sets the default Also unregisters the default Nuke viewer processes (sRGB/rec709) unless remove_nuke_default is False """ # TODO: How to we unregister all? This assumes no other luts # have been registered by other viewer processes if remove_nuke_default: nuke.ViewerProcess.unregister('rec709') nuke.ViewerProcess.unregister('sRGB') # Formats the display and transform, e.g "Film1D (sRGB)" DISPLAY_UI_FORMAT = "%(view)s (%(display)s)" import PyOpenColorIO as OCIO config = OCIO.GetCurrentConfig() # For every display, loop over every view for display in config.getDisplays(): for view in config.getViews(display): nuke.ViewerProcess.register(name=DISPLAY_UI_FORMAT % { 'view': view, "display": display }, call=nuke.nodes.OCIODisplay, args=(), kwargs={ "display": display, "view": view }) # Get the default display and view, register it as the # default used on Nuke startup defaultDisplay = config.getDefaultDisplay() defaultView = config.getDefaultView(defaultDisplay) nuke.knobDefault( "Viewer.viewerProcess", DISPLAY_UI_FORMAT % { 'view': defaultView, "display": defaultDisplay })
def onLoad(): print "launched init.py!" fps = os.environ['FPS'] width = os.environ['WIDTH'] height = os.environ['HEIGHT'] project = os.environ['PROJECT'] task = os.environ['TASK'] shot = os.environ['SHOT'] job = os.environ['JOB'] # Set Job folder in file browser nuke.addFavoriteDir( name = 'Task Dir', directory = job, type = nuke.SCRIPT) # Set res nuke.knobDefault('Root.format', width + ' ' + height + ' HD')
def ocio_populate_viewer(remove_nuke_default = True): """Registers the a viewer process for each display/transform, and sets the default Also unregisters the default Nuke viewer processes (sRGB/rec709) unless remove_nuke_default is False """ if remove_nuke_default: nuke.ViewerProcess.unregister('rec709') nuke.ViewerProcess.unregister('sRGB') # Formats the display and transform, e.g "Film1D (sRGB" DISPLAY_UI_FORMAT = "%(transform)s (%(display)s)" import PyOpenColorIO as OCIO cfg = OCIO.GetCurrentConfig() allDisplays = cfg.getDisplayDeviceNames() # For every display, loop over every transform for dname in allDisplays: allTransforms = cfg.getDisplayTransformNames(dname) for xform in allTransforms: nuke.ViewerProcess.register( name = DISPLAY_UI_FORMAT % {'transform': xform, "display": dname}, call = nuke.nodes.OCIODisplay, args = (), kwargs = {"device": dname, "transform": xform}) # Get the default display and transform, register it as the # default used on Nuke startup defaultDisplay = cfg.getDefaultDisplayDeviceName() defaultXform = cfg.getDefaultDisplayTransformName(defaultDisplay) nuke.knobDefault( "Viewer.viewerProcess", DISPLAY_UI_FORMAT % {'transform': defaultXform, "display": defaultDisplay})
def ocio_populate_viewer(remove_nuke_default = True): """Registers the a viewer process for each display/transform, and sets the default Also unregisters the default Nuke viewer processes (sRGB/rec709) unless remove_nuke_default is False """ # TODO: How to we unregister all? This assumes no other luts # have been registered by other viewer processes if remove_nuke_default: nuke.ViewerProcess.unregister('rec709') nuke.ViewerProcess.unregister('sRGB') # Formats the display and transform, e.g "Film1D (sRGB" DISPLAY_UI_FORMAT = "%(view)s (%(display)s)" import PyOpenColorIO as OCIO config = OCIO.GetCurrentConfig() # For every display, loop over every transform for display in config.getDisplays(): for view in config.getViews(display): nuke.ViewerProcess.register( name = DISPLAY_UI_FORMAT % {'view': view, "display": display}, call = nuke.nodes.OCIODisplay, args = (), kwargs = {"display": display, "view": view}) # Get the default display and transform, register it as the # default used on Nuke startup defaultDisplay = config.getDefaultDisplay() defaultView = config.getDefaultView(defaultDisplay) nuke.knobDefault( "Viewer.viewerProcess", DISPLAY_UI_FORMAT % {'view': defaultView, "display": defaultDisplay})
def setDefaultVariation(readNode): """ Sets the default variation to the read node :param readNode: Read node in nuke :type readNode: nuke.Node """ if readNode is None: return uVariationKnob = readNode['uVariation'] defaultVariationValue = nuke.knobDefault("Read.uVariation") if defaultVariationValue: for variationValue in uVariationKnob.values(): # the knobDefault can be defined using the glob syntax if fnmatch(variationValue, defaultVariationValue): uVariationKnob.setValue(variationValue) break
def set_knob_defaults(): """Set the knob defaults.""" # Shutter Offset default nuke.knobDefault("shutteroffset", "centered") # For some reason, TimeBlur doesn't get affected by the previous command. # As far as I can see, it's the only node that doesn't get affected. nuke.knobDefault("TimeBlur.shutteroffset", "centered") # Tracker defaults nuke.knobDefault( "Tracker4.label", "Motion: [value transform]\nRef Frame: [value reference_frame]")
def _setOCIOKnobDefaults(self): # Knob defaults by themselves dont seem to work correctly, they dont # intialize the viewer processes so we're also hitting this with # a big stick in the _setOCIOSettingsOnRootNode function and # essentially setting these defaults twice. Yay Nuke! ocio_path = os.getenv("OCIO_CONFIG") ocio_path = ocio_path.replace(os.path.sep, "/") ocio_path = nuke.filenameFilter(ocio_path) self.log_debug("Setting knob defaults for Root node OCIO settings.") nuke.knobDefault("Root.colorManagement", "OCIO") nuke.knobDefault("Root.OCIO_config", "custom") nuke.knobDefault("Root.customOCIOConfigPath", ocio_path)
def customTracker(): trackNode = nuke.knobDefault('Tracker.label', '[value name]') code = ''' allTranforms = nuke.allNodes("Transform", recurseGroups=True) allCornerPin = nuke.allNodes("CornerPin2D", recurseGroups=True) refFrame = int(nuke.thisNode()['reference_frame'].value()) trackerName = nuke.thisNode().name() ##--Here is the original script in a default tracker node--## tracker = nuke.thisNode() cornerPinOption = tracker.knob("cornerPinOptions").getValue() if cornerPinOption == 0: tracker.knob("createPinUseCurrentFrame").execute() elif cornerPinOption == 1: tracker.knob("createPinUseReferenceFrame").execute() elif cornerPinOption == 2: tracker.knob("createPinUseCurrentFrameBaked").execute() elif cornerPinOption == 3: tracker.knob("createPinUseReferenceFrameBaked").execute() elif cornerPinOption == 4: tracker.knob("createTransformStabilize").execute() elif cornerPinOption == 5: tracker.knob("createTransformMatchMove").execute() elif cornerPinOption == 6: tracker.knob("createTransformStabilizeBaked").execute() elif cornerPinOption == 7: tracker.knob("createTransformMatchMoveBaked").execute() ##---------------------------------------------------------## try: [node for node in nuke.allNodes("Transform", recurseGroups=True) if node not in allTranforms][0].knob("label").setValue("<html><center>From: " + trackerName + "\\nFrame: " + "%s</center></html>"%refFrame) [node for node in nuke.allNodes("Transform", recurseGroups=True) if node not in allTranforms][0].knob("shutteroffset").setValue("centred") except: [node for node in nuke.allNodes("CornerPin2D", recurseGroups=True) if node not in allCornerPin][0].knob("label").setValue("<html><center>From: " + trackerName + "\\nFrame: " + "%s</center></html>"%refFrame) [node for node in nuke.allNodes("CornerPin2D", recurseGroups=True) if node not in allCornerPin][0].knob("shutteroffset").setValue("centred") ''' nuke.thisNode().knob('createCornerPin').setValue(code)
import nuke nuke.knobDefault('Roto.output','alpha') nuke.knobDefault('Blur.label','[value size]') nuke.knobDefault('Dilate.label','[value size]') nuke.knobDefault('Dilate.label','[value size]') nuke.knobDefault('TimeOffset.label','[value time_offset]') nuke.knobDefault('Tracker4.label','[value reference_frame]') nuke.knobDefault('TimeWarp.label','[value filter]') nuke.knobDefault('Retime.label','[value filter]') nuke.knobDefault('PostageStamp.tile_color', '4278190335') nuke.knobDefault('Write.jpeg._jpeg_quality', '.9') nuke.knobDefault("Write.jpeg._jpeg_sub_sampling", "4:4:4") nuke.knobDefault("RotoPaint.toolbox", '''clone { { brush ltt 0 h 1} { clone ltt 0 h 0 opc 0.01 } { blur ltt 0} { sharpen ltt 0} { smear ltt 0} { eraser ltt 0} { reveal ltt 0} { dodge ltt 0} { burn ltt 0} }''') nuke.knobDefault('Grid.number', '10 {number.0/(width/height)}') ###################################################################################################################################################### ###################################################################################################################################################### def Stencil():
def knobDefaults(): nuke.knobDefault('DirBlurWrapper.channels', 'rgba') nuke.knobDefault('DirBlurWrapper.BlurType', 'linear') nuke.knobDefault('Read.on_error', 'checkerboard') nuke.knobDefault('DeepRead.on_error', 'checkerboard') nuke.knobDefault('DeepRead.black_outside', "1") nuke.knobDefault('Wireframe.operation', 'see through') nuke.knobDefault('Wireframe.operation', 'see through') nuke.knobDefault('STMap.uv', 'rgb') nuke.knobDefault('IDistort.uv', 'forward') nuke.knobDefault('DespillMadness.screenType', 'green') nuke.knobDefault('ScanlineRender.shutteroffset', 'centred') nuke.knobDefault('Read.on_error', 'black') nuke.knobDefault('raw', "0") nuke.knobDefault('PositionToPoints2.P_channel', 'P') nuke.knobDefault('PositionToPoints2.N_channel', 'N') nuke.knobDefault('DeepRead.on_error', 'black') nuke.knobDefault('Retime.filter', 'none') nuke.knobDefault('Text.message', '[value frame]') nuke.knobDefault('MergeGeo.selectable', '0') nuke.knobDefault('Scene.selectable', '0') nuke.knobDefault('ContactSheet.rows', '1') nuke.knobDefault('ContactSheet.columns', '2') nuke.knobDefault('Mirror2.flop', '1') nuke.knobDefault('TimeOffset.postage_stamp', '0') nuke.knobDefault('Project3D.crop', '0') nuke.knobDefault('DeepToPoints.detail', '0.05') nuke.knobDefault('Tracker4.retrack_on_move_link', '0') nuke.knobDefault('Tracker4.shutteroffset', 'centred') nuke.knobDefault('Tracker4.motionblur', '0') nuke.knobDefault('Tracker4.show_error_on_track', '1') nuke.knobDefault('Tracker4.zoom_window_behavior', 'never') nuke.knobDefault('FilterErode.channels', 'rgba') nuke.knobDefault('Blur.channels', 'rgba') nuke.knobDefault('Clamp.channels', 'rgba') nuke.knobDefault('Invert.channels', 'rgba') nuke.knobDefault('VectorBlur.channels', 'rgba') nuke.knobDefault('VectorBlur.uv', 'motion') nuke.knobDefault('Tracker4.create_key_on_move_link', '0') nuke.knobDefault('Tracker4.autotracks_delete_keyframes_link', '0') nuke.knobDefault('RotoPaint.toolbar_effect_parameter1', '5') nuke.knobDefault('RotoPaint.openspline_width', '2') nuke.knobDefault('Roto.openspline_width', '2') nuke.knobDefault('Roto.global_motionblur', '0') nuke.knobDefault('RotoPaint.global_motionblur', '0') nuke.knobDefault('RotoPaint.toolbar_brush_hardness', "1.0") nuke.knobDefault('RotoPaint.cliptype', "0") nuke.knobDefault('Roto.cliptype', "0") nuke.knobDefault('Roto.openspline_width', "1") nuke.knobDefault('Roto.hide_input', "1") nuke.knobDefault('Constant.channels', 'rgba') nuke.knobDefault('Constant.postage_stamp', '0') nuke.knobDefault('CheckerBoard2.postage_stamp', '0') nuke.knobDefault('IBKGizmoV3.st', 'C-green') nuke.knobDefault('IBKColourV3.screen_type', 'green') nuke.knobDefault('PostageStamp.hide_input', '1') nuke.knobDefault('PostageStamp.postage_stamp', '0') nuke.knobDefault('Read.postage_stamp', '0') nuke.knobDefault('Read.auto_alpha', '1') nuke.knobDefault('Read.cacheLocal', '0') nuke.knobDefault('Cube.rows', '1') nuke.knobDefault('Cube.columns', '1') nuke.knobDefault('Viewer.hide_input', '1') nuke.knobDefault('Bezier.linear', '0') nuke.knobDefault('Bezier.blur_type', 'smooth') nuke.knobDefault('Remove.operation', 'keep') nuke.knobDefault('Merge2.bbox', 'union') nuke.knobDefault('TransformMasked.tile_color', '2271788031') nuke.knobDefault('TransformMasked.channels', 'rgb') nuke.knobDefault('Tracker4.label', '') nuke.knobDefault('Merge2.label', '') nuke.knobDefault('Remove.channels', 'rgba') nuke.knobDefault('BackdropNode.bookmark', '0') nuke.knobDefault('Blur.label', '') nuke.knobDefault('RotoPaint.label', '') nuke.knobDefault('RotoPaint.output', 'rgba') nuke.knobDefault('Roto.output', 'rgba') nuke.knobDefault('Tracker4.label', '') nuke.knobDefault('Card2.rows', '4') nuke.knobDefault('Card2.columns', '4') nuke.knobDefault('Card2.image_aspect', '0')
except: LOG.warning('FAILED loading write_node') # LOAD paths try: for paths in os.getenv('SOFTWARE_SUB_PATH').split(';'): nuke.pluginAddPath(paths) except: LOG.warning('FAILED loading SOFTWARE_SUB_PATH') print('SETTINGS') # RESOLUTION **************************** try: nuke.addFormat(RESOLUTION) nuke.knobDefault('Root.format', project_data['name'].replace(' ', '')) print(' {} ON - {}'.format(chr(254), RESOLUTION)) except: LOG.error(' OFF - {}'.format(RESOLUTION), exc_info=True) print(' {} OFF - {}'.format(chr(254), RESOLUTION)) # FPS *********************************** try: nuke.knobDefault("Root.fps", str(project_data['fps'])) print(' {} ON - {} fps'.format(chr(254), project_data['fps'])) except: LOG.error(' OFF - {} fps'.format(project_data['fps']), exc_info=True) print(' {} OFF - {} fps'.format(chr(254), project_data['fps'])) # createFolder **************************** try:
import nuke ############################################################# # NODE DEFAULT VALUE ############################################################# nuke.knobDefault('Multiply.value', '0') nuke.knobDefault('FilterErode.channels', 'rgba') nuke.knobDefault("Transform.shutteroffset", "center") nuke.knobDefault("Tracker3.shutteroffset", "center") nuke.knobDefault("Tracker4.shutteroffset", "center") nuke.knobDefault("CornerPin2D.shutteroffset", "center") nuke.knobDefault("ScanlineRender.shutteroffset", "center") nuke.knobDefault("Project3D.crop", "false") nuke.knobDefault("Roto.cliptype", "no clip") nuke.knobDefault("RotoPaint.cliptype", "no clip") nuke.knobDefault("Log2Lin.operation", "lin2log") nuke.knobDefault("PLogLin.operation", "lin to log") nuke.menu('Nodes').addCommand( "Time/FrameHold", "nuke.createNode('FrameHold')['first_frame'].setValue( nuke.frame() )", 'FrameHold.png') nuke.knobDefault("Merge.bbox", "3") nuke.knobDefault("Keymix.bbox", "1") nuke.knobDefault("EXPTool.mode", "0") nuke.knobDefault("StickyNote.note_font_size", "40") nuke.knobDefault('BackdropNode.note_font_size', '40') nuke.knobDefault("BackdropNode.note_font", "bold") #nuke.knobDefault("Read.before", "3") #nuke.knobDefault("Read.after", "3") #nuke.knobDefault("Read.on_error", "1")
import nuke nuke.knobDefault('Root.fps', '25') nuke.knobDefault("Viewer.fps", "25") nuke.knobDefault("Root.format", "1920 1080 0 0 1920 1080 1 FullHD") nuke.knobDefault("Read.cached", "1") nuke.knobDefault("Read.cacheLocal", "always") nuke.knobDefault('Card.rows', '0' ); nuke.knobDefault('Card.columns', '0' ); nuke.knobDefault('ShuffleCopy.label', '[value in] -> [value out2]\n[value in2] -> [value out]') nuke.knobDefault('Shuffle.label', '[value in] -> [value out]') nuke.knobDefault('Blur.label', '[value size]') nuke.knobDefault('Blur.channels', 'alpha') nuke.knobDefault('IBKColourV3.screen_type', 'green') nuke.knobDefault('IBKGizmoV3.st', 'C-green') nuke.knobDefault("CheckerBoard.centerlinewidth","0") nuke.knobDefault("FilterErode.channels","alpha") nuke.knobDefault("Dilate.channels","alpha") nuke.knobDefault("Write.bookmark", "True") nuke.knobDefault("Merge.label", "[if {[value mix]<1} { value mix }]") nuke.knobDefault("Saturation.label", "[if {[value saturation]<1} { value saturation }]") nuke.knobDefault("Viewer.freezeGuiWhenPlayBack", "1") nuke.knobDefault("Grain2.maskgrain", "False") nuke.knobDefault("Card2.rows", "0.0") nuke.knobDefault("Card2.columns", "0.0") nuke.knobDefault("Viewer.tile_color", "1128481791") nuke.knobDefault("Blur.mix", "1.0") nuke.knobDefault("Blur.size", "2.0")
'VectorBlur2' : 'motion: [value this.scale]', 'VectorBlur' : channel+'multiply: [value this.scale]', #Keyer 'Difference' : 'gain: [value this.gain]', #Merge 'Merge' : 'mix: [value mix]', 'Keymix' : channel+'mix: [value mix]', 'Dissolve' : channel+'which: [value which]', 'Switch' : 'which: [value which]', 'Premult' : channel, 'Unpremult' : channel, #Transform 'Mirror' : '[if {[value this.Horizontal]==true} {return "Horizontal "}][if {[value this.Vertical]==true} {return " Vertical"}]', 'Mirror2' : '[if {[value this.flip]==true} {return "vertical "}][if {[value this.flop]==true} {return " horizontal"}]', 'Tracker4' : '[value transform] | frame:[value reference_frame]', 'VectorDistort': 'frame:[value this.reference_frame]', 'STMap' : channel, 'Transform' : Transform_label, } for knobName,label in labels.items(): nuke.knobDefault('%s.label'%knobName,label)
m_keybindings.addCommand('SliceTool', 'nuke.createNode("SliceTool")') m_keybindings.addCommand('RefractTo', 'nuke.createNode("refract_to_the_FUTURE")') # try: DeadlineNukeClient m_keybindings.addCommand('sjmDeadliner','DeadlineNukeClient.main()','Ctrl+Meta+D') except: pass # ======================================================================= # NODE PARAMETER DEFAULTS # ======================================================================= # set default values for various nodes (alpha sort except Labels collected below) # nuke.knobDefault('BackdropNode.note_font_size','189') nuke.knobDefault("Blur.size", "11") nuke.knobDefault('DirBlurWrapper.BlurLayer','rgba') nuke.knobDefault('PostageStamp.hide_input','true') nuke.knobDefault('Roto.cliptype','none') nuke.knobDefault('Roto.premultiply','rgba') nuke.knobDefault("RotoPaint.cliptype", "none") nuke.knobDefault('VectorBlur.method','backward') nuke.knobDefault('VectorBlur.grow_bbox','200') nuke.knobDefault('VectorBlur.uv','motion') nuke.knobDefault("Blur.label", "s:[value size]") nuke.knobDefault("FilterErode.label", "s:[value size]") nuke.knobDefault("Multiply.label", "v:[value value]") nuke.knobDefault("Switch.label", "w:[value which]") nuke.knobDefault("TimeOffset.label", "o:[value time_offset]")
# 256 pipeline tools # Add custom plugin paths # Set knob defaults # Set custom format import nuke, os # Get project root (P:/FUTURAMA/) rootProject = os.path.dirname(__file__).split('PREP/PIPELINE/DNA/2D')[0] # Set Path to GIZMOS gizmo = '{}PREP/PIPELINE/DNA/2D/gizmo'.format(rootProject) nuke.pluginAddPath(gizmo, addToSysPath=False) # Set paths DNA to scripts python = '{}PREP/PIPELINE/DNA/2D/scripts/'.format(rootProject) sys.path.append(python) # Set FORMAT nuke.addFormat('1998 1080 1.0 KZMRES') nuke.knobDefault('Root.format', 'KZMRES')
import os import nuke import gizmos import disconnect_wiggle import plugin_nuke # auto load all gizmos gizmosPath = "//bigfoot/jellyfish/00_pipeline/nuke/gizmos" nuke.pluginAddPath(gizmosPath) menuNodes = nuke.menu('Nodes') gizmos.addGizmos(gizmosPath, menuNodes) # load render threads menuMain = nuke.menu('Nodes').menu("Jellyfish") menuMain.addCommand("vuRenderThreads", "plugin_nuke.showPopup()", "Alt+F7") # set up defaults nuke.knobDefault("Root.format", "HD_1080") nuke.knobDefault("Root.fps", os.environ['FPS']) # set up favorites jf = os.environ['ROOT'].replace("\\", "/") nuke.addFavoriteDir('JELLYFISH', jf) nuke.addFavoriteDir('JF USER', os.environ['HOME']) nuke.addFavoriteDir('JF SHOTS', jf + '/30_shots') nuke.addFavoriteDir('JF RENDER', jf + '/40_render') nuke.addFavoriteDir('JF FOOTAGE', jf + '/45_footage')
nuke.pluginAddPath('./python') nuke.pluginAddPath('./tcl') nuke.pluginAddPath('./icons') nuke.pluginAddPath('./lib') nuke.pluginAddPath('./lut') import os, nukescripts, platform import pipeline import sendToAvconv # SET KNOB DEFAULTS # //////////////////////////////////////////////////////////////////////////////// # WRITE NODE # use this instead of nuke.addBeforeRender so that artists can remove it locally if needed nuke.knobDefault('Write.beforeRender', 'pipeline.createWriteDir()') nuke.knobDefault('Write.afterRender', 'sendToAvconv.sendToAvconv()') # ROOT nuke.knobDefault('Root.project_directory', '[python {nuke.script_directory()}]/../') nuke.knobDefault('Root.format', 'HD') nuke.knobDefault('Root.proxy_type', 'scale') nuke.knobDefault('Root.proxy_scale', '.5') nuke.knobDefault('Root.fps', '23.976') # NODE PRESETS # //////////////////////////////////////////////////////////////////////////////// import cam_presets cam_presets.nodePresetCamera() import reformat_presets reformat_presets.nodePresetReformat()
if platform.system() == "Windows": dir = Win_Dir elif platform.system() == "Darwin": dir = MacOSX_Dir elif platform.system() == "Linux": dir = Linux_Dir else: dir = None # -------------------------------------------------------------- # KNOB DEFAULTS :::::::::::::::::::::::::::::::::::::::::::::: # -------------------------------------------------------------- nuke.knobDefault('Tracker4.shutteroffset', "centered") nuke.knobDefault('Tracker4.label', "Motion: [value transform]\nRef Frame: [value reference_frame]") nuke.knobDefault('Transform.label', "motionblur: [value motionblur]") nuke.knobDefault('Merge2.label',"Mix: [value mix]") nuke.knobDefault('VectorBlur2.label', "Channels: [value channels]\nUV: [value uv]\nmotionblur: [value scale]") nuke.knobDefault('Roto.cliptype','no clip') nuke.knobDefault('RotoPaint.cliptype','no clip') nuke.knobDefault('Tracker4.adjust_for_luminance_changes','1') nuke.knobDefault('Transform.shutteroffset', "centered") nuke.knobDefault('Crop.crop','0') nuke.knobDefault('VectorBlur2.uv', "motion") nuke.knobDefault('ScanlineRender.shutteroffset', "centered") nuke.knobDefault('CornerPin2D.shutteroffset', "centered") nuke.knobDefault('TimeBlur.shutteroffset', "centered") nuke.knobDefault('TransformMasked.shutteroffset', "centered") nuke.knobDefault('MotionBlur2D.shutteroffset', "centered")
import nuke import Tools #Knob Defaults nuke.knobDefault("Root.format", "HD") nuke.knobDefault("Roto.output", "-rgba.red -rgba.green -rgba.blue rgba.alpha") #RT Hidden Items n.addCommand("BetterWrite", "Tools.WriteFix()", "w") n.addCommand("ErodeBlurImport", "Tools.ErodeBlur()", "e") n.addCommand("Packer", "Tools.Packer()", "#p") n.addCommand("ChannelPackerImport", "Tools.Saturation()", "+a") #RT Menu nuke.menu("Nodes").addMenu("Ahuge Tools", icon="AhugeTools.png") nuke.menu("Nodes").addCommand('Ahuge Tools/Roto Output', 'Ahuge_Tools.RotoOutputNode()', "+o") nuke.menu("Nodes").addCommand('Ahuge Tools/Paintout', 'Ahuge_Tools.Paintout()', "+p") nuke.menu("Nodes").addCommand('Ahuge Tools/PointsTo3D', 'Ahuge_Tools.P3D()', "+m") nuke.menu("Nodes").addCommand('Roto Tools/Current Frame Hold', 'Ahuge_Tools.FrameHoldMe()', "+c") nuke.menu("Nodes").addCommand('Roto Tools/CreateBackdrop', 'Ahuge_Tools.CreateBackdrop()', "+b") nuke.menu("Nodes").addCommand('Ahuge Tools/Grain Blur', 'Ahuge_Tools.GrainBlur()')
nuke.addFavoriteDir('Job', job) if seq: nuke.addFavoriteDir('Sequence', seq) if shot: nuke.addFavoriteDir('Shot', shot) toolbar = nuke.toolbar("Nodes") ### END FAVORITES SETUP ### ### BEGIN DEFAULTS SETUP ### nuke.addOnUserCreate(firstFrameEval, nodeClass = 'FrameHold') nuke.addOnUserCreate(guiOn, nodeClass = 'DiskCache') shuffleLabel = "<b>[value in]" nuke.knobDefault( 'Shuffle.label', shuffleLabel ) nuke.knobDefault( 'EXPTool.mode', 'Stops' ) # Node Colors nuke.knobDefault( 'Transform.tile_color', '1278560767.0' ) ### END DEFAULTS SETUP ### ### BEGIN LUMA GIZMO SETUP ### ## LUMA Pictures gizmo collector if __name__ == '__main__': # Just in case they didn't use the supplied init.py gizManager = globals().get('gizManager', None) if gizManager is None: print 'Problem finding GizmoPathManager - check that init.py was setup correctly' else:
nuke.pluginAppendPath(gizmo_path) #SuccessMsg print('Successfully added custom gizmo pathes') except: #FailMsg print('Error adding custom gizmo pathes') #OCIO #------------------------------------------------------------------ try: #set OCIO nuke.knobDefault('defaultViewerLUT', 'OCIO LUTs') #SuccessMsg print('Successfully set OCIO environment') except: #FailMsg print('Error setting OCIO environment') #Check init position #------------------------------------------------------------------ if (__name__ == '__main__'): print('Executed init: {0}'.format(__file__))
import nuke #setup default prefs nuke.knobDefault("Root.format", "HD") nuke.knobDefault("Root.fps", "25") #creating the Glapp menu menubar = nuke.menu("Nuke") m = menubar.addMenu("BAIT") #mocha to nuke nuke.menu('Nuke').addCommand('BAIT/MochaToNuke','import Mocha_AE_Import_v01 as mton;mton.Mocha_AE_Import()') #deadline import DeadlineNukeClient menubar = nuke.menu("Nuke") tbmenu = menubar.addMenu("&Thinkbox") tbmenu.addCommand("Submit Nuke To Deadline", DeadlineNukeClient.main, "")
## By Belal Salem ## # Plugins load and menu configurations for them: toolbar=nuke.toolbar("Nodes") toolbar.addCommand( "Filter/ZFog", "nuke.createNode('Fog')","", icon="ZFog.png" ) toolbar.addCommand( "Keyer/rgbMatte", "nuke.createNode('RGBmatte')","", icon="" ) toolbar.addCommand( "Keyer/colorMatte", "nuke.createNode('colorMatte')","", icon="" ) toolbar.addCommand( "Color/exr2lin", "nuke.createNode('exr2lin')", "", icon="" ) toolbar.addCommand( "Color/lin2exr", "nuke.createNode('lin2exr')", "", icon="" ) toolbar.addCommand( "Filter/bokehBlur", "nuke.createNode('Bokeh_Blur')","", icon="" ) toolbar=nuke.toolbar("Nodes") #toolbar.addCommand("Tractor/Open Tractor Panel", "tractorNukeLib.renderPanel(True)", icon="TractorRenderSpool.png") # Viewer Defaults: nuke.knobDefault('Viewer.viewerProcess', 'none') nuke.knobDefault('Viewer.useGPUForViewer', 'True') nuke.knobDefault('Viewer.disableGPUDitherForViewer', 'True') # Project settings Defaults: # LUTs and default LUTs for file Write/Read nodes: nuke.knobDefault("Root.monitorLut", "linear") nuke.knobDefault("Root.viewerLut", "linear") nuke.knobDefault("Root.int8Lut", "linear") nuke.knobDefault("Root.int16Lut", "linear") nuke.knobDefault("Root.logLut", "Cineon") nuke.knobDefault("Root.floatLut", "linear") # Frame format and FPS: nuke.knobDefault('Root.format', '720 576 1.09')
import nuke, os from amg import icons nuke.tprint('============== menu.py is running\n') nuke_path = os.getenv('NUKE_PATH').split(';')[0] #My custom formats # nuke.addFormat ('1280 720 1.0 720p') #Nuke defaults nuke.knobDefault('Root.format', '720p') toolbar = nuke.toolbar("Nodes") # Access the main toolbar menubar = nuke.menu("Nuke") # Access the main menu bar def initGizmos(): allgizmos = toolbar.addMenu('all_gizmos', icon=icons.ico['animagrad']) gizmos = os.path.join(nuke_path, 'gizmos').replace('\\','/') nuke.tprint('============== CUSTOM GIZMOS: %s' % gizmos) for d, dirs, files in os.walk(gizmos): for file in files: gizmo_name, ext = os.path.splitext(file) if ext == '.gizmo': allgizmos.addCommand(gizmo_name, "nuke.createNode(\"" + gizmo_name + '\")' ) nuke.tprint(gizmo_name) nuke.tprint('==============') initGizmos()
nuke.pluginAddPath('./python') nuke.pluginAddPath('./tcl') nuke.pluginAddPath('./icons') nuke.pluginAddPath('./lib') nuke.pluginAddPath('./lut') import os, nukescripts, platform import pipeline import sendToAvconv # SET KNOB DEFAULTS # //////////////////////////////////////////////////////////////////////////////// # WRITE NODE # use this instead of nuke.addBeforeRender so that artists can remove it locally if needed nuke.knobDefault('Write.beforeRender', 'pipeline.createWriteDir()') nuke.knobDefault('Write.afterRender', 'sendToAvconv.sendToAvconv()') # ROOT nuke.knobDefault('Root.project_directory', '[python {nuke.script_directory()}]/../') nuke.knobDefault('Root.format', 'HD') nuke.knobDefault('Root.proxy_type', 'scale') nuke.knobDefault('Root.proxy_scale', '.5') nuke.knobDefault('Root.fps', '23.976') # NODE PRESETS # //////////////////////////////////////////////////////////////////////////////// import cam_presets cam_presets.nodePresetCamera()
p = fin_assetManager.NkPanel( nkScripts ) # ADJUST SIZE p.setMinimumSize( 200, 200 ) # IF PANEL WAS CONFIRMED AND A NUKE SCRIPT WAS SELECTED, OPEN IT if p.showModalDialog(): if p.selectedScript: nuke.scriptOpen( p.selectedScript ) # ADD CALLBACKS nuke.addOnScriptSave( fin_assetManager.checkScriptName ) nuke.addOnUserCreate( nkPanelHelper, nodeClass='Root') nuke.addOnUserCreate( fin_assetManager.createVersionKnobs, nodeClass='Read' ) nuke.addKnobChanged( fin_assetManager.updateVersionKnob, nodeClass='Read' ) #nuke.addBeforeRender( assetManager.createOutDirs, nodeClass='Write' ) nuke.knobDefault( 'Write.beforeRender', 'fin_assetManager.createOutDirs()') ### END ASSET MANAGEMENT SETUP ### ### BEGIN RUSH SETUP ### ## Uncomment this if RUSH is used #m = menubar.addMenu("Render") #m.addCommand("Create Paths", "fin_Tools.createPaths()") #m.addCommand("Fix Paths", "fixPath.fixPath()") #m.addCommand("Send2Rush", "s2r.Nuke2Rush()") ### END RUSH SETUP ### ### BEGIN GIZMO SETUP ### ##Keyer_CB
import sys # SET TOOLS PATH global toolsPath toolsPath = os.path.dirname(__file__) # RETURN EVERYTHING IN DIRECTORY AND CHECK FOR THE DIRECTORY ONLY onlyDir = [ f for f in os.listdir(toolsPath) if os.path.isdir(os.path.join(toolsPath, f)) ] for eachDir in onlyDir: #ADD THE DIRECTORY AS PLUGIN nuke.pluginAddPath(eachDir) # SET THE ROOT TO USE BOTH BASE AND PROXY FORMATS # SET ROOT nuke.addFormat("1280 720 0 0 1280 720 1 CML") nuke.knobDefault("Root.format", "CML") nuke.knobDefault("Root.fps", "25") #nuke.knobDefault("Root.onScriptLoad", "assetScript.onLoad()") # SET ROTO nuke.knobDefault("Roto.output", "rgba") # SET ADDTIMECODE nuke.knobDefault("AddTimeCode.startcode", "00:00:00:00") nuke.knobDefault("AddTimeCode.metafps", "false") nuke.knobDefault("AddTimeCode.useFrame", "true") nuke.knobDefault("AddTimeCode.fps", "25") nuke.knobDefault("AddTimeCode.frame", "0")
else: subMenu = toolbar.addMenu(folder) self._recursiveAddGizmoMenuItems(subMenu, data) if __name__ == '__main__': if CUSTOM_GIZMO_LOCATION and os.path.isdir(CUSTOM_GIZMO_LOCATION): gizManager = GizmoPathManager(searchPaths=[CUSTOM_GIZMO_LOCATION]) else: gizManager = GizmoPathManager() gizManager.addGizmoPaths() if not nuke.GUI: # We're not gonna need it anymore, cleanup... del gizManager ### Read and Write nodes change defaults nuke.knobDefault("Read.before", "black") nuke.knobDefault("Read.after", "black") ### Image Formats nuke.addFormat ("2048 1556 2.0 2k_anamorphic") nuke.addFormat ("4096 3112 2.0 4k_anamorphic") nuke.addFormat ("2048 1556 1.0 2k_super35_cc") nuke.addFormat ("2048 1168 1.0 2k_3perf_1168") nuke.addFormat ("2048 1162 1.0 2k_3perf_1162") nuke.addFormat ("2048 1156 1.0 2k_3perf_1156") nuke.addFormat ("2048 1152 1.0 2k_3perf_1152") nuke.addFormat ("960 540 1.0 half_HD") nuke.addFormat ("720 405 1.0 email")
import nuke #setup default prefs nuke.knobDefault("Root.format", "HD") nuke.knobDefault("Root.fps", "25") #creating the Glapp menu menubar = nuke.menu("Nuke") m = menubar.addMenu("BAIT") #mocha to nuke nuke.menu('Nuke').addCommand( 'BAIT/MochaToNuke', 'import Mocha_AE_Import_v01 as mton;mton.Mocha_AE_Import()') #deadline import DeadlineNukeClient menubar = nuke.menu("Nuke") tbmenu = menubar.addMenu("&Thinkbox") tbmenu.addCommand("Submit Nuke To Deadline", DeadlineNukeClient.main, "")
try: os.environ['OFX_PLUGIN_PATH'] += ';' except: os.environ['OFX_PLUGIN_PATH'] = '' # Load Frischluft Lenscare if(sys.platform == 'win32'): os.environ['OFX_PLUGIN_PATH'] += volAssets + '/bin/lenscare/lenscare_ofx_v1.44_win' elif(sys.platform == 'darwin'): os.environ['OFX_PLUGIN_PATH'] += volAssets + '/bin/lenscare/lenscare_ofx_v1.44_osx' # If Write dir does not exist, create it def createWriteDir(): file = nuke.filename(nuke.thisNode()) dir = os.path.dirname( file ) osdir = nuke.callbacks.filenameFilter( dir ) try: os.makedirs( osdir ) return except: return # Activate the createWriteDir function nuke.addBeforeRender( createWriteDir ) # Make Write node default to sRGB color space nuke.knobDefault('Write.mov.colorspace', 'sRGB')
utilities_menu.addCommand('Autocrop', 'nukescripts.autocrop()') import relative_cornerpins utilities_menu.addCommand('Relative_Cornerpin', 'relative_cornerpins.relative_cornerpins()') import backdrops_setter utilities_menu.addCommand('Backdrops_Setter', 'backdrops_setter.backdrop_setter()') #------------------------------------------------------------------- # KNOB DEFAULTS :::::::::::::::::::::::::::::::::::::::::::::::: #------------------------------------------------------------------- #2D Tracker Defaults nuke.knobDefault('Tracker4.shutteroffset', "centered") nuke.knobDefault('Tracker4.label', "Motion: [value transform]\nRef: [value reference_frame]") nuke.addOnUserCreate( lambda: nuke.thisNode()['reference_frame'].setValue(nuke.frame()), nodeClass='Tracker4') #Framehold Defaults nuke.addOnUserCreate( lambda: nuke.thisNode()['first_frame'].setValue(nuke.frame()), nodeClass='FrameHold') # ----- Center Shutter --------------------------- nuke.knobDefault('Tracker4.shutteroffset', "centered") nuke.knobDefault('TimeBlur.shutteroffset', "centered")
m=menubar.addMenu("Image") m.addCommand("Grad", "nuke.createNode('grad')", icon='grad.png', index=8) m.addCommand("aePremult", "nuke.createNode('aePremult.gizmo')", index=4) m.addCommand("Branch Out Channels", "branchout.branchout()") #This adds html links to help Menu nuke.menu("Nuke").addMenu("Help").addCommand("Creative Crash Nuke Downloads", "nuke.tcl(\"start \\\"http://www.creativecrash.com/nuke/downloads/\\\"\")") nuke.menu("Nuke").addMenu("Help").addCommand("Creative Crash Nuke Tutorials", "nuke.tcl(\"start \\\"http://www.creativecrash.com/nuke/tutorials/\\\"\")") nuke.menu("Nuke").addMenu("Help").addCommand("Vfxtalk Nuke Forum", "nuke.tcl(\"start \\\"http://www.vfxtalk.com/forum/nuke-foundry-f60.html\\\"\")") nuke.menu("Nuke").addMenu("Help").addCommand("Vfxtalk Nuke Downloads", "nuke.tcl(\"start \\\"http://www.vfxtalk.com/forum/nuke-plugins-scripts-f124.html\\\"\")") nuke.menu("Nuke").addMenu("Help").addCommand("Nukepedia", "nuke.tcl(\"start \\\"http://www.nukepedia.com\\\"\")") #this sets default node values on the grade node and write node nuke.knobDefault('Grade.black_clamp','false')#turns off black clamp knob on Grade nodes when created nuke.knobDefault("Write.channels", "rgba")#changes the default on write nodes from rgb to rgba #example for spawining an external application or process from a nuke button import subprocess nuke.menu("Nuke").addMenu("Footage").addCommand('BrokenGlass rv', "subprocess.Popen('/usr/local/tweaks/rv/bin/rv /path/to/my/files/', shell = True)")#this spawns flipbook for specific render nuke.menu("Nuke").addMenu("Utilities").addCommand('Vim', "subprocess.Popen('/usr/bin/gvim', shell = True)")#this creates a menu on the top bar called Utilities and adds a button to start up gvim #example for adding slog lut in root nuke.root().knob('luts').addCurve("sLog", "{pow(10.0, ((t - 0.616596 - 0.03) /0.432699)) - 0.037584}") #example for killing all viewers apon opening new script to speed up working with large scripts def killViewers(): for v in nuke.allNodes("Viewer"):
def setRootKnobValue(name, val): nuke.knobDefault('Root.' + name, str(val)) nuke.Root().knob(name).setValue(val)
# 256 pipeline tools # Add custom plugin paths # Set knob defaults # Set custom format import nuke, os # Get project root (P:/FUTURAMA/) rootProject = os.path.dirname(__file__).split('PREP/PIPELINE/DNA/2D')[0] # Set Path to GIZMOS gizmo = '{}PREP/PIPELINE/DNA/2D/gizmo'.format(rootProject) nuke.pluginAddPath(gizmo, addToSysPath = False) # Set paths DNA to scripts python = '{}PREP/PIPELINE/DNA/2D/scripts/'.format(rootProject) sys.path.append(python) # Set FORMAT nuke.addFormat('1998 1080 1.0 KZMRES') nuke.knobDefault('Root.format', 'KZMRES')
def add_knob_default(node, knob, default): '''Add a knob default for a given node''' knob_default={ 'node': node, 'knob': knob, 'default': default } nuke.knobDefault(u'{node}.{knob}'.format(**knob_default) , '{default}'.format(**knob_default)) LOG.debug(u'Added knob default: {node}.{knob} = {default}'.format(**knob_default))
def smartProjectSetter(projectPath, scriptPath, renderPath): projectPath = projectPath scriptPath=scriptPath renderPath=renderPath if os.path.isdir(projectPath): #setting up p = createPanel(projectPath) if p.show(): userPath=p.value('create new script: ') #convert whitespace back userPath = userPath.replace("**", " ") artist = p.value('artist: ') scriptname=p.value('script name: ') scriptname=scriptname.replace(" ","_") scriptname=scriptname.replace("@","_") projectComment = p.value("comment (optional): ") # # actions # # 1 open recent # 2 open latest script # 3 create project #01 open recent recentFile=p.value("open recent file") #cancel button pressed if recentFile is None: recentFile="---OpenRecentFile---" if recentFile!="---OpenRecentFile---": def openRecent(): nuke.scriptOpen(recentFile) return True def thread_dispatch(): return nuke.executeInMainThreadWithResult(openRecent, ()) thread.start_new_thread(thread_dispatch, ()) #02 open latest script latestScript=p.value("open latest script") #cancel button pressed if latestScript is None: latestScript="---OpenLatestScript---" if latestScript!="---OpenLatestScript---": def openRecent(): nuke.scriptOpen(latestScript) return True def thread_dispatch(): return nuke.executeInMainThreadWithResult(openRecent, ()) thread.start_new_thread(thread_dispatch, ()) #03 create project if userPath!="---ChooseProject---" and userPath!=" -------------------- ": #convert whitespace back if scriptname!="": t=getTime() #create Folder projectPath=getSmartSettings("@projectPath") project = userPath scriptPath = getSmartSettings("@scriptPath") #setting script and render folder scriptFolder = projectPath + "/" + project + "/" + scriptPath + "/" + artist + "/" + scriptname scriptsDir = scriptFolder + "/scripts" footageFolderPath = scriptFolder + "/_footage" trkFolder = scriptFolder + "/trk" assetsFolder = scriptFolder + "/assets" referencesFolder = scriptFolder + "/references" fullScriptPath = scriptsDir + "/" + scriptname + "@" + t + ".nk" renderFolder = projectPath + "/" + project + "/" + renderPath + "/" + artist + "/" + scriptname #create scriptFolder, renderFolder, toFolder createFolders(scriptFolder) createFolders(scriptsDir) createFolders(footageFolderPath) createFolders(trkFolder) createFolders(assetsFolder) createFolders(referencesFolder) createFolders(renderFolder) #set root name #when starting nuke and setting up project nuke.knobDefault("Root.name", fullScriptPath) #when setting up new project in between nuke.root()['name'].setValue(fullScriptPath) if projectComment!="": #write comment in root.label and create text file in project folder #when starting nuke and setting up project nuke.knobDefault("Root.label", projectComment) #when setting up new project in between nuke.root()['label'].setValue(projectComment) #create txt file fobj_out = open(scriptFolder+"/_projectnote.txt","w") fobj_out.write(projectComment) fobj_out.close() smartSaver() else: if(scriptPath=="---" and renderPath=="---" and projectPath=="---"): nuke.message("Welcome to smart. Please make sure to insert all the inputs correctly in order to make .smart work correctly") else: nuke.message("Could not find the project path. Make sure that the path is set correctly") smartSetter()
# cope with the directory existing already by ignoring that exception try: os.makedirs(os_path) except OSError, e: if e.errno != errno.EEXIST: raise #************************ # PIPELINE Tank().init_software() print('SETTINGS') # FPS *********************************** try: nuke.knobDefault("nuke.Root()['fps'].setValue({})".format( project_data['fps'])) print(' {} ON - FPS: {}'.format(chr(254), project_data['fps'])) except: pass LOG.debug(' OFF - FPS: {}'.format(project_data['fps'])) print(' {} OFF - FPS: {}'.format(chr(254), project_data['fps'])) # RESOLUTION **************************** try: nuke.addFormat(RESOLUTION) nuke.knobDefault('Root.format', project_data['name'].replace(' ', '')) print(' {} ON - RES: {}'.format(chr(254), RESOLUTION)) except: LOG.debug(' OFF - RES: {}'.format(RESOLUTION)) print(' {} OFF - RES: {}'.format(chr(254), RESOLUTION))
#nukescripts.registerPanel('com.ohufx.IconPanel', addIconPanel) #frank's fovCalculator, not coming up for some reason, will investigate later #import FovCalculator #def addFovCalc(): # fovCalc = FovCalculator.FovCalculator() # return fovCalc.addToPane() #paneMenu.addCommand('Fov Calculator', addFovCalc, "ctrl+alt+f" ) #nukescripts.registerPanel('com.ohufx.FovCalculator', addFovCalc ) ########################################################################################## ################## Default Node Values Overide ################## nuke.knobDefault('Grade.black_clamp','false')# this turns off black clamp on Grade nodes nuke.knobDefault( 'Bezier.linear', 'true' ) #nuke.knobDefault('nuke.ViewerProcess','rec709') #nuke.knobDefault('root.ViewerProcess','rec709') nuke.knobDefault('Tracker.label', '[value transform] / ref:[value reference_frame]') nuke.knobDefault('Switch.label', '[value which]') nuke.knobDefault('Dissolve.label', '[value which]') nuke.knobDefault('Colorspace.label', '[value colorspace_in] >> [value colorspace_out]') nuke.knobDefault('Blur.label', '[value size]') nuke.knobDefault('Shuffle.label', '[value red]/[value green]/[value blue]/[value alpha]') ################## WRITE NODE ################## nuke.knobDefault("Write.channels", "rgba") nuke.knobDefault("Write.file_type","jpg") nuke.knobDefault("Write._jpeg_quality", "1")
print('Successfully added custom gizmo pathes') except: #FailMsg print('Error adding custom gizmo pathes') #OCIO #------------------------------------------------------------------ try: #set OCIO nuke.knobDefault('defaultViewerLUT', 'OCIO LUTs') #SuccessMsg print('Successfully set OCIO environment') except: #FailMsg print('Error setting OCIO environment')
import nuke import fastTrack nuke.menu("Nodes").addCommand("Transform/Tracker", "nuke.createNode('Tracker4')", "alt+t", icon="Tracker.png") nuke.menu("Nuke").addCommand("Edit/Node/Tracker set Ref Frame", "fastTrack.setRefFrame()", "alt+r") nuke.knobDefault("Tracker1.label", "ref: [value reference_frame]") nuke.knobDefault("Tracker2.label", "ref: [value reference_frame]") nuke.knobDefault("Tracker3.label", "ref: [value reference_frame]") nuke.knobDefault("Tracker4.label", "ref: [value reference_frame]")
toolbar.addCommand('Transform/Reformat', 'nuke.createNode("Reformat")', 'Ctrl+r') toolbar.addCommand("Merge/Merges/Stencil", "nuke.createNode('Merge2', 'operation stencil')", "Alt+z", icon="MergeOut.png") toolbar.addCommand("Merge/Merges/Plus", "nuke.createNode('Merge2', 'operation plus Achannels rgb', False)", "^+a") toolbar.addCommand("Merge/Merges/Divide", "nuke.createNode('Merge2', 'operation divide')") toolbar.addCommand("Merge/Merges/Mask", "nuke.createNode('Merge2', 'operation mask')", "^+z", icon="MergeIn.png") toolbar.addCommand('Color/Math/Multiply', 'nuke.createNode("Multiply")', '^m') toolbar.addCommand('Color/Exposure', 'nuke.createNode("EXPTool")', 'e', icon='Exposure.png') toolbar.addCommand('Draw/Bezier', 'nuke.createNode("Bezier")', 'Alt+b', icon='wizardFX_icon.png') toolbar.addCommand('Other/AutoBackdrop', 'autobackdrop.autoBackdrop()', 'Alt+m', icon='wizardFX_icon.png') nuke.knobDefault('CurveTool.ROI', 'autocropdata autocropdata autocropdata autocropdata') nuke.knobDefault('Bezier.cliptype', 'no clip') nuke.knobDefault('RotoPaint.label', '[value lifetime_type]') nuke.knobDefault('RotoPaint.outputMask', 'rotopaint_mask.a') nuke.knobDefault('RotoPaint.cliptype', 'no clip') nuke.knobDefault("RotoPaint.toolbar_source_translate_round", "true") nuke.knobDefault("Roto.toolbar_autokey", "true") nuke.knobDefault("Roto.output", "rgba") nuke.knobDefault("Read.before", 'hold') nuke.knobDefault("Card.rows", "1") nuke.knobDefault("Card.columns", "1") nuke.knobDefault("Write.extension", "sxr") nuke.knobDefault("Read.postage_stamp", "false") def showPath():
def knob_after_render(self): """ after write render :return: """ nuke.knobDefault("Write.afterRender", "command.run_readFromWrite()")
# ************************************************************* import nuke import settings as s sys.path.append(s.PATH["lib"]) from lib import libFunction # ************************ # INIT # ************************ print("\nWelcome " + libFunction.getCurrentUser()) print("\nBREAKINGPOINT: System is setting ...\n") # #******************* # # VARIABLES # #******************* FPS = "25" RESOLUTION = "2048 1152 BP_2K" # #******************* # # SETTINGS # #******************* nuke.knobDefault("Root.fps", FPS) nuke.addFormat(RESOLUTION) nuke.knobDefault("Root.format", "BP_2K")