Example #1
0
def buildUserPresetDeletePanel():
    presets = []
    presets = nuke.getUserPresets()
    if presets == []:
        nuke.message("No user presets defined.")
    else:
        UserPresetsDeletePanel().showModalDialog()
Example #2
0
    def __init__(self):
        nukescripts.PythonPanel.__init__(self, 'Delete User Preset',
                                         'uk.co.thefoundry.DeleteUserPreset')
        self.presets = []
        self.presets = nuke.getUserPresets()

        self.menuItemChoice = nuke.Enumeration_Knob('menuItemChoice',
                                                    'Menu item', self.presets)
        self.okButton = nuke.PyScript_Knob('delete', 'Delete')
        self.okButton.setFlag(0x00001000)
        self.cancelButton = nuke.PyScript_Knob('cancel', 'Cancel')

        # ADD KNOBS
        self.addKnob(self.menuItemChoice)
        self.addKnob(self.okButton)
        self.addKnob(self.cancelButton)
Example #3
0
def populatePresetsMenu(nodeName, className):
    knobValues = {}
    node = nuke.toNode(nodeName)
    m = nuke.getPresetsMenu(node)
    # reset the menus in case of preset deletion
    m.clearMenu()
    presets = []
    userpresets = []
    userpresets = nuke.getUserPresets(node)
    presets = nuke.getPresets(node)
    allpresets = userpresets + presets

    buildSavePanelFunc = lambda node=node: nukescripts.buildPresetSavePanel(
        "", node)
    m.addCommand("Save as Preset", buildSavePanelFunc)

    if allpresets != []:
        m.addCommand("-", "", "")
        for k in userpresets:
            f = lambda node=node, k=k: nuke.applyUserPreset("", k, node)
            m.addCommand('[User] ' + k, f)
        for k in presets:
            f = lambda node=node, k=k: nuke.applyPreset("", k, node)
            m.addCommand(k, f)
    if allpresets != []:
        m.addCommand("-", "", "")
        n = m.addMenu("Delete Preset")
        for k in userpresets:
            n.addCommand(
                '[User] ' + k,
                'nukescripts.deleteUserNodePreset("%s", "%s")\n' %
                (className, k))
        for k in presets:
            n.addCommand(
                k,
                'nukescripts.deleteNodePreset("%s", "%s")\n' % (className, k))