Exemple #1
0
def addGizmosFromAsset(asst):
    gizmos = False
    a = ueAssetUtils.getElements(ueSpec.Spec(asst[0], asst[1], asst[2]))
    if "giz" in a:
        for n in a["giz"]:
            for p in a["giz"][n]:
                spec = ueSpec.Spec(asst[0], asst[1], asst[2], "giz", n, p)
                versions = ueAssetUtils.getVersions(spec)
                version = versions[len(versions) - 1]
                menu = "%s:%s:%s/%s/%s" % (spec.proj, spec.grp, spec.asst, n,
                                           p)
                # Add a 'ueGizVers' knob to hold the version of the gizmo
                # we're bringing in. This can be used for version control later.
                # When you add a custom knob, Nuke makes the User tab active,
                # so a hack around that is to add the node with the prefs panel
                # disabled, add the custom knobs, then show the prefs.
                command = str('n = nuke.createNode("' + version["file_name"] +
                              '", \
                           "name ' + p + '", inpanel=False); \
                           n.addKnob(nuke.Int_Knob("ueGizmoVers", "gizmo version")); \
                           n.knob("ueGizmoVers").setValue(' +
                              str(len(versions)) + '); \
                           n.showControlPanel()')
                nuke.toolbar("Nodes").addCommand("ueTools/" + menu, command)
                nuke.menu("Nuke").addCommand("ueTools/gizmos/" + menu, command)
                gizmos = True
    if gizmos:
        nuke.toolbar("Nodes").addCommand("ueTools/-", "")
Exemple #2
0
    def _add_hotkeys(self):
        menu = nuke.toolbar("Nuke").menu("Viewer")
        menu.addSeparator()

        for button_name in BUTTON_ORDER:
            settings = HOTKEYS.get(button_name)
            if not settings:
                continue

            fallback_msg = "nuke.message('Failed to find func to use for button \"{0}\".'".format(button_name)
            func = getattr(COMMUNICATOR, settings.get("func", fallback_msg))
            ui_elem = getattr(self.ui, settings.get("ui_elem", ""))

            hotkey = ui_elem.text()
            if hotkey == self.hotkeys.get(button_name):
                # If hotkey is the same, do nothing.
                continue

            menu_button_name = "Gapframes: " + button_name
            menu_item = menu.findItem(menu_button_name)
            if menu_item:
                menu_item.setShortcut(hotkey)
            else:
                menu.addCommand(menu_button_name, func, hotkey, shortcutContext=1)

            self.hotkeys[button_name] = hotkey
            ui_elem.setText(hotkey)
Exemple #3
0
def ocio_populate_menu():
    """Adds OCIO nodes to a menu in Color
    """

    m_nodes = nuke.toolbar('Nodes')
    m_color = m_nodes.findItem("Color")
    m_ocio = m_color.addMenu("OCIO", icon="ocio_icon.png")

    allplugs = nuke.plugins(nuke.ALL | nuke.NODIR, "OCIO*.so", "OCIO*.dylib",
                            "OCIO*.dll")

    for fname in allplugs:
        nodeMenu = nodeClass = os.path.splitext(fname)[
            0]  # strip .so extension
        # Put a space after "OCIO" to match The Foundry's convention (huh?)
        if nodeMenu.startswith("OCIO"):
            nodeMenu = nodeMenu.replace("OCIO", "OCIO ", 1)
        # Only add the item if it doesn't exist
        if not m_ocio.findItem(nodeMenu):
            m_ocio.addCommand(
                nodeMenu,
                lambda nodeClass=nodeClass: nuke.createNode(nodeClass))

    m_utils = m_ocio.addMenu("Utils")
    m_utils.addCommand("Import .ccc to CDL nodes",
                       ocionuke.cdl.import_multiple_from_ccc)
    m_utils.addCommand("Export selected CDL's to .ccc",
                       ocionuke.cdl.export_multiple_to_ccc)
	def startup(self, origin):
		origin.timer.stop()

		for obj in QApplication.topLevelWidgets():
			if (obj.inherits('QMainWindow') and obj.metaObject().className() == 'Foundry::UI::DockMainWindow'):
				nukeQtParent = obj
				break
		else:
			nukeQtParent = QWidget()

		origin.messageParent = QWidget()
		origin.messageParent.setParent(nukeQtParent, Qt.Window)
		if platform.system() != "Windows" and self.core.useOnTop:
			origin.messageParent.setWindowFlags(origin.messageParent.windowFlags() ^ Qt.WindowStaysOnTopHint)

		nuke.menu('Nuke').addCommand( 'Prism/Save Version', origin.saveScene)
		nuke.menu('Nuke').addCommand( 'Prism/Save Comment', origin.saveWithComment)
		nuke.menu('Nuke').addCommand( 'Prism/Project Browser', origin.projectBrowser)
		nuke.menu('Nuke').addCommand( 'Prism/Update selected read nodes', self.updateNukeNodes)
		nuke.menu('Nuke').addCommand( 'Prism/Settings', origin.prismSettings)

		toolbar = nuke.toolbar("Nodes")
		iconPath = os.path.join(origin.prismRoot, "Scripts", "UserInterfacesPrism", "p_tray.png")
		toolbar.addMenu( 'Prism', icon=iconPath )
		toolbar.addCommand( "Prism/WritePrism", lambda: nuke.createNode('WritePrism'))

		nuke.addOnScriptLoad(origin.sceneOpen)

		self.isRendering = [False,""]
		self.useLastVersion = False
Exemple #5
0
 def update_class_mappings_with_ofx_nodes(self):
     m = nuke.toolbar("Nodes")
     all_toolbar_items = self.recurse_into_menu(m)
     ofx_items = [item for item in all_toolbar_items if "OFX" in item[1]]
     ofx_mappings = {
         self.find_ofx_class(item[1]): item[0]
         for item in ofx_items
     }
     self.class_mappings.update(ofx_mappings)
Exemple #6
0
def lique_menu():

    menubar = nuke.menu('Nuke')
    toolbar = nuke.toolbar('Nodes')

    print("Loading Liquefacteur's Awesome Toolbar...")
    m = toolbar.addMenu('LiqueNuke',
                        icon='Y:/Liquefacteur/utils/icons/liquenuke.png')
    m.addCommand("Asset Opener", lambda: nukes.plugins.nuke_opener.main())
 def __getIcons(self):
     for menu in nuke.toolbar('Nodes').items():
         if isinstance(menu, nuke.Menu):
             for subItem in menu.items():
                 if isinstance(subItem, nuke.MenuItem) or isinstance(subItem, nuke.Menu):
                     self.__icons[subItem.name()] = self.__getIconForNodeType(subItem.icon())
                 elif isinstance(subItem, nuke.Menu):
                     for subSubItem in subItem.items():
                         self.__icons[subSubItem.name()] = self.__getIconForNodeType(subItem.icon())
Exemple #8
0
 def _set_menus(self):
     """
     Query the actual menus in Nuke and set the user menus variales.
     """
     # Nuke menu and toolbar
     menubar = nuke.menu("Nuke")
     self.usermenu = menubar.addMenu("&{0}".format(
         self.preferences["MENU"]["nuke"]))
     toolbar = nuke.toolbar("Nodes")
     self.usertools = toolbar.addMenu(self.preferences["MENU"]["nodes"])
Exemple #9
0
def ocio_populate_menu():
    """Adds OCIO nodes to a menu in Color
    """

    m_nodes = nuke.toolbar('Nodes')
    m_color = m_nodes.findItem("Color")
    m_ocio = m_color.addMenu("OCIO", icon = "ocio_icon.png")

    allplugs = nuke.plugins(nuke.ALL | nuke.NODIR, "OCIO*.so", "OCIO*.dylib", "OCIO*.dll")

    for fname in allplugs:
        p = os.path.splitext(fname)[0] # strip .so extension
        m_ocio.addCommand(p, lambda p=p: nuke.createNode(p))
Exemple #10
0
def ocio_populate_menu():
    """Adds OCIO nodes to a menu in Color
    """

    m_nodes = nuke.toolbar('Nodes')
    m_color = m_nodes.findItem("Color")
    m_ocio = m_color.addMenu("OCIO", icon="ocio_icon.png")

    allplugs = nuke.plugins(nuke.ALL | nuke.NODIR, "OCIO*.so", "OCIO*.dylib",
                            "OCIO*.dll")

    for fname in allplugs:
        p = os.path.splitext(fname)[0]  # strip .so extension
        m_ocio.addCommand(p, lambda p=p: nuke.createNode(p))
Exemple #11
0
def ocio_populate_menu():
    """Adds OCIO nodes to a menu in Color
    """

    m_nodes = nuke.toolbar('Nodes')
    m_color = m_nodes.findItem("Color")
    m_ocio = m_color.addMenu("OCIO", icon = "ocio_icon.png")

    allplugs = nuke.plugins(nuke.ALL | nuke.NODIR, "OCIO*.so", "OCIO*.dylib", "OCIO*.dll")

    for fname in allplugs:
        p = os.path.splitext(fname)[0] # strip .so extension
        m_ocio.addCommand(p, lambda p=p: nuke.createNode(p))

    m_utils = m_ocio.addMenu("Utils")
    m_utils.addCommand("Import .ccc to CDL nodes", ocionuke.cdl.import_multiple_from_ccc)
    m_utils.addCommand("Export selected CDL's to .ccc", ocionuke.cdl.export_multiple_to_ccc)
Exemple #12
0
def ocio_populate_menu():
    """Adds OCIO nodes to a menu in Color
    """

    m_nodes = nuke.toolbar('Nodes')
    m_color = m_nodes.findItem("Color")
    m_ocio = m_color.addMenu("OCIO", icon="ocio_icon.png")

    allplugs = nuke.plugins(nuke.ALL | nuke.NODIR, "OCIO*.so", "OCIO*.dylib",
                            "OCIO*.dll")

    for fname in allplugs:
        p = os.path.splitext(fname)[0]  # strip .so extension
        m_ocio.addCommand(p, lambda p=p: nuke.createNode(p))

    m_utils = m_ocio.addMenu("Utils")
    m_utils.addCommand("Import .ccc to CDL nodes",
                       ocionuke.cdl.import_multiple_from_ccc)
    m_utils.addCommand("Export selected CDL's to .ccc",
                       ocionuke.cdl.export_multiple_to_ccc)
Exemple #13
0
def load_toolbars():
    """Load all custom toolbars via config files."""

    ptask_area = PTaskArea.current()
    nuke_toolbar_config = ptask_area.config(config_file=NUKE_TOOLBAR_CONFIG, composite_ancestors=True)

    for (toolbar_name, toolbar_config) in nuke_toolbar_config.iteritems():

        toolbar = nuke.toolbar(toolbar_name)
        for (item_key, item_config) in toolbar_config.iteritems():

            name = item_config.get("label", item_key)
            command = item_config.get("command", "print 'No op'")
            icon = item_config.get("image", None)
            tooltip = item_config.get("annotation", "")

            if icon:
                icon = IconFactory().disk_path(icon)

            toolbar.addCommand(name=name, command=command, icon=icon, tooltip=tooltip)
Exemple #14
0
def build(toolbar=True):
    logger.info('Building The Silo UI...')
    logger.info('Version: {0}'.format(__version__))

    if not nuke.GUI:
        logger.critical('Nuke is not in GUI mode, aborting UI creation')
        return

    if toolbar:
        silo_menu = nuke.toolbar('Nodes').addMenu(silo_name)
    else:
        silo_menu = nuke.menu('Nuke').addMenu(silo_name)

    with open('{0}/silo_data.json'.format(silo_location), 'r') as fp:
        silo_data = json.load(fp)

    for gizmo_name, gizmo in sorted(silo_data['gizmos'], key=lambda x: x[0]):
        logger.info('Adding gizmo: {0}'.format(gizmo_name))
        silo_menu.addCommand(
            'Gizmos/{0}'.format(gizmo_name), 'from the_silo import wrapper;'
            'wrapper.create_gizmo(\'{0}\')'.format(gizmo))

    for script_name, module, func, keys in sorted(silo_data['scripts'],
                                                  key=lambda x: x[0]):
        logger.info('Adding script: {0}'.format(script_name))
        silo_menu.addCommand(
            'Scripts/{0}'.format(script_name), 'from the_silo import wrapper;'
            'wrapper.exec_script(\'{0}\', \'{1}\')'.format(module, func), keys)

    silo_menu.addSeparator()
    silo_menu.addCommand(
        'Documentation', 'import webbrowser;webbrowser.open('
        '\'https://the-silo.readthedocs.io/en/latest/index.html\')')
    silo_menu.addSeparator()
    silo_menu.addCommand(
        'Version', 'nuke.message("The Silo version {0}")'.format(__version__))
    silo_menu.addCommand(
        'Contribute', 'import webbrowser;webbrowser.open('
        '\'https://github.com/florianeinfalt/the_silo\')')

    logger.info('[DONE]')
Exemple #15
0
def ocio_populate_menu():
    """Adds OCIO nodes to a menu in Color
    """

    m_nodes = nuke.toolbar('Nodes')
    m_color = m_nodes.findItem("Color")
    m_ocio = m_color.addMenu("OCIO", icon = "ocio_icon.png")

    allplugs = nuke.plugins(nuke.ALL | nuke.NODIR, "OCIO*.so", "OCIO*.dylib", "OCIO*.dll")

    for fname in allplugs:
        nodeMenu = nodeClass = os.path.splitext(fname)[0] # strip .so extension
        # Put a space after "OCIO" to match The Foundry's convention (huh?)
        if nodeMenu.startswith("OCIO"):
            nodeMenu = nodeMenu.replace("OCIO", "OCIO ", 1)
        # Only add the item if it doesn't exist
        if not m_ocio.findItem(nodeMenu):
            m_ocio.addCommand(nodeMenu, lambda nodeClass=nodeClass: nuke.createNode(nodeClass))

    m_utils = m_ocio.addMenu("Utils")
    m_utils.addCommand("Import .ccc to CDL nodes", ocionuke.cdl.import_multiple_from_ccc)
    m_utils.addCommand("Export selected CDL's to .ccc", ocionuke.cdl.export_multiple_to_ccc)
Exemple #16
0
def load_toolbars():
    """Load all custom toolbars via config files."""

    ptask_area = PTaskArea.current()
    nuke_toolbar_config = ptask_area.config(config_file=NUKE_TOOLBAR_CONFIG,
                                            composite_ancestors=True)

    for (toolbar_name, toolbar_config) in nuke_toolbar_config.iteritems():

        toolbar = nuke.toolbar(toolbar_name)
        for (item_key, item_config) in toolbar_config.iteritems():

            name = item_config.get('label', item_key)
            command = item_config.get('command', "print 'No op'")
            icon = item_config.get('image', None)
            tooltip = item_config.get('annotation', "")

            if icon:
                icon = IconFactory().disk_path(icon)

            toolbar.addCommand(name=name,
                               command=command,
                               icon=icon,
                               tooltip=tooltip)
    def populate_ftrack(self):

        import nuke
        import legacy
        from nukescripts import panels

        from ftrack_connect_nuke.ui.widget.crew import NukeCrew
        from ftrack_connect_nuke.connector import Connector

        # Check if QtWebKit or QWebEngine is avaliable.
        from FnAssetAPI.ui.toolkit import is_webwidget_supported
        has_webwidgets = is_webwidget_supported()

        Connector.registerAssets()

        # wrappers for initializing the widgets with
        # the correct connector object
        def wrapImportAssetDialog(*args, **kwargs):
            from ftrack_connect.ui.widget.import_asset import FtrackImportAssetDialog
            return FtrackImportAssetDialog(connector=Connector())

        def wrapAssetManagerDialog(*args, **kwargs):
            from ftrack_connect.ui.widget.asset_manager import FtrackAssetManagerDialog
            return FtrackAssetManagerDialog(connector=Connector())

        # Populate the ui
        nukeMenu = nuke.menu("Nuke")
        ftrackMenu = nukeMenu.addMenu("&ftrack")

        ftrackMenu.addSeparator()

        # add ftrack publish node to the menu
        ftrackMenu.addCommand('Create Publish Node',
                              lambda: legacy.createFtrackPublish())

        ftrackMenu.addSeparator()

        globals()['ftrackImportAssetClass'] = wrapImportAssetDialog

        panels.registerWidgetAsPanel(
            '{0}.{1}'.format(__name__, 'ftrackImportAssetClass'),
            'ftrackImportAsset', 'ftrackDialogs.ftrackImportAssetDialog')

        ftrackMenu.addSeparator()

        ftrackMenu.addCommand(
            'Import Asset', 'pane = nuke.getPaneFor("Properties.1");'
            'panel = nukescripts.restorePanel("ftrackDialogs.ftrackImportAssetDialog");'
            'panel.addToPane(pane)')

        globals()['ftrackAssetManagerDialogClass'] = wrapAssetManagerDialog

        # Create the asset manager dialog entry in the menu
        panels.registerWidgetAsPanel(
            '{0}.{1}'.format(__name__, 'ftrackAssetManagerDialogClass'),
            'ftrackAssetManager', 'ftrackDialogs.ftrackAssetManagerDialog')
        ftrackMenu.addCommand(
            'Asset Manager', 'pane = nuke.getPaneFor("Properties.1");'
            'panel = nukescripts.restorePanel("ftrackDialogs.ftrackAssetManagerDialog");'
            'panel.addToPane(pane)')

        if has_webwidgets:
            from ftrack_connect_foundry.ui.info_view import InfoView as _InfoView

            ftrackMenu.addCommand(
                _InfoView.getDisplayName(),
                'pane = nuke.getPaneFor("Properties.1");'
                'panel = nukescripts.restorePanel("{identifier}");'
                'panel.addToPane(pane)'.format(
                    identifier=_InfoView.getIdentifier()))

        ftrackMenu.addSeparator()

        if has_webwidgets:
            from ftrack_connect_foundry.ui.info_view import WorkingTaskInfoView as _WorkingTaskInfoView
            from ftrack_connect_foundry.ui.tasks_view import TasksView as _TasksView

            # Add Web Views located in the ftrack_connect_foundry package to the
            # menu for easier access.
            for widget in [_TasksView, _WorkingTaskInfoView]:
                ftrackMenu.addCommand(
                    widget.getDisplayName(),
                    'pane = nuke.getPaneFor("Properties.1");'
                    'panel = nukescripts.restorePanel("{identifier}");'
                    'panel.addToPane(pane)'.format(
                        identifier=widget.getIdentifier()))

        ftrackMenu.addSeparator()

        # Create the crew dialog entry in the menu
        panels.registerWidgetAsPanel(
            'ftrack_connect_nuke.ui.widget.crew.NukeCrew', 'Crew',
            'widget.Crew')
        ftrackMenu.addCommand(
            'Crew', 'pane = nuke.getPaneFor("Properties.1");'
            'panel = nukescripts.restorePanel("widget.Crew");'
            'panel.addToPane(pane)')

        # Add new entries in the ftrack menu.
        ftrackMenu.addSeparator()

        if has_webwidgets:
            from ftrack_connect_nuke.ui.widget.publish_gizmo import GizmoPublisherDialog
            ftrackMenu.addCommand('Publish gizmo', GizmoPublisherDialog)

        # Add ftrack publish node
        toolbar = nuke.toolbar("Nodes")
        ftrackNodesMenu = toolbar.addMenu("ftrack", icon="logobox.png")
        ftrackNodesMenu.addCommand('ftrackPublish',
                                   lambda: legacy.createFtrackPublish())

        # Set calbacks
        nuke.addOnScriptLoad(legacy.refAssetManager)
        nuke.addOnScriptLoad(legacy.scan_for_new_assets)
        nuke.addOnUserCreate(legacy.addFtrackComponentField, nodeClass='Write')
        nuke.addOnUserCreate(legacy.addFtrackComponentField,
                             nodeClass='WriteGeo')
        nuke.addOnUserCreate(legacy.addFtrackComponentField, nodeClass='Read')
        nuke.addKnobChanged(legacy.ftrackPublishKnobChanged, nodeClass="Group")
        nuke.addOnCreate(legacy.ftrackPublishHieroInit)
import nuke

tools = nuke.toolbar("Nodes")
C_menu = tools.addMenu("C", icon="C.png")

##########################################################################################################################################
C_menu.addMenu('Draw', icon='Draw.png')
C_menu.addCommand('Draw/Ramp Corner',
                  "nuke.createNode(\"Ramp_Corner\")",
                  icon="Ramp_Corner.png")
C_menu.addCommand('Draw/Noise C',
                  "nuke.createNode(\"Noise_C\")",
                  icon="Noise_C.png")
C_menu.addCommand('Draw/DuGrain',
                  "nuke.createNode(\"DuGrain\")",
                  icon="DuGrain.png")

##########################################################################################################################################
C_menu.addMenu('Time', icon='Time.png')
C_menu.addCommand('Time/Rebuild Frames',
                  "nuke.createNode(\"Rebuild\")",
                  icon="Rebuild_Frames.png")
C_menu.addCommand('Time/Curve Creator',
                  "nuke.createNode(\"Curve_Creator\")",
                  icon="Curve_Creator.png")
C_menu.addCommand('Time/Curve ReTime',
                  "nuke.createNode(\"Curve_ReTime\")",
                  icon="Curve_ReTime.png")
C_menu.addCommand('Time/Curve Normalise',
                  "nuke.createNode(\"Curve_Normalise\")", "")
Exemple #19
0
import nuke

# Defaults
import knob_defaults

nuke.tprint("Setting Tom's label defaults")
knob_defaults.set_default_labels()

nuke.tprint("Setting Tom's knob defaults")
knob_defaults.set_default_knobs()

# Shortcuts
nuke.toolbar('Nodes').addCommand('Channel/ChannelMerge',
                                 'nuke.createNode("ChannelMerge")',
                                 'shift+c',
                                 shortcutContext=dagContext)
nuke.toolbar('Nodes').addCommand('Transform/TransformMasked',
                                 'nuke.createNode("TransformMasked")',
                                 'shift+t',
                                 shortcutContext=dagContext)

# Tom's Python stuff
import tm_tools

tomsMenu = nuke.menu('Nuke').addMenu('Tom\'s tools')

tomsMenu.addCommand('Set Corner Pin reference frame',
                    'tm_tools.setCornerPinRefFrame()',
                    icon='CornerPin.png')
tomsMenu.addCommand('Enable Tracker TRS checkboxes',
                    'tm_tools.enable_Tracker_TRS()',
def main():
    # Getting current location
    dirname = os.path.dirname(os.path.abspath(__file__))

    # Saving selected nodes for export
    selection = nuke.selectedNodes()
    if selection == []:
        nuke.message("There are no nodes selected.")
    else:

        # Creating Template creation menu
        class TemplateCreation(nukescripts.PythonPanel):
            def __init__(self, node):

                nukescripts.PythonPanel.__init__(self, 'Template creation')
                self.tcNode = node
                self.typeKnob = nuke.Enumeration_Knob(
                    'exporttype', 'Export selected node(s) as',
                    ['Node', 'Template'])
                self.elementKnob = nuke.String_Knob('expname', 'Name')
                for k in (self.typeKnob, self.elementKnob):
                    self.addKnob(k)

        # Activating menu
        tc = TemplateCreation(selection)
        if tc.showModalDialog():
            # Getting values from menu
            exptype = tc.typeKnob.value()
            expname = tc.elementKnob.value()

            if expname == '':
                nuke.message('There was no name specified.')
            else:
                # Template export settings
                if exptype == 'Template':
                    # Creating export paths
                    expfile = expname + '.nk'
                    exploc = os.path.join(dirname, "project_repo", "Templates",
                                          expfile)

                    # Fixing windows slashes functionality
                    exploc_win = exploc.replace(os.sep, '/')

                    # Exporting as Nuke file
                    try:
                        nuke.nodeCopy(exploc_win)

                        # Creating menu to add recent created node
                        toolbar = nuke.toolbar("Nodes")
                        prj_repo = toolbar.addMenu(
                            "Project repository",
                            icon="project_repository.png")

                        # Creating command to import node when artist asks
                        prj_repo.addCommand(
                            "Templates/" + expname,
                            "nuke.nodePaste(" + "\"" + exploc_win + "\")")

                        # Giving artist success message
                        nuke.message("Exporting " + expname +
                                     " as template was successful.")

                    except:
                        nuke.message("An exception occurred")
                # Node export settings
                if exptype == 'Node':
                    # Creating export paths
                    expfile = expname + '.nk'
                    exploc = os.path.join(dirname, "project_repo", "Nodes",
                                          expfile)

                    # Fixing windows slashes functionality
                    exploc_win = exploc.replace(os.sep, '/')

                    # Exporting as Nuke file
                    try:
                        nuke.nodeCopy(exploc_win)

                        # Creating menu to add recent created node
                        toolbar = nuke.toolbar("Nodes")
                        prj_repo = toolbar.addMenu(
                            "Project repository",
                            icon="project_repository.png")

                        # Creating command to import node when artist asks
                        prj_repo.addCommand(
                            "Nodes/" + expname,
                            "nuke.nodePaste(" + "\"" + exploc_win + "\")")

                        # Giving artist success message
                        nuke.message("Exporting " + expname +
                                     " as node was successful.")

                    except:
                        nuke.message("An exception occurred")
Exemple #21
0
import NFTSCopyPaste
import NFTShelp
import hieroFPS

try:
    import AnimationMaker
except:
    pass

####################################
'''
Override default backdrop function with sb_backdrop
'''

nukescripts.autoBackdrop = sb_backdrop
nuke.toolbar("Nodes").addCommand('Other/Backdrop', 'sb_backdrop.sb_backdrop()',
                                 'alt+b')

####################################
'''
Add a NFTS Tools toolbar.
'''

NFTS = nuke.toolbar("Nodes").addMenu("NFTS", icon="nfts.png")
NFTS.addCommand('Python/ReadFromWrite', 'ReadFromWrite.ReadFromWrite()',
                'shift+r')
NFTS.addCommand("Python/sb RevealInFileBrowser",
                "sb_revealInFileBrowser.sb_revealInFileBrowser()",
                "alt+shift+r")
NFTS.addCommand('Python/nLabelShortcut', 'nLabelShortcut.nLabelShortcut()',
                'shift+l')
NFTS.addCommand('Python/ShuffleAll',
Exemple #22
0
import nuke
import os
import tm_tools
import knob_defaults
import passbuilder

# nuke.toolbar('Nodes').addCommand("Draw/ColorTexturePaint", "nuke.createNode('ColorTexturePaint')", icon='ColorTexturePaint.png')
nuke.toolbar("Nodes").addCommand(
    "Time/FrameHold",
    "nuke.createNode('FrameHold')['first_frame'].setValue(nuke.frame())")

# import readFromWrite
# nuke.toolbar("Nodes").addCommand("Image/Read from Write", "readFromWrite.ReadFromWrite()", "alt+r")

nuke.knobDefault('Root.format', 'DCI_Scope_2.39')
nuke.knobDefault('Root.first_frame', '1001')
nuke.knobDefault('Root.last_frame', '1100')

tomsMenu = nuke.menu('Nuke').addMenu('Tom\'s stuff')
tomsMenu.addCommand('Set Corner Pin reference frame',
                    'tm_tools.setCornerPinRefFrame()',
                    icon='CornerPin.png')
tomsMenu.addCommand('Clear Channelmerge labels',
                    "tm_tools.clearLabels(nodeClass='ChannelMerge')",
                    icon='StickyNote.png')
tomsMenu.addCommand("Set default labels",
                    "knob_defaults.set_default_labels()",
                    icon='StickyNote.png')
tomsMenu.addCommand('Show Node Classes',
                    'tm_tools.showNodeByClass()',
                    icon='Assert.png')
Exemple #23
0
import nuke
import os

from nodes.DA_WriteMovieSlices import DA_WriteMovieSlices

gizmos = '%s/gizmos' % os.path.dirname(os.path.abspath(__file__))

toolbar = nuke.toolbar('Nodes')

da_menu = toolbar.addMenu('DataArena')
da_menu.addCommand('DA_WriteMovieSlices', 'nuke.createNode("%s/DA_WriteMovieSlices")' % gizmos)

nuke.addOnUserCreate(DA_WriteMovieSlices.onUserCreateCallback)
Exemple #24
0
import nuke

mfx = nuke.toolbar('Nodes').addMenu('MaximumFX', 'MaximumFX.png')
mfx.addCommand('RotoKit', 'nuke.createNode("RotoKit")', icon='RotoKit.png')
Exemple #25
0
            "GUISwitch(mode='switch')",
            hotkey="shift+D")
addMenuItem('m',
            kuMu,
            '$GUI Switch/reverse',
            "GUISwitch(mode='reverse')",
            hotkey="ctrl+shift+D")
kuMu.addSeparator()
kuMu.addCommand('Shuffle',
                "nuke.createNode('Shuffle')",
                "h",
                shortcutContext=2)

########## KuFunc Toolbar ##########

tBar = nuke.toolbar("T_Bar")

addMenuItem('f',
            tBar,
            'Select Child Nodes',
            "selectChildNodes()",
            icon="Output.png")
tBar.addMenu('Align Nodes', icon="align_menu.png")
addMenuItem('m',
            tBar,
            'Align Nodes/top',
            "AlignNodes('up')",
            icon="align_T.png")
addMenuItem('m',
            tBar,
            'Align Nodes/bottom',
Exemple #26
0
import nuke, nukescripts, sys, os, errno

from AddPlus import *
from Directories import *
from Relative import *
from Organize import *
from LockPanel import *
from Multiple import *
from CP_to_Matrix import *
from ThreeD import *
from TwoD import *
from CP_to_Matrix import *
from curveGenBake import *

toolbar = nuke.toolbar("PLUS")
Dir = toolbar.addMenu('Directories', icon='admin.png')
Dir.addCommand('Add Plus Control', "addPlus()", icon='Dplus.png')
Dir.addSeparator()
Dir.addCommand('Open tmp Folder', "opentmp()", 'shift+t', icon='Dtmp.png')
Dir.addCommand('Open Script Folder',
               "openScriptFolder()",
               'shift+j',
               icon='Dscript.png')
Dir.addCommand('Open Project Folder',
               "openProjectFolder()",
               icon='Dproject.png')
Dir.addCommand('Open selected Nodes', "plusOpen_toolbar()", icon='Dnodes.png')
Dir.addSeparator()
Dir.addCommand('Make Selected Relative',
               "make_relative_Toolbar()",
               icon='TDreltv.png')
Exemple #27
0
def main():
    toolbar = nuke.toolbar("Nodes")
    m = toolbar.addMenu("NOID")
    m.addCommand("ChromaticAberation", "nuke.createNode('ChromaticAberation')")
	def buildMenu(self):
		toolbar = nuke.toolbar("Nodes")
		m =   toolbar.findItem("RugbyBugs")
		m.addCommand( 'submit to RR', 'rbNukeStartupCarl.RbNukeStartupCarl().rrSubmit_Nuke_5()', '^r')
Exemple #29
0
    def populate_ftrack(self):

        import nuke
        import legacy
        from nukescripts import panels

        from ftrack_connect_nuke.connector import Connector

        # Check if QtWebKit or QWebEngine is avaliable.
        from FnAssetAPI.ui.toolkit import is_webwidget_supported
        has_webwidgets = is_webwidget_supported()

        Connector.registerAssets()

        # wrappers for initializing the widgets with
        # the correct connector object
        def wrapImportAssetDialog(*args, **kwargs):
            from ftrack_connect.ui.widget.import_asset import FtrackImportAssetDialog
            return FtrackImportAssetDialog(connector=Connector())

        def wrapAssetManagerDialog(*args, **kwargs):
            from ftrack_connect.ui.widget.asset_manager import FtrackAssetManagerDialog
            return FtrackAssetManagerDialog(connector=Connector())

        # Populate the ui
        nukeMenu = nuke.menu("Nuke")
        ftrackMenu = nukeMenu.addMenu("&ftrack")

        ftrackMenu.addSeparator()

        # add ftrack publish node to the menu
        ftrackMenu.addCommand('Create Publish Node',
                              lambda: legacy.createFtrackPublish())

        ftrackMenu.addSeparator()

        globals()['ftrackImportAssetClass'] = wrapImportAssetDialog

        panels.registerWidgetAsPanel(
            '{0}.{1}'.format(__name__, 'ftrackImportAssetClass'),
            'ftrackImportAsset', 'ftrackDialogs.ftrackImportAssetDialog')

        ftrackMenu.addSeparator()

        ftrackMenu.addCommand(
            'Import Asset', 'pane = nuke.getPaneFor("Properties.1");'
            'panel = nukescripts.restorePanel("ftrackDialogs.ftrackImportAssetDialog");'
            'panel.addToPane(pane)')

        globals()['ftrackAssetManagerDialogClass'] = wrapAssetManagerDialog

        # Create the asset manager dialog entry in the menu
        panels.registerWidgetAsPanel(
            '{0}.{1}'.format(__name__, 'ftrackAssetManagerDialogClass'),
            'ftrackAssetManager', 'ftrackDialogs.ftrackAssetManagerDialog')
        ftrackMenu.addCommand(
            'Asset Manager', 'pane = nuke.getPaneFor("Properties.1");'
            'panel = nukescripts.restorePanel("ftrackDialogs.ftrackAssetManagerDialog");'
            'panel.addToPane(pane)')

        if has_webwidgets:

            def wrapAssetInfoDialog(*args, **kwargs):
                from ftrack_connect_nuke.ui.widget.info_view import AssetInfoView
                return AssetInfoView(bridge=self._bridge)

            globals()['ftrackAssetInfoDialogClass'] = wrapAssetInfoDialog

            # Create the crew dialog entry in the menu
            panels.registerWidgetAsPanel(
                '{0}.{1}'.format(__name__, 'ftrackAssetInfoDialogClass'),
                'ftrackAssetInfo', 'ftrackDialogs.ftrackAssetInfoDialog')

            ftrackMenu.addCommand(
                'Asset Info', 'pane = nuke.getPaneFor("Properties.1");'
                'panel = nukescripts.restorePanel("ftrackDialogs.ftrackAssetInfoDialog");'
                'panel.addToPane(pane)')

        ftrackMenu.addSeparator()

        if has_webwidgets:
            from ftrack_connect_foundry.ui.info_view import WorkingTaskInfoView as _WorkingTaskInfoView
            from ftrack_connect_foundry.ui.tasks_view import TasksView as _TasksView

            # Add Web Views located in the ftrack_connect_foundry package to the
            # menu for easier access.
            for widget in [_TasksView, _WorkingTaskInfoView]:
                ftrackMenu.addCommand(
                    widget.getDisplayName(),
                    'pane = nuke.getPaneFor("Properties.1");'
                    'panel = nukescripts.restorePanel("{identifier}");'
                    'panel.addToPane(pane)'.format(
                        identifier=widget.getIdentifier()))

        ftrackMenu.addSeparator()

        # Add new entries in the ftrack menu.
        ftrackMenu.addSeparator()

        if has_webwidgets:
            from ftrack_connect_nuke.ui.widget.publish_gizmo import GizmoPublisherDialog
            ftrackMenu.addCommand('Publish gizmo', GizmoPublisherDialog)

        # Add ftrack publish node
        toolbar = nuke.toolbar("Nodes")
        ftrackNodesMenu = toolbar.addMenu("ftrack", icon="ftrack_logo.png")
        ftrackNodesMenu.addCommand('ftrackPublish',
                                   lambda: legacy.createFtrackPublish())

        # Set calbacks

        def asset_info_menu_switch():
            '''Enable and disable asset info depending on selection.'''

            this_node = nuke.thisNode()

            # Do not continue if selection is not node.
            if not isinstance(this_node, nuke.Node):
                return

            try:
                is_ftrack = this_node.knob('assetVersionId')
            except ValueError:
                is_ftrack = False

            nuke_menu = nuke.menu('Nuke')
            menu_item = nuke_menu.findItem('&ftrack')
            asset_info_menu = menu_item.findItem('Asset Info')

            if has_webwidgets and asset_info_menu:
                if is_ftrack:
                    asset_info_menu.setEnabled(True)
                else:
                    asset_info_menu.setEnabled(False)

        nuke.addKnobChanged(asset_info_menu_switch)

        # other callbacks
        nuke.addOnScriptLoad(legacy.refAssetManager)
        nuke.addOnScriptLoad(legacy.scan_for_new_assets)
        nuke.addOnUserCreate(legacy.addFtrackComponentField, nodeClass='Write')
        nuke.addOnUserCreate(legacy.addFtrackComponentField,
                             nodeClass='WriteGeo')
        nuke.addOnUserCreate(legacy.addFtrackComponentField, nodeClass='Read')
        nuke.addKnobChanged(legacy.ftrackPublishKnobChanged, nodeClass="Group")
        nuke.addOnCreate(legacy.ftrackPublishHieroInit)

        # Set default values from environments.
        start_frame = os.environ.get('FS', 0)
        end_frame = os.environ.get('FE', 100)

        FnAssetAPI.logging.debug(
            'Setting start frame : {}'.format(start_frame))
        nuke.knob('root.first_frame', str(start_frame))
        FnAssetAPI.logging.debug('Setting end frame : {}'.format(end_frame))
        nuke.knob('root.last_frame', str(end_frame))
Exemple #30
0
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()
Exemple #31
0
                           reference_asset.reload_all,
                           icon="nuke_reload_all.png")
    wizard_menu.addCommand("Resolve missing files",
                           reference_asset.resolve_local_paths,
                           icon="nuke_resolve_local.png")
    wizard_menu.addCommand("Import lighting",
                           reference_asset.import_lighting,
                           icon="nuke_import_lighting.png")
    wizard_menu.addCommand("Import lighting helios",
                           reference_asset.import_lighting_helios,
                           icon="nuke_import_lighting_helios.png")
    wizard_menu.addCommand("Prepare export",
                           plugin.prepare_export,
                           icon="nuke_export.png")

    t = nuke.toolbar("Wizard")
    t.addCommand("Save", plugin.save, icon="nuke_save.png")
    t.addCommand("Set frame range",
                 plugin.set_f_range,
                 icon="nuke_frame_range.png")
    t.addCommand("Set format", plugin.set_format, icon="nuke_format.png")
    t.addCommand("Set frame rate",
                 plugin.set_f_rate,
                 icon="nuke_frame_rate.png")
    t.addCommand("Reload all",
                 reference_asset.reload_all,
                 icon="nuke_reload_all.png")
    t.addCommand("Resolve missing files",
                 reference_asset.resolve_local_paths,
                 icon="nuke_resolve_local.png")
    t.addCommand("Import lighting",
Exemple #32
0
def buildMenu():

    # randomly get toolbar icon
    iconPrefix = TF2CLASSES.keys()[random.randint(0,len(TF2CLASSES)-1)]
    iconTooltip = TF2CLASSES[iconPrefix][random.randint(0,len(TF2CLASSES[iconPrefix])-1)]
    iconPath = NUKE_SHARE+'/tf2avatars/'+iconPrefix+'.jpg'
    # iconPath = NUKE_SHARE+'userIcon.png'

    print iconTooltip

    m = nuke.toolbar("Nodes").addMenu('dmptools/Misc', tooltip=iconTooltip, icon=iconPath)

    # 2D
    m.addCommand('2d/Nuke Image Converter...', 'import dmptools.tools.imageConverter as imageConverter");imageConverter.makeProxyUI()')
    m.addCommand('2d/Buf Clone', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.bclone()')
    m.addCommand('2d/Connect Selection ', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.connectSel()', "CTRL+Shift+Y")
    m.addCommand('2d/Clear Animation', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.clearAnim()')
    m.addCommand('2d/Show-Hide inputs', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.hideInputs()',"Alt+T")
    m.addCommand('2d/Set Selected or All Read Frame Range...', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.setReadFrameRange()')
    m.addCommand('2d/Set frame range from selection', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.setFrameRangeFromSel()', "Ctrl+Shift+R")
    m.addCommand('2d/Rename label according the dependance node', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.renameLabel()', "Ctrl+Alt+Shift+R")
    m.addCommand('2d/Switch crop format', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.switchCrop()', "Ctrl+Alt+Shift+O")
    m.addCommand('2d/Switch 0 - 1', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.switchUV_PROJ()', "Ctrl+Alt+Shift+S")
    m.addCommand('2d/Create read from write', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.createReadFromWrite()', "Ctrl+Alt+Shift+R")
    m.addCommand('2d/Toggle postage stamp on read nodes', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.togglePostageStamps()', "Ctrl+Alt+P")
    m.addCommand('2d/Bezier', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.switchNode()', "Ctrl+Alt+Shift+S")
    m.addCommand('2d/Write default', 'import nuke;nuke.createNode("Write")', "Shift+W")
    m.addCommand('2d/Switch node', 'nuke.tcl("Bezier")', "Shift+B")

    # 3D
    m.addCommand('3d/Shadow Generator', 'nuke.createNode("shadow_generator")')
    m.addCommand('3d/Connect Master Scene', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.connectMasterScene()', 'Ctrl+1')

    # other
    m.addCommand('Other/Centralize script...', 'execfile("/usr/people/michael-ha/python/centralizeNukeScript.py");makeLocalUI()')
    m.addCommand('Other/Archive script...', 'execfile("/usr/people/michael-ha/python/archive_v1.0.py");ai.interface()')
    m.addCommand('Other/Copy special', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.copySpecial()', "CTRL+SHIFT+C")
    m.addCommand('Other/list knobs', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.listKnobs()',"Ctrl+Alt+Shift+I")
    m.addCommand('Other/Play', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.nukePlay()', "Alt+V")
    m.addCommand('Other/Goto first frame', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.goToFirstFrame()', "Alt+Shift+V")
    m.addCommand('Other/Replace string in file knob...', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.replaceStringInFile()')
    m.addCommand('Other/Set selected Write the only active write', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.setSelWriteActive()')
    m.addCommand('Other/How many nodes', 'nuke.message(str(len(nuke.allNodes()))+" nodes in comp.")', "Ctrl+Shift+Alt+A")
    m.addCommand('Other/Expression arrows', '_internal_expression_arrow_cmd()', "Alt+Shift+E")
    m.addCommand('Other/Unselect All', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.deselectAll();nukeCommands.closeAllControlPanel()', "Ctrl+Space")
    m.addCommand('Other/fNextRender', 'import dmptools.utils.nukeCommands as nukeCommands;reload(nukeCommands);nukeCommands.getNextRender();', "Alt+]")
    m.addCommand('Other/fPreviousRender', 'import dmptools.utils.nukeCommands as nukeCommands;reload(nukeCommands);nukeCommands.getPreviousRender();', "Alt+[")

    # misc
    m.addCommand('Execute', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.executeSelection()', "Alt+E")
    m.addCommand('Import exported file', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.importScript()', "Ctrl+Shift+I")
    m.addCommand('Open terminal from selection', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.openTerminal()', "Ctrl+Alt+X")
    m.addCommand('Start server', 'execfile("/usr/people/michael-ha/python/nukeserver.py");threaded_server()')
    m.addCommand('Set Shot FrameRange', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.setShotFrameRange()')
    m.addCommand('Show modules...', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.showModules()')
    m.addCommand('Merge...', 'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.merge()', 'M')

    # framestore
    m.addCommand('Framestore/Refresh OCIO nodes...', 'import dmptools_misc.framestore.refreshOCIONodes as refreshOCIONodes;refreshOCIONodes.refreshOCIONodes()')
    m.addCommand('Framestore/Formater', 'nuke.nuke.nodePaste("'+FRAMESTORE_NUKE_PATH+'/formater.nk")')
    # aynik
    m.addCommand('Framestore/aynik/crop compensator', 'nuke.nuke.nodePaste("'+FRAMESTORE_NUKE_PATH+'/crop_compensator.nk")')
    m.addCommand('Framestore/aynik/srgb to linear', 'nuke.nuke.nodePaste("'+FRAMESTORE_NUKE_PATH+'/sRGB_to_Linear.nk")')
Exemple #33
0
import sys
import nuke
import os
import webbrowser

#*****************************************************************
#*****************************************************************
#******************ADD THIS TO YOUR FILE INIT.PY******************
#Expression_path = "/Users/yourPath/.nuke/Expression"
#nuke.pluginAddPath(Expression_path)
#*****************************************************************
#*****************************************************************

toolbar = nuke.toolbar("Nodes")
m = toolbar.addMenu("Expression Nodes",
                    icon=os.path.join(Expression_path, "icon/expr.png"))

m.addMenu('Creations', icon=os.path.join(Expression_path, "icon/01.png"))
m.addMenu('Alpha', icon=os.path.join(Expression_path, "icon/02.png"))
m.addMenu('Pixel', icon=os.path.join(Expression_path, "icon/03.png"))
m.addMenu('Keying and Despill',
          icon=os.path.join(Expression_path, "icon/04.png"))
m.addMenu('Transform', icon=os.path.join(Expression_path, "icon/05.png"))
m.addMenu('3D and Deep', icon=os.path.join(Expression_path, "icon/06.png"))

#CREATIONS
m.addCommand(
    'Creations/Random/Random Colors', "nuke.nodePaste(\"" +
    os.path.join(Expression_path + "/Creations/Random/Random_colors.nk") +
    "\")")
m.addCommand(
Exemple #34
0
def buildMenu():
    """
        build dmptools menu
    """

    #============================
    #   DEFAULT STARTUP TOOLS 
    #============================

    # add custom callbacks
    nukeCommands.addCustomCallBacks()

    # create default favorite dirs
    favorites.createFavorites()

    # add tex tab on write nodes
    texTab.addCallback()

    # add a latestAutosave menu item 
    nuke.menu("Nuke").addCommand('File/Recent Files/Latest autosave',
        'import dmptools.utils.nukeCommands as nukeCommands;nuke.scriptOpen(nukeCommands.getLatestAutosave())')

    # tmp tool
    import dmptools.tools.panoTool as panoTool
    panoTool.addCallback()

    #========================
    #   BUILD THE TOOLBAR 
    #========================

    # create 3ddmp toolbar
    toolbar = nuke.toolbar("Nodes").addMenu('dmptools', icon=NUKE_SHARE+'/toolbar.png')

    # toolbar menus
    toolbar.addMenu('Tools', icon=NUKE_SHARE+'/tools.png')
    toolbar.addMenu('Nodes', icon=NUKE_SHARE+'/nodes.png')
    toolbar.addMenu('Nodes/2d')
    toolbar.addMenu('Nodes/3d')
    toolbar.addMenu('Macros', icon=NUKE_SHARE+'/macros.png')
    toolbar.addMenu('Macros/2d')
    toolbar.addMenu('Macros/3d')

    #===================
    #    TOOLS MENU
    #===================

    #export nuke to maya
    toolbar.addCommand('Tools/Nuke to Maya...',
        'import dmptools.tools.nukeToMaya as nukeToMaya;reload(nukeToMaya);nukeToMaya.main()',
        icon=NUKE_SHARE+'/nukeToMaya.png')

    # psd to nuke 
    toolbar.addCommand('Tools/Psd to Nuke...',
        'import dmptools.tools.psdToNuke as psdToNuke;reload(psdToNuke);psdToNuke.main()',
        icon=NUKE_SHARE+'/psdToNuke.png')

    # ratio calculator
    toolbar.addCommand('Tools/Ratio calculator...',
        'import dmptools.tools.ratioCalculator as ratioCalculator;reload(ratioCalculator);ratioCalculator.main()',
        icon=NUKE_SHARE+'/ratioCalculator.png')

    # bake camera projections into uv textures
    toolbar.addCommand('Tools/Bake projection to UV...',
        'import dmptools.tools.bakeProjToUV as bakeProjToUV;reload(bakeProjToUV);bakeProjToUV.main()',
        icon=NUKE_SHARE+'/bake.png')

    # scanline render manager
    sc = ScanlineRenderManager()
    pane = nuke.menu("Pane")
    pane.addCommand("ScanlineRender Manager", sc.addToPane)
    nukescripts.registerPanel('ScanlineRenderManager', sc.addToPane)
    toolbar.addCommand('Tools/ScanlineRender Manager', sc.show, icon=NUKE_SHARE+'/scanline.png')

    # converts the selected node(s) and create a new read
    toolbar.addCommand('Tools/Image Converter...',
        'import dmptools.tools.imageConverter as imageConverter;reload(imageConverter);imageConverter.main()')

    # imgage converter dev
    toolbar.addCommand('Tools/Image Converter dev...',
        'import dmptools.tools.imageConverter_dev as imageConverter;reload(imageConverter);i = imageConverter.ImageConverter();i.show()')

    # mosaicer
    toolbar.addCommand('Tools/Mosaicer...',
        'import dmptools.tools.mosaicer as mosaicer;reload(mosaicer);mosaicer.main()')

    # demosaicer
    toolbar.addCommand('Tools/Demosaicer...',
        'import dmptools.tools.demosaicer as demosaicer;reload(demosaicer);demosaicer.main()')

    # run command
    run = RunCommand()
    pane = nuke.menu("Pane")
    pane.addCommand("Run Command", run.addToPane)
    nukescripts.registerPanel('RunCommand', run.addToPane)
    toolbar.addCommand('Tools/Run Command...', run.show)

    # web browser
    web = WebBrowser()
    nukescripts.panels.registerWidgetAsPanel(WebBrowser, 'Web Browser','Web Browser')
    toolbar.addCommand('Tools/Web Browser...', web.show)

    #===================
    #    NODES MENU
    #===================

    #2D
    # coverage map
    toolbar.addCommand('Nodes/2d/Coverage Map', 'nuke.nodePaste("'+GIZMO_PATH+'/coverageMap.nk")')
    # apply lut
    toolbar.addCommand('Nodes/2d/Apply Lut', 'nuke.createNode("ApplyLUT")')

    # 3D
    # create projection camera from render camera
    toolbar.addCommand('Nodes/3d/Bake-Create Camera',
        'import dmptools.nodes.bakeCamera as bakeCamera;bakeCamera.BakeCamera()')
    # 3d image plane
    toolbar.addCommand('Nodes/3d/Image plane',
        'nuke.nodePaste("'+GIZMO_PATH+'/imagePlane.nk")')
    # populate geo on 3d selection
    toolbar.addCommand('Nodes/3d/Populate 3d Geo ...',
        'import dmptools.tools.populate as populate;populate.main()')
    # sequence manager (dev)
    toolbar.addCommand('Nodes/3d/Sequence Manager',
        'nuke.nodePaste("'+GIZMO_PATH+'/sequenceManager.nk")')
    # create script node
    toolbar.addCommand('Nodes/misc/Script Node',
        'import dmptools.nodes.scriptNode as scriptNode;scriptNode.main()')

    #===================
    #   MACROS MENU
    #===================

    # 2D
    # set the colorspace of the selected read nodes
    toolbar.addCommand('Macros/2d/Set colorspace...',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.setColorspace()')
    # try to reload the selected nodes
    toolbar.addCommand('Macros/2d/Reload selected nodes',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.reloadReadNodes()', "Shift+Alt+R")
    # flip the viewer
    toolbar.addCommand('Macros/2d/Flip',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.flipViewer()', "`")
    # flop the viewer
    toolbar.addCommand('Macros/2d/Flop',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.flopViewer()', "Alt+`")
    # align nodes in the nodegraph
    toolbar.addCommand('Macros/2d/Align Up',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.upAlignSelectedNodes()')
    toolbar.addCommand('Macros/2d/Align Center',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.centerAlignSelectedNodes()')
    toolbar.addCommand('Macros/2d/Align Down',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.downAlignSelectedNodes()')
    # search and replace string in file knob
    toolbar.addCommand('Macros/2d/Search and replace string in file knob...',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.replaceStringInFile()')
    # show the path of all or selected read nodes
    toolbar.addCommand('Macros/2d/Show paths of all or selected Read nodes...',
        'import dmptools.tools.getFilePath as getFilePath;getFilePath.printPath()')
    # deselect and close all nodes control panel
    toolbar.addCommand('Macros/2d/Close all the nodes control panel',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.closeAllControlPanel()')
    # create viewerinput node check
    toolbar.addCommand('Macros/2d/Viewerinput Check node',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.createViewerInput()', "CTRL+ALT+X")

    # 3D
    # toggle visibility of 3d nodes
    toolbar.addCommand('Macros/3d/toggle camera and geo display',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.toggleCamGeoDisplay()',"Ctrl+Alt+Shift+C")
    # go through wireframe, shaded, textured and textured+wireframe
    toolbar.addCommand('Macros/3d/Wireframe',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.setDisplayWireframe()', "Ctrl+Alt+4")
    toolbar.addCommand('Macros/3d/Shaded',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.setDisplayShaded()', "Ctrl+Alt+5")
    toolbar.addCommand('Macros/3d/Textured',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.setDisplayTextured()', "Ctrl+Alt+6")
    toolbar.addCommand('Macros/3d/Textured+Lines',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.setDisplayTexturedLines()', "Ctrl+Alt+7")
    # toggle default lighting on/off
    toolbar.addCommand('Macros/3d/Enable-Disable gl lighting',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.gl_lighting()', "Ctrl+Alt+0")

    # intranet help
    toolbar.addCommand('Help !',
        'import dmptools.utils.nukeCommands as nukeCommands;nukeCommands.helpButton()',
        icon=NUKE_SHARE+'/help.png')
Exemple #35
0
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()
Exemple #36
0
from __future__ import print_function
import nuke

nuke.toolbar('Nodes').addCommand('Color/ColorMatrix Combine',
                                 'colormatrix.process(nuke.selectedNodes())')

float3x3 = nuke.math.Matrix3


def matrix_from_node(node):
    # return 3x3 matrix object from node
    if not 'matrix' in node.knobs():
        print('Error: node {0} does not contain a matrix knob.'.format(
            node.fullName()))
        return None
    mtx_list = node['matrix'].getValue()
    M = float3x3()
    for i in range(9):
        M[i] = mtx_list[i]
    if node['invert'].getValue():
        M = M.inverse()
    return M


def process(nodes):
    # Process all nodes. Combine all colormatrix nodes in order that they are connected. Bake invert knobs to false.
    if not nodes:
        return
    _ = [n.setSelected(False) for n in nuke.allNodes(recurseGroups=True)]
    matrices = [matrix_from_node(n) for n in nodes if 'matrix' in n.knobs()]
    node = nuke.createNode('ColorMatrix')
Exemple #37
0
# auto check alpha on write node creation 
nukeCommands.autoCheckAlpha()

# auto check gl_light on viewers 
nukeCommands.viewerSettings()

# add a latestAutosave menu item 
nuke.menu("Nuke").addCommand('File/Recent Files/Latest autosave', 'import dmptools.macros.nukeCommands as nukeCommands ; nuke.scriptOpen(nukeCommands.getLatestAutosave())')

#========================
#   BUILD THE TOOLBAR 
#========================

# create 3ddmp toolbar
toolbar = nuke.toolbar("Nodes").addMenu('dmptools', icon = NUKE_SHARE+'/toolbar.png')

# toolbar menus
toolbar.addMenu('Tools', icon = NUKE_SHARE+'/tools.png')
toolbar.addMenu('Nodes', icon = NUKE_SHARE+'/nodes.png')
toolbar.addMenu('Nodes/2d')
toolbar.addMenu('Nodes/3d')
toolbar.addMenu('Macros', icon = NUKE_SHARE+'/macros.png')
toolbar.addMenu('Macros/2d')
toolbar.addMenu('Macros/3d')

#===================
#    TOOLS MENU
#===================

#export nuke to maya
Exemple #38
0
from widgets import NUKE_pathConverter_v02
from widgets import hub

import nuke

#creates a new 'menu' object, named 'MercadoFX Tools,' and places it within the existing 'Nodes' toolbar
toolbar = nuke.toolbar('Nodes')
mFX_menu = toolbar.addMenu('MercadoFX Tools',
                           icon='./widgets/images/mercadofx-logo-gray-64.png')
hub_menu = toolbar.addMenu('hub')

#uses 'addCommand()' function to create commands, or buttons, within the menu items created previously
mFX_menu.addCommand('Path Converter',
                    'NUKE_pathConverter_v02.create_pathConverter_window()')
hub_menu.addCommand('Hub', hub.nukeTestWindow().show())
Exemple #39
0
def SharpenSandwhich():
    y_offset = 60
    Lo1 = nuke.createNode('Log2Lin')
    Lo1['operation'].setValue('lin2log')
    Lo1.hideControlPanel()
    ySh = int(Lo1.ypos() + y_offset)
    yLo = int(Lo1.ypos() + (90+y_offset))
    Sh = nuke.nodes.Sharpen()
    Sh['size'].setValue(3)
    Sh['label'].setValue('Size: [value size]')
    Sh['xpos'].setValue(Lo1.xpos())
    Sh['ypos'].setValue(ySh)
    Sh.setInput(0,Lo1)
    Lo2 = nuke.nodes.Log2Lin()
    Lo2['operation'].setValue('log2lin')
    Lo2['xpos'].setValue(Lo1.xpos())
    Lo2['ypos'].setValue(yLo)
    Lo2.setInput(0,Sh)
    Lo2.hideControlPanel()
    Sh.showControlPanel()


nuke.menu('Nodes').addMenu('Filter').addCommand('SharpenSandwhich', 'SharpenSandwhich()', shortcut='ctrl+l', icon='Sharpen.png', index=26)

# --------------------------------------------------------------
#  SHORTCUTS ::::::::::::::::::::::::::::::::::::::::::::::::::
# --------------------------------------------------------------

nuke.toolbar('Nodes').addCommand('Channel/ChannelMerge', 'nuke.createNode("ChannelMerge")', 'shift+c', shortcutContext=dagContext)
Exemple #40
0
import nuke

toolbar = nuke.toolbar("Nodes")
m = toolbar.addMenu("MatteHue", icon="MatteHue.png")
m.addCommand("Cell Noise", "nuke.createNode('Cell_Noise.gizmo')", icon="Cell_Noise.png")
        for curve in nuke.animations():
            for frame in all_script_frames():
                fc.append(framecurve.FrameCorrelation(at=frame, value=this_knob.getValueAt(frame)))
            framecurve.serialize(fc_file, framecurve.simplify(fc))
                  
# Unfortunately we CANNOT specify a function callback as something that goes into the Animation menu, we have
# to do it with a function path as a string. This should be filed as a Nuke bug.
# Therefore, we resort to this workaround:
# https://gist.github.com/3010826/8a312c42ff1c343b54450feb6c4c8d169ef3afc7
import inspect
def func_shorthand(symbol):
    """
    Returns the fully qualified function call with it's module so that it can be used in Nuke's menus,
    even if your function is nested 6 levels deep in a module
    func_shorthand(do_this) #=> "some.module.another.do_this()"
    """
    my_module = inspect.getmodule(symbol).__name__
    return '.'.join([my_module, symbol.__name__]) + '()'

mydir = os.path.dirname(os.path.abspath(__file__))

if nuke.GUI:
    tb = nuke.toolbar("Nodes").addMenu('Framecurve', icon = os.path.join(mydir, "images", "icon.png"))
    
    tb.addCommand('Load a framecurve from file and apply to selected node', apply_framecurve_from_selected_files_to_selected_nodes)
    tb.addCommand('Add retime to the selected node', lambda: add_framecurve(nuke.selectedNode()))
    
    anim = nuke.menu("Animation").addMenu("Framecurve")
    anim.addCommand("Load into this knob", func_shorthand(load_framecurve_into_focused_knob))
    anim.addCommand("Export from this knob", func_shorthand(export_framecurve_from_this_knob))
    
import nuke, nukescripts, math
from menu_pipe import pipe_path


##########################################################################################################################################
##########################################################################################################################################
#######                                                      #############################################################################
#######               ADD FRANKLIN TOOLS                     #############################################################################
#######                                                      #############################################################################
##########################################################################################################################################
##########################################################################################################################################


toolbar = nuke.toolbar("Nodes")
F_menu = toolbar.addMenu("F_tools", icon="F_menu.png")

##############################################################
#  DRAW
##############################################################
F_menu.addMenu( 'Draw',  icon='F_draw2.png' )
F_menu.addCommand( 'Draw/Volet', "nuke.createNode(\"Volet\")" , icon="F_volet.png")

##############################################################
#  TIME
##############################################################
F_menu.addMenu( 'Time', icon='F_time.png' )
##############################################################
F_menu.addCommand( 'Time/TimeCode_F', "nuke.createNode(\"TimeCode_F\")" , icon="F_tcode.png")
F_menu.addCommand( 'Time/FrameRange_Infos', "nuke.createNode(\"FrameRange_Infos\")" , icon="F_framerange_infos.png")
#_____________________________________________________________
Exemple #43
0
import nuke
import os
import random
import dmptools.tf2classes as tf2

NUKE_SHARE = '!NUKE_SHARE!'
TF2CLASSES = tf2.CLASSES
    
# randomly get toolbar icon
iconPrefix = TF2CLASSES.keys()[random.randint(0,len(TF2CLASSES)-1)]
iconTooltip = TF2CLASSES[iconPrefix][random.randint(0,len(TF2CLASSES[iconPrefix])-1)]
iconPath = NUKE_SHARE+'/tf2avatars/'+iconPrefix+'.jpg'

print iconTooltip

m = nuke.toolbar("Nodes").addMenu('dmptools/Misc', tooltip = iconTooltip, icon = iconPath)

# 3D
m.addCommand('3d/Shadow Generator', 'nuke.createNode("shadow_generator")')

# 2D
m.addCommand('2d/Nuke Image Converter...', 'execfile("/usr/people/michael-ha/python/env/nukeImageConverter.py");makeProxyUI()')
m.addCommand('2d/Buf Clone', 'import dmptools.macros.nukeCommands as nukeCommands;nukeCommands.bclone()')
m.addCommand('2d/Connect Selection ', 'import dmptools.macros.nukeCommands as nukeCommands;nukeCommands.connectSel()', "CTRL+Shift+Y")
m.addCommand('2d/Clear Animation', 'import dmptools.macros.nukeCommands as nukeCommands;nukeCommands.clearAnim()')
m.addCommand('2d/Show-Hide inputs', 'import dmptools.macros.nukeCommands as nukeCommands;nukeCommands.hideInputs()',"Alt+T")
m.addCommand('2d/Set Selected or All Read Frame Range...', 'import dmptools.macros.nukeCommands as nukeCommands;nukeCommands.setReadFrameRange()')
m.addCommand('2d/Set frame range from selection', 'import dmptools.macros.nukeCommands as nukeCommands;nukeCommands.setFrameRangeFromSel()', "Ctrl+Shift+R")
m.addCommand('2d/Rename label according the dependance node', 'import dmptools.macros.nukeCommands as nukeCommands;nukeCommands.renameLabel()', "Ctrl+Alt+Shift+R")
m.addCommand('2d/Switch crop format', 'import dmptools.macros.nukeCommands as nukeCommands;nukeCommands.switchCrop()', "Ctrl+Alt+Shift+O")
m.addCommand('2d/Switch 0 - 1', 'import dmptools.macros.nukeCommands as nukeCommands;nukeCommands.switchUV_PROJ()', "Ctrl+Alt+Shift+S")
Exemple #44
-1
def sb_autoAddGizmos(gizmoPath, menuName, subMenuName = "", mainIcon = "", subIcon = ""):

    if not os.path.exists(gizmoPath):
        return

    # Get supported luts.
    allFiles = nuke.getFileNameList(gizmoPath)
    gizmos = []
    for i in allFiles:
        if i.endswith(".gizmo"):
            gizmos.append(i)
    
    if len(gizmos) == 0:
        print "sb_autoAddGizmos: No gizmos found."
        return

    t = nuke.toolbar("Nodes")
    customMenu = t.findItem(menuName)

    if not customMenu:
        customMenu = t.addMenu(menuName, icon = mainIcon)

    if subMenuName:
        customMenu = customMenu.addMenu(subMenuName, icon = subIcon)

    for i in sorted(gizmos):
        gizmoName = os.path.splitext(i)[0].strip()
        gizmoNameFix = gizmoName.replace("_", " ")
        customMenu.addCommand(gizmoNameFix, "nuke.createNode(\"" + gizmoName +"\")")