示例#1
0
def createNodePresetsMenu():
    for d in nuke.pluginPath():

        if ".nuke" in d:
            nuke.setReadOnlyPresets(False)
        else:
            nuke.setReadOnlyPresets(True)

        # First look for a user_presets.py in the nuke path
        processPresetFile(d)

        # Now load all user_presets.py files in a directory tree below nodePresets
        fulName = os.path.join(d, "NodePresets")
        userFiles = buildPresetFileList(fulName)

        for pyFile in userFiles:
            try:
                module = imp.load_source('user_presets', pyFile)
                module.nodePresetsStartup()
            except:
                pass

    nuke.setReadOnlyPresets(False)

    # now parse the .nuke root presets again to make sure deleted items get processed properly
    processPresetFile(getNukeUserFolder())
示例#2
0
    def __init__(
        self,
        searchPaths=None,
        exclude=r'^\.',
    ):
        '''
        'searchPaths': An iterable of paths to recursively search. If omitted,
        the search will first try to use the `NUKE_GIZMO_PATH` environment
        variable. If that is also undefined, it will resolve and use the
        directory in which this file resides. If that cannot be determined, the
        contents of the Nuke plugin path will be used.

        'exclude': A regular expression for folders and gizmo files to ignore.
        The default pattern ignores anything beginning with `.`.
        '''
        if isinstance(exclude, basestring):
            exclude = re.compile(exclude)
        self.exclude = exclude
        if searchPaths is None:
            searchPaths = os.environ.get('NUKE_GIZMO_PATH',
                                         '').split(os.pathsep)
            if not searchPaths:
                import inspect
                thisFile = inspect.getsourcefile(lambda: None)
                if thisFile:
                    searchPaths = [os.path.dirname(os.path.abspath(thisFile))]
                else:
                    searchPaths = list(nuke.pluginPath())
        self.searchPaths = searchPaths
        self.reset()
示例#3
0
def goofy_title():
    """Returns a random message for use as an untitled script name.
  Can be assigned to nuke.untitled as a callable.
  Put a goofy_title.txt somewhere in your NUKE_PATH to customise."""

    goofyFile = None
    for dir in nuke.pluginPath():
        fileName = os.path.join(dir, "goofy_title.txt")
        if os.path.exists(fileName):
            goofyFile = fileName
            break

    if goofyFile is None:
        return "Missing goofy_title.txt"

    file = open(goofyFile)
    lines = file.readlines()
    file.close()

    lines = [line.strip() for line in lines]
    lines = [line for line in lines if len(line) > 0 and line[0] != '#']

    if len(lines) < 1:
        return "Empty goofy_title.txt"

    return random.choice(lines)
示例#4
0
        def __init__(self, searchPaths=None, exclude=r'^\.', ):
            '''
            'searchPaths': An iterable of paths to recursively search. If omitted,
            the search will first try to use the `NUKE_GIZMO_PATH` environment
            variable. If that is also undefined, it will resolve and use the
            directory in which this file resides. If that cannot be determined, the
            contents of the Nuke plugin path will be used.

            'exclude': A regular expression for folders and gizmo files to ignore.
            The default pattern ignores anything beginning with `.`.
            '''
            if isinstance(exclude, basestring):
                exclude = re.compile(exclude)
            self.exclude = exclude
            if searchPaths is None:
                searchPaths = os.environ.get('NUKE_GIZMO_PATH', '').split(os.pathsep)
                if not searchPaths:
                    import inspect
                    thisFile = inspect.getsourcefile(lambda: None)
                    if thisFile:
                        searchPaths = [os.path.dirname(os.path.abspath(thisFile))]
                    else:
                        searchPaths = list(nuke.pluginPath())
            self.searchPaths = searchPaths
            self.reset()
示例#5
0
 def __init__(self, exclude=r'^\.', searchPaths=None):
     '''Used to add folders within the gizmo folder(s) to the gizmo path
     
     exclude: a regular expression for folders / gizmos which should NOT be
         added; by default, excludes files / folders that begin with a '.'
         
     searchPaths: a list of paths to recursively search; if not given, it
         will use the NUKE_GIZMO_PATH environment variable; if that is
         not defined, it will use the directory in which this file resides;
         and if it cannot detect that, it will use the pluginPath 
     '''
     if isinstance(exclude, basestring):
         exclude = re.compile(exclude)
     self.exclude = exclude
     if searchPaths is None:
         searchPaths = os.environ.get('NUKE_GIZMO_PATH',
                                      '').split(os.pathsep)
         if not searchPaths:
             import inspect
             thisFile = inspect.getsourcefile(lambda: None)
             if thisFile:
                 searchPaths = [os.path.dirname(os.path.abspath(thisFile))]
             else:
                 searchPaths = list(nuke.pluginPath())
     self.searchPaths = searchPaths
     self.reset()
示例#6
0
def traversePluginPaths(m, delete, allToolsetsList, isLocal):
    ret = False
    if delete and (not isLocal):
        return True
    excludePaths = nuke.getToolsetExcludePaths()
    for d in nuke.pluginPath():
        d = d.replace('\\', '/')
        ignore = False
        for i in excludePaths:
            i = i.replace('\\', '/')
            if d.find(i) != -1:
                ignore = True
                break
        if ignore:
            continue
        if (not isLocal) and (d.find(".nuke") != -1):
            continue
        if isLocal and (d.find(".nuke") == -1):
            continue
        if os.path.isdir(d):
            dircontents = os.listdir(d)
            if "ToolSets" in dircontents:
                fullPath = "/".join([d, "ToolSets"])
                if createToolsetMenuItems(m, fullPath, fullPath, delete,
                                          allToolsetsList, isLocal):
                    ret = True
    return ret
示例#7
0
 def __init__(self, exclude=r'^\.', searchPaths=None):
     '''Used to add folders within the gizmo folder(s) to the gizmo path
     
     exclude: a regular expression for folders / gizmos which should NOT be
         added; by default, excludes files / folders that begin with a '.'
         
     searchPaths: a list of paths to recursively search; if not given, it
         will use the NUKE_GIZMO_PATH environment variable; if that is
         not defined, it will use the directory in which this file resides;
         and if it cannot detect that, it will use the pluginPath 
     '''
     if isinstance(exclude, basestring):
         exclude = re.compile(exclude)
     self.exclude = exclude
     if searchPaths is None:
         searchPaths = os.environ.get('NUKE_GIZMO_PATH', '').split(os.pathsep)
         if not searchPaths:
             import inspect
             thisFile = inspect.getsourcefile(lambda: None)
             if thisFile:
                 searchPaths = [os.path.dirname(os.path.abspath(thisFile))]
             else:
                 searchPaths = list(nuke.pluginPath())
     self.searchPaths = searchPaths
     self.reset()
示例#8
0
    def _find_tree_items(self):
        """

        :return:
        """

        for path in nuke.pluginPath():
            path = os.path.abspath(os.path.join(path, 'ToolSets'))

            if not os.path.exists(path) or VERSION in path:
                continue

            for base, folder, files in scandir.walk(path):
                name = os.path.basename(base)

                if 'ToolSets' != name:
                    item = QTreeWidgetItem(self.tree_widget, [name])
                    item.setData(0, Qt.UserRole, base)

                else:
                    item = self.tree_widget

                for f in files:
                    name = os.path.basename(f)
                    file_item = QTreeWidgetItem(item, [name])
                    file_item.setData(0, Qt.UserRole, os.path.join(base, f))

        return True
示例#9
0
    def __init__(self):
        nukescripts.PythonPanel.__init__(self, 'Create ToolSet',
                                         'uk.co.thefoundry.CreateToolset')

        # CREATE KNOBS
        # Loop through and find all user folders
        self.userFolders = []
        for d in nuke.pluginPath():
            if os.path.isdir(d):
                if ".nuke" in d:
                    dircontents = os.listdir(d)
                    if "ToolSets" in dircontents:
                        fullPath = os.path.join(d, "ToolSets")
                        self.buildFolderList(fullPath, '')

        self.menuItemChoice = nuke.CascadingEnumeration_Knob(
            'menuItemChoice', 'ToolSets menu', ['root'] + self.userFolders)
        self.menuItemChoice.setTooltip(
            "The menu location that the ToolSet will appear in. Specify 'root' to place the ToolSet in the main ToolSets menu."
        )
        self.menuPath = nuke.String_Knob('itemName', 'Menu item:')
        self.menuPath.setFlag(0x00001000)
        self.menuPath.setTooltip(
            "ToolSet name. Use the '/' character to create a new submenu for this ToolSet, eg to create a ToolSet named 'Basic3D' and place it in a new submenu '3D', type '3D/Basic3D'. Once created the 3D menu will appear in the ToolSet menu."
        )
        self.okButton = nuke.PyScript_Knob('create', 'Create')
        #self.okButton.setToolTip("Create a ToolSet from the currently selected nodes with the given name")
        self.okButton.setFlag(0x00001000)
        self.cancelButton = nuke.PyScript_Knob('cancel', 'Cancel')

        # ADD KNOBS
        self.addKnob(self.menuItemChoice)
        self.addKnob(self.menuPath)
        self.addKnob(self.okButton)
        self.addKnob(self.cancelButton)
示例#10
0
def Documentation():
	for search in nuke.pluginPath():
		path = os.path.dirname(search) + "/documentation/Pr_Suite v1.0 Documentation.html"
		if os.path.exists(path):
			webbrowser.open("file:///" + path)
			break
		else:
			if nuke.ask("Pr_Suite documentation not found in expected installation directory. Click 'Yes' to access online Pr_Suite documentation."):
				webbrowser.open("http://www.parimalvfx.com/rnd/pr_suite/documentation/")
			break
示例#11
0
def where(filename):
    file_list = []
    for path in nuke.pluginPath():
        check_file = '%s%s%s' % (path, os.sep, filename)
        if os.path.isfile(check_file):
            file_list.append(check_file)
    if file_list:
        file_list.reverse()

    return file_list
示例#12
0
 def __init__(self):
     nukescripts.PythonPanel.__init__(
         self, "Open Specific Plugin Path Folder")
     paths = []
     plugin_path = nuke.pluginPath()
     for each in plugin_path:
         paths.append(os.path.normpath(each))
     self.ppaths = nuke.Enumeration_Knob("plugin_paths", "Select Path",
                                         paths)
     self.addKnob(self.ppaths)
示例#13
0
    def getFolder(self):
        pluginPaths = nuke.pluginPath()
        pluginPathList = []

        for i in pluginPaths:
            if '.nuke' in i:
                pluginPathList.append(i)

        pluginFolder = pluginPathList[0].split('.nuke')[0] + '.nuke'
        multiCBFolder = pluginFolder + '/' + 'multi_clipboard'
        return multiCBFolder
示例#14
0
 def getAps( self ):
     for d in nuke.pluginPath():
         # FIND apertures.txt IN PLUGIN PATH
         apFile = os.path.join( d, 'apertures.txt')
         if not os.path.isfile( apFile ):
             continue
         # READ THE FILE
         with open( apFile ) as FILE:
             #apString = FILE.read()
             apInfo = FILE.readlines()
         for ap in apInfo:
             self.apDict[ ' '.join( ap.split()[:-2] ) ] = [ float(n) for n in ap.split()[-2:] ]
示例#15
0
def Documentation():
    for search in nuke.pluginPath():
        path = os.path.dirname(
            search) + "/documentation/Pr_Suite v1.0 Documentation.html"
        if os.path.exists(path):
            webbrowser.open("file:///" + path)
            break
        else:
            if nuke.ask(
                    "Pr_Suite documentation not found in expected installation directory. Click 'Yes' to access online Pr_Suite documentation."
            ):
                webbrowser.open(
                    "http://www.parimalvfx.com/rnd/pr_suite/documentation/")
            break
示例#16
0
  def __init__(self):
    self._saveLookAction = hiero.ui.createMenuAction("Save Look...", self.saveGradeAsLook)
    self._clearLooksAction = hiero.ui.createMenuAction("Clear Project Looks", self.clearLooksFromProject)
    self._clearLookThumbnailCacheAction = hiero.ui.createMenuAction("Clear Look Thumbnails", self.clearLooksThumbnailCache)
    self._lookNameDialog = LookNameDialog()

    self._looksMainMenu = None
    self._restoreLookSubMenu = None
    self._tagActions = []

    # Get the .nuke Plugin path for saving thumbnails of Looks
    rootPluginPath = nuke.pluginPath()[0]
    self._lookThumbnailPath = os.path.join(rootPluginPath, "Looks", "thumbnails")

    hiero.core.events.registerInterest((hiero.core.events.EventType.kShowContextMenu, hiero.core.events.EventType.kTimeline), self.eventHandler)
示例#17
0
def docs():
    """
    Bc_ToolSet Documentation
    """
    doc = False
    for search in nuke.pluginPath():
        docPath = os.path.dirname(search) + "/documentation/Bc_ToolSet v1.1 Documentation.html"
        if os.path.exists(docPath):
            webbrowser.open("file:///" + docPath)
            doc = True
            break

    if doc is False:
        if nuke.ask(
                "Bc_ToolSet documentation not found in expected installation directory. Click on 'Yes' to access online "
                "Bc_ToolSet documentation."):
            webbrowser.open("http://bit.ly/PrSuiteDocumentation")
示例#18
0
def __change__(repoPath):
    ''' Changes the repository path from argument input. 
        repoPath = directory to repository.
    '''

    path = nuke.pluginPath()[0] + '/Tapp.config'

    if os.path.exists(path):
        f = open(path, 'w')
        f.write(repoPath)
        f.close()

        if os.path.exists(repoPath):
            if not path in sys.path:
                sys.path.append(repoPath)

        #run setup
        import Tapp
示例#19
0
def __change__(repoPath):
    ''' Changes the repository path from argument input. 
        repoPath = directory to repository.
    '''
    
    path=nuke.pluginPath()[0]+'/Tapp.config'
    
    if os.path.exists(path):
        f=open(path,'w')
        f.write(repoPath)
        f.close()
    
        if os.path.exists(repoPath):
            if not path in sys.path:
                sys.path.append(repoPath)
        
        #run setup
        import Tapp
示例#20
0
文件: utils.py 项目: hradec/pipeVFX
def launchHelp():
    """J_Ops in gui help system. Searches for help file in the Nuke
    plug-in path, and if found fires up web browser pointing to it.
    
    Failure to find the file results in a Nuke error message.
    
    """
    
   
    for possible in nuke.pluginPath():
        if possible.find("J_Ops"):
            url = os.path.expanduser(possible[0:possible.rfind("J_Ops")+6]) + "docs/index.html"
            if os.path.exists(url): 
                break
    try:
        webbrowser.open("file://"+url)
    except:
        nuke.message("J_Ops install/browser not found. Docs can be found in the directory\
                            you selected when installing. If not, it's time for a reinstall.")         
示例#21
0
def launchHelp():
    """J_Ops in gui help system. Searches for help file in the Nuke
    plug-in path, and if found fires up web browser pointing to it.
    
    Failure to find the file results in a Nuke error message.
    
    """

    for possible in nuke.pluginPath():
        if possible.find("J_Ops"):
            url = os.path.expanduser(
                possible[0:possible.rfind("J_Ops") + 6]) + "docs/index.html"
            if os.path.exists(url):
                break
    try:
        webbrowser.open("file://" + url)
    except:
        nuke.message(
            "J_Ops install/browser not found. Docs can be found in the directory\
                            you selected when installing. If not, it's time for a reinstall."
        )
示例#22
0
    def __init__(self):
        self._saveLookAction = hiero.ui.createMenuAction(
            "Save Look...", self.saveGradeAsLook)
        self._clearLooksAction = hiero.ui.createMenuAction(
            "Clear Project Looks", self.clearLooksFromProject)
        self._clearLookThumbnailCacheAction = hiero.ui.createMenuAction(
            "Clear Look Thumbnails", self.clearLooksThumbnailCache)
        self._lookNameDialog = LookNameDialog()

        self._looksMainMenu = None
        self._restoreLookSubMenu = None
        self._tagActions = []

        # Get the .nuke Plugin path for saving thumbnails of Looks
        rootPluginPath = nuke.pluginPath()[0]
        self._lookThumbnailPath = os.path.join(rootPluginPath, "Looks",
                                               "thumbnails")

        hiero.core.events.registerInterest(
            (hiero.core.events.EventType.kShowContextMenu,
             hiero.core.events.EventType.kTimeline), self.eventHandler)
示例#23
0
    def load_nuke_env(self):
        """Loads all sequence and shot plugin paths. Validates the plugins are there, if not displays warning
        using nuke.message
        """
        sequence, shot = self.session.get_core_session()

        # show based plugins and templates since not in shot envir
        if sequence == "show":
            # check that plugin paths exist
            if not os.path.exists(self.ani_vars.plugin_show):
                nuke.message("Could not load show plugins {0}. Please check they exist. If not see Installing Show "
                             "Nuke Plugins and Templates on Confluence to add them.".format(self.ani_vars.plugin_show))
                return
            if not os.path.exists(self.ani_vars.templates_show):
                nuke.message("Could not load show templates {0}. Please check they exist. If not see Installing Show "
                             "Nuke Plugins and Templates on Confluence to add them.".format(self.ani_vars.templates_show))
                return
            nuke.pluginAddPath(self.ani_vars.plugin_show)
            nuke.pluginAddPath(self.ani_vars.templates_show)
        # sequence and shot based plugins since in shot envir
        else:
            # do this first, update func needs this set
            self.ani_vars.load_seq_shot_list()
            self.ani_vars.update(sequence, shot)
            # check that plugin paths exist
            if not os.path.exists(self.ani_vars.plugin_seq):
                nuke.message("Could not load seq: {0} plugins path: {1}. Please see Production Team > Tools > Py Ani "
                             "Tools > PyNukeMngr on Confluence to add them".format(sequence, self.ani_vars.plugin_seq))
                return
            if not os.path.exists(self.ani_vars.templates_seq):
                nuke.message(
                    "Could not load seq: {0} templates path: {1}. Please see Production Team > Tools > Py Ani "
                    "Tools > PyNukeMngr on Confluence to add them".format(sequence, self.ani_vars.templates_seq)
                )
                return
            nuke.pluginAddPath(self.ani_vars.shot_comp_plugin_dir)
            nuke.pluginAddPath(self.ani_vars.plugin_seq)
            nuke.pluginAddPath(self.ani_vars.templates_seq)

        logging.info("Plugin Paths: {0}".format(nuke.pluginPath()))
示例#24
0
def get_session_icons(ext=".png"):
    """Get all images from all paths in Nuke's plugin path with extension.

    Args:
        ext (str): Image extension files to scan for. Can include the leading
            dot but this is not mandatory.

    Returns:
        list: Absolute paths of all images that were found in all directories
            of Nuke's plugin path that contain the given file extension.

    """
    paths = [path for path in nuke.pluginPath() if os.path.isdir(path)]

    icon_dir = os.path.join(os.path.dirname(__file__), "icons")
    paths.append(icon_dir)

    icons = []
    for path in paths:
        _icons = (os.path.join(path, image) for image in os.listdir(path)
                  if image.endswith(ext))
        icons.extend(_icons)

    return icons
示例#25
0
#  init.py
#  J_Ops
#
#  Created by Jack Binks on 14/02/2010.
#  Copyright (c) 2010 Jack Binks. All rights reserved.
import sys, nuke, os

for path in nuke.pluginPath():
    if os.path.exists(os.path.normpath(path + "/J_Ops/py")):
        sys.path.append(path + "/J_Ops/py")
    if os.path.exists(os.path.normpath(path + "/../J_Ops/py")):
        sys.path.append(path + "/py")
    if os.path.exists(os.path.normpath(path + "/../J_Ops/ndk")):
        nuke.pluginAddPath(path + "/ndk")
    if os.path.exists(os.path.normpath(path + "/../J_Ops/icons")):
        nuke.pluginAddPath(path + "/icons")
示例#26
0
import nuke, os, sys, re, nukescripts
import jeeves_gui

nuke.tprint('STARTING NUKE MENU.PY''\n')

############################################################################################################
# Jeeves menu dictionary                                                                                          
############################################################################################################

nukeDict = {}
suffix = ('gizmo', 'py', 'tcl', 'dylib')

for filepath in nuke.pluginPath():
    menuName=os.path.split(filepath)[1]
    if menuName.startswith('menu.'):
        if not menuName == 'menu.ICONS':
            if not len(os.listdir(filepath)) == 0:
                menuName = menuName.split('menu.')[-1]
                nukeDict[menuName] = []
                for scripts in os.listdir(filepath):
                    if not scripts.startswith('.'):
                        if scripts.endswith(suffix):
                            nukeDict[menuName].append((os.path.splitext(scripts)[0], scripts))
            
############################################################################################################
# Add Menus                                                                                             
############################################################################################################

nukeMenu = nuke.menu('Nuke')
jeevesMenu = nukeMenu.addMenu('JEEVES')
示例#27
0
#coding:utf-8
import nuke, os

#插件路径的不确定性,没法使用固定路径,只能全部添加

dir_list = ["gizmos", "Channel"
            ]  #要添加的文件夹,暂时只知道这2个里面有gizmo节点,需要添加的pluginpath里,其他的路径还为发现错误

for nukepath in nuke.pluginPath():
    for dir in dir_list:
        file_path = "{}/{}".format(nukepath, dir)
        if os.path.isdir(file_path):
            for root, dirs, files in os.walk(file_path):
                for dir in dirs:
                    dirpath = "{}/{}".format(file_path, dir)
                    if not dirpath in nuke.pluginPath():
                        nuke.pluginAddPath(dirpath)
示例#28
0
import nuke
import os
import sys
import re

nuke.tprint('running init.py')

homepath = os.path.abspath('/nas/projects/development/pipeline/pipeline.config/nuke_repo')
targetDirs = [os.path.join(homepath, dir) for dir in os.listdir(homepath) if os.path.isdir(os.path.join(homepath, dir))]

nukePattern = re.compile('nuke\.([A-Z]+)$')
sysPattern = re.compile('sys\.([A-Z]+)$')

for i in targetDirs:
    thisDir = os.path.split(i)[1]
    if nukePattern.match(thisDir):
        nuke.pluginAddPath(i)
    if sysPattern.match(thisDir):
        sys.path.append(i)

if not nuke.GUI:
    nuke.tprint('\n\n')
    for i in nuke.pluginPath():
        nuke.tprint(i)
    nuke.tprint('\n\n')
    for i in sys.path:
        nuke.tprint(i)
    nuke.tprint('\n\n')

nuke.ViewerProcess.register("3D LUT", nuke.createNode, ("Vectorfield", "vfield_file /nas/projects/development/pipeline/pipeline.config/nuke_repo/nuke.LUT/logC-Filmlook_display/AlexaV3_EI1600_LogC2Film_EL_nuke3d.cube"))
示例#29
0
elif platform.system() == "Linux":
    homepath = os.path.abspath('/Public/Ptd/Nuke/NukePlugin/')

nukePattern = re.compile('nuke_([a-z]+)$')
sysPattern = re.compile('sys_([a-z]+)$')

for i in targetDirs:
    thisDir = os.path.split(i)[1]
    if nukePattern.match(thisDir):
        nuke.pluginAddPath(i)
    if sysPattern.match(thisDir):
        sys.path.append(i)

if not nuke.GUI:
    nuke.tprint('\n\n')
    for i in nuke.pluginPath():
        nuke.tprint(i)
    nuke.tprint('\n\n')
    for i in sys.path:
        nuke.tprint(i)
    nuke.tprint('\n\n')


def createWriteDir():
    import nuke, os
    file = nuke.filename(nuke.thisNode())
    dir = os.path.dirname(file)
    osdir = nuke.callbacks.filenameFilter(dir)
    try:
        os.makedirs(osdir)
        return
示例#30
0
#  init.py
#  J_Ops
#
#  Created by Jack Binks on 14/02/2010.
#  Copyright (c) 2010 Jack Binks. All rights reserved.
import sys, nuke, os

for path in nuke.pluginPath():
    if os.path.exists(os.path.normpath(path+"/J_Ops/py")):
        sys.path.append(path+"/J_Ops/py")
    if os.path.exists(os.path.normpath(path+"/../J_Ops/py")):
        sys.path.append(path+"/py")
    if os.path.exists(os.path.normpath(path+"/../J_Ops/ndk")):
        nuke.pluginAddPath(path+"/ndk")
    if os.path.exists(os.path.normpath(path+"/../J_Ops/icons")):         
        nuke.pluginAddPath(path+"/icons")
        
        
示例#31
0
文件: menu.py 项目: tws0002/jeeves
- we also add the three main tools, deadline, write node and the jeeves ui

'''

import nuke, os, re, nukescripts
nuke.tprint('> importing core.setup.menu.py')

############################################################################################################
# Jeeves menu dictionary
############################################################################################################

nukeDict = {}
suffix = ('gizmo', 'py', 'tcl', 'dylib')

for filepath in nuke.pluginPath():
    menuName = os.path.split(filepath)[1]
    if menuName.startswith('menus.'):
        if not menuName == 'menus.ICONS':
            if not len(os.listdir(filepath)) == 0:
                menuName = menuName.split('menus.')[-1]
                menuName = menuName.lower()
                nukeDict[menuName] = []
                for scripts in os.listdir(filepath):
                    if not scripts.startswith('.'):
                        if scripts.endswith(suffix):
                            nukeDict[menuName].append(
                                (os.path.splitext(scripts)[0], scripts))

############################################################################################################
# Add Menus
示例#32
0
# import nuke
# import nukescripts
import os
import scandir
import nuke

VERSION = nuke.NUKE_VERSION_STRING
PLUGIN_PATHS = nuke.pluginPath()


def find_toolset_path():
    """
    Look through the nuke plugin path and find the base folder
    directory of the assigned toolset directory....

    :return: base toolset path
    """

    for path in PLUGIN_PATHS:
        toolset_dir = os.path.join(path, 'ToolSets').replace('\\', '/')

        if not os.path.exists(toolset_dir) or VERSION in toolset_dir:
            continue

        for base, folder, files in scandir.walk(toolset_dir):
            yield base


def refresh_toolset():
    """
    Refresh nukes default toolset and new create menu and
示例#33
0
def getNukeUserFolder():
    for d in nuke.pluginPath():
        if os.path.isdir(d):
            if d.endswith(".nuke"):
                return d
    return None
 def __getNukeDefaultIconPaths(self):
     iconPaths = []
     for path in nuke.pluginPath():
         if nuke.NUKE_VERSION_STRING in path and 'icons' in path:
             iconPaths.append(path)
     return iconPaths
示例#35
0
def getNukeUserFolder():
    for d in nuke.pluginPath():
        if os.path.isdir(d):
            if d.endswith(".nuke"):
                return d