Example #1
0
    def __init__(self):
        nukescripts.PythonPanel.__init__(self, 'Create ToolSet',
                                         'uk.co.thefoundry.CreateToolset')

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

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

        # ADD KNOBS
        self.addKnob(self.menuItemChoice)
        self.addKnob(self.menuPath)
        self.addKnob(self.okButton)
        self.addKnob(self.cancelButton)
    def __init__(self, fullFilePath, rename):

        self.rename = rename
        self.fullFilePath = fullFilePath

        if rename == False:
            self.namePanel = 'Create ToolSet'
            self.nameOkButton = 'Create'
        else:
            self.namePanel = 'Rename ToolSet'
            self.nameOkButton = 'Rename'

        nukescripts.PythonPanel.__init__(self, self.namePanel,
                                         'uk.co.thefoundry.Toolset')

        # CREATE KNOBS
        self.userFolders = []
        fullPath = SHARED_TOOLSET_PATH
        self.buildFolderList(fullPath, '')

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

        # ADD KNOBS
        self.addKnob(self.menuItemChoice)
        self.addKnob(self.menuPath)
        self.addKnob(self.okButton)
        self.addKnob(self.cancelButton)
        self.addKnob(self.space)
        self.addKnob(self.infoText)

        if rename == True:
            toolSetPath = fullFilePath.replace(SHARED_TOOLSET_PATH + "/", '')
            toolSetPath = toolSetPath.replace(".nk", '')
            self.menuPath.setValue(toolSetPath)
Example #3
0
    def __init__(self):
        nukescripts.PythonPanel.__init__(self, 'Select a colorspace')
        sel = nuke.selectedNodes(filter='Read')

        # Read list of available colorspaces from first read node. Probably a better way to do this
        self.cs_list = sel[0]['colorspace'].values()
        self.cs_knob = nuke.CascadingEnumeration_Knob('out_cs', 'target colorspace: ', self.cs_list)
        self.raw_knob = nuke.Boolean_Knob('out_raw', 'RAW')
        self.raw_knob.setFlag(nuke.STARTLINE)
        self.addKnob(self.cs_knob)
        self.addKnob(self.raw_knob)
def _add_auto_name_knobs(node):
    auto_ext_konb = nuke.CascadingEnumeration_Knob(
        'dayu_write_ext_list', 'format',
        ['.exr', '.dpx', '.tif', '.png', '.jpg', '.mov'])
    auto_ext_konb.setFlag(0x1000)
    node.addKnob(auto_ext_konb)
    user_sub_level_knob = nuke.EvalString_Knob('dayu_write_user_sub_level',
                                               'Sub Level')
    user_sub_level_knob.setFlag(0x1000)
    node.addKnob(user_sub_level_knob)
    button_knob = nuke.PyScript_Knob('dayu_write_auto_name', 'Auto Rename')
    button_knob.setFlag(0x1000)
    node.addKnob(button_knob)
Example #5
0
    def __init__(self, node):
        self.node = node

        # Loop through and find all user folders
        userFolder = getNukeUserFolder()
        newFileList = []
        if userFolder != None:
            userFolder = os.path.join(userFolder, "NodePresets")
            fileList = buildPresetFileList(userFolder)

            for file in fileList:
                # We need to convert these absolute filenames into items that can be passed to a cascading enumeration knob.
                # First strip the nuke user folder path from the start
                newFileName = file[len(str(userFolder)):].replace("\\", "/")

                # Now strip the "/user_presets.py" part from the end
                endSize = 16

                if len(newFileName) > endSize:
                    newFileName = newFileName[:len(newFileName) - endSize]

                if newFileName != "/user_presets.py":
                    if newFileName[:1] == '/':
                        newFileName = newFileName[1:]
                    newFileList.append(newFileName)

        nukescripts.PythonPanel.__init__(self, 'Create Node Preset',
                                         'uk.co.thefoundry.CreateNodePreset')

        self.menuItemChoice = nuke.CascadingEnumeration_Knob(
            'menuItemChoice', 'Presets menu', ['root'] + newFileList)
        self.menuItemChoice.setTooltip(
            "The menu location that the Preset will appear in. Specify 'root' to place the Preset in the main Presets menu."
        )
        self.menuPath = nuke.String_Knob('presetname', 'Name:')
        self.menuPath.setFlag(0x00001000)
        self.okButton = nuke.PyScript_Knob('create', 'Create')
        self.okButton.setFlag(0x00001000)
        self.cancelButton = nuke.PyScript_Knob('cancel', 'Cancel')

        # ADD KNOBS
        self.addKnob(self.menuItemChoice)
        self.addKnob(self.menuPath)
        self.addKnob(self.okButton)
        self.addKnob(self.cancelButton)