def insert_script_editor_ui(self, *args): if pmc.window(self.script_panel + "Window", exists=True): pmc.deleteUI(self.script_panel + "Window", window=True) pmc.scriptedPanel(self.script_panel, e=True, unParent=True) pmc.scriptedPanel(self.script_panel, e=True, parent=self.form_scriptEditor) marge = 1 pmc.formLayout(self.form_scriptEditor, edit=True, attachForm=[ (self.script_panel, "top", marge), (self.script_panel, "left", marge), (self.script_panel, "right", marge), (self.script_panel, "bottom", marge), ], )
def __init__(self): title = 'pbUV' ver = '1.00' if pm.window('pbUV', exists=True): pm.deleteUI('pbUV') window = pm.window('pbUV', s=True, title='{0} | {1}'.format(title, ver)) try: pane = pm.paneLayout('textureEditorPanel', paneSize=[1, 1, 1], cn='vertical2', swp=1) except: pane = pm.paneLayout('textureEditorPanel', paneSize=[1, 1, 1], cn='vertical2') uvtextureviews = pm.getPanel(scriptType='polyTexturePlacementPanel') if len(uvtextureviews): pm.scriptedPanel(uvtextureviews[0], e=True, unParent=True) with pm.columnLayout(p=pane): TransformUI() opts = GlobalOptions() SetEditorUI() DensityUI(opts) SnapshotUI(opts) pm.scriptedPanel(uvtextureviews[0], e=True, parent=pane) # Replace Default UV Editor Toolbar flowlayout = pm.melGlobals['gUVTexEditToolBar'] framelayout = pm.flowLayout(flowlayout, q=True, p=True) framelayout = pm.uitypes.FrameLayout(framelayout) pm.deleteUI(flowlayout) flowlayout = pm.flowLayout(p=framelayout) Tools01UI(flowlayout) CutSewUI(flowlayout) UnfoldUI(flowlayout) AlignUI(flowlayout) PushUI(flowlayout) SnapUI(flowlayout) LayoutUI(flowlayout) IsolateUI(flowlayout, uvtextureviews[0]) Opts01UI(flowlayout, uvtextureviews[0]) Opts02UI(flowlayout, uvtextureviews[0]) Opts03UI(flowlayout, uvtextureviews[0]) ManipUI(flowlayout) window.show()
def _delete_existing_uis(self): """ """ # Delete main window, if it exists if pm.window(self.name, exists=True): pm.deleteUI(self.name, window=True) ''' # Delete Dock Control, if it exists # Remove special characters from title dock_name = self.title special_chars = [' ', '.'] for char in special_chars: dock_name = dock_name.replace(char, '_') if pm.dockControl(dock_name, exists=True): pm.deleteUI(dock_name, control=True) ''' # Delete Scripted Panel (graphEditor), if it exists if pm.scriptedPanel(self.graph_editor, exists=True): pm.deleteUI(self.graph_editor, panel=True) # Delete keyable attribute filter from the outlinerEditor if pm.objExists(KEYABLE_ATTR_FILTER_NAME): pm.delete(KEYABLE_ATTR_FILTER_NAME)
def __init__(self, instance, windowObj, namespace=__name__): """install event monitoring""" self._UIobject = windowObj self._module = namespace self.__name__ = instance self._instance = str(self._module) + '.' + self.__name__ if windowObj is None: print "UI Element does not exist: %s" % UIpath return else: if not mel.scriptedPanel (windowObj.__name__, exists=True): return control = mel.scriptedPanel (windowObj.__name__, q=True, control=True) print "Panel Name: %s" % control mel.setParent (control) parent = str(mel.setParent (upLevel=True)) # list maya events scriptJobs = mel.scriptJob(listEvents=True) jobIdList = [] for job in scriptJobs: # create alerts for all events except the "idle*" events if "idle" not in job: jobId = mel.scriptJob(p=parent, e=[job, "%s._eventCallup('%s','%s')" % (self._instance, str(job), windowObj.__name__)]) jobIdList.append(jobId) else: jobIdList.append(0) # assign events as keys with id's # load global eventID self.eventID = dict(zip(scriptJobs,jobIdList)) for (key,value) in self.eventID.iteritems(): print "Key: %30s Value: %d" % (key, value)
def bdItemClicked(self,item): pm.select(str(item.text())) selectedNode = pm.ls(selection=True)[0] selectedConnections = selectedNode.connections() pmNames = [pmNode.name() for pmNode in selectedConnections] self.unConListView.clear() self.unConListView.addItems(pmNames) nodeEditor = pm.scriptedPanel(type="nodeEditorPanel", label="Node Editor")
def show( self ): #mel.scriptedPanel( self._title, edit=True, tearOff=True ) print "SHOW PANEL" # print "self?: %s" % self.__name__ if not mel.window(self._wName, exists=True ): print "fenster existiert nicht: %s" % self._wName try: wPanel = mel.scriptedPanel( self.__name__, mbv=self._optionShowMenue, unParent=True, type=self.__name__, label=self._title ) except: pLabel = mel.panel( self.__name__, query=True, label=True ) wPanel = mel.scriptedPanel( self.__name__, edit=True, label=pLabel ) self._wName = mel.window( self._title, t=self.windowTitle ) wFrame = mel.frameLayout( self.panelWrapName, l=self.panelLabel ,lv=True, bv=True ) ## get external definitions # print "Frame Name %s" % wFrame #panelParent = (wName+'|'+wFrame) self.panelParent = wFrame mel.scriptedPanel( wPanel, e=True, parent=self.panelParent) self.panelUIpath = mel.scriptedPanel( self.__name__, q=True, control=True ) mel.showWindow(self._wName)
def _build_graph_editor_pane(self, parent_layout): """ """ garph_editor_formLayout = pm.formLayout() pm.scriptedPanel(self.graph_editor, type='graphEditor') # Initialize custom selectionConnection for only FIZ nodes outliner_selectionConnection = pm.selectionConnection() # Create a custom outlineEditor and assign our mainListConnection # This way, the mFIZ outliner will only show mFIZ nodes oulineEditor_name = self.graph_editor + 'OutlineEd' pm.outlinerEditor( oulineEditor_name, # scriptedPanel name + 'OutlineEd' found with pm.lsUI(editors=True) edit=True, mainListConnection=outliner_selectionConnection) pm.formLayout(garph_editor_formLayout, edit=True, attachForm=[(self.graph_editor, "top", 3), (self.graph_editor, "bottom", 3), (self.graph_editor, "left", 3), (self.graph_editor, "right", 3)]) pm.setParent(parent_layout) # Set a 'keyable' filter on the outlineEditor to only show keyable attributes keyable_attr_filter = pm.itemFilterAttr(KEYABLE_ATTR_FILTER_NAME, keyable=True) pm.outlinerEditor(oulineEditor_name, edit=True, attrFilter=keyable_attr_filter) # Create a selectionConnection # sel_con = pm.selectionConnection(activeList=True, mainListConnection= # Store the selectionConnections to an instance attribute self.outliner_selection_connection = outliner_selectionConnection
def _removeCallback(self): """Unparent any editors and save state if required.""" if not mel.scriptedPanel(self.__name__, ex=1): return # no common call print 'REMOVE CALLBACK: %s' % self.__name__ # control=str(mel.scriptedPanel(self.__name__, # q=1,control=1)) mel.setParent(self._ActionCol) #------------------------------- testmodule self.gSampleState['fsg1']=float(floatSliderGrp('fsg1',q=1,v=1)) self.gSampleState['fsg2']=float(floatSliderGrp('fsg2',q=1,v=1)) self.gSampleState['fsg3']=float(floatSliderGrp('fsg3',q=1,v=1)) self.gSampleState['rbg']=float(radioButtonGrp('rbg',q=1,sl=1)) self.gSampleState['rbg1']=float(radioButtonGrp('rbg2',q=1,sl=1))
def _setup(self): """Command to be call for new scene""" print 'SETUP CALLED' gMainPane = mel.mel.eval( 'global string $gMainPane; $temp = $gMainPane;' ) mel.sceneUIReplacement( update=gMainPane ) panelName = mel.sceneUIReplacement( getNextScriptedPanel=(self.__name__, self._title) ) # print "-->Panel Name: %s" % panelName if panelName == '': try: panelName = mel.scriptedPanel(self.__name__, mbv=self._optionShowMenue, unParent=True, type=self.__name__, label=self._title ) mel.scriptedPanel( panelName, e=True, parent=self.panelParent) print "sceneUIreplacement has FAILED finding something - however: %s" % panelName except: pass else: try: pLabel = panel( self.__name__, query=True, label=True ) panelName = mel.scriptedPanel( self.__name__, edit=True, label=pLabel ) mel.scriptedPanel( panelName, e=True, parent=self.panelParent) print "sceneUIreplacement has found something: %s" % pLabel except: pass
def menuBar(self): if self.panelName: return pm.scriptedPanel(self.panelName, q=True, control=True)
def exists(self): return pm.scriptedPanel(self.panel, q=True, ex=True)
def newPanel(typ, title, name): """ Create and return a new panel of the given type. """ pm.scriptedPanel(name, unParent=True, type=typ, label=title) return ScriptedPanelTypes.getInstance(typ, name)