def render(): cn = nuke.thisNode() setCommentPath() frameStart = int(cn["frameStart"].getValue()) frameEnd = int(cn["frameEnd"].getValue()) if cn["submit"].getValue() == 0.0: threads = int(cn["threads"].getValue()) from plugins.vuRenderThreads.plugin_nuke import plugin_nuke plugin_nuke.createThreads(frameStart, frameEnd, threads, [cn.name()]) LOG.info("END : RENDERTHREADS : " + cn["exrPathComment"].getValue()) elif cn["submit"].getValue() == 1.0: import rrenderSubmit nuke.load('rrenderSubmit') rrenderSubmit.rrSubmit_Nuke_Node(cn, frameStart, frameEnd) LOG.info("END : RRSUBMIT : " + cn["exrPathComment"].getValue()) else: try: nuke.execute(nuke.thisNode(), start=frameStart, end=frameEnd, incr=1) LOG.info("END : LOCAL : " + cn["exrPathComment"].getValue()) except: print "END : LOCAL : Execution failed" LOG.error("END : LOCAL : " + cn["exrPathComment"].getValue(), exc_info=True)
def render(): this_node = nuke.thisNode() frameStart = int(this_node["frameStart"].getValue()) frameEnd = int(this_node["frameEnd"].getValue()) LOG.info('{}-{}'.format(frameStart, frameEnd)) notice_status = { 'RENDERTHREADS': 'multi process rendering is started', 'RR SUBMIT': 'scene was submit to RR', 'LOCAL': 'local rendering was started', 'NO JOB': 'process seems to be broken' } tmp_job = 'NO JOB' # RENDERTHREADS if this_node["submit"].getValue() == 0.0: from plugins.vuRenderThreads.plugin_nuke import plugin_nuke threads = int(this_node["threads"].getValue()) plugin_nuke.createThreads(frameStart, frameEnd, threads, [this_node.name()]) LOG.info("END : RENDERTHREADS : " + this_node["exrPath"].getValue()) tmp_job = 'RENDERTHREADS' # RENDERFARM elif this_node["submit"].getValue() == 1.0: import rrenderSubmit nuke.load('rrenderSubmit') rrenderSubmit.rrSubmit_Nuke_Node(this_node, frameStart, frameEnd) LOG.info("END : RRSUBMIT : " + this_node["exrPath"].getValue()) tmp_job = 'RR SUBMIT' # LOCAL else: try: nuke.execute(nuke.thisNode(), start=frameStart, end=frameEnd, incr=1) tmp_job = 'LOCAL' except: LOG.error("END : LOCAL : " + this_node["exrPath"].getValue(), exc_info=True) note = arNotice.Notice( title=os.path.basename(nuke.root().name()).split('.')[0], msg=notice_status[tmp_job], func=tmp_job, img='lbl/lblNuke131' if tmp_job != 'NO JOB' else 'lbl/lblWarning131', img_link='') arNotice.ArNotice(note)
def load_and_create_plugin(plugin, plugin_path): """ Dynamically in nuke loads a plugin given a path to the plugin and a plugin name. If plugin doesn't exist lets user know and does nothing :param plugin: name of the plugin without extension. ie: AOV_CC, not AOV_CC.gizmo :param plugin_path: absolute path to directory with the plugin """ nuke.pluginAddPath(plugin_path) logging.info("Adding plugin path {0} and loading plugin {1}".format(plugin_path, plugin)) # try to load, since nuke doesn't return an error just throws a runtime exception. try: nuke.load(plugin) nuke.createNode(plugin) except RuntimeError as e: error = "Could not load the plugin named {0}. Error is {1}".format(plugin, e) logging.exception(error) nuke.message(error)
def nukeDir(): showParts = newParts() if showParts == 0: return #SHOWln = showParts[1] nkDir = os.path.join(SHOWln, "%s" % EP, "%s" % SEQ, "%s" % SHOT, 'nuke', os.environ['USERNAME'], 'scripts') pathCheck = os.path.join(SHOWln, "%s" % EP, "%s" % SEQ, "%s" % SHOT) if os.path.isdir(pathCheck): if not os.path.isdir(nkDir): os.makedirs(nkDir) else: nuke.message("Shot does not exist") nuke.load("panel") #raise ValueError, 'directory does not exist' print 'Shot does not exist.' return nkDir
def load_all_plugins(): tried = 0 failed = 0 p = nuke.plugins(nuke.ALL, "*." + nuke.PLUGIN_EXT) for i in p: # Ignore Alembic_In, since it isn't a nuke plugin. # TODO - Needs to be moved a directory up so it doesn't show as a nuke plugin if i.find("Alembic_In") != -1: continue tried += 1 print i try: try_load = nuke.load(i) except: print i, "failed to load." failed += 1 if failed > 0: print failed, "of", tried, "plugin(s) total did not load" else: print "All available binary plugins (", tried, ") successfully loaded"
mergeMenu.addCommand('MergeAll AP', "nuke.createNode('{}MergeAll')".format(prefixNST), icon="Merge.png") ############################################################################################################ ############################################################################################################ # Create Transform Menu transformMenu = m.addMenu('Transform', icon = 'ToolbarTransform.png', index = 90) transformMenu.addCommand('vector3DMathExpression EL', "nuke.createNode('{}vector3DMathExpression')".format(prefixNST), icon = 'vectorTools.png') transformMenu.addCommand('Vectors_Direction EL', "nuke.createNode('{}Vectors_Direction')".format(prefixNST), icon = 'vectorTools.png') transformMenu.addCommand('Vectors_to_Degrees EL', "nuke.createNode('{}Vectors_to_Degrees')".format(prefixNST), icon = 'vectorTools.png') # Add VectorTracker python file try: nuke.load('{}VectorTracker.py'.format(prefixNST)) except: print "Could not load VectorTracker.py" pass transformMenu.addCommand('VectorTracker NKPD', "nuke.createNode('{}VectorTracker.gizmo')".format(prefixNST), icon = 'vectorTools.png') transformMenu.addSeparator() transformMenu.addCommand('AutoCropTool TL', "nuke.createNode('{}AutoCropTool')".format(prefixNST), icon="AutoCrop.png") transformMenu.addCommand('BBoxToFormat TL', "nuke.createNode('{}BBoxToFormat')".format(prefixNST), icon="Rectangle.png") transformMenu.addCommand('ImagePlane3D TL', "nuke.createNode('{}ImagePlane3D')".format(prefixNST), icon="Card.png") transformMenu.addCommand('Matrix_Inverse TL', "nuke.createNode('{}Matrix4x4_Inverse')".format(prefixNST), icon="ColorMatrix.png") transformMenu.addCommand('Matrix4x4Math TL', "nuke.createNode('{}Matrix4x4Math')".format(prefixNST), icon="ColorMath.png") transformMenu.addCommand('MirrorBorder TL', "nuke.createNode('{}MirrorBorder')".format(prefixNST), icon="AdjBBox.png") transformMenu.addCommand('TransformCutOut TL', "nuke.createNode('{}TransformCutOut')".format(prefixNST), icon="MergeOut.png") transformMenu.addCommand('iMorph TL', "nuke.createNode('{}iMorph')".format(prefixNST), icon="Blend.png")
'GradeBeauty': 'GradeBeauty.png', 'GradeBeautyLayerSet': 'GradeBeautyLayerSet.png', 'FlattenLayerSet': 'FlattenLayerSet.png', 'RemoveLayerSet': 'RemoveLayerSet.png', 'MultiplyLayerSet': 'MultiplyLayerSet.png', 'GradeLayerSet': 'GradeLayerSet.png', } menu = nuke.menu('Nodes').addMenu('LayerAlchemy', icon='layer_alchemy.png') for pluginName, icon in sorted(plugins.items()): pluginFile = '{0}.{1}'.format(pluginName, libExtension) if os.path.isfile(os.path.join(layerAlchemyPluginDir, pluginFile)): menu.addCommand(name=pluginName, command="nuke.createNode('{}')".format(pluginName), icon=icon) nuke.load('{0}.{1}'.format(pluginName, libExtension)) nuke.addKnobChanged( lambda: layer_alchemy.callbacks.knobChangedCommon(nuke.thisKnob()), nodeClass=pluginName) menu.addSeparator() menu.addCommand( name='documentation', command=( "import layer_alchemy;import nuke;import nukescripts;" "nukescripts.start(layer_alchemy.utilities.getDocumentationIndexPath())" ), icon="documentation.png")
# devPrint = '- Dev Options ................... Yes' # else: # devPrint = '- Dev Options ................... No' # nuke.tprint(devPrint) #----------------------------------------------------------------------------------------------------------------- # IMPORT MACHINE MOLLE PIPE #----------------------------------------------------------------------------------------------------------------- import MM_Tools import MM_Presets import MM_Toolsets #----------------------------------------------------------------------------------------------------------------- # IMPORT FRANKLIN PIPE #----------------------------------------------------------------------------------------------------------------- nuke.load("F_Hub") nuke.load("F_Panels") nuke.load("F_Scripts") nuke.load("F_Tools") #----------------------------------------------------------------------------------------------------------------- # IMPORT OTHER TOOLS #----------------------------------------------------------------------------------------------------------------- import C_Tools # CGEV gizmos import Spin_Tools # SpinVFX gizmos #----------------------------------------------------------------------------------------------------------------- # SET NUKE_LOCAL DIRECTORY #----------------------------------------------------------------------------------------------------------------- # # Need to check all conditions # if platform.system() == "Windows":
import nuke import fxpipe import fxpipenukescripts import os ''' The template for the nuke setup Make sure to configure this file so that you get the show specific things loaded in ''' ### CUSTOMIZE HERE nuke.pluginAddPath(os.path.join(fxpipe.jobPath, fxpipe.job, fxpipe.jobPathNuke)) ### END CUSTOMIZE ### NO Fiddling past here generally nuke.pluginAddPath('./gizmos') ### Add general formats here nuke.load('formats.py') ### Make sure we create write directories automatically nuke.addBeforeRender(fxpipenukescripts.createWriteDir)
def _RV_renderWrite(write, _NK, _SFM, _EFM, _BFM, _IN, _OUT, _CGV, _NUKE_RUN_PATH): _SERVER_Plugins = r"B:" print '---------------------------------------' print 'write = ', write print 'first|last|byframe = %d-%d-%d' % (_SFM, _EFM, _BFM) print '---------------------------------------\n' ############################################################################### print _CGV # if _CGV == '9.0v1': # if os.path.exists(r'C:/Program Files/Nuke9.0v1/'): # nuke_path = r'C:/Program Files/Nuke9.0v1/Nuke9.0.exe' # else: # nuke_path = None # if _CGV == '10.0v4': # if os.path.exists(r'C:/Program Files/Nuke10.0v4/'): # nuke_path = r'C:/Program Files/Nuke10.0v4/Nuke10.0.exe' # else: # nuke_path = None # if _CGV == '10.5v1': # if os.path.exists(r'C:/Program Files/Nuke10.5v1/'): # nuke_path = r'C:/Program Files/Nuke10.5v1/Nuke10.5.exe' # else: # nuke_path = None # if os.path.exists(r'C:/Program Files/Nuke9.0v9/'): # nuke_path = r'C:/Program Files/Nuke9.0v9/Nuke9.0.exe' # else: # nuke_path = None # if nuke_path == None: # return None # else: # print nuke_path nuke_path = _NUKE_RUN_PATH + "/" + "Nuke9.0.exe" print "_NUKE_RUN_PATH= " + nuke_path nukeExecutePath = nuke_path # nukeExecutePath = nuke.env["ExecutablePath"] max_threads_number = int(multiprocessing.cpu_count()) # nuke.scriptOpen(_NK) nuke.load(_NK) renderwrite = nuke.toNode(write) print type(write) print type(renderwrite) fileName = nuke.filename(renderwrite) cmdList = createCMDList(nukeExecutePath, max_threads_number, write, _NK, _SFM, _EFM, _BFM, fileName) threads = [] print r"--------------------rendering start---------------------- " print r"cmd starting %s" % datetime.datetime.now() for cmd in cmdList: th = threading.Thread(target=RBcmd, args=(cmd, )) th.start() threads.append(th) for th in threads: th.join() print r"cmd ending %s" % datetime.datetime.now() print r"--------------------rendering end---------------------- " #newinputpath = _IN + fileName.split("/")[0][0] + "/" + "/".join(fileName.split("/")[1:]) newinputpath = fileName newoutputpath = fileName.replace(fileName.split("/")[0], _OUT, 1) if not os.path.exists(os.path.dirname(newoutputpath)): os.makedirs(os.path.dirname(newoutputpath)) finalpath = os.path.dirname(newoutputpath) root = os.path.dirname(newinputpath) root.replace("/", "\\") finalpath.replace("/", "\\") print "User output path : %s" % root.replace('/', '\\') print "Platform output path : %s" % finalpath.replace('/', '\\') cmd1 = 'c:\\fcopy\\FastCopy.exe /speed=full /force_close /no_confirm_stop /force_start "' + root.replace( '/', '\\') + '" /to="' + finalpath.replace('/', '\\') + '"' RBTry3cmd(cmd1) # try: # checkResult(root,finalpath) # except Exception, e: # print '[checkResult.err]' # print e # a = os.walk(root) # for x in a: # pre=os.path.basename(x[0]) # for j in x[-1]: # os.rename(x[0]+'/'+j, finalpath +'/'+j) print("RENDERING FINISHED WITH EXECUTE PARM!")
import nuke EBANNER = "OCIO Error: " OCIO = None def load_ocio_plugins(): """Loads the PyOpenColorIO module and the OCIO-prefixed nodes """ global OCIO try: import PyOpenColorIO as OCIO except Exception, e: print '%s%s\n%s' % (EBANNER, 'Loading OCIO python module', e) allplugs = nuke.plugins(nuke.ALL | nuke.NODIR, "OCIO*.so", "OCIO*.dylib", "OCIO*.dll") for p in allplugs: try: nuke.load(p) except Exception, e: print '%sLoading OCIO node %s\n%s' % (EBANNER, p, e) if __name__ == "__main__": load_ocio_plugins()
r = nuke.createNode('Camera2', inpanel=False) nuke.tcl('in %s {import_chan_file %s}' %(r.name(), dropdata)) r['selected'].setValue(0) return if fileExt == '.nk': try: r = nuke.nodePaste(dropdata) except Exception, e: log_('Error %s' % e) pass return if fileExt == '.py': try: r = nuke.load(dropdata) except Exception, e: log_('Error %s' % e) pass return if fileExt in (None, False, '', '.db', '.sni', '.ma', '.mb', '.hip', '.sfx', '.xml', '.pkl', '.tmp', 'otl'): log_('Ignore') return r = nuke.createNode('Read', "file {"+dropdata+"}", inpanel=False) return def PathHandler( dropdata ): value = dropdata
nuke.addFormat( '1280 720 HD 720p' ) # Set plugin/gizmo sub-folders nuke.pluginAppendPath(volAssets + '/include/nuke/gizmos') nuke.pluginAppendPath(volAssets + '/include/nuke/plugins') nuke.pluginAppendPath(volAssets + '/include/nuke/scripts') nuke.pluginAppendPath(volAssets + '/include/nuke/icons') # Load Bokeh os.environ['RLM_LICENSE'] = '[email protected]' if nuke.env['WIN32']: currentBokeh = 'Bokeh-Nuke6.3-1.2.1-win64' if nuke.env['MACOS']: currentBokeh = 'Bokeh-Nuke6.3-1.2.1-Darwin' nuke.pluginAppendPath(volAssets + '/include/nuke/plugins/bokeh/' + currentBokeh + '/') nuke.load("pgBokeh") # Check wheter OFX_PLUGIN_PATH has been set or not 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'
def main(arguments): if(arguments["force"]): nuke.load(arguments["file"], open=True, force=True) else: nuke.scriptSave(file_name=None) nuke.load(arguments["file"], open=True, force=False)
import nuke import fxpipe import fxpipenukescripts import filenameFilters import os ''' The template for the nuke setup Make sure to configure this file so that you get the show specific things loaded in ''' ### CUSTOMIZE HERE nuke.pluginAddPath(os.path.join(fxpipe.jobPath, fxpipe.job, fxpipe.jobPathNuke)) ### END CUSTOMIZE ### NO Fiddling past here generally nuke.pluginAddPath('./gizmos') ### Add general formats here nuke.load('formats.py') ### Make sure we create write directories automatically nuke.addBeforeRender(fxpipenukescripts.createWriteDir)
class __group__reduce__(): def __call__(self, script): g = nuke.nodes.Group() with g: nuke.tcl(script) for i in range(g.inputs()): g.setInput(0, None) g.autoplace() __group__reduce = __group__reduce__() # Define image formats: nuke.load("formats.tcl") # back-compatibility for users setting root format in formats.tcl: if nuke.knobDefault("Root.format") == None: nuke.knobDefault("Root.format", nuke.value("root.format")) nuke.knobDefault("Root.proxy_format", nuke.value("root.proxy_format")) def addProfileOutput(filename): print "TIMING ENABLED: profile will be saved to " + filename import nukescripts nukeProfiler = nukescripts.NukeProfiler() nukeProfiler.setPathToFile(filename) nuke.addBeforeRender(nukeProfiler.resetTimersAndStartProfile) nuke.addAfterFrameRender(nukeProfiler.addFrameProfileAndResetTimers) nuke.addOnScriptClose(nukeProfiler.endProfile)
from version_check import check_nuke_version_and_os nuke.pluginAddPath('./icons') #from this point it's trying to load the plugin based on the OS if check_nuke_version_and_os('11.2', 'WIN', print_error_message=True): nuke.pluginAddPath('./KeenTools/win') # optional environment variable that can be set to specify the path to the data directory # should be absolute or relative to the KeenTools library file (.so, .dll or .dylib) # os.environ["KEENTOOLS_DATA_PATH"] = "../data" # preload KeenTools so all the nodes will be available nuke.load('KeenTools') else: print('loading KeenTools for Nuke11.2 WIN skipped') if nuke.env['MACOS']: # add KeenTools directory to python path to be able to import # python files from KeenTools directory import os import sys sys.path.append(os.path.dirname(os.path.abspath(__file__))) from version_check import check_nuke_version_and_os nuke.pluginAddPath('./icons') if check_nuke_version_and_os('11.2', 'OSX', print_error_message=True):
import nuke import sys nuke.load( sys.argv[1] ) node = nuke.toNode( 'Read1' ) print node.metadata() print "Test"
for folder, data in crawlData.get('dirs', {}).iteritems(): import sys subMenu = toolbar.findItem(folder) if subMenu is None: if defaultSubMenu: subMenu = toolbar.findItem(defaultSubMenu) else: if topLevel: subMenu = toolbar.addMenu(folder, folder + '.png') else: subMenu = toolbar.addMenu(folder, icon=folder + '.png') self._recursiveAddGizmoMenuItems(subMenu, data, currentDir + '' + subMenu.name()) 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 ## PLUGINS if nuke.NUKE_VERSION_STRING == '9.0v8': ##nuke.load("aton") nuke.load("superpose")
def shareNodes(): print dirName folder = next(os.walk(dirName))[1] folder = " ".join(folder) folder = folder.replace('Disable', '') folder = 'Root ' + folder try: # < Nuke 11 import PySide.QtGui as QtGui from PySide.QtGui import QApplication except: # >= Nuke 11 import PySide2.QtWidgets as QtGui from PySide2.QtWidgets import QApplication try: nuke.selectedNodes() nuke.nodeCopy(nukescripts.cut_paste_file()) clipboard = QtGui.QApplication.clipboard() clipboard = clipboard.text() except: nuke.message("You have to select something first.") return p = nuke.Panel('Share nodes with other') p.addEnumerationPulldown('Project', folder) p.addSingleLineInput('Node Name Setup:', '') p.addButton('Cancel') p.addButton('Share') if p.show(): fullName = p.value("Node Name Setup:") fileName = fullName.split("/")[-1] fileNameChanged = "_" + fileName newFolder = fullName.split("/")[0] if p.value('Project') == 'Root': if fileName == newFolder: nukeFile = dirName + fileNameChanged + '.nk' else: subDir = dirName + newFolder os.mkdir(subDir) nukeFile = subDir + "\\" + fileNameChanged + '.nk' else: folderChoose = p.value('Project') nukeFile = dirName + folderChoose + "\\" + fileNameChanged + '.nk' if fileName == '': nuke.message('WARNING: The setup need a name') p.show() else: if os.path.isfile(nukeFile) == True: nuke.message('WARNING: File Already exist') p.show() else: menu_file = open(nukeFile, 'w+') menu_content = menu_file.read() menu_file.close() menu_content = menu_content.replace("", clipboard) menu_file = open(nukeFile, 'w') menu_file.write(menu_content) menu_file.close() nuke.load("Reload") reloadSpecific("F Toolsets", "F_Toolsets") else: return
import os import nuke import nukescripts import autowrite import browseDir import SubmitToDeadline ## Loading asset manager nuke.load("manager") nuke.load("panel") nuke.load ("environment") def addManagementPanel(): return assetManagerPanel().addToPane() menu = nuke.menu('Pane') menu.addCommand('Project Management Settings', addManagementPanel) nukescripts.registerPanel( 'assetpanel', addManagementPanel) # Browse Directory nuke.menu( 'Nuke' ).addCommand( 'Scripts/Browse/Node\'s file path', "browseDir.browseDirByNode()", 'shift+b' ) ## Submit to Deadline tb = menubar.addMenu("&Submit") tb.addCommand("Submit To Deadline", SubmitToDeadline.main, "")
def open(self): path = nuke.getFilename('Get File Contents', '*.nknc *.nk') nuke.load(path)