def build_srcMenu(self, *a): cmd.setParent(a[0], menu=True) cmd.menu(a[0], e=True, dai=True) cmd.menuItem(l='Add Selected Objects', c=self.on_addSrc) cmd.menuItem(l='Replace With Selected Objects', c=self.on_replaceSrc) cmd.menuItem(d=True) cmd.menuItem(l='Remove Highlighted Item', c=self.on_removeSrcItem) cmd.menuItem(d=True) cmd.menuItem(l='Select All Objects', c=self.on_selectAllSrc) cmd.menuItem(d=True) cmd.menuItem(l='Save Mapping...', c=self.on_saveMapping) cmd.menuItem(l='Load Mapping...', sm=True) pm = presets.PresetManager(TOOL_NAME, EXT) presetDict = pm.listAllPresets(True) for loc in presets.LOCAL, presets.GLOBAL: for f in presetDict[loc]: cmd.menuItem(l=f.name(), c=Callback(self.loadMappingFile, f.path())) cmd.menuItem(d=True) cmd.menuItem( l='Manage Mappings...', c=lambda *x: presetsUI.load(TOOL_NAME, presets.LOCAL, EXT)) cmd.setParent('..', menu=True) cmd.menuItem(d=True) cmd.menuItem(l='Swap Mapping', c=self.on_swap)
def __init__( self, parent, tool, extension, *a, **kw ): MelOptionMenu.__init__( self, parent, *a, **kw ) self.setChangeCB( self.on_change ) self._manager = presets.PresetManager( tool, extension ) self._presets = {} self.update()
def __init__( self, parent, tool, locale=presets.LOCAL, ext=presets.DEFAULT_XTN ): MelFormLayout.__init__( self, parent ) self.tool = tool self.locale = locale self.ext = ext self.presetManager = presets.PresetManager(tool, ext) self.populate()
import maya.cmds as cmd from zooPy import sobject from zooPy import presets from zooPyMaya import triggered from zooPyMaya import mappingUtils TOOL_NAME = presets.DEFAULT_TOOL XTN = 'trigger' PRESET_MANAGER = presets.PresetManager( TOOL_NAME, XTN ) def writeToPreset( presetName, triggers=None ): thePreset = presets.Preset( presets.LOCAL, TOOL_NAME, presetName, XTN ) writeToFilepath( thePreset.path(), triggers ) return thePreset def writeToFilepath( filepath, triggers=None ): if triggers is None: triggers = triggered.Trigger.All( True, True ) root = sobject.SObject() root.triggerDict = triggerDict = {} #store all the nodes that are used by the triggers - both the trigger nodes themselves and all connects allNodes = set()
def __init__(self): self._presetManager = presets.PresetManager(TOOL_NAME)