コード例 #1
0
ファイル: nukedock.py プロジェクト: satandancing/PythonEditor
def setup_dock(shortcut=None):
    """ Register the PythonEditor interface
    as a Nuke docked panel.
    """
    try:
        import nuke
        from nukescripts import PythonPanel, registerPanel
    except ImportError:
        return

    # register the panel manually, expressly for
    # the purpose of redefining the nested addToPane
    # function to take a pane parameter.
    class Panel(PythonPanel):
        def __init__(self, widget, name, _id):
            PythonPanel.__init__(self, name, _id)
            self.custom_knob = nuke.PyCustom_Knob(
                name, '',
                '__import__("nukescripts").panels.WidgetKnob('+widget+')'
            )
            self.addKnob(self.custom_knob)

    widget = '__import__("PythonEditor.ui.ide", fromlist=["IDE"]).IDE'
    name = 'Python Editor'
    _id = 'Python.Editor'
    def add_panel(pane=None):
        return Panel(widget, name, _id).addToPane(pane=pane)

    menu = nuke.menu('Pane')
    menu.addCommand(name, add_panel, shortcut=shortcut)
    registerPanel(_id, add_panel)
コード例 #2
0
ファイル: panels.py プロジェクト: tws0002/Nuke-2
def register(widget, name, widget_id, create=False):
    """registerWidgetAsPanel(widget, name, id, create) -> PythonPanel

      Wraps and registers a widget to be used in a Nuke panel.

      widget - should be a string of the class for the widget
      name - is is the name as it will appear on the Pane menu
      widget_id - should the the unique ID for this widget panel
      create - if this is set to true a new NukePanel will be returned that wraps this widget
    """
    class _Panel(PythonPanel):
        def __init__(self, widget, name, widget_id):
            name_e = get_encoded(name, 'utf-8')
            super(_Panel, self).__init__(name_e, widget_id)
            self.custom_knob = nuke.PyCustom_Knob(
                name_e, "", "__import__('nukescripts').panels.WidgetKnob("
                "__import__('{0.__module__}', globals(), locals(), ['{0.__name__}'])"
                ".{0.__name__})".format(widget))
            self.addKnob(self.custom_knob)

    def _add():
        return _Panel(widget, name, widget_id).addToPane()

    menu = nuke.menu('Pane')
    menu.addCommand(get_encoded(name, 'utf-8'), _add)
    nukescripts.registerPanel(widget_id, _add)

    if create:
        return _Panel(widget, name, widget_id)
コード例 #3
0
def run():
    """Adds the iconPanel panel to the Layout Menu"""
    pane_menu = nuke.menu('Pane')
    pane_menu.addCommand(
        'Universal Icons',
        'iconPanel.IconPanel().addToPane()',
        index=_get_menu_item_index(pane_menu, 'Universal Icons'),
    )
    nukescripts.registerPanel('com.thorium.iconPanel',
                              'iconPanel.IconPanel().addToPane()')
コード例 #4
0
 def doShowFileNameResult(self):
     self.buttonModeType = 2
     errorNameList = []
     errorNameList = self.myCheckFileName()  #检查文件名是否与服务器上相同
     if errorNameList:
         nukescripts.registerPanel('checkFileName', myCheckFile)
         readStr = "\n".join(errorNameList)
         self.textKnob.setValue(readStr)
         #self.show()
         return False
     return True
コード例 #5
0
ファイル: __init__.py プロジェクト: ThoriumGroup/iconPanel
def run():
    """Adds the iconPanel panel to the Layout Menu"""
    pane_menu = nuke.menu('Pane')
    pane_menu.addCommand(
        'Universal Icons',
        'iconPanel.IconPanel().addToPane()',
        index=_get_menu_item_index(pane_menu, 'Universal Icons'),
    )
    nukescripts.registerPanel(
        'com.thorium.iconPanel',
        'iconPanel.IconPanel().addToPane()'
    )
コード例 #6
0
 def doShowFramesResult(self):
     self.buttonModeType = 1
     readStr = ''
     noFileList = {}
     noFileList = self.myCheckFrames()  #检查帧数的完整性
     #缺帧的节点名,路径和帧数
     if noFileList:
         for eachFile in noFileList.keys():
             readStr = eachFile + ':  ' + noFileList[eachFile] + '\n'
         nukescripts.registerPanel('checkFrame', myCheckFile)
         self.textKnob.setValue(readStr)
         #self.show()
         return False
     return True
コード例 #7
0
ファイル: nukedock.py プロジェクト: plasmax/PythonEditor
def setup_dock(shortcut=None):
    """Register the PythonEditor interface
    as a Nuke docked panel.
    """
    import nuke
    from nukescripts import PythonPanel, registerPanel

    # register the panel manually, expressly for
    # the purpose of redefining the nested addToPane
    # function to take a pane parameter.
    class Panel(PythonPanel):
        # This class was previously nested within
        # the nukescripts.registerWidgetAsPanel function.
        def __init__(self, widget, name, _id):
            PythonPanel.__init__(self, name, _id)
            self.custom_knob = nuke.PyCustom_Knob(
                name, '',
                '__import__("nukescripts").panels.WidgetKnob(' + widget + ')')
            self.addKnob(self.custom_knob)

    widget = '__import__("PythonEditor.ui.ide", fromlist=["IDE"]).IDE'
    name = 'Python Editor'
    _id = 'Python.Editor'

    def add_panel(pane=None):
        """Add or move existing PythonEditor
        panel to a new pane. This is what
        makes the PythonEditor a singleton.

        :param pane: Nuke <type 'Dock'>

        TODO: maybe not here, but this should trigger the "in focus" signal that overrides shortcuts
        (me, later: the editor showEvent triggers a ShortcutFocusReason, is this what I meant?)
        """
        import PythonEditor
        try:
            panel = PythonEditor.__dock
        except AttributeError:
            panel = Panel(widget, name, _id)
            PythonEditor.__dock = panel
        return panel.addToPane(pane=pane)

    menu = nuke.menu('Pane')
    menu.addCommand(name, add_panel, shortcut=shortcut)
    registerPanel(_id, add_panel)
コード例 #8
0
ファイル: ratioCalculator.py プロジェクト: jonntd/dmptools
def main():
    nodes = nuke.selectedNodes()

    if len(nodes) == 2:
        camera = [node for node in nodes if node.Class() in ('Camera', 'Camera2')][0]
        
        RatioCalculator(camera, dmp).show()
            
    if len(nodes) == 1:
        camera = [node for node in nodes if node.Class() in ('Camera', 'Camera2')][0]
        dmp = None
        
        RatioCalculator(camera).show()
        
    if len(nodes) == 0 or len(nodes) >= 2:
        nuke.message('please select a Camera node')
        
    nukescripts.registerPanel('ratioCalculator', main)
コード例 #9
0
ファイル: massivePanel.py プロジェクト: gobomus/toolset
                o2= takesInfo.split(",")[1]
                o3= takesInfo.split(",")[2]
                o4= takesInfo.split(",")[3]
                o5= takesInfo.split(",")[4]
                o6= takesInfo.split(",")[5]
                o7= takesInfo.split(",")[6]               
                aa6 = self.Array6.value()
                w['label'].setValue(o1+","+o2+","+o3+","+o4+","+o5+","+aa6+","+o7)

            elif knob == self.Array7:        
                w = nuke.toNode("root")
                takesInfo = nuke.Root().knob('label').getValue()
                o1= takesInfo.split(",")[0]
                o2= takesInfo.split(",")[1]
                o3= takesInfo.split(",")[2]
                o4= takesInfo.split(",")[3]
                o5= takesInfo.split(",")[4]
                o6= takesInfo.split(",")[5]
                o7= takesInfo.split(",")[6]               
                aa7 = self.Array7.value()
                w['label'].setValue(o1+","+o2+","+o3+","+o4+","+o5+","+o6+","+aa7)
                                
                
def addMassivePanel():
    myPanel = MassivePanel()
    return myPanel.addToPane()
paneMenu = nuke.menu('Pane')
paneMenu.addCommand('MassivePanel', addMassivePanel)
nukescripts.registerPanel( 'com.ohufx.MassivePanel', addMassivePanel)

コード例 #10
0
ファイル: addSGnotes.py プロジェクト: tws0002/nukeScripts
            #line=nuke.String_Knob('test','',str(compNotes[nt]))
            #self.addKnob(line)
            ch = nuke.Boolean_Knob(str(nt), str(compNotes[nt]))
            self.addKnob(ch)
            self.checkKnobs[str(nt)] = ch
            ch.setFlag(nuke.STARTLINE)

    def updateNotes(self):
        #setup shotgun
        import shotgun_api3 as shotgun
        SERVER_PATH = "https://psyop.shotgunstudio.com"
        SCRIPT_USER = "******"
        SCRIPT_KEY = "e0078c0e80f09ee7a76de2c25afce6bd34a5bc601f598d446daf6a8e848d9089"
        sg = shotgun.Shotgun(SERVER_PATH, SCRIPT_USER, SCRIPT_KEY)
        for n in self.notes:
            sg.update('Note', int(n), {'sg_status_list': 'clsd'})
        for k in self.knobs():
            if k[0].isdigit():
                self.removeKnob(self.checkKnobs[k])


def addSNPanel():
    global snPanel
    snPanel = ShotgunNotesPanel()
    return snPanel.addToPane()


paneMenu = nuke.menu('Pane')
paneMenu.addCommand('ShotgunNotes', addSNPanel)
nukescripts.registerPanel('mlavoy', addSNPanel)
コード例 #11
0
def dialogNonModalSample():
  # Next, the testPanel function is added to the content menus where it will appear under Pane > Frame Panel.
  menu = nuke.menu( "Pane" )
  menu.addCommand( "Frame Panel", testPanel )
  # Finally, the panel's unique ID is registered for window layout restoration. The testPanel function is called to create the panel that should go into the pane with the unique ID.
  nukescripts.registerPanel( "uk.co.thefoundry.FramePanel", testPanel )
コード例 #12
0
ファイル: searchReplacePanel.py プロジェクト: gobomus/toolset
def regSRPanel():
        nuke.menu('Pane').addCommand('SearchReplace', addSRPanel)
        nukescripts.registerPanel('com.ohufx.SearchReplace', addSRPanel)
コード例 #13
0
##########################################################################################################################################
#######                                                      #############################################################################
#######                   ADD PANNELS                        #############################################################################
#######                                                      #############################################################################
##########################################################################################################################################
##########################################################################################################################################

p = nuke.menu("Pane")
#------------------------------
p.addCommand('-', "", icon="F_toolset.png")
#------------------------------

import BackdropManager
from BackdropManager import addBackdropManager
p.addCommand('Backdrop Manager', addBackdropManager, icon='Backdrop.png')
nukescripts.registerPanel('com.ohufx.Backdrop', addBackdropManager)

#------------------------------

import capture


def addCaptureManager():
    Capture = capture.captureNodePanel()
    return Capture.addToPane()


p.addCommand('ToolSet Manager', addCaptureManager, icon="F_toolset.png")
nukescripts.registerPanel('com.0hufx.Capture', addCaptureManager)

#------------------------------
コード例 #14
0
def regSRPanel():
    nuke.menu('Pane').addCommand('SearchReplace', addSRPanel)
    nukescripts.registerPanel('com.ohufx.SearchReplace', addSRPanel)
コード例 #15
0
            self.__doStuf()
        elif knob is self.optChoice:
            if self.optChoice.value() == 'text':
                self.FILE_Knob.setEnabled(False)
                self.STRING_Knob.setEnabled(True)
            elif self.optChoice.value() == 'image':
                self.FILE_Knob.setEnabled(True)
                self.STRING_Knob.setEnabled(False)

# Code to add the Menu
def addPanel():
    return WatermarkUtilityPanel().addToPane()
 
menu = nuke.menu('Pane')
menu.addCommand('Watermark Utility', addPanel )
nukescripts.registerPanel( 'dushyant.info.WatermarkUtility', addPanel )

# Handy function to create directories for given write node/ can/should be use as pre-render callback 
# But currently is in use while creating the watermark node
def createWriteDirs(in_node):

    baseDir = os.path.dirname( nuke.filename(in_node) )
    viewTokenRE = re.compile( r'%V' )
    if viewTokenRE.search( baseDir ):
        nodeViews = nuke.thisNode()['views'].value().split()
        outDirs = [nuke.filenameFilter(viewTokenRE.sub(v, baseDir)) for v in nodeViews]
    else:
        outDirs = [nuke.filenameFilter(baseDir)]
    for outDir in outDirs:
        if not os.path.exists(outDir):
            print 'Creating output directory: %s' % outDir
コード例 #16
0
ファイル: __init__.py プロジェクト: MaxSteven/snapshotr
# Andrew Savchenko © 2014-2015
# [email protected]
#
# Attribution 4.0 International (CC BY 4.0)
# http://creativecommons.org/licenses/by/4.0/
#
# Developed on OS X and RHEL, should work on random *nix system
#
# ------------------------------------------------

__version__ = "0.2.0"
__release__ = True

import nuke
import nukescripts
import os
from sys import path

snapr_path = os.getenv("HOME") + "/.nuke/snapshotr"
path.append(snapr_path)

if nuke.GUI:

    def addSSpanel():
        import snapshotr_panel
        return snapshotr_panel.ssPanel().addToPane()

    menu = nuke.menu("Pane")
    menu.addCommand("Snapshotr", addSSpanel)
    nukescripts.registerPanel("uk.co.thefoundry.ssPanel", addSSpanel)
コード例 #17
0
ファイル: menu.py プロジェクト: jonntd/dmptools
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')
コード例 #18
0
ファイル: menu.py プロジェクト: manymax21/dmptools
#    TOOLS MENU
#===================

#export nuke to maya
toolbar.addCommand('Tools/Nuke to Maya...', 'import dmptools.tools.exportNukeToMaya as exportNukeToMaya ; exportNukeToMaya.exportToMayaUI()', icon = NUKE_SHARE+'/nukeToMaya.png')
# psd to nuke 
toolbar.addCommand('Tools/Psd to Nuke...', 'import dmptools.tools.psdToNuke as psdToNuke ; psdToNuke.psdToNuke()', icon = NUKE_SHARE+'/psdToNuke.png')
# ratio calculator
toolbar.addCommand('Tools/Ratio calculator...', 'import dmptools.tools.nukeRatioCalculator as nukeRatioCalculator ; nukeRatioCalculator.ratioCalculator()', icon = NUKE_SHARE+'/ratioCalculator.png')
# bake camera projections into uv textures
toolbar.addCommand('Tools/Bake projection to UV...', 'import dmptools.tools.bakeProjToUV as bakeProjToUV ; bakeProjToUV.bakeItUI()', icon = NUKE_SHARE+'/bake.png')
# scanline render manager
sc = ScanlineRenderManager()
pane = nuke.menu("Pane")
pane.addCommand( "scanlineRenderManager", sc.addToPane)
nukescripts.registerPanel('ScanlineRenderManager', sc.addToPane)
toolbar.addCommand('Tools/Scanline Render Manager', sc.show, icon = NUKE_SHARE+'/scanline.png')

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

#2D
# coverage map
toolbar.addCommand('Nodes/2d/Coverage Map', 'nuke.createNode("coverageMap")')
# 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()')
コード例 #19
0
    def create_menu(self):
        """
        Render the entire Shotgun menu.
        """
        # create main menu
        nuke_menu = nuke.menu("Nuke")
        menu_handle = nuke_menu.addMenu(self._menu_name)

        # the right click menu that is displayed when clicking on a pane
        self._pane_menu = nuke.menu("Pane")
        # create tank side menu
        node_menu_handle = nuke.menu("Nodes").addMenu(self._menu_name,
                                                      icon=self.tank_logo)

        # slight hack here but first ensure that the menu is empty
        menu_handle.clearMenu()

        # now add the context item on top of the main menu
        self._context_menu = self._add_context_menu(menu_handle)
        menu_handle.addSeparator()

        # now enumerate all items and create menu objects for them
        menu_items = []
        for (cmd_name, cmd_details) in self._engine.commands.items():
            menu_items.append(AppCommand(cmd_name, cmd_details))

        # sort list of commands in name order
        menu_items.sort(key=lambda x: x.name)

        # now add favourites
        for fav in self._engine.get_setting("menu_favourites"):
            app_instance_name = fav["app_instance"]
            menu_name = fav["name"]

            # scan through all menu items
            for cmd in menu_items:
                if cmd.get_app_instance_name(
                ) == app_instance_name and cmd.name == menu_name:
                    # found our match!
                    cmd.add_command_to_menu(menu_handle)
                    # mark as a favourite item
                    cmd.favourite = True

        menu_handle.addSeparator()

        # now go through all of the menu items.
        # separate them out into various sections
        commands_by_app = {}

        for cmd in menu_items:

            if cmd.get_type() == "node":
                # add to the node menu
                # get icon if specified - default to tank icon if not specified
                icon = cmd.properties.get("icon", self.tank_logo)
                node_menu_handle.addCommand(cmd.name, cmd.callback, icon=icon)

            elif cmd.get_type() == "custom_pane":
                # custom pane
                # add to the std pane menu in nuke
                icon = cmd.properties.get("icon")
                self._pane_menu.addCommand(cmd.name, cmd.callback, icon=icon)
                # also register the panel so that a panel restore command will
                # properly register it on startup or panel profile restore.
                nukescripts.registerPanel(
                    cmd.properties.get("panel_id", "undefined"), cmd.callback)

            elif cmd.get_type() == "context_menu":
                # context menu!
                cmd.add_command_to_menu(self._context_menu)

            else:
                # normal menu
                app_name = cmd.get_app_name()
                if app_name is None:
                    # un-parented app
                    app_name = "Other Items"
                if not app_name in commands_by_app:
                    commands_by_app[app_name] = []
                commands_by_app[app_name].append(cmd)

        # now add all apps to main menu
        self._add_app_menu(commands_by_app, menu_handle)
コード例 #20
0
ファイル: menu.py プロジェクト: simonjokuschies/nuke
import nuke
import nukePluginManager
import nukescripts

nuke.menu('Pane').addCommand('Nuke Plugin Manager', nukePluginManager.addPMPanel)
nukescripts.registerPanel('com.ohufx.pluginManager', nukePluginManager.addPMPanel)
nukePluginManager.init()

コード例 #21
0
ファイル: menu_generation.py プロジェクト: baitstudio/tk-nuke
    def create_menu(self):
        """
        Render the entire Shotgun menu.
        """
        # create main menu
        nuke_menu = nuke.menu("Nuke")
        menu_handle = nuke_menu.addMenu(self._menu_name) 
        
        # the right click menu that is displayed when clicking on a pane 
        self._pane_menu = nuke.menu("Pane") 
        # create tank side menu
        node_menu_handle = nuke.menu("Nodes").addMenu(self._menu_name, icon=self.tank_logo)

        # slight hack here but first ensure that the menu is empty
        menu_handle.clearMenu()
    
    
        
        # now add the context item on top of the main menu
        self._context_menu = self._add_context_menu(menu_handle)
        menu_handle.addSeparator()

        # now enumerate all items and create menu objects for them
        menu_items = []
        for (cmd_name, cmd_details) in self._engine.commands.items():
             menu_items.append( AppCommand(cmd_name, cmd_details) )

        # sort list of commands in name order
        menu_items.sort(key=lambda x: x.name)

        # now add favourites
        for fav in self._engine.get_setting("menu_favourites"):
            app_instance_name = fav["app_instance"]
            menu_name = fav["name"]
            
            # scan through all menu items
            for cmd in menu_items:                 
                 if cmd.get_app_instance_name() == app_instance_name and cmd.name == menu_name:
                     # found our match!
                     cmd.add_command_to_menu(menu_handle)
                     # mark as a favourite item
                     cmd.favourite = True            

        menu_handle.addSeparator()
        
        
        # now go through all of the menu items.
        # separate them out into various sections
        commands_by_app = {}
        
        for cmd in menu_items:
                        
            if cmd.get_type() == "node":
                # add to the node menu
                # get icon if specified - default to tank icon if not specified
                icon = cmd.properties.get("icon", self.tank_logo)
                node_menu_handle.addCommand(cmd.name, cmd.callback, icon=icon)
                
            elif cmd.get_type() == "custom_pane":
                # custom pane
                # add to the std pane menu in nuke
                icon = cmd.properties.get("icon")
                self._pane_menu.addCommand(cmd.name, cmd.callback, icon=icon)
                # also register the panel so that a panel restore command will
                # properly register it on startup or panel profile restore.
                nukescripts.registerPanel(cmd.properties.get("panel_id", "undefined"), cmd.callback)
                
            elif cmd.get_type() == "context_menu":
                # context menu!
                cmd.add_command_to_menu(self._context_menu)
                
            else:
                # normal menu
                app_name = cmd.get_app_name()
                if app_name is None:
                    # un-parented app
                    app_name = "Other Items" 
                if not app_name in commands_by_app:
                    commands_by_app[app_name] = []
                commands_by_app[app_name].append(cmd)
        
        # now add all apps to main menu
        self._add_app_menu(commands_by_app, menu_handle)
コード例 #22
0
def addPanelToPane():
    paneMenu = nuke.menu('Pane')
    paneMenu.addCommand('GQ_Tools', addPanel)
    nukescripts.registerPanel('com.ohufx.GQ_Tools', addPanel)
コード例 #23
0
ファイル: diskcache.py プロジェクト: RonThomas/nuke.env
      
  
      
  # Work out the Cache Limit set in Bytes
  totalDiskCacheBytes = totalDiskCacheGB*pow(1024,3)
  # Percentage Cache Used
  diskCachePerc = ((diskCachedBytes-paintCachedBytes)/totalDiskCacheBytes)*100
  
  return diskCachePerc
  

# Method to update the sliders
def updateSliders(self):
  self.bufferReport.setValue(str(nukescripts.cache_report(str())))  
  if nuke.env['NukeVersionMajor']==5:
    percs = getDiskCachePerc5()
    self.diskCachePercUsed.setValue(percs)
  else:
    percs = getDiskCachePerc6()
    self.diskCachePercUsed.setValue(percs[0])
    self.paintCachePercUsed.setValue(percs[1]) 


  
#menu = nuke.menu('Pane')
#menu.addCommand('DiskCache',addPanel)
#nukescripts.registerPanel('uk.co.thefoundry.DiskCache', addPanel)

nuke.menu('Pane').addCommand('DiskCache', addPanel)
nukescripts.registerPanel('uk.co.thefoundry.DiskCache', addPanel)
コード例 #24
0
            else:
                workersPerSlave = int(int(numSlavesWorkers) / int(numSlaves))
            numHostWorkers = len(frameServerWorkers()[0])

            self.slavesWorkers.setValue(slavesWorkers)
            self.hostWorkers.setValue(hostWorkers)
            self.slavesRunning.setValue(slavesRunning)
            self.numOfSlaves.setValue(numSlaves)
            self.numOfWorkers.setValue(numSlavesWorkers)
            self.workersPerSlave.setValue(workersPerSlave)
            self.hostRunning.setValue(numHostWorkers)

        elif knob is self.showCommand:
            # copyFScommand()
            clipboard = QtWidgets.QApplication.clipboard()
            clipboard.setText(
                'from hiero.ui.nuke_bridge.FnNsFrameServer import frameServer\nprint [worker.address for worker in frameServer.getStatus(1).workerStatus]'
            )


# register panel
def addFSpanel():
    global FSpanel
    FSpanel = FrameServerStatus()
    return FSpanel.addToPane()


paneMenu = nuke.menu('Pane')
paneMenu.addCommand('Frame Server Status', addFSpanel)
nukescripts.registerPanel('FSPanel', addFSpanel)
コード例 #25
0
ファイル: menu.py プロジェクト: vfxwiki/nuke
import nuke
import nukePluginManager
import nukescripts

nuke.menu('Pane').addCommand('Nuke Plugin Manager',
                             nukePluginManager.addPMPanel)
nukescripts.registerPanel('com.ohufx.pluginManager',
                          nukePluginManager.addPMPanel)
nukePluginManager.init()
コード例 #26
0
ファイル: pipelNukeMenu.py プロジェクト: skarone/PipeL
nuke.addOnUserCreate( nuk.general.read.createVersionKnobs, nodeClass='Read' )
nuke.addKnobChanged( nuk.general.read.updateVersionKnob, nodeClass='Read' )

nuke.addOnScriptLoad( nuk.general.read.checkVersions )
nuke.addOnScriptSave( nuk.general.read.checkVersions )
"""
import nuk.general.read
import nuke
nuke.removeOnScriptLoad(nuk.general.read.checkVersions)
nuke.removeOnScriptSave(nuk.general.read.checkVersions)
"""

def mergeColor():
	n = nuke.thisNode()
	k = nuke.thisKnob()
	if k.name() == "mix":
		v = k.value()
		green = v
		red = 1 - int(v)
		r = red
		g = green
		b = 0
		hexColour = int('%02x%02x%02x%02x' % (r*255,g*255,b*255,1),16)
		n["tile_color"].setValue(hexColour)

nuke.addKnobChanged(mergeColor, nodeClass="Merge2")
 
#THIS LINE WILL REGISTER THE PANEL SO IT CAN BE RESTORED WITH LAYOUTS
nukescripts.registerPanel('com.ohufx.SearchReplace', addSRPanel)
コード例 #27
0
ファイル: getFilePath.py プロジェクト: jonntd/dmptools
def printPath():
    """return a panel with the path of the selected nodes"""
    nukescripts.registerPanel( 'printpath', printPath)
    PrintPath().show()
コード例 #28
0
            if self.optChoice.value() == 'text':
                self.FILE_Knob.setEnabled(False)
                self.STRING_Knob.setEnabled(True)
            elif self.optChoice.value() == 'image':
                self.FILE_Knob.setEnabled(True)
                self.STRING_Knob.setEnabled(False)


# Code to add the Menu
def addPanel():
    return WatermarkUtilityPanel().addToPane()


menu = nuke.menu('Pane')
menu.addCommand('Watermark Utility', addPanel)
nukescripts.registerPanel('dushyant.info.WatermarkUtility', addPanel)


# Handy function to create directories for given write node/ can/should be use as pre-render callback
# But currently is in use while creating the watermark node
def createWriteDirs(in_node):

    baseDir = os.path.dirname(nuke.filename(in_node))
    viewTokenRE = re.compile(r'%V')
    if viewTokenRE.search(baseDir):
        nodeViews = nuke.thisNode()['views'].value().split()
        outDirs = [
            nuke.filenameFilter(viewTokenRE.sub(v, baseDir)) for v in nodeViews
        ]
    else:
        outDirs = [nuke.filenameFilter(baseDir)]
コード例 #29
0
ファイル: menu.py プロジェクト: vfx-engineering/openslate
    		print response_text

	    	# return where the file is stored
	    	# add this information to the read node

	    	json_response = json.loads(response_text)
	    	print json_response["slatepath"]
	    	slatepath = json_response["slatepath"]

	    	## Lets say the response is cool
	    	selectedWriteNode = nuke.selectedNode()
	    	parentNode = selectedWriteNode.input(0)
	    	
	    	read1 = nuke.nodes.Read(file=slatepath,last=self.slateduration.value())
	    	appc1 = nuke.nodes.AppendClip(inputs=[read1, parentNode])
	    	selectedWriteNode.setInput(0,appc1)

	    	read1.autoplace()
	    	appc1.autoplace()
	    	parentNode.autoplace()
	    	selectedWriteNode.autoplace()


def InitPanel():
  return OpenSlatePanel().addToPane()
# Next, the testPanel function is added to the content menus where it will appear under Pane > Frame Panel.
menu = nuke.menu( "Pane" )
menu.addCommand( "Open Slate", InitPanel )
# Finally, the panels unique ID is registered for window layout restoration.
nukescripts.registerPanel( "engineering.vfx.projects.openslate", InitPanel )
コード例 #30
0
ファイル: readMyScript.py プロジェクト: y0ta/readMyScript
					name = i.name()
					self.dicModif[name] = self.goodColor
		else:
			nuke.message('please select a node')
		#Store Data
		self.edit(0)

	def Disable(self):
		self.edit(1)
		for i in nuke.allNodes():
			name = i.name()
			if i.knob('disable'):
				select = i['disable'].value()
				if select:
					self.dicModif[name] = self.goodColor
				else:
					self.dicModif[name] = self.darkColor
			else:
				self.dicModif[name] = self.darkColor
		#Store Data
		self.edit(0)

def add_RmsPanel():
	global Rms
	Rms = Rms()
	return Rms.addToPane()

paneMenu = nuke.menu( 'Pane' )
paneMenu.addCommand( 'Rms', add_RmsPanel )
nukescripts.registerPanel('com.romainbouvard.Rms', add_RmsPanel )
コード例 #31
0
ファイル: menu.py プロジェクト: luckyspacetraveller/LukeTools
import labelConnector
nuke.menu('Nuke').addCommand('Luke/Label connector',
                             "labelConnector.runLabelMatch()", 'ctrl+shift+y')

import AnimationMaker

import W_hotbox, W_hotboxManager

import SearchReplacePanel


def addSRPanel():
    '''Run the panel script and add it as a tab into the pane it is called from'''
    myPanel = SearchReplacePanel.SearchReplacePanel()
    return myPanel.addToPane()


nuke.menu('Pane').addCommand('SearchReplace', addSRPanel)
nukescripts.registerPanel('com.ohufx.SearchReplace', addSRPanel)

import knob_scripter

import RetimeCamera
nuke.menu('Nuke').addCommand('Luke/Retime Camera',
                             'RetimeCamera.create_RCPanel()')

import ColorGradientUi

import L_ToolSets
L_ToolSets.createToolsetsMenu(nuke.menu("Nodes"))
コード例 #32
0
# -*- coding: utf-8 -*-
# --------------------------------------------------------------
# Estimator: calculate space occupied by files presented in script
#
# Andrew Savchenko © 2015
# [email protected]
#
# Attribution 4.0 International (CC BY 4.0)
# https://creativecommons.org/licenses/by/4.0/
#
# Developed on OSX, should work on random *nix system
# --------------------------------------------------------------
__version__ = "0.1.2"
__release__ = True

import nuke
import nukescripts

if nuke.GUI:
    from estimator_panel import estimatorPanel
    def addPanel():
        return estimatorPanel().addToPane()

if nuke.GUI:
    menu = nuke.menu("Pane")
    menu.addCommand("Estimator", addPanel)
    nukescripts.registerPanel(
        "uk.co.thefoundry.estimatorPanel", addPanel)
コード例 #33
0
ファイル: diskcache.py プロジェクト: z199416/nuke.env
            filename = os.path.join(path, file)
            paintCachedBytes += os.path.getsize(filename)

    # Work out the Cache Limit set in Bytes
    totalDiskCacheBytes = totalDiskCacheGB * pow(1024, 3)
    # Percentage Cache Used
    diskCachePerc = (
        (diskCachedBytes - paintCachedBytes) / totalDiskCacheBytes) * 100

    return diskCachePerc


# Method to update the sliders
def updateSliders(self):
    self.bufferReport.setValue(str(nukescripts.cache_report(str())))
    if nuke.env['NukeVersionMajor'] == 5:
        percs = getDiskCachePerc5()
        self.diskCachePercUsed.setValue(percs)
    else:
        percs = getDiskCachePerc6()
        self.diskCachePercUsed.setValue(percs[0])
        self.paintCachePercUsed.setValue(percs[1])


#menu = nuke.menu('Pane')
#menu.addCommand('DiskCache',addPanel)
#nukescripts.registerPanel('uk.co.thefoundry.DiskCache', addPanel)

nuke.menu('Pane').addCommand('DiskCache', addPanel)
nukescripts.registerPanel('uk.co.thefoundry.DiskCache', addPanel)
コード例 #34
0
import nuke
import nukescripts


class FramePanel(nukescripts.PythonPanel):
    def __init__(self):
        nukescripts.PythonPanel.__init__(self, "Go to Frame", "uk.co.thefoundry.FramePanel")
        self.frame = nuke.Int_Knob("frame", "Frame:")
        self.addKnob(self.frame)
        self.frame.setValue(nuke.frame())

    def knobChanged(self, knob):
        if knob == self.frame:
            nuke.frame(self.frame.value())


def testPanel():
    return FramePanel().addToPane()


menu = nuke.menu("Pane")
menu.addCommand("Frame Panel", testPanel)
nukescripts.registerPanel("uk.co.thefoundry.FramePanel", testPanel)
コード例 #35
0
ファイル: menu.py プロジェクト: hasielhassan/assetManager
import os
import nuke
import nukescripts
import autowrite
import browseDir
import SubmitToDeadline


## Loading asset manager
nuke.load("manager")
nuke.load("panel")

nuke.load ("environment")

def addManagementPanel():
    return assetManagerPanel().addToPane()

menu = nuke.menu('Pane')
menu.addCommand('Project Management Settings', addManagementPanel)
nukescripts.registerPanel( 'assetpanel', addManagementPanel)


# Browse Directory
nuke.menu( 'Nuke' ).addCommand( 'Scripts/Browse/Node\'s file path', "browseDir.browseDirByNode()", 'shift+b' )



## Submit to Deadline
tb = menubar.addMenu("&Submit") 
tb.addCommand("Submit To Deadline", SubmitToDeadline.main, "")
コード例 #36
0
ファイル: moduleUpdater.py プロジェクト: kuchinal/lamakaha
                # attempt to find out whether module is a panel
                try:
                    moduleSource = inspect.getsource(sys.modules.get(module))
                except:
                    nuke.message(
                        "Could not read the module. Please check whether the python file still exists or restart Nuke (Module Updater always shows the currently loaded modules)."
                    )
                    return

                if "PythonPanel" in moduleSource or "QWidget" in moduleSource:
                    self.function.setValue("Panel? (Leave this if it is)")
                elif len(strFunctions) == 1:
                    self.function.setValue(strFunctions[0])
                elif strFunctions == []:
                    self.function.setValue("No executable function found")

                # reset currently selected function list item to first one
                self.functionList.setValue(0)

        self.saveSettings()


def createModuleUpdater():
    return moduleUpdater().addToPane()


menu = nuke.menu("Pane")
menu.addCommand("Module Updater", createModuleUpdater)
nukescripts.registerPanel("uk.co.thefoundry.moduleUpdater",
                          createModuleUpdater)