Example #1
0
    def _recursiveAddGizmoPaths(self, folder, crawlData, foldersOnly=False):
        # If we're in GUI mode, also store away data in _crawlDatato to be used
        # later by addGizmoMenuItems
        if not os.path.isdir(folder):
            return

        if nuke.GUI:
            if 'files' not in crawlData:
                crawlData['gizmos'] = []
            if 'dirs' not in crawlData:
                crawlData['dirs'] = {}

        # avoid an infinite loop due to symlinks...
        canonical_path = self.canonical_path(folder)
        if canonical_path in self._visited:
            return
        self._visited.add(canonical_path)

        for subItem in sorted(os.listdir(canonical_path)):
            if self.exclude and self.exclude.search(subItem):
                continue
            subPath = os.path.join(canonical_path, subItem)
            if os.path.isdir(subPath):
                nuke.pluginAppendPath(subPath)
                subData = {}
                if nuke.GUI:
                    crawlData['dirs'][subItem] = subData
                self._recursiveAddGizmoPaths(subPath, subData)
            elif nuke.GUI and (not foldersOnly) and os.path.isfile(subPath):
                name, ext = os.path.splitext(subItem)
                if ext == '.gizmo':
                    crawlData['gizmos'].append(name)
Example #2
0
        def _recursiveAddGizmoPaths(self, folder, crawlData, foldersOnly=False):
            # If we're in GUI mode, also store away data in _crawlDatato to be used
            # later by addGizmoMenuItems
            if not os.path.isdir(folder):
                return

            if nuke.GUI:
                if 'files' not in crawlData:
                    crawlData['gizmos'] = []
                if 'dirs' not in crawlData:
                    crawlData['dirs'] = {}

            # avoid an infinite loop due to symlinks...
            canonical_path = self.canonical_path(folder)
            if canonical_path in self._visited:
                return
            self._visited.add(canonical_path)

            for subItem in sorted(os.listdir(canonical_path)):
                if self.exclude and self.exclude.search(subItem):
                    continue
                subPath = os.path.join(canonical_path, subItem)
                if os.path.isdir(subPath):
                    nuke.pluginAppendPath(subPath)
                    subData = {}
                    if nuke.GUI:
                        crawlData['dirs'][subItem] = subData
                    self._recursiveAddGizmoPaths(subPath, subData)
                elif nuke.GUI and (not foldersOnly) and os.path.isfile(subPath):
                    name, ext = os.path.splitext(subItem)
                    if ext == '.gizmo':
                        crawlData['gizmos'].append(name)
Example #3
0
def add_callbacks():
    callback_folder = os.path.sep.join([NUKE_FITMENT_ROOT_PATH, 'callbacks'])
    if not os.path.isdir(callback_folder):
        return

    nuke.pluginAppendPath(callback_folder)
    all_callback_files = [f.split('.')[0] for f in os.listdir(callback_folder) if f.endswith('.py')]
    callback_auto_load_structure = _go_through_and_find_callback_files(all_callback_files)
    for node_class, events in callback_auto_load_structure.items():
        for e in events:
            _register_callback_on_node(e, node_class)
Example #4
0
  def _recursiveAddGizmoPaths(self, folder, crawlData, foldersOnly=False):
    # If we're in GUI mode, also store away data in _crawlData to to be used
    # later by addGizmoMenuItems
    if not os.path.isdir(folder):
      return

    if nuke.GUI:
      if 'files' not in crawlData:
        crawlData['gizmos'] = {}
      if 'dirs' not in crawlData:
        crawlData['dirs'] = {}

    # avoid an infinite loop due to symlinks...
    canonicalPath = self.canonicalPath(folder)
    if canonicalPath in self._visited:
      return
    self._visited.add(canonicalPath)

    for subItem in sorted(os.listdir(canonicalPath)):
      if self.exclude and self.exclude.search(subItem):
        continue
      subPath = os.path.join(canonicalPath, subItem)
      if os.path.isdir(subPath):
        nuke.pluginAppendPath(subPath)
        nuke.pluginAppendPath(os.path.join(subPath,'icons'))
        if DEBUG:
          nuke.tprint('GIZMO PATH: %s' % subPath)
        subData = {}
        if nuke.GUI:
          crawlData['dirs'][subItem] = subData
        self._recursiveAddGizmoPaths(subPath, subData)
      elif nuke.GUI and (not foldersOnly) and os.path.isfile(subPath):
        name, ext = os.path.splitext(subItem)
        if ext == '.gizmo':
          if re.match('[0-9]{3}', name[-3:]):
            gizmoName = name[:-4]
            version = name[-3:]
          else:
            gizmoName = name
            version = '000'
          crawlData['gizmos'][gizmoName]=[]
          crawlData['gizmos'][gizmoName].append(int(version))
          if DEBUG:
            nuke.tprint('GIZMO NAME: %s' % name)
            nuke.tprint('GIZMO VERS: %s' % version )
Example #5
0
    def _recursiveAddGizmoPaths(self, folder, crawlData, foldersOnly=False):
        # If we're in GUI mode, also store away data in _crawlData to to be used
        # later by addGizmoMenuItems
        if not os.path.isdir(folder):
            return

        if nuke.GUI:
            if 'files' not in crawlData:
                crawlData['gizmos'] = {}
            if 'dirs' not in crawlData:
                crawlData['dirs'] = {}

        # avoid an infinite loop due to symlinks...
        canonicalPath = self.canonicalPath(folder)
        if canonicalPath in self._visited:
            return
        self._visited.add(canonicalPath)

        for subItem in sorted(os.listdir(canonicalPath)):
            if self.exclude and self.exclude.search(subItem):
                continue
            subPath = os.path.join(canonicalPath, subItem)
            if os.path.isdir(subPath):
                nuke.pluginAppendPath(subPath)
                nuke.pluginAppendPath(os.path.join(subPath, 'icons'))
                if DEBUG:
                    nuke.tprint('GIZMO PATH: %s' % subPath)
                subData = {}
                if nuke.GUI:
                    crawlData['dirs'][subItem] = subData
                self._recursiveAddGizmoPaths(subPath, subData)
            elif nuke.GUI and (not foldersOnly) and os.path.isfile(subPath):
                name, ext = os.path.splitext(subItem)
                if ext == '.gizmo':
                    if re.match('[0-9]{3}', name[-3:]):
                        gizmoName = name[:-4]
                        version = name[-3:]
                    else:
                        gizmoName = name
                        version = '000'
                    crawlData['gizmos'][gizmoName] = []
                    crawlData['gizmos'][gizmoName].append(int(version))
                    if DEBUG:
                        nuke.tprint('GIZMO NAME: %s' % name)
                        nuke.tprint('GIZMO VERS: %s' % version)
    def add_to_menu(self, parent_root):
        import nuke

        command = self._command()
        sub_level = self._menu_level()
        tooltip = self.file_path.stem

        nuke.pluginAppendPath(self.file_path.parent)
        parent_root.addCommand(sub_level, command=command, tooltip=tooltip)

        # 从根部层级 一层层的查找对应menu的icon
        parent_menu = parent_root
        icon_path = Path(self.pre_path)
        for sub in sub_level.split('/'):
            icon_path = icon_path.child(sub)
            parent_menu = parent_menu.menu(sub)
            parent_menu.setIcon(find_icon(icon_path))
            parent_menu.setShortcut(find_hotkey(icon_path))
Example #7
0








#Set plugins and scripts path
#------------------------------------------------------------------
try:
    plugin_path_list = [PIPELINE_SCRIPTS_BASE_PATH, NUKE_PLUGIN_PATH]
    
    for plugin_path in plugin_path_list:
        nuke.pluginAppendPath(plugin_path)
    
    #SuccessMsg
    print('Successfully set Helga Plugin Pathes')
    
except:
    
    #FailMsg
    print('Error setting Helga plugin pathes')






Example #8
0
 def run(self):
     nuke.pluginAppendPath(self.path)
Example #9
0
 def append_nuke_path(self):
     for path in self.pipeline_paths_list:
         nuke.pluginAppendPath(path)
Example #10
0
    #SuccessMsg
    print('Successfully set Helga menu.py path: {0}'.format(NUKE_MENU_PATH))

except:

    #FailMsg
    print('Error setting Helga menu.py path: {0}'.format(NUKE_MENU_PATH))

#Set plugins and scripts path
#------------------------------------------------------------------
try:
    plugin_path_list = [PIPELINE_SCRIPTS_BASE_PATH, NUKE_PLUGIN_PATH]

    for plugin_path in plugin_path_list:
        nuke.pluginAppendPath(plugin_path)

    #SuccessMsg
    print('Successfully set Helga Plugin Pathes')

except:

    #FailMsg
    print('Error setting Helga plugin pathes')

#LumaNukeGizmos startup procedure
#------------------------------------------------------------------
try:
    # This can be used to set the root directory for the GizmoPathManager search
    # without the need to define any environment variables. Note that if this is
    # defined and points to an existing directory, other possible search locations
Example #11
0
import os, sys, nuke

mydir = os.path.dirname(__file__)

# Add platform-dependent plugins
platform = []
if nuke.env['MACOS']:
  platform.append('mac')
if nuke.env['LINUX']:
  platform.append('linux')
if nuke.env['WIN32']:
  platform.append('win')
platform.append('-')
platform.append(str(nuke.NUKE_VERSION_MAJOR))

nuke.pluginAppendPath(os.path.join(mydir, "plugins-64", ''.join(platform)))
Example #12
0
import os, sys, nuke

mydir = os.path.dirname(__file__)

# Add platform-dependent plugins
platform = []
if nuke.env['MACOS']:
    platform.append('mac')
if nuke.env['LINUX']:
    platform.append('linux')
if nuke.env['WIN32']:
    platform.append('win')
platform.append('-')
platform.append(str(nuke.NUKE_VERSION_MAJOR))

nuke.pluginAppendPath(os.path.join(mydir, "plugins-64", ''.join(platform)))
Example #13
0
elif(sys.platform == 'darwin'):
	volProjects = '/Volumes/Projects'
	volAssets = '/Volumes/Assets'


# Make these favorites show up in Nuke
nuke.addFavoriteDir('File server', volProjects + '/Projects/')
nuke.addFavoriteDir('Assets', volAssets)
nuke.addFavoriteDir('R&D', volProjects + '/RnD/')

# Formats
nuke.addFormat( '1024 576 PAL Widescreen' )
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