def update_size_ui(self): if self.dock_ui and self.dock[0]: kwargs = self.__dock_kwargs() kwargs["e"] = True pmc.dockControl(self.dock_ui, **kwargs) else: self.win.setWidthHeight(self.sizes[:2]) paneSizes = [] tmp = self.sizes[2:8] j = 1 for i in range(0, len(tmp) - 1, 2): paneSizes.append([j, tmp[i], tmp[i + 1]]) j += 1 pmc.paneLayout(self.main_layout, e=True, paneSize=paneSizes) pmc.paneLayout(self.script_layout, e=True, paneSize=[ [1, self.sizes[8], self.sizes[10]], [2, self.sizes[9], self.sizes[11]], ] ) pmc.checkBoxGrp(self.order_ui, e=True, v1=self.order) pmc.checkBoxGrp(self.order_ui, e=True, v2=self.show_doc) pmc.optionMenuGrp(self.filter_test_ui, e=True, v=self.filter_test)
def set_options(self, *arg): for opt in self.options: if opt == "sizes": value = [] if self.dock_ui: value.append(pmc.dockControl(self.dock_ui, q=True, w=True)) value.append(pmc.dockControl(self.dock_ui, q=True, h=True)) else: value.append(pmc.window(self.win, q=True, w=True)) value.append(pmc.window(self.win, q=True, h=True)) value.extend(pmc.paneLayout(self.main_layout, q=True, paneSize=True)) value.extend(pmc.paneLayout(self.script_layout, q=True, paneSize=True)) elif opt == "dock": if self.dock_ui: value = [self.dock[0]] value.append(int(pmc.dockControl(self.dock_ui, q=True, floating=True))) tmp = pmc.dockControl(self.dock_ui, q=True, area=True) for obj_id, a in self.dock_areas.iteritems(): if a == tmp: break else: obj_id = self.dock[2] value.append(obj_id) else: value = getattr(self, opt) else: value = getattr(self, opt) opt_name = self.get_option_name(opt) pmc.optionVar[opt_name] = value self.update_pys()
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 createShotManager(self): self.win = pm.window(title='SHOT MANAGER', w=300, h=200) form = pm.formLayout(numberOfDivisions=100) pane = pm.paneLayout(p=form, configuration='horizontal2') self.infoWidget = InfoWidget() self.infoWidget.createInfo(pane) self.infoWidget.putItemInfo(self.itemMData) self.compListWidget = ComponentListWidget() self.compListWidget.projectName = self.projectName self.compListWidget.createList(pane) b1 = pm.button(p=form, label='Update', h=40, w=80, c=self.updateCallback) b2 = pm.button(p=form, label='Close', h=40, w=80, c=self.closeCallback) pm.formLayout(form, edit=True, attachForm=[(pane, 'left', 5), (pane, 'top', 5), (pane, 'right', 5), (b1, 'left', 30), (b1, 'bottom', 5), (b2, 'right', 30), (b2, 'bottom', 5)], attachControl=[(pane, 'bottom', 5, b1)], attachPosition=[], attachNone=()) pm.showWindow(self.win) self.compListWidget.refreshList(itemMData=self.itemMData)
def start(): if pm.window('wBatchTools', ex=1): pm.deleteUI('wBatchTools') DOCK_NAME = 'BT_DOCK' LYT_NAME = 'BT_LYT_NAME' WIN_NAME = 'wBatchTools' AREA = 'left' app = BatchTools(mayaMainWindow) app.show() app.postLoad() # dock window if pm.dockControl(DOCK_NAME, ex=1): pm.deleteUI(DOCK_NAME) dockLayout = pm.paneLayout(LYT_NAME, configuration='single', parent=WIN_NAME, width=500, height=500) pm.dockControl(DOCK_NAME, aa=['left', 'right'], a=AREA, floating=0, content=dockLayout, l='Batch tools') pm.control(WIN_NAME, e=True, parent=dockLayout) if pm.dockControl(DOCK_NAME, ex=1): pm.control(WIN_NAME, e=1, p=dockLayout) pm.dockControl(DOCK_NAME, e=1, a=AREA, fl=0) pm.dockControl(DOCK_NAME, e=1, vis=1) pm.dockControl(DOCK_NAME, e=1, w=500)
def _create_mFIZ_window(self, controls_width): """ """ self.win = pm.window(self.name, title=self.title) self.main_layout = pm.paneLayout('mFIZ_paneLayout', configuration="vertical2", staticWidthPane=1, paneSize=[1, controls_width, 100])
def isolateSelect(sel, *args, **kwargs): view = pm.paneLayout('viewPanes', q=True, pane1=True) # inverting a query of the current boolean state returns the toggled value new_state = 1 - int(pm.isolateSelect(view, q=True, state=True)) pm.isolateSelect(view, state=new_state) if new_state == 1: # when toggling on.... pm.isolateSelect(view, u=True) # update with the current selection pm.mel.eval('enableIsolateSelect ' + view + ' true;') # and use this MEL script for some reason
def isolate_current_panel(add=False, *args): panel = pm.paneLayout('viewPanes', q=1, pane1=1) state = pm.isolateSelect(panel, q=1, state=1) pm.editor(panel, e=1, mainListConnection="activeList") pm.isolateSelect(panel, loadSelected=1) pm.isolateSelect(panel, state=not state) if add: pm.editor(panel, e=1, unlockMainConnection=1) else: pm.editor(panel, e=1, lockMainConnection=1)
def createAssetPrompt(self): form = pm.setParent(q=True) f = pm.formLayout(form, e=True, width=150) col2 = pm.columnLayout(p=f, adjustableColumn=True) nsField = pm.textFieldGrp('nsFieldPrompt', l='Name Space', tx='ref') refModeField = pm.optionMenuGrp(l='Assemble Mode') pm.menuItem(l='reference') pm.menuItem(l='cache') pm.menuItem(l='import') pm.menuItem(l='copy') pane = pm.paneLayout(p=col2, configuration='top3', ps=[(1, 20, 80), (2, 80, 80), (3, 100, 20)]) folderTreeWidget = FolderTreeWidget() folderTreeWidget.createFolderTree(pane) folderTreeWidget.projectName = self.projectName folderTreeWidget.type = 'asset' folderTreeWidget.getFolderTree() itemListWidget = ItemListBase() itemListWidget.projectName = self.projectName itemListWidget.createList(pane) itemListWidget.refreshList(path=[], task=['uvs', 'rig']) infoWidget = InfoWidget() infoWidget.createInfo(pane) folderTreeWidget.itemListWidget = itemListWidget folderTreeWidget.itemListWidget.type = 'asset' folderTreeWidget.itemListWidget.task = ['uvs', 'rig'] itemListWidget.infoWidget = infoWidget b1 = pm.button(p=f, l='Cancel', c='pm.layoutDialog( dismiss="Abort" )') b2 = pm.button( p=f, l='OK', c=lambda x: self.createAssetCallBack(itemListWidget.selectedItem)) spacer = 5 top = 5 edge = 5 pm.formLayout(form, edit=True, attachForm=[(col2, 'right', edge), (col2, 'top', top), (col2, 'left', edge), (b1, 'right', edge), (b1, 'bottom', edge), (b2, 'left', edge), (b2, 'bottom', edge)], attachNone=[], attachControl=[], attachPosition=[(b1, 'right', spacer, 90), (b2, 'left', spacer, 10)])
def show(): if pmc.window("colorKeyWindow", q=True, exists=True): pmc.deleteUI("colorKeyWindow") if pmc.paneLayout('colorKeyPane', q=True, exists=True): pmc.deleteUI('colorKeyPane') if pmc.dockControl('colorKeyDocked', q=True, exists=True): pmc.deleteUI('colorKeyDocked') dialog = ColorKeyUI(getMayaWindow()) dialog.show()
def createBrowser(self): win = pm.window(w=200) form = pm.formLayout(numberOfDivisions=100) col2 = pm.columnLayout(p=form, adjustableColumn=True) allowedAreas = ['right', 'left'] pm.dockControl(label='BROWSER', w=200, area='left', content=win, allowedArea=allowedAreas) self.projectSelectWidget = ProjectSelectWidget() self.projectSelectWidget.createProjectSelect(col2) pm.rowLayout(nc=3, adj=1) self.typeOpt = pm.optionMenuGrp(label='Item Type', changeCommand=self.changeTypeCallback, cat=[[1,'left',5],[2,'left',-80]]) types = ['asset', 'shot', 'model', 'uvs', 'texture', 'blendShape', 'rig', 'layout', 'animation', 'shotFinalizing', 'lightining', 'render'] for assetType in types: pm.menuItem(label=assetType) pm.symbolButton(image=r'D:/JOBS/PIPELINE/pipeExemple/scenes/icons/small.png', c=lambda x, y=2: self.changeViewCallback(y)) pm.symbolButton(image=r'D:/JOBS/PIPELINE/pipeExemple/scenes/icons/big.png', c=lambda x, y=1: self.changeViewCallback(y)) pane = pm.paneLayout(p=form, configuration='top3', ps=[(1, 20, 80), (2, 80, 80), (3, 100, 20)], shp = 0) self.folderTreeWidget = FolderTreeWidget('asset') self.folderTreeWidget.createFolderTree(pane) self.folderTreeWidget.getFolderTree() self.itemListWidget = ItemListWidget() self.itemListWidget.createList(pane) self.itemListWidget.refreshList(path=[], task='asset') self.infoWidget = InfoWidget() self.infoWidget.createInfo(pane) self.folderTreeWidget.itemListWidget = self.itemListWidget self.folderTreeWidget.itemListWidget.type = 'asset' self.folderTreeWidget.itemListWidget.task = 'asset' self.projectSelectWidget.folderTreeWidget = self.folderTreeWidget self.projectSelectWidget.itemListWidget = self.itemListWidget self.itemListWidget.infoWidget = self.infoWidget pm.formLayout(form, edit=True, attachForm=[(pane, 'left', 5), (pane, 'bottom', 5), (pane, 'right', 5), (col2, 'top', 5), (col2, 'left', 5), (col2, 'right', 5)], attachControl=[(pane, 'top', 5, col2)], attachPosition=[], attachNone=() ) pm.showWindow()
def AppleseedAOVsCreateTab(self): log.debug("AppleseedAOVsCreateTab()") aovDict = {} self.rendererTabUiDict['aovs'] = aovDict pm.setUITemplate("attributeEditorTemplate", pushTemplate = True) with pm.window() as win: scLo = "AOScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness = 0): with pm.columnLayout("ColumnLayout", adjustableColumn = True, width = 400): with pm.frameLayout(label="AOVs", collapsable = True, collapse=False): with pm.columnLayout(): with pm.paneLayout(configuration="vertical2", paneSize=(1, 25, 100)): aovDict['aovSourceField'] = pm.textScrollList("AOVSource", ams=True, append=self.aovShaders, selectCommand = pm.Callback(self.AppleseedAOVSelectCommand,"source")) aovList = self.AppleseedGetAOVConnections() aovDict['aovDestField'] = pm.textScrollList("AOVDest", append=aovList, ams=True, dcc=self.AppleseedDoubleClickCommand, selectCommand = pm.Callback(self.AppleseedAOVSelectCommand,"dest")) aovDict['aovButton'] = pm.button(label="Selection", enable=False, c=self.AppleseedAOVButtonCommand) win.show() pm.setUITemplate("attributeEditorTemplate", popTemplate = True)
def _MakeObjectSelectionList(objectAttribute): """ Helper function for constructing object selector fields. Constructs selectable list of objects in the Maya scene of the type determined by the MayaObjectAttribute. Will be shown when user presses button linked to the parent object selection UI component. :param objectAttribute: MayaObjectAttribute instance. """ objectAttribute._updateInputUiComponents() allowNone = objectAttribute.allowNoneType objectType = objectAttribute.objectType objectList = [None] if(allowNone) else [] objectNamesList = ["<None>"] if(allowNone) else [] objectList.extend(scene.GetObjectsInSceneOfType(objectAttribute.objectType)) objectNamesList.extend(map(lambda obj: obj.name(), objectList[1:] if(allowNone) else objectList)) windowHandle = ("Select %s" % objectType.__name__) DestroyWindowIfNecessary(windowHandle) window = pm.window(windowHandle) formLayout = MakeFormLayout() menuPaneLayout = pm.paneLayout() def _onObjectSelect(objectAttribute, objectList, objectNamesList, objectMenu): index = objectNamesList.index(objectMenu.getSelectItem()[0]) objectAttribute.value = objectList[index] objectMenu = pm.iconTextScrollList(allowMultiSelection=False, append=objectNamesList) if(objectAttribute.getRawAttribute() in objectList): objectMenu.setSelectItem(objectNamesList[objectList.index(objectAttribute.getRawAttribute())]) objectMenu.selectCommand(lambda *args: _onObjectSelect(objectAttribute, objectList, objectNamesList, objectMenu)) SetAsChildLayout(menuPaneLayout) buttonLayout = MakeButtonStrip( (("Close", lambda *args: DestroyWindowIfNecessary(window)), ) )[0] SetAsChildLayout(buttonLayout) DistributeButtonedWindowInFormLayout(formLayout, menuPaneLayout, buttonLayout) window.show()
def AppleseedAOVsCreateTab(self): aovDict = {} self.rendererTabUiDict['aovs'] = aovDict self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "AOScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout("ColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="AOVs", collapsable=True, collapse=False): with pm.columnLayout(): with pm.paneLayout(configuration="vertical2", paneSize=(1, 25, 100)): aovDict['aovSourceField'] = pm.textScrollList("AOVSource", ams=True, append=self.aovShaders, selectCommand=pm.Callback(self.AppleseedAOVSelectCommand, "source")) aovList = self.AppleseedGetAOVConnections() aovDict['aovDestField'] = pm.textScrollList("AOVDest", append=aovList, ams=True, dcc=self.AppleseedDoubleClickCommand, selectCommand=pm.Callback(self.AppleseedAOVSelectCommand, "dest")) aovDict['aovButton'] = pm.button(label="Selection", enable=False, c=self.AppleseedAOVButtonCommand) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
def _addMayaUI(self): ptr = long(shiboken2.getCppPointer(self.cameraBoxLayout)[0]) # Then get the full path to the UI in maya as a string mayaFullDagPath = openMayaUI.MQtUtil.fullName(ptr) if pmc.modelPanel('lcModelPanel', ex=True): pmc.deleteUI('lcModelPanel', panel=True) # Find a pointer to the paneLayout that we just created self.paneLayoutName = pmc.paneLayout('lcPaneLayout', cn='horizontal2', parent=mayaFullDagPath) ptr = openMayaUI.MQtUtil.findControl(self.paneLayoutName) # Wrap the pointer into a python QObject panelObj = wrapinstance(long(ptr)) self.lcModelPanel = pmc.modelPanel('lcModelPanel', label='Light Control', p=self.paneLayoutName) self.lcModelPanel.setMenuBarVisible(False) self.lcModelPanel.unParent() # add our QObject reference to the paneLayout to our layout self.cameraBoxLayout.addWidget(panelObj)
def getEditor(): """ The modelEditor is the node in maya that contains all the information about a modelPanel. A panel is an object in maya that acts as the root of a ui element. The model editor for instance holds information about what cameras have been added to a panel. """ if pm.modelEditor("mypanel", exists=True): print("the panel exists...deleting and creating a new one") pm.deleteUI("mypanel") cam = pm.ls(selection=True)[0] #SETTING CAMERA VIEWPORT SETTINGS pm.camera(cam, edit=True, displayResolution=False, displayFilmGate=False) window = pm.window(width=1280, height=720, backgroundColor=(1.0, 0.0, 0.0)) lay = pm.paneLayout() pan = pm.modelPanel() pm.modelEditor("mypanel", camera=cam, activeView=True, displayAppearance="smoothShaded") pm.showWindow(window, window=True)
def AppleseedAOVsCreateTab(self): log.debug("AppleseedAOVsCreateTab()") aovDict = {} self.rendererTabUiDict['aovs'] = aovDict pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) with pm.window() as win: scLo = "AOScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout("ColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="AOVs", collapsable=True, collapse=False): with pm.columnLayout(): with pm.paneLayout(configuration="vertical2", paneSize=(1, 25, 100)): aovDict['aovSourceField'] = pm.textScrollList( "AOVSource", ams=True, append=self.aovShaders, selectCommand=pm.Callback( self.AppleseedAOVSelectCommand, "source")) aovList = self.AppleseedGetAOVConnections() aovDict['aovDestField'] = pm.textScrollList( "AOVDest", append=aovList, ams=True, dcc=self.AppleseedDoubleClickCommand, selectCommand=pm.Callback( self.AppleseedAOVSelectCommand, "dest")) aovDict['aovButton'] = pm.button( label="Selection", enable=False, c=self.AppleseedAOVButtonCommand) win.show() pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
def createAssetPrompt(self): form = pm.setParent(q=True) f = pm.formLayout(form, e=True, width=150) col2 = pm.columnLayout(p=f, adjustableColumn=True) pane = pm.paneLayout(p=col2, configuration='top3', ps=[(1, 20, 80), (2, 80, 80), (3, 100, 20)]) folderTreeWidget = FolderTreeWidget() print 'ok' folderTreeWidget.createFolderTree(pane) print 'ok2' folderTreeWidget.projectName = database.getCurrentProject() folderTreeWidget.type = 'asset' folderTreeWidget.getFolderTree() itemListWidget = ItemListBase() itemListWidget.projectName = database.getCurrentProject() itemListWidget.createList(pane) itemListWidget.refreshList(path=[], task='asset') infoWidget = InfoWidget() infoWidget.createInfo(pane) folderTreeWidget.itemListWidget = itemListWidget folderTreeWidget.itemListWidget.type = 'asset' folderTreeWidget.itemListWidget.task = 'asset' itemListWidget.infoWidget = infoWidget b1 = pm.button(p=f, l='Cancel', c='pm.layoutDialog( dismiss="Abort" )') b2 = pm.button(p=f, l='OK', c=lambda x: self.createAssetCallBack(itemListWidget.selectedItem)) spacer = 5 top = 5 edge = 5 pm.formLayout(form, edit=True, attachForm=[(col2, 'right', edge), (col2, 'top', top), (col2, 'left', edge), (b1, 'right', edge), (b1, 'bottom', edge), (b2, 'left', edge), (b2, 'bottom', edge)], attachNone=[], attachControl=[], attachPosition=[(b1, 'right', spacer, 90), (b2, 'left', spacer, 10)])
def get_active_camera(): """ Return the active camera. Thanks to Nohra Seif for the snippet! """ # seems that $gMainPane contain the name of the main window pane layout holding the panels. main_pane = mel.eval('string $test = $gMainPane;') if main_pane != "": # get the layout's immediate children main_pane_ctrls = pymel.paneLayout(main_pane, q=True, childArray=True) for i in range(len(main_pane_ctrls)): # panel containing the specified control panel_name = pymel.getPanel(containing=main_pane_ctrls[i]) if "" != panel_name: # Return the type of the specified panel. if ("modelPanel" == pymel.getPanel(typeOf=panel_name)): # Return whether the control can actually be seen by the user, isObscured for invisible if not (pymel.control(main_pane_ctrls[i], q=True, isObscured=True)): model_editor = pymel.modelPanel(panel_name, q=True, modelEditor=True) if model_editor: # If this view is already active, let's continue to use it. if pymel.modelEditor(model_editor, q=True, activeView=True): # get the camera in the current modelPanel return pymel.PyNode(pymel.modelPanel(model_editor, q=True, camera=True))
def createAssetPrompt(self): form = pm.setParent(q=True) f = pm.formLayout(form, e=True, width=150) col2 = pm.columnLayout(p=f, adjustableColumn=True) pm.rowLayout(nc=3, adj=1) self.typeOpt = pm.optionMenuGrp(label='Item Type', changeCommand=self.changeTypeCallback, cat=[[1, 'left', 5], [2, 'left', -80]]) pm.menuItem(label='asset') pm.menuItem(label='shot') pm.menuItem(divider=True) typesAsset = database.getAllTasks('asset') for assetType in typesAsset: pm.menuItem(label=assetType) pm.menuItem(divider=True) typesShot = database.getAllTasks('shot') for assetType in typesShot: pm.menuItem(label=assetType) pm.symbolButton( image=r'D:/JOBS/PIPELINE/pipeExemple/scenes/icons/small.png', c=lambda x, y=2: self.changeViewCallback(y)) pm.symbolButton( image=r'D:/JOBS/PIPELINE/pipeExemple/scenes/icons/big.png', c=lambda x, y=1: self.changeViewCallback(y)) pane = pm.paneLayout(p=form, configuration='top3', ps=[(1, 20, 80), (2, 80, 80), (3, 100, 20)], shp=0) self.folderTreeWidget = FolderTreeWidget('asset') self.folderTreeWidget.createFolderTree(pane) self.folderTreeWidget.getFolderTree() self.itemListWidget = ItemListWidget() self.itemListWidget.createList(pane) self.itemListWidget.refreshList(path=[], task='asset') self.infoWidget = InfoWidget() self.infoWidget.createInfo(pane) self.folderTreeWidget.itemListWidget = self.itemListWidget self.folderTreeWidget.itemListWidget.type = 'asset' self.folderTreeWidget.itemListWidget.task = 'asset' self.itemListWidget.infoWidget = self.infoWidget b1 = pm.button(p=f, l='Cancel', c='pm.layoutDialog( dismiss="Abort" )') b2 = pm.button( p=f, l='OK', c=lambda x: self.okCallback(self.itemListWidget.selectedItem)) pm.formLayout(form, edit=True, attachForm=[(pane, 'left', 5), (pane, 'bottom', 5), (pane, 'right', 5), (col2, 'top', 5), (col2, 'left', 5), (col2, 'right', 5), (b1, 'right', 5), (b1, 'bottom', 5), (b2, 'left', 5), (b2, 'bottom', 5)], attachControl=[(pane, 'top', 5, col2)], attachPosition=[(b1, 'right', 5, 90), (b2, 'left', 5, 10)], attachNone=())
selected = pm.ls(sl=True) # Dealing with instances # Dealing with attributes # get and set # Creating nodes # Connecting attributes import pymel.core as pm pm.window() # Result: ui.Window('window1') # pm.paneLayout() # Result: ui.PaneLayout('window1|paneLayout10') # pm.textScrollList(numberOfRows=8, allowMultiSelection=True, append=[ 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen' ], selectItem='six', showIndexedItem=4) pm.showWindow() ''' Part 3 - Object Oriented Programming (OOP) Pros:
def buildUI(self): _notifySavingDisabled() self.win = pm.window(title='Pymel Control Panel') self.win.show() with pm.paneLayout(configuration='vertical3', paneSize=([1, 20, 100], [3, 20, 100])) as self.pane: # Lef Column: Api Classes self.classScrollList = pm.textScrollList('apiClassList') # Center Column: Api Methods # Would LIKE to do it like this, but there is currently a bug with # objectType UI, such that even if # layout('window4|paneLayout5', q=1, exists=1) == True # when you run: # objectTypeUI('window4|paneLayout5') # you will get an error: # RuntimeError: objectTypeUI: Object 'window4|paneLayout5' not found. # with formLayout() as apiForm: # #with scrollLayout() as scroll: # with tabLayout('apiMethodCol') as self.apiMethodCol: # pass # status = helpLine(h=60) # So, instead, we do it old-school... apiForm = pm.formLayout() self.apiMethodCol = pm.tabLayout('apiMethodCol') pm.setParent(apiForm) status = pm.cmds.helpLine(h=60) pm.setParent(self.pane) apiForm.attachForm(self.apiMethodCol, 'top', 5) apiForm.attachForm(self.apiMethodCol, 'left', 5) apiForm.attachForm(self.apiMethodCol, 'right', 5) apiForm.attachControl(self.apiMethodCol, 'bottom', 5, status) apiForm.attachPosition(status, 'bottom', 5, 20) apiForm.attachForm(status, 'bottom', 5) apiForm.attachForm(status, 'left', 5) apiForm.attachForm(status, 'right', 5) # Right Column: Mel Methods melForm = pm.formLayout() label1 = pm.text(label='Unassigned Mel Methods') self.unassignedMelMethodLister = pm.textScrollList() label2 = pm.text(label='Assigned Mel Methods') self.assignedMelMethodLister = pm.textScrollList() label3 = pm.text(label='Disabled Mel Methods') self.disabledMelMethodLister = pm.textScrollList() pm.setParent(self.pane) melForm.attachForm(label1, 'top', 5) melForm.attachForm(label1, 'left', 5) melForm.attachForm(label1, 'right', 5) melForm.attachControl(self.unassignedMelMethodLister, 'top', 0, label1) melForm.attachForm(self.unassignedMelMethodLister, 'left', 5) melForm.attachForm(self.unassignedMelMethodLister, 'right', 5) melForm.attachPosition(self.unassignedMelMethodLister, 'bottom', 5, 33) melForm.attachControl(label2, 'top', 5, self.unassignedMelMethodLister) melForm.attachForm(label2, 'left', 5) melForm.attachForm(label2, 'right', 5) melForm.attachControl(self.assignedMelMethodLister, 'top', 0, label2) melForm.attachForm(self.assignedMelMethodLister, 'left', 5) melForm.attachForm(self.assignedMelMethodLister, 'right', 5) melForm.attachPosition(self.assignedMelMethodLister, 'bottom', 5, 66) melForm.attachControl(label3, 'top', 5, self.assignedMelMethodLister) melForm.attachForm(label3, 'left', 5) melForm.attachForm(label3, 'right', 5) melForm.attachControl(self.disabledMelMethodLister, 'top', 0, label3) melForm.attachForm(self.disabledMelMethodLister, 'left', 5) melForm.attachForm(self.disabledMelMethodLister, 'right', 5) melForm.attachForm(self.disabledMelMethodLister, 'bottom', 5) pm.setParent('..') pm.popupMenu(parent=self.unassignedMelMethodLister, button=3) pm.menuItem(l='disable', c=pm.Callback(PymelControlPanel.disableMelMethod, self, self.unassignedMelMethodLister)) pm.popupMenu(parent=self.assignedMelMethodLister, button=3) pm.menuItem(l='disable', c=pm.Callback(PymelControlPanel.disableMelMethod, self, self.assignedMelMethodLister)) pm.popupMenu(parent=self.disabledMelMethodLister, button=3) pm.menuItem(l='enable', c=pm.Callback(PymelControlPanel.enableMelMethod)) self.classScrollList.extend(self.classList) self.classScrollList.selectCommand( lambda: self.apiClassList_selectCB()) pm.scriptJob(uiDeleted=[str(self.win), cacheResults]) self.win.show()
def export(self, **kwargs): # the category is just a folder below the library path assetCategory = kwargs.setdefault('assetCategory', 'default') # if no name is specified it uses the scene name assetName = kwargs.setdefault('assetName', pm.sceneName().basename()[:-3]) # an asset can have a .txt file associated with it. This should # help to clarify the contents of an asset assetDescription = kwargs.setdefault('assetDescription') # by default the exportAll command is called exportType = kwargs.setdefault('type', 'all') # if true automatically sets the camera to frame the exported objs autoFrame = kwargs.setdefault('autoFrame', True) breakRef = kwargs.setdefault('breakRef', False) # if the scene was not saved it has no name if assetName == '': raise Exception('Asset Name not specified') if exportType == 'selected' and not pm.selected(): # if nothing is selected, stop the execution here raise Exception('Nothing Selected') # create the folders if they don't exist self.checkPath(os.path.join(self.libraryPath, assetCategory)) assetPath = os.path.join(self.libraryPath, assetCategory, assetName) self.checkPath(assetPath) # save the selection now because enableIsolateSelect clears it selection = pm.selected() mpanel = pm.paneLayout('viewPanes', q=True, pane1=True) # disable selection highlighting and wireframe on shaded wireframeOnShadedState = pm.windows.modelEditor(mpanel, q=True, wireframeOnShaded=True) pm.windows.modelEditor(mpanel, e=True, sel=False, wireframeOnShaded=False) # set background color originalBackgroundColor = pm.general.displayRGBColor('background', q=True) pm.general.displayRGBColor('background', 0.3, 0.3, 0.3) # set the camera cam = pm.ls(pm.modelPanel(mpanel, q=True, cam=True), type='transform')[0] if autoFrame: wTrans = cam.getTranslation(ws=True) wRot = cam.getRotation(ws=True) try: cam.rx.set(-10) cam.ry.set(30) pm.viewFit() except: pass pm.general.refresh() if exportType == 'selected': # hide everything that is not selected for the playblast pm.mel.eval('enableIsolateSelect %s %d' % (mpanel, 1)) # RENDER ICON # this is a simple playblast of the current frame # image is saved as .jpg with an _icon suffix pm.animation.playblast(cf=assetPath + '/' + assetName + '_icon.jpg', format='image', compression='jpg', widthHeight=[128, 128], frame=[pm.animation.currentTime()], orn=False, os=True, v=False, percent=100) if autoFrame: try: # reset camera cam.setTranslation(wTrans, ws=True) cam.setRotation(wRot, ws=True) except: pass if exportType == 'selected': # show the scene again. the user shouldn't notice pm.mel.eval('enableIsolateSelect %s %d' % (mpanel, 0)) # reenable selection highlighting and reset wireframe on shaded to what it was before pm.windows.modelEditor(mpanel, e=True, sel=True, wireframeOnShaded=wireframeOnShadedState) #reset the background color to what it was before pm.general.displayRGBColor('background', originalBackgroundColor[0], originalBackgroundColor[1], originalBackgroundColor[2]) # EXPORT FILE # reselect the selection, isolate select clears it. pm.select(selection) if exportType == 'all': self.fixNamespaces( self.removeStudentLic( pm.system.exportAll(assetPath + '/' + assetName + '.ma', preserveReferences=not breakRef, force=True))) if exportType == 'selected': self.fixNamespaces( self.removeStudentLic( pm.system.exportSelected(assetPath + '/' + assetName + '.ma', preserveReferences=not breakRef, force=True))) # SAVE DESCRIPTION # newlines are saved if assetDescription: text_file = open(assetPath + '/' + assetName + '.txt', 'wt') text_file.write(assetDescription.encode('utf8')) text_file.close()
def ui(self): marge = 2 self.win = None if pmc.window(self.__class__.__name__, q=True, exists=True): pmc.deleteUI(self.__class__.__name__) with pmc.window(self.__class__.__name__, title=self.ui_name, menuBar=True) as self.win: #=================================================================== # Menus #=================================================================== pmc.menu(label="File", tearOff=False) pmc.menuItem(label="Open", c=self.select_py_ui) pmc.menuItem(label="Refresh", c=self.read_py) self.recents_menu_ui = pmc.menuItem(subMenu=True, label="Recents") pmc.setParent("..", menu=True) pmc.setParent("..", menu=True) pmc.menu(label="Options", tearOff=False) pmc.menuItem(label="Insert ScriptEditor", c=self.insert_script_editor_ui) self.reset_menu_ui = pmc.menuItem(label="Run Reset History", checkBox=self.reset, c=self.set_reset_his_ui) if self.maya_version >= 2011: self.dock_ui_item = pmc.menuItem(label="In Dock", checkBox=self.dock[0], c=self.set_in_dock_ui) pmc.menuItem(divider=True) pmc.menuItem(subMenu=True, label="Recents") self.max_recents_ui = pmc.menuItem(l="Set length (%s)" % self.max_recents, c=self.set_recents_ui) pmc.menuItem(l="Reset", c=self.reset_recents_ui) pmc.setParent("..", menu=True) pmc.menuItem(subMenu=True, label="Settings") pmc.menuItem(l="Reset", c=self.reset_options_ui) pmc.menuItem(l="Save", c=self.save_options) pmc.setParent("..", menu=True) pmc.menu(label='Help', helpMenu=True) pmc.menuItem(label='About', c=self.help_ui) #=================================================================== # Layout and Contents #=================================================================== main_form = pmc.formLayout(nd=100) self.run_but = pmc.button(l="Run", c=self.run_cmd_ui) self.main_layout = pmc.paneLayout(configuration="top3") form = pmc.formLayout(nd=100) self.cmd_ui = pmc.scrollField(ed=1, ww=0) pmc.setParent("..") form_infos = pmc.formLayout(nd=100) self.infos_ui = pmc.textScrollList(ams=0, fn="fixedWidthFont", sc=self.doc_cmd_ui, dcc=self.insert_cmd_ui) infos_layout = pmc.frameLayout(label="Filter / Sort / Doc", collapse=True, collapsable=True) pmc.columnLayout(adj=1) pmc.rowLayout(numberOfColumns=2, adj=1) self.filter_ui = pmc.textFieldGrp(label="Filter", text="", cw=[1, 40], adj=2, fcc=True, cc=self.order_by_ui) self.filter_test_ui = pmc.optionMenuGrp(cc=self.set_filter_test_ui) pmc.menuItem(label="in") pmc.menuItem(label="startswith") pmc.menuItem(label="endswith") pmc.setParent("..") self.order_ui = pmc.checkBoxGrp(numberOfCheckBoxes=2, label="Sort", label1="Alphabetical", label2="Show doc", cw=[1, 40], cc1=self.order_by_ui, cc2=self.set_show_doc_ui, ) pmc.setParent("..") pmc.setParent("..") pmc.setParent("..") self.form_scriptEditor = pmc.formLayout(nd=100) # self.form_scriptEditor = pmc.paneLayout(configuration="single") pmc.setParent("..") pmc.setParent("..") #=================================================================== # Layout settings #=================================================================== pmc.formLayout(main_form, edit=True, attachNone=[ (self.run_but, "bottom") ], attachForm=[ (self.run_but, "top", marge), (self.run_but, "left", marge), (self.run_but, "right", marge), (self.main_layout, "top", marge), (self.main_layout, "left", marge), (self.main_layout, "right", marge), (self.main_layout, "bottom", marge), ], attachControl=[ (self.main_layout, "top", marge, self.run_but), ] ) pmc.formLayout(form, edit=True, attachForm=[ (self.cmd_ui, "top", marge), (self.cmd_ui, "left", marge), (self.cmd_ui, "right", marge), (self.cmd_ui, "bottom", marge), ], ) pmc.formLayout(form_infos, edit=True, attachForm=[ (self.infos_ui, "top", marge), (self.infos_ui, "left", marge), (self.infos_ui, "right", marge), (infos_layout, "left", marge), (infos_layout, "right", marge), (infos_layout, "bottom", marge), ], attachControl=[ (self.infos_ui, "bottom", marge, infos_layout) ] ) self.insert_script_editor_ui() self.dock_it()
# Dealing with attributes # get and set # Creating nodes # Connecting attributes import pymel.core as pm pm.window() # Result: ui.Window('window1') # pm.paneLayout() # Result: ui.PaneLayout('window1|paneLayout10') # pm.textScrollList( numberOfRows=8, allowMultiSelection=True, append=['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen'], selectItem='six', showIndexedItem=4 ) pm.showWindow() ''' Part 3 - Object Oriented Programming (OOP) Pros: - Build your own data types. - Keep access to much more information.
def __init__(self, parent=None): super(ColorKeyUI, self).__init__(parent) self.setWindowTitle("Keyframe colors") self.setObjectName("colorKeyWindow") self.setModal(False) # Import preferences data = ColorKey.importPref() # Docking floatingLayout = pmc.paneLayout('colorKeyPane', configuration='single') pmc.control("colorKeyWindow", e=True, p=floatingLayout) if pmc.about(v=True) == '2016': pmc.dockControl('colorKeyDocked', area='bottom', allowedArea=['bottom', 'top'], content=floatingLayout, floating=True, w=500, h=80, fixedWidth=True, label='Color Key') else: pmc.dockControl('colorKeyDocked', area='bottom', allowedArea=['bottom', 'top'], content=floatingLayout, floating=True, w=500, h=80, sizeable=False, label='Color Key') # Menu menuBar = QtGui.QMenuBar(self) optionsMenu = QtGui.QMenu('Options') menuBar.addMenu(optionsMenu) # Menu item : filter graph editor self.filterGraphAction = QtGui.QAction(self) self.filterGraphAction.setText('Filter graph editor') self.filterGraphAction.setCheckable(True) self.filterGraphAction.setChecked(True) optionsMenu.addAction(self.filterGraphAction) # Menu item : settings settingsAction = QtGui.QAction(self) settingsAction.setText('Settings') optionsMenu.addAction(settingsAction) optionsMenu.addSeparator() # Menu item : remove colors removeColorAction = QtGui.QAction(self) removeColorAction.setText('Remove colors') optionsMenu.addAction(removeColorAction) optionsMenu.addSeparator() # Menu item : help helpAction = QtGui.QAction(self) helpAction.setText('Help + hotkeys') optionsMenu.addAction(helpAction) # MainVbox mainVbox = QtGui.QVBoxLayout(self) mainVbox.insertSpacing(0, 10) # Buttons hbox = QtGui.QHBoxLayout() mainVbox.addLayout(hbox) color1Btn = QtGui.QPushButton(data['color1'][0]) color1Btn.setStyleSheet("background:rgb%s;height:8px;color:black;" % str(data['color1'][1])) color2Btn = QtGui.QPushButton(data['color2'][0]) color2Btn.setStyleSheet("background:rgb%s;height:8px;color:black;" % str(data['color2'][1])) color3Btn = QtGui.QPushButton(data['color3'][0]) color3Btn.setStyleSheet("background:rgb%s;height:8px;color:black;" % str(data['color3'][1])) color4Btn = QtGui.QPushButton(data['color4'][0]) color4Btn.setStyleSheet("background:rgb%s;height:8px;color:black;" % str(data['color4'][1])) color5Btn = QtGui.QPushButton(data['color5'][0]) color5Btn.setStyleSheet("background:rgb%s;height:8px;color:black;" % str(data['color5'][1])) color6Btn = QtGui.QPushButton(data['color6'][0]) color6Btn.setStyleSheet("background:rgb%s;height:8px;color:black;" % str(data['color6'][1])) hbox.addWidget(color1Btn) hbox.addWidget(color2Btn) hbox.addWidget(color3Btn) hbox.addWidget(color4Btn) hbox.addWidget(color5Btn) hbox.addWidget(color6Btn) #Keyframing option info text hbox = QtGui.QHBoxLayout() mainVbox.addLayout(hbox, 0) label = QtGui.QLabel('keyframing option : ') hbox.addWidget(label) if data['keyframing'] == -2: keyframeOption = 'Keyframe all attributes' elif data['keyframing'] == -3: keyframeOption = 'Keyframe only keyed attributes' else: keyframeOption = 'Just add colors' label = QtGui.QLabel(keyframeOption) label.setStyleSheet("color:orange;") emptyLabel = QtGui.QLabel() emptyLabel.setMinimumWidth(300) hbox.addWidget(label) hbox.addWidget(emptyLabel) # Connections cK = ColorKey() color1Btn.released.connect( partial(cK.getInfo, color1Btn.palette().color(QtGui.QPalette.Button), '_1', data['keyframing'])) color2Btn.released.connect( partial(cK.getInfo, color2Btn.palette().color(QtGui.QPalette.Button), '_2', data['keyframing'])) color3Btn.released.connect( partial(cK.getInfo, color3Btn.palette().color(QtGui.QPalette.Button), '_3', data['keyframing'])) color4Btn.released.connect( partial(cK.getInfo, color4Btn.palette().color(QtGui.QPalette.Button), '_4', data['keyframing'])) color5Btn.released.connect( partial(cK.getInfo, color5Btn.palette().color(QtGui.QPalette.Button), '_5', data['keyframing'])) color6Btn.released.connect( partial(cK.getInfo, color6Btn.palette().color(QtGui.QPalette.Button), '_6', data['keyframing'])) self.filterGraphAction.triggered.connect(self.graphEditorFilter) settingsAction.triggered.connect(self.showSettingsWindow) removeColorAction.triggered.connect(self.removeColor) helpAction.triggered.connect(self.openHelp)
def buildUI(self): self.win = pm.window(title='Pymel Control Panel') self.win.show() with pm.paneLayout(configuration='vertical3', paneSize=([1,20,100], [3,20,100]) ) as self.pane: # Lef Column: Api Classes self.classScrollList = pm.textScrollList('apiClassList') # Center Column: Api Methods # Would LIKE to do it like this, but there is currently a bug with # objectType UI, such that even if # layout('window4|paneLayout5', q=1, exists=1) == True # when you run: # objectTypeUI('window4|paneLayout5') # you will get an error: # RuntimeError: objectTypeUI: Object 'window4|paneLayout5' not found. # with formLayout() as apiForm: # #with scrollLayout() as scroll: # with tabLayout('apiMethodCol') as self.apiMethodCol: # pass # status = helpLine(h=60) # So, instead, we do it old-school... apiForm = pm.formLayout() self.apiMethodCol = pm.tabLayout('apiMethodCol') pm.setParent(apiForm) status = pm.cmds.helpLine(h=60) pm.setParent(self.pane) apiForm.attachForm( self.apiMethodCol, 'top', 5 ) apiForm.attachForm( self.apiMethodCol, 'left', 5 ) apiForm.attachForm( self.apiMethodCol, 'right', 5 ) apiForm.attachControl( self.apiMethodCol, 'bottom', 5, status ) apiForm.attachPosition( status, 'bottom', 5, 20 ) apiForm.attachForm( status, 'bottom', 5 ) apiForm.attachForm( status, 'left', 5 ) apiForm.attachForm( status, 'right', 5 ) # Right Column: Mel Methods melForm = pm.formLayout() label1 = pm.text( label='Unassigned Mel Methods' ) self.unassignedMelMethodLister = pm.textScrollList() label2 = pm.text( label='Assigned Mel Methods' ) self.assignedMelMethodLister = pm.textScrollList() label3 = pm.text( label='Disabled Mel Methods' ) self.disabledMelMethodLister = pm.textScrollList() pm.setParent(self.pane) melForm.attachForm( label1, 'top', 5 ) melForm.attachForm( label1, 'left', 5 ) melForm.attachForm( label1, 'right', 5 ) melForm.attachControl( self.unassignedMelMethodLister, 'top', 0, label1 ) melForm.attachForm( self.unassignedMelMethodLister, 'left', 5 ) melForm.attachForm( self.unassignedMelMethodLister, 'right', 5 ) melForm.attachPosition( self.unassignedMelMethodLister, 'bottom', 5, 33 ) melForm.attachControl( label2, 'top', 5, self.unassignedMelMethodLister) melForm.attachForm( label2, 'left', 5 ) melForm.attachForm( label2, 'right', 5 ) melForm.attachControl( self.assignedMelMethodLister, 'top', 0, label2 ) melForm.attachForm( self.assignedMelMethodLister, 'left', 5 ) melForm.attachForm( self.assignedMelMethodLister, 'right', 5 ) melForm.attachPosition( self.assignedMelMethodLister, 'bottom', 5, 66 ) melForm.attachControl( label3, 'top', 5, self.assignedMelMethodLister) melForm.attachForm( label3, 'left', 5 ) melForm.attachForm( label3, 'right', 5 ) melForm.attachControl( self.disabledMelMethodLister, 'top', 0, label3 ) melForm.attachForm( self.disabledMelMethodLister, 'left', 5 ) melForm.attachForm( self.disabledMelMethodLister, 'right', 5 ) melForm.attachForm( self.disabledMelMethodLister, 'bottom', 5 ) pm.setParent('..') pm.popupMenu(parent=self.unassignedMelMethodLister, button=3 ) pm.menuItem(l='disable', c=pm.Callback( PymelControlPanel.disableMelMethod, self, self.unassignedMelMethodLister ) ) pm.popupMenu(parent=self.assignedMelMethodLister, button=3 ) pm.menuItem(l='disable', c=pm.Callback( PymelControlPanel.disableMelMethod, self, self.assignedMelMethodLister ) ) pm.popupMenu(parent=self.disabledMelMethodLister, button=3 ) pm.menuItem(l='enable', c=pm.Callback( PymelControlPanel.enableMelMethod)) self.classScrollList.extend( self.classList ) self.classScrollList.selectCommand( lambda: self.apiClassList_selectCB() ) pm.scriptJob(uiDeleted=[str(self.win),cacheResults]) self.win.show()
def createProjectSettingsWidget(self): if not self.projectName: self.projDict = database.getDefaultDict() else: self.projDict = database.getProjectDict(self.projectName) self.win = pm.window(w=800, h=600) col = pm.columnLayout( adjustableColumn=True, columnAlign='left', ) self.projNameTxt = pm.textFieldGrp(label='ProjectName', text=self.projDict['projectName'], cat=(1, 'left', 20), adj=2, editable=False) self.prefixTxt = pm.textFieldGrp(label='Prefix', text=self.projDict['prefix'], cat=(1, 'left', 20), adj=2, editable=False) self.statusOpt = pm.optionMenuGrp(l='Status', cat=(1, 'left', 20)) pm.menuItem(label='inative') pm.menuItem(label='active') pm.menuItem(label='current') pm.optionMenuGrp(self.statusOpt, e=True, v=self.projDict['status']) self.workLocTxt = pm.textFieldButtonGrp( label='Work Location', text=self.projDict['workLocation'], buttonLabel='...', adj=2, cat=(1, 'left', 20), bc=lambda: self.browseCallback(1)) self.publishLocTxt = pm.textFieldButtonGrp( label='Publish Location', text=self.projDict['publishLocation'], buttonLabel='...', adj=2, cat=(1, 'left', 20), bc=lambda: self.browseCallback(2)) self.imgWorkLocTxt = pm.textFieldButtonGrp( label='Images Work Location', text=self.projDict['imagesWorkLocation'], buttonLabel='...', adj=2, cat=(1, 'left', 20), bc=lambda: self.browseCallback(3)) self.imgPublishLocTxt = pm.textFieldButtonGrp( label='Images Publish Location', text=self.projDict['imagesPublishLocation'], buttonLabel='...', adj=2, cat=(1, 'left', 20), bc=lambda: self.browseCallback(4)) self.cacheLocTxt = pm.textFieldButtonGrp( label='Cache Location', text=self.projDict['cacheLocation'], buttonLabel='...', adj=2, cat=(1, 'left', 20), bc=lambda: self.browseCallback(5)) self.assetCollTxt = pm.textFieldGrp( label='Asset Collection', text=self.projDict['assetCollection'], adj=2, cat=(1, 'left', 20), editable=False) self.shotCollTxt = pm.textFieldGrp( label='Shot Collection', text=self.projDict['shotCollection'], adj=2, cat=(1, 'left', 20), editable=False) self.nameTemplTxt = pm.textFieldGrp( label='Asset Name Template', text=','.join(self.projDict['assetNameTemplate']), adj=2, cat=(1, 'left', 20)) self.cacheTemplTxt = pm.textFieldGrp( label='Cache Name Template', text=','.join(self.projDict['cacheNameTemplate']), adj=2, cat=(1, 'left', 20)) self.fpsTxt = pm.textFieldGrp(label='Project Frame Rate', text=self.projDict['fps'], adj=2, cat=(1, 'left', 20)) self.mayaVersionOpt = pm.optionMenuGrp(label='Maya Version', cat=(1, 'left', 20)) pm.menuItem(label='2015') pm.menuItem(label='2016') pm.menuItem(label='2017') pm.menuItem(label='2016') pm.optionMenuGrp(self.mayaVersionOpt, e=True, v=self.projDict['mayaVersion']) self.rendererOpt = pm.optionMenuGrp(label='Renderer', cat=(1, 'left', 20)) pm.menuItem(label='vray') pm.menuItem(label='arnold') pm.menuItem(label='mental ray') pm.menuItem(label='red shift') pm.optionMenuGrp(self.rendererOpt, e=True, v=self.projDict['renderer']) self.resolutionOpt = pm.optionMenuGrp(l='Resolution', cat=(1, 'left', 20)) pm.menuItem(label='1920x1080') pm.menuItem(label='2048x1780') pm.optionMenuGrp( self.resolutionOpt, e=True, v='%sx%s' % (self.projDict['resolution'][0], self.projDict['resolution'][1])) pm.text(p=col, l='FOLDERS') pane = pm.paneLayout(p=col, cn='vertical2', h=150) self.assetTreeView = FolderTreeEditableWidget('asset') self.assetTreeView.createFolderTree(pane) self.assetTreeView.getFolderTree() self.assetTreeView.createMenus() self.shotTreeView = FolderTreeEditableWidget('shot') self.shotTreeView.createFolderTree(pane) self.shotTreeView.getFolderTree() self.shotTreeView.createMenus() pm.text(p=col, l='WORKFLOWS') pane = pm.paneLayout(p=col, cn='vertical2', h=100) self.workflowScrll = pm.textScrollList(parent=pane) for workflow in self.projDict['workflow']: pm.textScrollList(self.workflowScrll, e=True, append=' ' + workflow) pm.rowLayout(p=col, nc=3, adj=1) pm.text(l='') pm.button(l='OK', w=50, h=50, c=self.okCallback) pm.button(l='Cancel', w=50, h=50, c=self.cancelCallback) pm.showWindow()