def popup_sets( self, parent, *args ): cmd.setParent(parent, m=True) cmd.menu(parent, e=True, dai=True) items = self.selection() addEazel = cmd.optionVar(q='zooVisManEazel') if cmd.optionVar(ex='zooVisManEazel') else True enable = bool(items) cmd.menuItem(en=enable, l="+ selection to vis set", c=self.on_add) cmd.menuItem(en=enable, l="- selection from vis set", c=self.on_remove) cmd.menuItem(en=enable, l="select items in vis set", c=self.on_set_select) cmd.menuItem(en=enable, l="parent to...", c=self.on_reparent) cmd.menuItem(d=True) cmd.menuItem(l="new vis set", c=self.on_new) cmd.menuItem(en=enable, l="remove vis set", c=self.on_delete) cmd.menuItem(d=True) cmd.menuItem(l="always show eazel", cb=addEazel, c=self.on_eazel) cmd.menuItem(d=True) cmd.menuItem(l="merge all sets (nasty hack)", c="mel.hackyMergeSets()") cmd.menuItem(l="add faces affected by joint", c=self.on_joint_affected_faces) cmd.menuItem(l="add faces affected by joint heirarchy", c=self.on_joint_affected_faces) cmd.menuItem(d=True) #build the preset list... visPresets = presetsUI.listAllPresets( visManager.TOOL_NAME, visManager.EXTENSION, True ) cmd.menuItem(l="build sets from preset", sm=True) for locale, pList in visPresets.iteritems(): for p in pList: cmd.menuItem(l=p.name(), c=Callback(self.import_preset, p.name(), locale, True, True)) cmd.setParent('..', m=True) cmd.menuItem(l="import preset volumes", sm=True) for locale, pList in visPresets.iteritems(): for p in pList: cmd.menuItem(l=p.name(), c=Callback(self.import_preset, p.name(), locale, False, False)) cmd.setParent('..', m=True) selected = cmd.ls(sl=True) cmd.menuItem(en=len(selected)==1, l="export volume preset", c=self.export_preset) cmd.menuItem(l="manage presets", c=lambda *x: presetsUI.load(visManager.TOOL_NAME, visManager.DEFAULT_LOCALE, visManager.EXTENSION)) cmd.menuItem(d=True) cmd.menuItem(l='create sphere volume', c=lambda *x: assets.createExportVolume(assets.ExportManager.kVOLUME_SPHERE)) cmd.menuItem(l='create cube volume', c=lambda *x: assets.createExportVolume(assets.ExportManager.kVOLUME_CUBE))
def popup_filterPresets( self, parent, *args ): cmd.setParent( parent, m=True ) cmd.menu( parent, e=True, dai=True ) hasItems = False allFilterPresets = presetsUI.listAllPresets( PRESET_ID_STR, PRESET_EXTENSION ) for locale, filterPresets in allFilterPresets.iteritems(): for item in filterPresets: itemName = item.name() cmd.menuItem( l=itemName, c=Callback( self.setFilter, itemName ) ) hasItems = True if hasItems: cmd.menuItem( d=True ) cmd.menuItem( l='clear', c=Callback( self.setFilter, '' ) ) if self.getFilter(): cmd.menuItem( d=True ) cmd.menuItem( l='save filter preset', c=self.on_filterSave ) cmd.menuItem( l='manager filter presets', c=self.on_filterManage )