def gui(): ''' # gui for the script ''' win = 'rigid_body_win' if pm.window(win, exists= True): pm.deleteUI(win) if pm.windowPref(win, exists= True): pm.windowPref(win, remove= True) global obj_scroll_list, name_field, tab_layout my_win = pm.window(win, title= 'BAKE', toolbox= True, width= 300) tab_layout = pm.tabLayout() ui_creator = pm.columnLayout(adjustableColumn= False) name_field = pm.textFieldGrp(label = 'System Name', text= 'Name', columnWidth2= [145, 150]) obj_scroll_list = pm.textScrollList(width= 300, height= 200, allowMultiSelection= True) pm.rowColumnLayout(nc=3, columnWidth= ([1,100], [2,100], [1,100])) pm.button(label= 'Load', command= pm.Callback(load_objects), width= 100) pm.button(label= '+', command= pm.Callback(add_objects), width= 100) pm.button(label= '-', command= pm.Callback(remove_objects), width= 100) pm.setParent('..') pm.button(label= 'Create Baking System', height= 50, width= 300, command= pm.Callback(create_baking_system)) pm.tabLayout( tab_layout, edit=True, tabLabel=((ui_creator, 'Setup'))) my_win.show()
def gui(): win = 'rigid_body_win' if pm.window(win, exists= True): pm.deleteUI(win) if pm.windowPref(win, exists= True): pm.windowPref(win, remove= True) global obj_scroll_list, name_field, tab_layout my_win = pm.window(win, title= 'BAKE', toolbox= True, width= 300) tab_layout = pm.tabLayout() ui_creator = pm.columnLayout(adjustableColumn= False) name_field = pm.textFieldGrp(label = 'System Name', text= 'Name', columnWidth2= [145, 150]) obj_scroll_list = pm.textScrollList(width= 300, height= 200, allowMultiSelection= True) pm.rowColumnLayout(nc=3, columnWidth= ([1,100], [2,100], [1,100])) pm.button(label= 'Load', command= pm.Callback(load_objects), width= 100) pm.button(label= '+', command= pm.Callback(add_objects), width= 100) pm.button(label= '-', command= pm.Callback(remove_objects), width= 100) pm.setParent('..') pm.button(label= 'Create Baking System', height= 50, width= 300, command= pm.Callback(create_baking_system)) pm.tabLayout( tab_layout, edit=True, tabLabel=((ui_creator, 'Setup'))) my_win.show()
def _get_tab_name(self, ctrl=None): """ Gets the name of the tab that the active controller is assigned to """ tab_layout = self.controls_tab_layout # Get all of the tab labels tab_labels = pm.tabLayout(tab_layout, query=True, tabLabel=True) if 'Setup' in tab_labels: tab_labels.remove('Setup') # Remove the setup tab if not ctrl: # We can get the name of the selected tab directly tab_name = pm.tabLayout(tab_layout, query=True, selectTab=True) else: # Get the controller for each tab for tab_name in tab_labels: tab_ctrl = self._get_tab_ctrl(tab_name) # If the selected controller matches the i-th tab controller, # select the tab if ctrl == tab_ctrl: break return tab_name
def animExport_2(self): mel.eval('source gameFbxExporter;gameFbxExporter();')#opening game exporter pm.tabLayout('gameExporterTabLayout', st = 'gameExporterAnimationTab', edit = True) #switches over to the animation tab mel.eval('gameExp_CurrentTabChanged();gameExp_UpdatePrefix;gameExp_PopulatePresetList();gameExp_CreateExportTypeUIComponents();')#updates the window mel.eval('setAttr("gameExporterPreset2.exportSetIndex") `optionMenu -q -select anim_gameExporterExportSet`; gameExp_CreateExportTypeUIComponents;') #set export to export selection try: #spamming delete entry in case there are entries before already mel.eval('gameExp_DeleteAnimationClipLayout 0;') mel.eval('gameExp_DeleteAnimationClipLayout 0;') mel.eval('gameExp_DeleteAnimationClipLayout 0;') mel.eval('gameExp_DeleteAnimationClipLayout 0;') mel.eval('gameExp_DeleteAnimationClipLayout 0;') except: pass mel.eval('gameExp_AddNewAnimationClip 1;') # adds a new clip mel.eval('setAttr($gGameFbxExporterCurrentNode + ".exportPath") - type "string" "' + self.exportPath.toPlainText() + '";') #setting address formLayout1 = pm.layout('anim_gameExporterExportTypeFormLayout', query = True, childArray = True)[0] formLayout2 = pm.layout('anim_gameFbxExporterScrollLayout', query = True, childArray = True)[0] fieldText1 = pm.layout(formLayout2, query = True, childArray = True)[1] self.clipNameFieldpy = 'gameExporterWindow|gameExporterTabFormLayout|gameExporterTabLayout|gameExporterAnimationTab|anim_gameExporterMainFormLayout|anim_gameExporterExportTypeFormLayout|' + formLayout1 + '|anim_gameFbxExporterAnimClipFrameLayout|anim_gameFbxExporterAnimClipFormLayout|anim_gameFbxExporterScrollLayout|' + formLayout2 + '|' + fieldText1 mel.eval('gameExp_SetUniqueAnimationClipName 0"' + self.fileName + '"' + self.clipNameFieldpy + ';')#changing name? the 0 at the start indicates it position in the list of game clips #mel.eval('gameExp_SetUniqueAnimationClipName 0"' + self.fileName + '"' + self.clipNameFieldpy + ';')#changing name? the 0 at the start indicates it position in the list of game clips if self.ingameExport.isChecked() == 1: #forking code for future cutscene export pass elif self.cutsceneExport.isChecked() == 1: pass mel.eval('gameExp_DoExport();') mel.eval('gameExp_DeleteAnimationClipLayout 0;') # delete clip afterward
def gui(): global wnd_connector_window, windowKeepAlive global chk_keepAlive if pm.window('connectorWindow', exists=1): pm.deleteUI('connectorWindow') wnd_connector_window = pm.window("connectorWindow", title="Connector Window", widthHeight=([windowWidth, windowHeight]), sizeable=True, resizeToFitChildren=True) pm.frameLayout('Connector Mod', width=windowWidth, height=windowHeight) pm.tabLayout('tabList') tab_Todo = pm.columnLayout('TODOList', h=200, w=200) wnd_rowTODO() pm.setParent("..") tab_Quicks = pm.columnLayout('QuickLinks', h=200, w=200) wnd_rowPad() wnd_rowShapes() pm.setParent("..") tab_FKIK = pm.columnLayout('FKIK', h=200, w=200) wnd_rowFKIK() pm.setParent("..") tab_Cloth = pm.columnLayout('Cloth', h=200, w=200) pm.text(label="In the works") pm.setParent("..") tabHair = pm.columnLayout('Hair', h=200, w=200) wnd_hair_deformers() pm.setParent("..") tabOptions = pm.columnLayout('Options') pm.checkBox(label="Automatically Close Window On Creation") pm.button(label="Save Options", command=pm.Callback(saveOptions)) # back to main layout pm.setParent("..") # Lay out the tab list pm.tabLayout('tabList', edit=1, tabLabel=[(tab_Quicks, "Quick Creates"), (tab_FKIK, "FKIK"), (tab_Cloth, "Cloth Deformers"), (tabHair, "Hair Deformers"), (tab_Todo, "TODO"), (tabOptions, "Options")]) pm.setParent("..") pm.rowLayout(numberOfColumns=1) pm.button(label="Close Window/Cancel", command=pm.Callback(btn_closeWindow), height=30) pm.setParent("..") wnd_connector_window.setSizeable(False) pm.showWindow(wnd_connector_window)
def initialiseLayout(self): """ define the layout of the ui, also find every module under the TOOL_FOLDER, create a button for each module found""" logger.debug("Function Called ( %s )"%inspect.stack()[0][3]) # Define Layout self.widgets["topLevel_scroll"] = pm.scrollLayout(childResizable=True, width=self.windowWidth+25) # Add top banner to the toolbox pm.text("Animation GUI", align='center', font='boldLabelFont', height=20, bgc=[0,0,0]) #pm.text("", align='center', font='boldLabelFont', height=5, bgc=[0,0,0]) self.widgets['topLevel_tabLayout'] = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5) tab_folders = [dir for dir in os.listdir( self.top_folder_path ) if not dir.startswith("_") and dir.find('.') == -1] tab_folders = sort_with_index(tab_folders, self.top_folder_path) tab_index = 1 for tab_folder in tab_folders: pm.setParent(self.widgets["topLevel_tabLayout"]) #self.widgets['%s_frameLayout'%tab_folder] = pm.frameLayout ( label = tab_folder, collapsable = True, bgc = [0.15,0.15,0.15]) self.widgets['%s_columnLayout'%tab_folder] = pm.columnLayout(adj=True) tab_folder_path = os.path.join( self.top_folder_path, tab_folder) frame_folders = [dir for dir in os.listdir(tab_folder_path) if not dir.startswith("_") and dir.find('.')==-1] frame_folders = sort_with_index(frame_folders, tab_folder_path) logger.info ("%s|| TabLayout Created" %(tab_folder.ljust(40))) for frame_folder in frame_folders: pm.setParent(self.widgets['%s_columnLayout'%tab_folder]) self.widgets['%s_frameLayout'%frame_folder] = pm.frameLayout ( label = frame_folder, collapsable = True) self.widgets['%s_columnLayout'%frame_folder] = pm.columnLayout (adj=True) frame_folder_path = os.path.join(tab_folder_path, frame_folder) layout_folders = [dir for dir in os.listdir( frame_folder_path ) if not dir.startswith("_") and dir.find('.') == -1] layout_folders = sort_with_index(layout_folders, frame_folder_path) logger.info (" %s|| FrameLayout Created" %(frame_folder.ljust(35))) for module in layout_folders : #print "\tCreate layout for (%s.%s.%s)" %() pm.setParent(self.widgets['%s_columnLayout'%frame_folder]) try : mod = __import__ (".".join([self.top_folder, tab_folder, frame_folder, module, module]), (), (), [module]);reload(mod) mod.main() logger.info (" %s|| Layout Created" %(module.ljust(30))) except Exception, error: logger.error(' %s|| %s'%(module.ljust(30), str(error)), level='error') #print '\t\tERROR: ' + str(error) + ", skipping..." #pm.tabLayout( tabs, edit=True, tabLabel=((child1, 'One'), (child2, 'Two')) ) pm.tabLayout( self.widgets['topLevel_tabLayout'], e=True, tabLabelIndex=[tab_index, tab_folder]) tab_index += 1
def animExport_2(self): mel.eval('source gameFbxExporter;gameFbxExporter();')#opening game exporter pm.tabLayout('gameExporterTabLayout', st = 'gameExporterAnimationTab', edit = True) #switches over to the animation tab mel.eval('gameExp_CurrentTabChanged();gameExp_UpdatePrefix;gameExp_PopulatePresetList();gameExp_CreateExportTypeUIComponents();')#updates the window x = mel.eval("ls $gGameFbxExporterCurrentNode") #getting the value of the preset pm.setAttr(x[0] + '.exportSetIndex', 2)#set export to export selection mel.eval('gameExp_CreateExportTypeUIComponents;')#refresh the option #mel.eval('setAttr("gameExporterPreset2.exportSetIndex") `optionMenu -q -select anim_gameExporterExportSet`; gameExp_CreateExportTypeUIComponents;') try: #spamming delete entry in case there are entries before already mel.eval('gameExp_DeleteAnimationClipLayout 0;') mel.eval('gameExp_DeleteAnimationClipLayout 0;') mel.eval('gameExp_DeleteAnimationClipLayout 0;') mel.eval('gameExp_DeleteAnimationClipLayout 0;') mel.eval('gameExp_DeleteAnimationClipLayout 0;') except: pass mel.eval('gameExp_AddNewAnimationClip 1;') # adds a new clip mel.eval('setAttr($gGameFbxExporterCurrentNode + ".exportPath") - type "string" "' + self.exportPath.text() + '";') #setting address formLayout1 = pm.layout('anim_gameExporterExportTypeFormLayout', query = True, childArray = True)[0] #formLayout1, formLayout2, fieldText1 and self.clipNameFieldpy are all formLayout2 = pm.layout('anim_gameFbxExporterScrollLayout', query = True, childArray = True)[0] fieldText1 = pm.layout(formLayout2, query = True, childArray = True)[1] self.clipNameFieldpy = 'gameExporterWindow|gameExporterTabFormLayout|gameExporterTabLayout|gameExporterAnimationTab|anim_gameExporterMainFormLayout|anim_gameExporterExportTypeFormLayout|' + formLayout1 + '|anim_gameFbxExporterAnimClipFrameLayout|anim_gameFbxExporterAnimClipFormLayout|anim_gameFbxExporterScrollLayout|' + formLayout2 + '|' + fieldText1 if self.ingameExport.isChecked() == True:#motion export mel.eval('gameExp_SetUniqueAnimationClipName 0"' + self.exportName.text() + '"' + self.clipNameFieldpy + ';')#changing name? the 0 at the start indicates it position in the list of game clips pm.select('Character_Holder') elif self.camExport.isChecked() == True: #aim camera export mel.eval('gameExp_SetUniqueAnimationClipName 0"' + self.exportName.text() + '_cam' + '"' + self.clipNameFieldpy + ';')#changing name? the 0 at the start indicates it position in the list of game clips mel.eval('gameExp_DoExport();') #this is the point at which it exports mel.eval('gameExp_DeleteAnimationClipLayout 0;') # delete clip afterward
def __init__(self): if pm.window(win, q=True, exists=True ): pm.deleteUI(win) with pm.window(win, wh=[300,600], t=title): with pm.frameLayout( lv=False, cll=False, mw=1, mh=1): with pm.formLayout() as mainForm: # 상단 with pm.tabLayout(tv=False) as top: with pm.frameLayout(lv=False, cll=False, mw=2, mh=2, bv=False): with pm.rowLayout(nc=3, adj=2): pm.image( image = shelf_icon ) pm.text(l=' %s'%title, fn='boldLabelFont', align='left') pm.image( image = alfredIcon ) # # Contents start =========================================================== # 중단 with pm.tabLayout(tv=False, scr=True, childResizable=True) as self.mid: #with pm.columnLayout(adj=True): with pm.frameLayout( lv=False, cll=False, mw=3, mh=3, bv=False): uiContents() # # Contents end ============================================================= # # 하단 with pm.columnLayout(adj=True) as btm: pm.helpLine() # 팝업메뉴 # 왼쪽 마우스 클릭 pm.popupMenu(button=1, p=top) pm.menuItem(l='Add To Shelf', c=pm.Callback( self.addToShalf ) ) # 오른쪽 마우스 클릭 pm.popupMenu(button=3, p=top) pm.menuItem(l='Help', en=False ) # 폼조정 pm.formLayout( mainForm, e=True, attachForm=[ (top, 'top', 3), (top, 'left', 3), (top, 'right', 3), (self.mid, 'left', 3), (self.mid, 'right', 3), (btm, 'left', 3), (btm, 'right', 3), (btm, 'bottom', 3), ], attachControl=[ (self.mid, 'top', 3, top), (self.mid, 'bottom', 0, btm) ], )
def addOneTabToGlobalsWindow(self, renderer, tabLabel, createProc): # no windows no need to call if not pm.window('unifiedRenderGlobalsWindow', exists=True): return displayAllTabs = pm.mel.isDisplayingAllRendererTabs() if not displayAllTabs and pm.SCENE.defaultRenderGlobals.currentRenderer.get() != renderer: return # Set the correct tabLayout parent. if displayAllTabs: tabLayoutName = pm.mel.getRendererTabLayout(pm.melGlobals['gMasterLayerRendererName']) else: tabLayoutName = pm.mel.getRendererTabLayout(renderer) # Hide the tabForm while updating. tabFormManagedStatus = pm.formLayout('tabForm', q=True, manage=True) pm.formLayout('tabForm', edit=True, manage=False) pm.setParent('tabForm') if displayAllTabs: tabLayoutName = pm.mel.getRendererTabLayout(pm.melGlobals['gMasterLayerRendererName']) else: tabLayoutName = pm.mel.getRendererTabLayout(renderer) pm.setParent(tabLayoutName) tabName = pm.mel.rendererTabName(renderer, tabLabel) commonTabNames = { 'Common' : "m_unifiedRenderGlobalsWindow.kCommon", 'Passes' : "m_unifiedRenderGlobalsWindow.kPassesTab", 'Maya Software' : "m_unifiedRenderGlobalsWindow.kMayaSoftware", 'Maya Hardware' : "m_unifiedRenderGlobalsWindow.kMayaHardware", 'Maya Vector' : "m_unifiedRenderGlobalsWindow.kMayaVector", 'Features' : "m_unifiedRenderGlobalsWindow.kFeatures", 'Quality' : "m_unifiedRenderGlobalsWindow.kQuality", 'Indirect Lighting' : "m_unifiedRenderGlobalsWindow.kIndirectLighting", 'Options' : "m_unifiedRenderGlobalsWindow.kOptions" } if commonTabNames.has_key(tabLabel): tabLabel = pm.mel.uiRes(commonTabNames[tabLabel]) if not pm.layout(tabName, exists=True): pm.setUITemplate('renderGlobalsTemplate', pushTemplate=True) pm.setUITemplate('attributeEditorTemplate', pushTemplate=True) pm.formLayout(tabName) createProcs = ['createMayaSoftwareCommonGlobalsTab', 'createMayaSoftwareGlobalsTab'] try: createProcs.extend(pm.renderer(renderer, q=True, globalsTabCreateProcNames=True)) except: pass if createProc in createProcs: pm.mel.eval(createProc) pm.setParent('..') pm.setUITemplate(popTemplate=True) pm.setUITemplate(popTemplate=True) pm.tabLayout(tabLayoutName, edit=True, tabLabel=(tabName, tabLabel)) pm.formLayout('tabForm', edit=True, manage=tabFormManagedStatus)
def gui(path): win = 'salwindow' if(pm.window(win, ex = True)): pm.deleteUI(win) if(pm.windowPref(win, ex = True)): pm.windowPref(win, remove = True) myWin = pm.window(win, title='SAL_Grading' , sizeable = True, mnb = True, width = 490, height = 800, backgroundColor= [.68,.68,.68], toolbox= 0) main = pm.scrollLayout(width = 490) tabs = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5, width = 490) pm.setParent(tabs) first = pm.columnLayout(adjustableColumn = True, width = 490) proj01 = sal.Project01(path).create() pm.setParent(tabs) second = pm.columnLayout(adjustableColumn = True, width = 490) proj02 = sal.Project02(path).create() pm.setParent(tabs) third = pm.columnLayout(adjustableColumn = True, width = 490) proj03 = sal.Project03(path).create() pm.setParent(tabs) fourth = pm.columnLayout(adjustableColumn = True, width = 490) proj04 = sal.Project04(path).create() pm.setParent(tabs) fith = pm.columnLayout(adjustableColumn = True, width = 490) proj05 = sal.Project05(path).create() pm.setParent(tabs) sixth = pm.columnLayout(adjustableColumn = True, width = 490) proj06 = sal.Project06(path).create() pm.setParent(tabs) seventh = pm.columnLayout(adjustableColumn = True, width = 490) proj07 = sal.Project07(path).create() pm.setParent(tabs) final = pm.columnLayout(adjustableColumn = True, width = 490) final_proj = sal.Final_Project(path).create() # ------------------------------------------ pm.tabLayout( tabs, edit=True, tabLabel=((first, 'Proj01'), (second, 'Proj02'), (third, 'Proj03 '), (fourth, 'Proj04'), (fith, 'Proj05'), (sixth, 'Proj06'), (seventh, 'Proj07'), (final, ' Final ')) ) myWin.show()
def assign_tabs(tabs, tab_layout, change_command=''): for tab in tabs: pm.tabLayout(tab_layout, edit=True, tabLabel=[(tab[0], tab[1])]) if change_command: pm.tabLayout(tab_layout, edit=True, changeCommand=change_command)
def MakeTabLayout(height=None): """ Creates & returns a PyMel tab layout. :param height: float, specific height, or None for default. """ if(height is not None): return pm.tabLayout(height=height) else: return pm.tabLayout()
def show_in_shelf_editor(self, button): """ Open the shelf editor, and view the script for the shelf button with the given name. """ # The shelf editor only works on the currently-selected shelf. pm.tabLayout(gShelfTopLevel, edit=True, selectTabIndex=self.shelf_idx + 1) wnd = shelfEditorWindow() wnd.create(button, 2)
def __init__(self): title="michaelTools" if(pm.windowPref(title, q=True, ex=True)): pm.windowPref(title, remove=True) if(pm.window(title, q=True, ex=True)): pm.deleteUI(title) # Michael's Tools UI self.win = pm.window(title, title="Michael's Tools") self.winlayout = pm.columnLayout() self.tabs = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5) # CTRL Tools TAB self.ctrlTools_layout = pm.columnLayout(parent = self.tabs) # grouping Functions frame and contents self.grpFrame = pm.frameLayout( parent = self.ctrlTools_layout, w =244, label='Grouping Functions', borderStyle='out', cll = True, cl = True ) self.grplayout = pm.rowColumnLayout(parent = self.grpFrame, numberOfColumns = 2, columnWidth = [(1, 120), (2, 120)] ) self.offSetGRP_Btn = pm.button(parent=self.grplayout,w = 100, h = 24, label="Add Offset Group", command = offSetGRP.add_offset_grps ) self.sdkGRP_Btn = pm.button(parent=self.grplayout,w = 100, h = 24, label="Add SDK Group", command = sdkGRP.add_SDK_grps ) self.conGRP_Btn = pm.button(parent=self.grplayout,w = 100, h = 24, label="Add Control Group", command = conGRP.add_con_grps ) self.underLoc_Btn = pm.button(parent=self.grplayout,w = 100, h = 24, label="Under Locator", command = unLoc.under_locator ) # color overrides frame and contents self.colorFrame = pm.frameLayout( parent = self.ctrlTools_layout, w =244, label='Color Overrides', borderStyle='out', cll = True, cl = True ) self.colorlayout = pm.columnLayout( parent = self.colorFrame, columnWidth = 120 ) self.colorSlider = pm.colorIndexSliderGrp( parent = self.colorlayout,cw3 = [40, 60, 130], label='Color ', min=1, max=32, value=0 ) self.changeColor_Btn = pm.button(parent=self.colorlayout,w = 240, h = 24, label="Override Color", command = self.exe_sliderColor ) self.orRGBText = pm.text( parent=self.colorlayout, w = 240, label='Or Use', align='center' ) self.changeColor_Btn = pm.button(parent=self.colorlayout,w = 240, h = 24, label="RGB Color Picker", command = rgbColor.rgbColorOverride ) # Shape Functions Frame and Contents self.shapeFrame = pm.frameLayout( parent = self.ctrlTools_layout, w =244, label='Shape Functions', borderStyle='out', cll = True, cl = True ) self.shapelayout = pm.columnLayout(parent = self.shapeFrame, columnWidth = 240 ) self.parentShape_Btn = pm.button(parent=self.shapelayout,w = 240, h = 24, label="Parent Shapes To Last", command = prntShps.parentShapes ) ctrlTools_gradParent=self.ctrlTools_layout ctrlTools_gradParent.getNumberOfChildren() color_range = ColorRange([0.0, 0.4, 0.4]) for ctrlTools_grad, color in zip(ctrlTools_gradParent.children(), color_range.get_range(len(ctrlTools_gradParent.children())) ): print ctrlTools_grad, color ctrlTools_grad.setBackgroundColor(color) # TRANSFORM TOOLS TAB self.transformTools_layout = pm.columnLayout(parent = self.tabs) self.newPivBtn = pm.button(parent = self.transformTools_layout, w = 244, h = 24, label="Match All Piviots To Last Selected", command = newPivot.set_newPivot ) self.newPosBtn = pm.button(parent = self.transformTools_layout, w = 244, h = 24, label="Match All Positions To Last Selected", command = newPosition.set_newPosition ) # Edit Tab Layout labels pm.tabLayout( self.tabs, edit=True, tabLabel=((self.ctrlTools_layout, 'Control Tools'), (self.transformTools_layout, 'Transform Tools')) ) # Window Functions self.closeToolBtn = pm.button(parent = self.winlayout,w = 251, h = 24, label="Close Tool", command = self.closeWin) self.delete = [] self.win.show()
def get_shelves(cls): """ Return an array of all shelves, as Shelf objects. """ labels = pm.tabLayout(gShelfTopLevel, q=True, tabLabel=True) shelves = pm.tabLayout(gShelfTopLevel, q=True, childArray=True) results = [] for idx, (shelf, label) in enumerate(zip(shelves, labels)): if pm.objectTypeUI(shelf) != 'shelfLayout': continue results.append(cls(shelf, label)) return results
def select_shelf(self): """ Select this shelf in the main shelf. Return true on success, false if the shelf no longer exists. """ idx = self.shelf_idx if idx == -1: log.warning('Shelf %s no longer exists', self.path) return False pm.tabLayout(gShelfTopLevel, edit=True, selectTabIndex=idx + 1) return True
def _categoryUpdated(self, add=None, rename=None, delete=None): _pmCore.setParent(self._uiWidget[_UiWidgetEnum.categoryTabLayout]) if add: # Add a tab in main asset view. childLayout = _pmCore.scrollLayout(width=300, height=200, childResizable=True) self._uiWidget[add] = _pmCore.gridLayout(numberOfColumns=3, cellHeight = self._iconSize, cellWidth=self._iconSize) _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], tabLabel=((childLayout, add),), edit=True) # Add a menu item in category list. From example in Maya doc optionMenuGrp. newMenuItem = _pmCore.menuItem(label=add, parent=self._uiWidget[_UiWidgetEnum.categoryCombox]+'|OptionMenu') self._uiWidget[_UiWidgetEnum.categoryMenuList].append(newMenuItem) if rename: tabNameList = _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], query=True, tabLabel=True) childLayoutList = _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], query=True, childArray=True) _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], edit=True, tabLabel=((childLayoutList[tabNameList.index(rename[0])], rename[1]))) for item in self._uiWidget[_UiWidgetEnum.categoryMenuList]: if _pmCore.menuItem(item, query=True, label=True) != rename[0]: continue _pmCore.menuItem(item, edit=True, label=rename[1]) break if delete: tabNameList = _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], query=True, tabLabel=True) childLayoutList = _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], query=True, childArray=True) _pmCore.deleteUI(childLayoutList[tabNameList.index(delete)]) for item in self._uiWidget[_UiWidgetEnum.categoryMenuList]: if _pmCore.menuItem(item, query=True, label=True) != delete: continue _pmCore.deleteUI(item) break
def create_baking_system(): ''' # this creates an Options_ui instances and appends to the tab_layout ''' pm.setParent(tab_layout) rigid_body_objects = obj_scroll_list.getAllItems() name = name_field.getText() ui = Options_UI(rigid_body_objects, name) layout = ui.create_ui() pm.tabLayout(tab_layout, edit=True, tabLabel=((layout, '%s' % (name))))
def __init__(self): self._window = pm.window(title='Vibrate', widthHeight=VibrateWindow._size, sizeable=False, maximizeButton=False) self._wrapper = pm.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, VibrateWindow._size[0]), (2, VibrateWindow._size[0])], height=VibrateWindow._size[1]) self._form = pm.formLayout(parent=self._wrapper, height=470) self._execBtn = pm.button(label='Set Vibration', parent=self._wrapper, command=State.setVibration) self._clearBtn = pm.button(label='Clear Vibration', parent=self._wrapper, command=State.clearVibration) self._tabs = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5) self._subform = pm.formLayout(self._form, edit=True, attachForm=((self._tabs, 'top', 0), (self._tabs, 'left', 0), (self._tabs, 'bottom', 0), (self._tabs, 'right', 0))) self._tabObjects = pm.rowColumnLayout(numberOfColumns=1) pm.button(label='Add selected from scene', command=State.addSelectedObjectsFromScene) pm.button(label='Remove selected in scene', command=State.removeSelectedObjectInScene) pm.button(label='Remove selected in list', command=State.removeSelectedObjectsInList) pm.button(label='Remove all', command=State.removeAllObjects) self.selectedObjectsList = pm.iconTextScrollList(allowMultiSelection=True, height=(VibrateWindow._size[1] - 150)) pm.setParent('..') self._tabVibration = pm.rowColumnLayout(numberOfColumns=1) pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)]) pm.text(label='Start frame:') self.startField = pm.intField(minValue=-999999, maxValue=999999, step=1, value=0) pm.setParent('..') pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)]) pm.text(label='End frame:') self.endField = pm.intField(minValue=-999999, maxValue=999999, step=1, value=1) pm.setParent('..') pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)]) pm.text(label='X Force:') self.xForceField = pm.floatField(minValue=0.0, maxValue=999999.9, step=0.1, value=1.0) pm.setParent('..') pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)]) pm.text(label='Y Force:') self.yForceField = pm.floatField(minValue=0.0, maxValue=999999.9, step=0.1, value=1.0) pm.setParent('..') pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)]) pm.text(label='Z Force:') self.zForceField = pm.floatField(minValue=0.0, maxValue=999999.9, step=0.1, value=1.0) pm.setParent('..') pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)]) pm.text(label='Speed:') self.speedField = pm.floatField(minValue=0.0, maxValue=999999.9, step=0.2, value=1.0) pm.setParent('..') pm.tabLayout(self._tabs, edit=True, tabLabel=((self._tabObjects, 'Objects'), (self._tabVibration, 'Vibration')))
def run(self): pm.setParent(pm.mel.eval('getOptionBox()')) pm.setUITemplate('DefaultTemplate', pushTemplate=True) pm.waitCursor(state=1) pm.tabLayout(tabsVisible=False, scrollable=True) self.options_box_setup() self.option_box_load() pm.waitCursor(state=0) pm.setUITemplate(popTemplate=True) # We need to set both apply and apply and close explicitly. Maya breaks apply and close # if apply is set to a Python function. def apply(unused): self.option_box_save() self.option_box_apply() def apply_and_close(unused): self.option_box_save() self.option_box_apply() pm.mel.eval('hideOptionBox()') pm.button(pm.mel.eval('getOptionBoxApplyBtn()'), edit=True, command=apply) pm.button(pm.mel.eval('getOptionBoxApplyAndCloseBtn()'), edit=True, command=apply_and_close) # XXX: Is there a way for us to add a help link? pm.mel.eval('setOptionBoxCommandName("%s")' % self.title) # pm.mel.eval('setOptionBoxHelpTag "%s"' % self.title) pm.mel.eval('setOptionBoxTitle("%s");' % self.title) pm.mel.eval('showOptionBox()') # These need to be set directly to the menu item after showing the option box to # work around a Maya bug that breaks these when they're connected to Python functions. pm.menuItem(pm.mel.globals['gOptionBoxEditMenuSaveItem'], edit=True, command=lambda unused: self.option_box_save()) pm.menuItem(pm.mel.globals['gOptionBoxEditMenuResetItem'], edit=True, command=lambda unused: self.option_box_reset())
def create_baking_system(): ''' # this creates an Options_ui instances and appends to the tab_layout ''' pm.setParent(tab_layout) rigid_body_objects = obj_scroll_list.getAllItems() name = name_field.getText() ui = Options_UI(rigid_body_objects, name) layout = ui.create_ui() pm.tabLayout( tab_layout, edit=True, tabLabel=((layout, '%s' % (name))))
def ui(): ''' update : 2015-04-24 ''' if pm.window(win, q=True, exists=True ): pm.deleteUI(win) with pm.window(win, wh=[300,600], t=title): with pm.frameLayout( lv=False, cll=False, mw=1, mh=1): with pm.formLayout() as mainForm: #with pm.columnLayout(adj=True) with pm.tabLayout(tv=False) as top: with pm.frameLayout(lv=False, cll=False, mw=2, mh=2, bv=False): with pm.rowLayout(nc=3, adj=2): pm.image( image = shelfIcon ) pm.text(l=' %s'%title, fn='boldLabelFont', align='left') pm.image( image = alfredIcon ) with pm.tabLayout(tv=False, scr=True, childResizable=True) as mid: with pm.columnLayout(adj=True): uiContents() #with pm.columnLayout(adj=True) as btm: # pm.helpLine() with pm.horizontalLayout() as btm: pm.button() pm.button() pm.button() pm.formLayout( mainForm, e=True, attachForm=[ (top, 'top', 3), (top, 'left', 3), (top, 'right', 3), (mid, 'left', 3), (mid, 'right', 3), (btm, 'left', 3), (btm, 'right', 3), (btm, 'bottom', 3), ], attachControl=[ (mid, 'top', 3, top), (mid, 'bottom', 3, btm) ] )
def show_popup_in_shelf_editor(self, button, popup): """ Open the shelf editor, and view the script for a popup in a shelf button. """ pm.tabLayout(gShelfTopLevel, edit=True, selectTabIndex=self.shelf_idx + 1) wnd = shelfEditorWindow() wnd.create(button, 4) # Find the index of the popup. popup_names = wnd.updateMenuItemList() idx = popup_names.index(popup) if idx != -1: wnd.updateMenuItemList(idx + 1)
def _build_axis_limits_frame(parent_layout): limits_frame = pm.frameLayout(label="Axis Limits", collapsable=True) limits_tab_layout = pm.tabLayout('limits_tab_layout') position_limits_tab = _build_position_limits_tab(limits_tab_layout) velocity_limits_tab = _build_velocity_limits_tab(limits_tab_layout) accel_limits_tab = _build_accel_limits_tab(limits_tab_layout) jerk_limits_tab = _build_jerk_limits_tab(limits_frame) tabs = [(position_limits_tab, 'Position'), (velocity_limits_tab, 'Vel'), (accel_limits_tab, 'Accel'), (jerk_limits_tab, 'Jerk')] assign_tabs(tabs, limits_tab_layout) pm.columnLayout() pm.gridLayout(nc=2, cw=114, ch=25) pm.button(label='Get Axis Limits', command=mimic_utils.write_limits_to_ui) pm.button(label='Set Axis Limits', command=mimic_utils.set_axis_limits) pm.setParent('..') pm.button(label='Clear', width=228, command=mimic_utils.clear_limits_ui) pm.setParent(parent_layout)
def uiOptions(self): with pm.tabLayout(tv=False, imw=5, imh=5 ) as layout: with pm.columnLayout(adj=1): self.navFieldGrp( 'navFieldGrp', label='Work Path : ', text=self.startPath.get(), optVar=self.startPath, fileMode='dir' ) pm.separator(style='in', h=8) with pm.rowLayout(nc=7): pm.text(l=' Work : ', al='right', w=140 ) pm.button(l='Create', c=partial( self.btnCmd, 'create'), w=50 ) pm.button(l='Reload', c=partial( self.btnCmd, 'reload'), w=50 ) pm.button(l='Replace', c=partial( self.btnCmd, 'replace'), w=50 ) pm.button(l='Import', c=partial( self.btnCmd, 'import'), w=50 ) pm.button(l='Remove', c=partial( self.btnCmd, 'remove'), w=50 ) with pm.rowLayout(nc=7): pm.text(l='',al='right', w=140 ) pm.button(l='Print Reference State', c=partial( self.btnCmd, 'state'), w=128 ) pm.separator(style='in', h=8) with pm.rowLayout(nc=7): pm.text(l='Maya Editor : ',al='right', w=140 ) pm.button(l='Reference Editor', c=pm.Callback( pm.mel.ReferenceEditor ), w=128 ) pm.button(l='Namespace Editor', c=pm.Callback( pm.mel.NamespaceEditor ), w=128 ) return layout
def build_external_tab(parent_layout): # Create preferences tab Layout external_tab_layout = pm.columnLayout(adj=True, height=525, width=200) # Create Form Layout with embeded Tab Layout external_tabs_form = pm.formLayout() external_tabs_layout = pm.tabLayout('external_tabs_layout', height=100, borderStyle='none') pm.formLayout(external_tabs_form, edit=True, attachForm=[(external_tabs_layout, "top", 0), (external_tabs_layout, "bottom", 0), (external_tabs_layout, "left", 0), (external_tabs_layout, "right", 0)]) external_axes_tab_layout = _build_external_axes_tab(external_tabs_layout) # io_tab_layout = _build_io_tab(external_tabs_layout) # comms_tab_layout = _build_comms_tab(external_tabs_layout) tabs = [ [external_axes_tab_layout, 'External Axes'], # [io_tab_layout, 'IOs'], # [comms_tab_layout, 'Comms'] ] assign_tabs(tabs, external_tabs_layout) pm.setParent(parent_layout) return external_tab_layout
def toolShelf(): tab = tabLayout() shelfLayout( 'Tools - Copy these freely into your shelf, they will get remade when fossil is opened' ) shelfButton( image1='zeropose.png', annotation='Zero Controllers', command= "import pdil.tool.fossil.userTools;pdil.core.alt.call('Zero Controllers')()" ) shelfButton( image1='skeletonTool.png', annotation='Open Fossil', command="import pdil.tool.fossil.main;pdil.core.alt.call('Rig Tool')()" ) shelfButton( image1='selectAllControls.png', annotation='Select All Controllers', command= "import pdil.tool.fossil.userTools;pdil.core.alt.call('Select All Controllers')()" ) shelfButton( image1='quickHideControls.png', annotation='Similar to "Isolated Selected" but just for rig controls', command= "import pdil.tool.rigControls;pdil.core.alt.call('Quick Hide Controls')()" ) return tab
def ui(): if pm.window(win, q=True, exists=True ): pm.deleteUI(win) with pm.window(win, wh=[300,600], t=title): with pm.frameLayout( lv=False, cll=False, mw=1, mh=1): with pm.columnLayout(adj=True): with pm.tabLayout(tv=False): with pm.frameLayout(lv=False, cll=False, mw=2, mh=2, bv=False): with pm.rowLayout(nc=3, adj=2): pm.image( image = shelfIcon ) pm.text(l=' %s'%title, fn='boldLabelFont', align='left') pm.image( image = alfredIcon ) pm.separator( h=8, style='in') with pm.frameLayout(lv=False, cll=False, mw=0, mh=0, bv=False): with pm.frameLayout(lv=False, cll=False, mw=3, mh=3, bv=False): # Scene ----------------------- with pm.frameLayout(l='Scene', cll=True, mw=3, mh=3 ): with pm.columnLayout(adj=True): with pm.rowLayout( nc=10 ): pm.text(label='Reference Editor 2 : ', align='right', w=150) pm.button(label='Open UI...', w=180, en=False ) with pm.rowLayout( nc=10 ): pm.text(label='File Traveler : ', align='right', w=150) pm.button(label='Open UI...', w=180, en=False ) # Camera ----------------------- with pm.frameLayout(l='Camera', cll=True, mw=3, mh=3 ): with pm.columnLayout(adj=True): with pm.rowLayout( nc=10 ): pm.text(label='Create Camera : ', align='right', w=150) with pm.columnLayout(): pm.button(label='Create Turntable Camera', w=180, en=False ) pm.button(label='Create Frustum Camera', w=180, en=False ) pm.button(label='Create Stereo Camera', w=180, en=False ) with pm.rowLayout( nc=10 ): pm.text(label='Set Camera Playback Range : ', align='right', w=150) pm.button(label='set', c=pm.Callback( sm.setCamPlaybackRange ), w=180 ) with pm.rowLayout( nc=10 ): pm.text(label='HUD : ', align='right', w=150) pm.button(label='Scene Name HUD', w=180, en=False ) with pm.rowLayout( nc=10 ): pm.text(label='Export Camera : ', align='right', w=150) pm.button(label='for After Effect...', w=180, en=False ) # Asset ----------------------- with pm.frameLayout(l='Asset', cll=True, mw=3, mh=3 ): with pm.columnLayout(adj=True): with pm.rowLayout( nc=10 ): pm.text(label='Toggle Display CharacterGeo : ', align='right', w=150) pm.button(label='( preview / render )', c=pm.Callback( sm.toggleDisplayCharacterGeo ), w=180 )
def build_setup_tab(parent_layout): # Create setup tab Layout setup_tab_layout = pm.columnLayout(adj=True, height=525, width=200) # Create Form Layout with embeded Tab Layout setup_tabs_form = pm.formLayout() setup_tabs_layout = pm.tabLayout('setup_tabs_layout', height=100, borderStyle='none') pm.formLayout(setup_tabs_form, edit=True, attachForm=[(setup_tabs_layout, "top", 0), (setup_tabs_layout, "bottom", 0), (setup_tabs_layout, "left", 0), (setup_tabs_layout, "right", 0)]) general_setup_tab_layout = _build_general_setup_tab(setup_tabs_layout) external_axes_tab_layout = _build_external_axes_tab(setup_tabs_layout) io_tab_layout = _build_io_tab(setup_tabs_layout) # comms_tab_layout = _build_comms_tab(setup_tabs_layout) tabs = [ [general_setup_tab_layout, 'General'], [external_axes_tab_layout, 'External Axes'], [io_tab_layout, 'IOs'], # [comms_tab_layout, 'Comms'] ] assign_tabs(tabs, setup_tabs_layout) pm.setParent(parent_layout) return setup_tab_layout
def select_tab(self, tab_ctrl): """ """ tab_layout = self.controls_tab_layout # Get all of the tab labels tab_labels = pm.tabLayout(tab_layout, query=True, tabLabel=True) tab_labels.remove('Setup') # Remove the setup tab # Get the controller for each tab for tab_name in tab_labels: tab_ctrl_i = self._get_tab_ctrl(tab_name) # If the selected controller matches the i-th tab controller, # select the tab if tab_ctrl == tab_ctrl_i: pm.tabLayout(tab_layout, edit=True, selectTab=tab_name)
def __init__(self): #Store UI elements in a dictionary self.UIElements = {} if pm.window("blueprint_UI_window", exists=True): pm.deleteUI("blueprint_UI_window") self.windowWidth = 400 self.windowHeight = 598 self.UIElements["window"] = pm.window("blueprint_UI_window", width=self.windowWidth, height=self.windowHeight, title="blueprint_UI_window") self.UIElements["topLevelColumn"] = pm.columnLayout( adjustableColumn=True, columnAlign="center") #Setup Tabs #every child creates new tab tabHeight = 500 self.UIElements["tabs"] = pm.tabLayout(height=tabHeight, innerMarginWidth=5, innerMarginHeight=5) tabWidth = pm.tabLayout(self.UIElements["tabs"], q=True, width=True) tabWidth = 400 self.scrollWidth = tabWidth - 40 self.initializeModuleTab(tabHeight, tabWidth) pm.tabLayout(self.UIElements["tabs"], edit=True, tabLabelIndex=([1, "Modules"])) #3. Lock and Publish Buttons pm.setParent(self.UIElements["topLevelColumn"]) self.UIElements["lockPublishColumn"] = pm.columnLayout( adj=True, columnAlign="center", rs=3) #single column pm.separator() self.UIElements["lockBtn"] = pm.button(label="Lock", command=partial(self.lock)) pm.separator() self.UIElements["publishBtn"] = pm.button(label="Publish") pm.separator() #Display window pm.showWindow(self.UIElements["window"])
def __init__(self): #Store UI elements in a dictionary self.UIElements = {} if pm.window("mo_UI_window", exists=True): pm.deleteUI("mo_UI_window") self.windowWidth = 400 self.windowHeight = 598 self.UIElements["window"] = pm.window("mo_UI_window", width=self.windowWidth, height=self.windowHeight, title="mo_UI_window") self.UIElements["topLevelColumn"] = pm.columnLayout( adjustableColumn=True, columnAlign="center") #Setup Tabs #every child creates new tab tabHeight = 500 tabWidth = 400 self.scrollWidth = tabWidth - 40 self.UIElements["tabs"] = pm.tabLayout(height=tabHeight, innerMarginWidth=5, innerMarginHeight=5) riggTab = self.initializeRiggTab(tabHeight, tabWidth) pm.setParent("..") animTab = self.initializeAnimTab(tabHeight, tabWidth) pm.setParent("..") displayTab = self.initializeDisplayTab(tabHeight, tabWidth) pm.setParent("..") modelTab = self.initializeModelTab(tabHeight, tabWidth) pm.setParent("..") renderTab = self.initializeRenderTab(tabHeight, tabWidth) pm.tabLayout(self.UIElements["tabs"], edit=True, tabLabel=((riggTab, 'mo_rigg'), (animTab, 'mo_anim'), (displayTab, 'mo_display'), (modelTab, 'mo_model'), (renderTab, 'mo_render'))) #Display window pm.showWindow(self.UIElements["window"])
def _buildupWindow(self): if self._dockControl and self._dockControl.exists(self._winTitle): _pmCore.deleteUI(self._dockControl) self._window = _pmCore.window(title=self._winTitle) _pmCore.columnLayout() self._dockControl = _pmCore.dockControl(area='right', content=self._window, label=self._winTitle) tabLayout = _pmCore.tabLayout() self._uiWidget[_UiWidgetEnum.categoryTabLayout] = tabLayout for category in _Database.getCategoryList(): childLayout = _pmCore.scrollLayout(width=300, height=300, childResizable=True) self._uiWidget[category] = _pmCore.gridLayout(numberOfColumns=3, cellHeight = self._iconSize, cellWidth=self._iconSize) for assetInfo in _Database.getAssetUnderCategory(category): id, sceneName, _, versionID, _, _, _ = assetInfo self._addAssetButton(id, sceneName, versionID) _pmCore.tabLayout(tabLayout, tabLabel=((childLayout, category),), edit=True) _pmCore.setParent('..') _pmCore.setParent('..') _pmCore.setParent('..') self._uiWidget[_UiWidgetEnum.sceneNameTextField] = _pmCore.textFieldGrp(label='Scene Name: ', width=300, columnAlign2=['left', 'left'], columnWidth2=[100, 195]) self._uiWidget[_UiWidgetEnum.filePathTextField] = _pmCore.textFieldGrp(label='File Path: ', width=300, columnAlign2=['left', 'left'], columnWidth2=[100, 195]) _pmCore.rowLayout(numberOfColumns=2) _pmCore.text(label="Current Version:", width=100, align='left') self._uiWidget[_UiWidgetEnum.versionNumText] = _pmCore.text(label="") _pmCore.setParent('..') self._uiWidget[_UiWidgetEnum.categoryCombox] = _pmCore.optionMenuGrp(label='Category: ', width=300, columnAlign2=['left', 'left'], columnWidth2=[100, 195]) for category in _Database.getCategoryList(): self._uiWidget.setdefault(_UiWidgetEnum.categoryMenuList, []).append(_pmCore.menuItem(label=category)) _pmCore.text(label='Description:') self._uiWidget[_UiWidgetEnum.descriptionTextField] = _pmCore.scrollField(width=300, height=50) _pmCore.separator(style='single', horizontal=True) _pmCore.gridLayout(numberOfColumns=2, cellWidth=150) self._uiWidget[_UiWidgetEnum.updateAssetBtn] = _pmCore.button(label='Update Asset Info', command=_pmCore.Callback(self._updateAssetClicked)) self._uiWidget[_UiWidgetEnum.addCommentBtn] = _pmCore.button(label='View Version & Comment', command=_pmCore.Callback(self._viewVersionListClicked)) self._uiWidget[_UiWidgetEnum.addAssetBtn] = _pmCore.button(label='Add New Asset', command=_pmCore.Callback(self._addAssetClicked)) self._uiWidget[_UiWidgetEnum.deleteAssetBtn] = _pmCore.button(label='Delete Asset', command=_pmCore.Callback(self._deleteAssetClicked)) self._uiWidget[_UiWidgetEnum.addVersionBtn] = _pmCore.button(label='Add Version', command=_pmCore.Callback(self._addVersionClicked)) self._uiWidget[_UiWidgetEnum.manageCategoryBtn] = _pmCore.button(label='Manage Category', command=self._manageCategoryClicked) _pmCore.setParent('..')
def show(self): if pm.window("dataConvertWin", ex=True): pm.deleteUI("dataConvertWin") pm.window("dataConvertWin", t=u"自动输出 %s" % __version__, mb=True, cc=lambda *args: self._close_main_window()) self.menu_list() tabs = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5) child1 = self.child_tab_export() child2 = self.child_tab_import() pm.tabLayout(tabs, edit=True, tabLabel=((child1, u'输出'), (child2, u'导入'))) pm.showWindow("dataConvertWin")
def _build_program_settings_frame(parent_layout): program_settings_frame = pm.frameLayout(label="Program Settings", collapsable=True) # Create Form Layout with embedded Tab Layout program_settings_form = pm.formLayout() program_settings_tab_layout = pm.tabLayout('program_settings_tab_layout') pm.formLayout(program_settings_form, edit=True, attachForm=[(program_settings_tab_layout, "top", 3), (program_settings_tab_layout, "bottom", 3), (program_settings_tab_layout, "left", 3), (program_settings_tab_layout, "right", 3)]) general_settings_tab_layout = _build_general_settings_tab( program_settings_tab_layout) proc_options_tab_layout = _build_proc_options_tab(program_settings_frame) tabs = [[general_settings_tab_layout, 'General'], [proc_options_tab_layout, 'Advanced']] assign_tabs(tabs, program_settings_tab_layout) program_settings_col = pm.columnLayout(adj=True, columnAttach=['both', 3]) # Output options pm.checkBox('cb_overwriteFile', label="Overwrite existing file", value=postproc_config.OPTS_OVERWRITE_EXISTING_FILE, annotation='If checked, an existing file with the input ' \ 'output name will be overwritten') pm.checkBox('cb_ignoreWarnings', label="Ignore warnings", value=postproc_config.OPTS_IGNORE_WARNINGS, annotation='If checked, all warnings will be ignored and ' \ 'a program will be written') pm.separator(height=3, style='none') pm.separator(height=3, style='none') pm.button('Analyze Program', command=mimic_program.analyze_program, height=25, annotation='Launches graphical analysis tool') pm.button('Save Program', command=mimic_program.save_program, height=25, annotation='Saves robot control program with input parameters') pm.separator(height=3, style='none') export_progress_bar = pm.progressBar('pb_exportProgress', isInterruptable=True, maxValue=100, visible=0) pm.setParent(parent_layout)
def shelf_idx(self): """ Return the index of this shelf. This can change after we're created, eg. if shelves are reordered. """ shelves = pm.tabLayout(gShelfTopLevel, q=True, childArray=True) try: return shelves.index(self.path) except IndexError: return -1
def main(): # create controls win = pm.window(t="autoren", tlb=1) tab = pm.tabLayout(showNewTab=1, tc=1) tab.newTabCommand(pm.Callback(createNewTab, tab)) # create first tab createNewTab(tab, "base") win.show()
def create_mimic_tabs(): # Create Form Layout with embeded Tab Layout mimic_form = pm.formLayout() mimic_tab_layout = pm.tabLayout() pm.formLayout(mimic_form, edit=True, attachForm=[(mimic_tab_layout, "top", 3), (mimic_tab_layout, "bottom", 3), (mimic_tab_layout, "left", 3), (mimic_tab_layout, "right", 3)]) return mimic_tab_layout
def _deleteShelfTab(self, shelfTab=None,*args): ''' Deleting shelfLayout crashes 2010, so hiding, disabling and changing name. When saving shelves, hidden ones will be ignored. ''' if len(self.shelfTabs) == 1: print '\nFloatingShelf: Warning: Can not delete the last tab.', return if pm.shelfLayout(shelfTab, q=True, exists=True): # Display shelf not being deleted for tab in self.shelfTabs: if tab != shelfTab: pm.tabLayout(self.mainLayout,edit=True,selectTab=tab) # Hide the shelf pm.shelfLayout( shelfTab, e=True, visible=False ) pm.shelfLayout( shelfTab, e=True, enable=False ) tabName = shelfTab.split('|')[-1] pm.shelfTabLayout( self.mainLayout, e=True, tabLabel=(tabName,'%s(Deleted)'%tabName) ) index = self.shelfTabs.index(shelfTab) self.shelfTabs[index] = shelfTab.replace(tabName,tabName+'(Deleted)')
def _create_control_tabs(self): """ """ control_tabs_formLayout = pm.formLayout() controls_tab_layout = pm.tabLayout(changeCommand=self._tab_changed) pm.formLayout(control_tabs_formLayout, edit=True, attachForm=[(controls_tab_layout, "top", 5), (controls_tab_layout, "bottom", 0), (controls_tab_layout, "left", 0), (controls_tab_layout, "right", 0)]) return controls_tab_layout
def __init__(self, iconPath): self.name = "Control_Creation_UI" self.title = "Create Controls" if (pm.window(self.name, q=1, exists=1)): pm.deleteUI(self.name) self.window = pm.window(self.title, widthHeight=(300, 300), resizeToFitChildren=1, menuBar=True) self.iconPath = iconPath icons = [f for f in os.listdir(self.iconPath) if f.endswith('.png')] #menu pm.menu( label='UI', helpMenu=True ) pm.menuItem( label='Create Icons', command = pm.Callback(self.createIcons)) form = pm.formLayout() tabs = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5) pm.formLayout( form, edit=True, attachForm=((tabs, 'top', 0), (tabs, 'left', 0), (tabs, 'bottom', 0), (tabs, 'right', 0))) child1 = pm.rowColumnLayout(numberOfColumns=3) for style in SimpleCurves.STYLES: if icons and "%s.png"%(style) in icons: iPath = os.path.join(self.iconPath, "%s.png"%(style)) pm.iconTextButton(label=style, style='iconAndTextVertical', image1=iPath, command = pm.Callback(self.simpleCurve, style)) else: pm.button(label=style, command = pm.Callback(self.simpleCurve, style)) pm.setParent( '..' ) child2 = pm.rowColumnLayout(numberOfColumns=2) pm.button() pm.setParent( '..' ) child3 = pm.rowColumnLayout(numberOfColumns=2) pm.button() pm.button() pm.button() pm.setParent( '..' ) pm.tabLayout( tabs, edit=True, tabLabel=((child1, 'Simple Curves'), (child2, 'Combo Controls'), (child3, 'Facial Controls')) ) pm.showWindow(self.window)
def gui(): ''' # gui for the script ''' win = 'shader_grading' if (pm.window(win, ex=True)): pm.deleteUI(win) if (pm.windowPref(win, ex=True)): pm.windowPref(win, remove=True) my_win = pm.window(win, title='shader_grading', width=550, height=250) main = pm.columnLayout() tab_layout = pm.tabLayout() sorter = pm.columnLayout() grader = Shader_sorter() pm.setParent(tab_layout) assigner_layout = pm.columnLayout() assigner = Shader_assign() pm.setParent(sorter) pm.tabLayout(tab_layout, edit=True, tabLabel=((sorter, 'Grade'), (assigner_layout, 'Assign'))) pm.text(label='Objects With Default Lambert', align='center', height=50, backgroundColor=[1, 0, 0], width=550) pm.scrollLayout(width=560, height=300) lambert_objs = Lambert_objects_checker() my_win.show()
def __init__(self): self._window = pm.window(title='RandMats', widthHeight=RandMatsWindow._size, sizeable=False, maximizeButton=False) self._wrapper = pm.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, RandMatsWindow._size[0]), (2, RandMatsWindow._size[0])], height=RandMatsWindow._size[1]) self._form = pm.formLayout(parent=self._wrapper, height=470) self._execBtn = pm.button(label='Set Materials', parent=self._wrapper, command=State.setMaterials) self._tabs = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5) self._subform = pm.formLayout(self._form, edit=True, attachForm=((self._tabs, 'top', 0), (self._tabs, 'left', 0), (self._tabs, 'bottom', 0), (self._tabs, 'right', 0))) self._tabObjects = pm.rowColumnLayout(numberOfColumns=1) pm.button(label='Add selected from scene', command=State.addSelectedObjectsFromScene) pm.button(label='Remove selected in scene', command=State.removeSelectedObjectInScene) pm.button(label='Remove selected in list', command=State.removeSelectedObjectsInList) pm.button(label='Remove all', command=State.removeAllObjects) self.selectedObjectsList = pm.iconTextScrollList(allowMultiSelection=True, height=(RandMatsWindow._size[1] - 150)) pm.setParent('..') self._tabMaterials = pm.rowColumnLayout(numberOfColumns=1) pm.button(label='Add selected from HyperShade', command=State.addSelectedMaterialsFromHS) pm.button(label='Remove selected in HyperShade', command=State.removeSelectedMaterialsInHS) pm.button(label='Remove selected in list', command=State.removeSelectedMaterialsInList) pm.button(label='Remove all', command=State.removeAllMaterials) self.selectedMaterialsList = pm.iconTextScrollList(allowMultiSelection=True, height=(RandMatsWindow._size[1] - 150)) pm.setParent('..') self._tabPatterns = pm.rowColumnLayout(numberOfColumns=1) self.patternList = pm.iconTextScrollList(allowMultiSelection=False, height=(RandMatsWindow._size[1] - 300), selectItem='Random', selectCommand=self.randomAlgoChanged, append=PatternManager.getAllPatternNames()) self.rN = RandMatsWindow._createIntRandParam('N') self.rA = RandMatsWindow._createFloatRandParam('Alpha') self.rB = RandMatsWindow._createFloatRandParam('Beta') self.rL = RandMatsWindow._createFloatRandParam('Lambda') self.rM = RandMatsWindow._createFloatRandParam('Mu') self.rS = RandMatsWindow._createFloatRandParam('Sigma') self.rK = RandMatsWindow._createFloatRandParam('Kappa') pm.setParent('..') pm.tabLayout(self._tabs, edit=True, tabLabel=((self._tabObjects, 'Objects'), (self._tabMaterials, 'Materials'), (self._tabPatterns, 'Pattern')))
def _add_mFIZ_controller_to_scene(self, *args): """ """ # Get the user input name and filter out special characters name = get_textField_input(ADD_CONTROLLER_TEXTFIELD_NAME, filter=True) ## Create a new tab in the mFIZ UI for the new controller controller = mFIZ_utils.add_mFIZ_controller_to_scene(name) # Set the state of the Stop Playback on Disconnect attribute on the node # based on user input in the Setup Tab stop_on_disconnect = pm.checkBox(self.stop_playback_checkBox, query=True, value=True) controller.node.setAttr('stopPlaybackOnDisconnect', stop_on_disconnect, lock=True) ## Assign the controller to the controls tabLayout tab_layout = self.controls_tab_layout ctrl = controller.ctrl ctrl_name = str(ctrl) tab_name = ctrl_name.replace('_CTRL', '') tab = self._build_program_tab(controller, tab_name, tab_layout, tab_layout) self._assign_tabs([(tab, tab_name)], tab_layout) ## Move the "Setup" tab to the end tab_labels = pm.tabLayout(tab_layout, query=True, tabLabel=True) num_tabs = len(tab_labels) setup_tab_index = tab_labels.index( 'Setup') + 1 # Tabs are 1-based indeces pm.tabLayout(tab_layout, edit=True, moveTab=[setup_tab_index, num_tabs])
def _get_tab_ctrl(self, tab_name=None): """ Gets the Transform of the mFIZ locator assigned to the tab If no tab tab_name is passed, returns controller of the active tab Returns None if the active tab is the 'Setup' tab """ # Get controller associated with tab. We do this so as not to assume the # tab name is the same as the controller object (locator transform) tab_layout = self.controls_tab_layout tab_labels = pm.tabLayout(tab_layout, query=True, tabLabel=True) # If no tab is passed, get the name of the currently selected tab if not tab_name: tab_name = pm.tabLayout(tab_layout, query=True, selectTab=True) try: tab_ctrl = self.controls_tab_data[tab_name][ 'tab_data'].controller.ctrl except KeyError: # Setup tab has no tab_data tab_ctrl = None return tab_ctrl
def gui(): ''' # gui for the script ''' win = 'shader_grading' if(pm.window(win, ex = True)): pm.deleteUI(win) if(pm.windowPref(win, ex = True)): pm.windowPref(win, remove = True) my_win = pm.window(win, title= 'shader_grading', width= 550, height= 250) main = pm.columnLayout() tab_layout = pm.tabLayout() sorter = pm.columnLayout() grader = Shader_sorter() pm.setParent(tab_layout) assigner_layout = pm.columnLayout() assigner = Shader_assign() pm.setParent(sorter) pm.tabLayout( tab_layout, edit=True, tabLabel=((sorter, 'Grade'), (assigner_layout, 'Assign'))) pm.text(label= 'Objects With Default Lambert', align= 'center', height= 50, backgroundColor= [1,0,0], width= 550) pm.scrollLayout(width= 560, height= 300) lambert_objs = Lambert_objects_checker() my_win.show()
def gui(): win = 'lighting' if pm.window(win, exists= True): pm.deleteUI(win) if pm.windowPref(win, exists= True): pm.windowPref(win, remove= True) global first, second my_win = pm.window(win, title= 'lighting_tools', sizeable= True, width= 400, backgroundColor= [.5, .5, .5]) main_layout = pm.scrollLayout(width= 400) tabs = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5, width = 400) first = pm.columnLayout(adjustableColumn= True) global light_type light_type = pm.optionMenu( label='Light Type', width= 250,) pm.menuItem( label='Spot') pm.menuItem( label='Area') pm.menuItem( label='Directional') pm.menuItem( label='Point') pm.menuItem( label='Ambient') pm.menuItem( label='Volume') my_text = pm.textFieldButtonGrp('myText', label= 'light name', buttonLabel= 'create', buttonCommand= create_light, columnWidth3= [100, 100, 100]) pm.setParent(tabs) second = pm.columnLayout(adjustableColumn = True, width = 400) pm.button(label= 'Create IBL UI', command= create_ibl) pm.tabLayout( tabs, edit=True, tabLabel=((first, 'Create Lights'),(second, 'IBL UI'))) my_win.show()
def _deleteShelfTab(self, shelfTab=None, *args): ''' Deleting shelfLayout crashes 2010, so hiding, disabling and changing name. When saving shelves, hidden ones will be ignored. ''' if len(self.shelfTabs) == 1: print '\nFloatingShelf: Warning: Can not delete the last tab.', return if pm.shelfLayout(shelfTab, q=True, exists=True): # Display shelf not being deleted for tab in self.shelfTabs: if tab != shelfTab: pm.tabLayout(self.mainLayout, edit=True, selectTab=tab) # Hide the shelf pm.shelfLayout(shelfTab, e=True, visible=False) pm.shelfLayout(shelfTab, e=True, enable=False) tabName = shelfTab.split('|')[-1] pm.shelfTabLayout(self.mainLayout, e=True, tabLabel=(tabName, '%s(Deleted)' % tabName)) index = self.shelfTabs.index(shelfTab) self.shelfTabs[index] = shelfTab.replace(tabName, tabName + '(Deleted)')
def all_sections(): global main_layout main_layout = pm.rowColumnLayout() heading_area() pm.separator(w=marginWidth, h=14) info_area() pm.separator(w=marginWidth, h=14) lightCreation_area() pm.separator(w=marginWidth, h=14) global main_tabsLayout, lights_tab, lightTools_tab main_tabsLayout = pm.tabLayout() # [507, 330] int(pm.window('MayaWindow', q=True, h=True)/2.69) lights_tab = pm.rowColumnLayout() lights_area() lightTools_tab = pm.rowColumnLayout() tools_area() pm.setParent(main_layout)
def createShelfBtn(): # Get top shelf as parent pm.mel.eval('global string $gShelfTopLevel') topShelf = pm.mel.eval('$temp = $gShelfTopLevel') currentShelf = pm.tabLayout(topShelf, query=True, selectTab=True) pm.setParent(topShelf + '|' + currentShelf) # Create the button pm.shelfButton( annotation = 'myRigTool', command = 'python(\"import sys\");\n' '\n' 'catchQuiet ( `python(\"del sys.modules[\'myRigTool\']\")`);\n' 'catchQuiet ( `python(\"del sys.modules[\'myRigTool.UI\']\")`);\n' 'catchQuiet ( `python(\"del sys.modules[\'myRigTool.core\']\")`);\n' '\n' 'python(\"import myRigTool\");', label='myRigTool', image1='commandButton.png', sourceType='mel' )
def __init__(self, baseFilePath, placerMapping, indMapping, meshNames): ''' create UI and init vars ''' self.imageRefPath = baseFilePath self.placerMapping = placerMapping self.indMapping = indMapping self.mesh = meshNames['face'] self.lf_eye = meshNames['leftEye'] self.rt_eye = meshNames['rightEye'] self.locTweakWidgets = {} self.placementGrp = None with pm.menu(l='Options') as menuOptions: pm.menuItem(l='Refresh') pm.menuItem(l='Reset') with pm.menu(l='Help') as menuHelp: pm.menuItem(l='Documentation') pm.menuItem(l='About') with pm.tabLayout() as mainTab: with pm.columnLayout(adj=True) as geoSelectionLayout: pass with pm.columnLayout(adj=True) as jntPlacementLayout: with pm.verticalLayout(ratios=(1,10,1), spacing=10) as jntPlacementVertLayout: #self.chk_symmetry = pm.checkBox(l='Symmetry', v=True) with pm.horizontalLayout() as startPlacementLayout: self.btn_startJntPlacement = pm.button(l='Start Joint Placement', c=pm.Callback(self.startJointPlacement), w=180) self.img_jntReference = pm.image(image=self.imageRefPath+'default.jpg') with pm.rowLayout(numberOfColumns=3, adj=2) as jntRowLayout: self.btn_jntScrollLt = pm.button(l='<<', w=40, en=False) self.txt_jntCurrent = pm.text(label='Click "Start Joint Placement" above to begin.', align='center') self.btn_jntScrollRt = pm.button(l='>>', w=40, c=pm.Callback(self.selectNextItem), en=False) pm.separator(style='in') with pm.horizontalLayout(ratios=(1,5), spacing=5): with pm.verticalLayout(): # left labels self.locTweakWidgets['txt_position'] = pm.text(label='Position', align='right', en=False) self.locTweakWidgets['txt_orient'] = pm.text(label='Orient', align='right', en=False) self.locTweakWidgets['txt_scale'] = pm.text(label='Scale', align='right', en=False) self.locTweakWidgets['txt_mirror'] = pm.text(label='Mirror', align='right', en=False) with pm.verticalLayout(): # right buttons with pm.horizontalLayout(): self.locTweakWidgets['btn_prevCV'] = pm.button(l='Prev CV', en=False, c=pm.Callback(self.stepCV, -1)) self.locTweakWidgets['btn_nextCV'] = pm.button(l='Next CV', en=False, c=pm.Callback(self.stepCV, 1)) self.locTweakWidgets['btn_snapToVtx'] = pm.button(l='Snap to Vtx', en=False) self.locTweakWidgets['btn_user'] = pm.button(l='User', en=False) with pm.horizontalLayout(): self.locTweakWidgets['btn_normal'] = pm.button(l='Normal', en=False) self.locTweakWidgets['btn_normal_yup'] = pm.button(l='Normal + Y-up', en=False) self.locTweakWidgets['btn_world'] = pm.button(l='World', en=False) self.locTweakWidgets['btn_orient_user'] = pm.button(l='User', en=False) with pm.horizontalLayout(): self.locTweakWidgets['float_scale'] = pm.floatSliderGrp(f=True, min=0.01, max=1.0, v=0.5, pre=2, fmx=10.0, en=False, dc=pm.Callback(self.editLocScale)) with pm.horizontalLayout(): self.locTweakWidgets['btn_mirLtToRt'] = pm.button(l='Left to Right', en=False, c=pm.Callback(self.mirrorLocs)) self.locTweakWidgets['btn_mirRtToLt'] = pm.button(l='Right to Left', en=False) pm.separator(style='in') with pm.verticalLayout(spacing=5) as buildRigVertLayout: self.btn_updateLocs = pm.button(l='Update All Locators', en=False) self.btn_buildRig = pm.button(l='Build Rig', c=pm.Callback(self.buildRig), en=False) with pm.columnLayout(adj=True) as deformationLayout: pass with pm.columnLayout(adj=True) as motionLayout: pass with pm.columnLayout(adj=True) as actionsLayout: pass mainTab.setTabLabel((geoSelectionLayout,'Geometry')) mainTab.setTabLabel((jntPlacementLayout,'Joints')) mainTab.setTabLabel((deformationLayout,'Deformation')) mainTab.setTabLabel((motionLayout,'Motion')) mainTab.setTabLabel((actionsLayout,'Action Units')) mainTab.setSelectTab(jntPlacementLayout) self.show()
def ui(self): frameLayOpt = dict( cll=True, bs='etchedIn', mw=3, mh=3 ) rowLayOpt = dict( nc=2 ) textLabelOpt = dict( align='right', width=250) #with pm.frameLayout(lv=False, bv=False,mw=3, mh=3): with ui.stackLayout(adj=1, mw=3, mh=3): with pm.tabLayout( scr=True, cr=True ) as self.tabLay: # Arnold -------------------------------------------------------------------------------- with pm.frameLayout(lv=False, bv=False,mw=3, mh=3): with pm.columnLayout(adj=1): ''' with pm.tabLayout( tv=False ): with pm.columnLayout(adj=1): pm.text(l="Solid Angle Arnold", h= 32, en=False) pm.separator( h=6, style='none') ''' with pm.frameLayout(lv=False, bv=True, bs='etchedIn', mw=3, mh=3): with pm.columnLayout(adj=1): pm.checkBoxGrp( l='Arnold options : ', ncb=1, vr=True, l1='Set opaque (Shape node)', v1=self.setAiOpaque.get(), cc1=self.setAiOpaque.set, #l2='Assign To Object', v2=self.assignToObject.get(), cc2=self.assignToObject.set, #l3='self.boolAttr3', v3=self.boolAttr3.get(), cc3=self.boolAttr3.set ) pm.separator( h=6, style='none') #with pm.frameLayout( l=u'Maya Software → Arnold', **frameLayOpt): with pm.frameLayout( l=u'Maya Software → Arnold', cl=self.collapseFrames.get()[0], cc=pm.Callback( self.frameColCmd, 0, 1 ), ec=pm.Callback( self.frameColCmd, 0, 0 ), **frameLayOpt): with pm.columnLayout(adj=1): with pm.rowLayout( **rowLayOpt ): pm.text(l=u'Lambert, Blinn, Phong, PhongE → aiStandard : ', **textLabelOpt ) pm.button(l='Convert', c=pm.Callback( self.mayaShader_to_aiStandard ) ) #with pm.frameLayout( l=u'Mentalray → Arnold', **frameLayOpt): with pm.frameLayout( l=u'Mentalray → Arnold', cl=self.collapseFrames.get()[1], cc=pm.Callback( self.frameColCmd, 1, 1 ), ec=pm.Callback( self.frameColCmd, 1, 0 ), **frameLayOpt): with pm.columnLayout(adj=1): with pm.rowLayout( en=False, **rowLayOpt ): pm.text(l=u'mia_material_x → aiStandard : ', **textLabelOpt ) pm.button(l='Convert') with pm.rowLayout( en=False, **rowLayOpt ): pm.text(l=u'mia_car_paint_phen_x → aiStandard : ', **textLabelOpt ) pm.button(l='Convert') #with pm.frameLayout( l=u'Vray → Arnold', **frameLayOpt): with pm.frameLayout( l=u'Vray → Arnold', cl=self.collapseFrames.get()[2], cc=pm.Callback( self.frameColCmd, 2, 1 ), ec=pm.Callback( self.frameColCmd, 2, 0 ), **frameLayOpt): with pm.columnLayout(adj=1): with pm.rowLayout( **rowLayOpt ): pm.text(l=u'VRayMtl → aiStandard : ', **textLabelOpt ) pm.button(l='Convert', c=pm.Callback( self.VRayMtl_to_aiStandard ) ) # Vray -------------------------------------------------------------------------------- with pm.frameLayout(lv=False, bv=False,mw=3, mh=3, en=False): with pm.columnLayout(adj=True): pm.button() # Mentalray --------------------------------------------------------------------------- with pm.frameLayout(lv=False, bv=False,mw=3, mh=3, en=False): with pm.columnLayout(adj=True): pm.button() # Maya Software ----------------------------------------------------------------------- with pm.frameLayout(lv=False, bv=False,mw=3, mh=3, en=False): with pm.columnLayout(adj=True): pm.button() with pm.frameLayout( l=u'Advanced Options', cl=self.collapseFrames.get()[3], cc=pm.Callback( self.frameColCmd, 3, 1 ), ec=pm.Callback( self.frameColCmd, 3, 0 ), **frameLayOpt): with pm.columnLayout(adj=True): pm.radioButtonGrp( l='Select : ', nrb=2, vr=True, cw4=(140,30,30,30), select=self.selectOpt.get(), l1='Selected shaders only', on1=pm.Callback( self.selectOpt.set, 1), l2='All Shaders in this scene', on2=pm.Callback( self.selectOpt.set, 2), #l3='3', on3=pm.Callback( self.selectOpt.set, 3), ) pm.separator( h=8, style='in') pm.checkBoxGrp( l='Options : ', numberOfCheckBoxes=4, vertical=True, l1='Delete old shader', v1=self.deleteOldShader.get(), cc1=self.deleteOldShader.set, l2='Assign to object', v2=self.assignToObject.get(), cc2=self.assignToObject.set, l3='Add subfix', v3=self.addSubfix.get(), cc3=self.addSubfix.set, l4='Reconnect Hardware Texture', v4=self.reconnectHwTx.get(), cc4=self.reconnectHwTx.set, ) pm.checkBoxGrp( l='', numberOfCheckBoxes=1, vertical=True, l1='Display process (slow)', v1=self.processDisplay.get(), cc1=self.processDisplay.set, #l2='Assign to object', v2=self.assignToObject.get(), cc2=self.assignToObject.set, #l3='Add subfix', v3=self.addSubfix.get(), cc3=self.addSubfix.set, #l4='Display process (slow)', v4=self.processDisplay.get(), cc4=self.processDisplay.set, ) # # 탭 조정 # self.tabLay.setTabLabel( [ ( self.tabLay.getChildren()[0], 'Arnold'), ( self.tabLay.getChildren()[1], 'VRay'), ( self.tabLay.getChildren()[2], 'Mentalray'), ( self.tabLay.getChildren()[3], 'Maya Software'), ] ) self.tabLay.changeCommand( lambda: self.selectedTab.set( self.tabLay.getSelectTabIndex() ) ) try: self.tabLay.setSelectTabIndex( self.selectedTab.get() ) except: self.selectedTab.set(1) self.tabLay.setSelectTabIndex( self.selectedTab.get() )
def addOneTabToGlobalsWindow(renderer, tabLabel, createProc): # Check to see if the unified render globals window existed. # If it does not exist, then we don't need to add any tab yet. if not pm.window('unifiedRenderGlobalsWindow', exists=True): try: pm.error(pm.mel.uiRes("m_unifiedRenderGlobalsWindow.kCannotAddTabs")) except: pass return displayAllTabs = pm.mel.isDisplayingAllRendererTabs() # If the current renderer the renderer is not this # renderer, then don't add the tab yet. if not displayAllTabs and utils.currentRenderer() != renderer: return pm.setParent('unifiedRenderGlobalsWindow') # Hide the tabForm while updating. tabFormManagedStatus = pm.formLayout('tabForm', q=True, manage=True) pm.formLayout('tabForm', edit=True, manage=False) pm.setParent('tabForm') # Set the correct tabLayout parent. if displayAllTabs: tabLayoutName = pm.mel.getRendererTabLayout(pm.melGlobals['gMasterLayerRendererName']) else: tabLayoutName = pm.mel.getRendererTabLayout(renderer) pm.setParent(tabLayoutName) # The tabName is the tabLabel with the white space removed # and the word "Tab" added to the end. # "masterLayer" will act as the renderer name if the tab # is in the master layer. tabName = pm.mel.rendererTabName(renderer, tabLabel) # if the tab-control does not exist, define it and add it # to the tabLayout if not pm.layout(tabName, exists=True): pm.setUITemplate('renderGlobalsTemplate', pushTemplate=True) pm.setUITemplate('attributeEditorTemplate', pushTemplate=True) # Define the tab pm.formLayout(tabName) # get the content of the tab from the createTabProc # Most create procs are now deferred till the tab is selected # These two are the default tabs, so we don't defer them createProcs = ['createMayaSoftwareCommonGlobalsTab', 'createMayaSoftwareGlobalsTab', 'createArnoldRendererCommonGlobalsTab', 'createArnoldRendererGlobalsTab', 'createArnoldRendererSystemTab', 'createArnoldRendererOverrideTab', 'createArnoldRendererDiagnosticsTab'] if createProc in createProcs: pm.mel.eval(createProc) # These end off the layouts of the information in the Tab pm.setParent('..') pm.setUITemplate(popTemplate=True) pm.setUITemplate(popTemplate=True) # Add the tab to the tabLayout pm.tabLayout(tabLayoutName, edit=True, tabLabel=(tabName, renderSettingsTabLabel_melToUI(tabLabel))) # Restore the old manage status for the tabForm. pm.formLayout('tabForm', edit=True, manage=tabFormManagedStatus)
def uiCreate(self): self.onCloseClicked() self.window = pm.window( WIN_NAME, title='PyMel Window', maximizeButton=False ) with self.window: with pm.formLayout() as uiLAY_mainForm: with pm.scrollLayout('uiLAY_mainScroll', childResizable=True) as self.uiLAY_mainScroll: with pm.columnLayout(adjustableColumn=True): with self.uiCreateFrame('uiLAY_frameCheckBoxes', 'Check Boxes (PMCheckBox)') as self.uiLAY_frameCheckBoxes: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=140, style='none') self.uiCHK_test1 = pm.checkBox('uiCHK_test1', label='test1') self.uiCHK_test2 = pm.checkBox('uiCHK_test2', label='test2') with self.uiCreateFrame('uiLAY_frameCheckBoxGroups', 'Check Box Groups (PMCheckBoxGrp#)') as self.uiLAY_frameCheckBoxGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiCHKGRP_test1 = pm.checkBoxGrp( 'uiCHKGRP_test1', numberOfCheckBoxes=1, label='PMCheckBoxGrp1', label1='test1' ) self.uiCHKGRP_test2 = pm.checkBoxGrp( 'uiCHKGRP_test2', numberOfCheckBoxes=2, label='PMCheckBoxGrp2', labelArray2=('test1', 'test2') ) self.uiCHKGRP_test3 = pm.checkBoxGrp( 'uiCHKGRP_test3', numberOfCheckBoxes=3, label='PMCheckBoxGrp3', labelArray3=('test1', 'test2', 'test3') ) self.uiCHKGRP_test4 = pm.checkBoxGrp( 'uiCHKGRP_test4', numberOfCheckBoxes=4, label='PMCheckBoxGrp4', labelArray4=('test1', 'test2', 'test3', 'test4') ) with self.uiCreateFrame('uiLAY_frameColorSliders', 'Color Slider Groups (PMColorSliderGrp)') as self.uiLAY_frameColorSliders: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiCLRGRP_test1 = pm.colorSliderGrp( 'uiCLRGRP_test1', label='test1' ) self.uiCLRGRP_test2 = pm.colorSliderGrp( 'uiCLRGRP_test2', label='test2' ) with self.uiCreateFrame('uiLAY_frameFloatFields', 'Float Fields (PMFloatField)') as self.uiLAY_frameFloatFields: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=140, style='none') self.uiFLF_test1 = pm.floatField('uiFLF_test1') self.uiFLF_test2 = pm.floatField('uiFLF_test2') with self.uiCreateFrame('uiLAY_frameFloatFieldGroups', 'Float Field Groups (PMFloatFieldGrp#)') as self.uiLAY_frameFloatFieldGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiFLFGRP_test1 = pm.floatFieldGrp( 'uiFLFGRP_test1', numberOfFields=1, label='PMFloatFieldGrp1' ) self.uiFLFGRP_test2 = pm.floatFieldGrp( 'uiFLFGRP_test2', numberOfFields=2, label='PMFloatFieldGrp2' ) self.uiFLFGRP_test3 = pm.floatFieldGrp( 'uiFLFGRP_test3', numberOfFields=3, label='PMFloatFieldGrp3' ) self.uiFLFGRP_test4 = pm.floatFieldGrp( 'uiFLFGRP_test4', numberOfFields=4, label='PMFloatFieldGrp4' ) with self.uiCreateFrame('uiLAY_frameFloatScrollBars', 'Float Scroll Bars (PMFloatScrollBar)') as self.uiLAY_frameFloatScrollBars: with pm.columnLayout(adjustableColumn=True): pm.separator(style='none', height=2) self.uiFLSCRL_test1 = pm.floatScrollBar('uiFLSCRL_test1') self.uiFLSCRL_test2 = pm.floatScrollBar('uiFLSCRL_test2') with self.uiCreateFrame('uiLAY_frameFloatSliders', 'Float Sliders (PMFloatSlider)') as self.uiLAY_frameFloatSliders: with pm.columnLayout(adjustableColumn=True): pm.separator(style='none', height=2) self.uiFLTSLD_test1 = pm.floatSlider('uiFLTSLD_test1') self.uiFLTSLD_test2 = pm.floatSlider('uiFLTSLD_test2') with self.uiCreateFrame('uiLAY_frameFloatSliderGroups', 'Float Slider Groups (PMFloatSliderGrp)') as self.uiLAY_frameFloatSliderGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiFLSGRP_test1 = pm.floatSliderGrp( 'uiFLSGRP_test1', label='test1', field=True ) self.uiFLSGRP_test2 = pm.floatSliderGrp( 'uiFLSGRP_test2', label='test2', field=True ) with self.uiCreateFrame('uiLAY_frameIconTextCheckBoxes', 'Icon Text Check Boxes (PMIconTextCheckBox)') as self.uiLAY_frameIconTextCheckBoxes: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiITCHK_test1 = pm.iconTextCheckBox( 'uiITCHK_test1', style='iconAndTextHorizontal', label='cube', image1='cube' ) self.uiITCHK_test2 = pm.iconTextCheckBox( 'uiITCHK_test2', style='iconAndTextHorizontal', label='cone', image1='cone' ) with self.uiCreateFrame('uiLAY_frameIconTextRadioButtons', 'Icon Text Radio Buttons (PMIconTextRadioButton)') as self.uiLAY_frameIconTextRadioButtons: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=4): pm.separator(style='none', width=140) pm.iconTextRadioCollection() self.uiITRAD_test1 = pm.iconTextRadioButton( 'uiITRAD_test1', style='iconAndTextHorizontal', label='cube', image1='cube' ) self.uiITRAD_test2 = pm.iconTextRadioButton( 'uiITRAD_test2', style='iconAndTextHorizontal', label='cone', image1='cone' ) self.uiITRAD_test3 = pm.iconTextRadioButton( 'uiITRAD_test3', style='iconAndTextHorizontal', label='torus', image1='torus' ) with self.uiCreateFrame('uiLAY_frameIconTextScrollLists', 'Icon Text Scroll Lists (PMIconTextScrollList)') as self.uiLAY_frameIconTextScrollLists: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiITSLST_test1 = pm.iconTextScrollList( 'uiITSLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) self.uiITSLST_test2 = pm.iconTextScrollList( 'uiITSLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) with self.uiCreateFrame('uiLAY_frameIntFields', 'Int Fields (PMIntField)') as self.uiLAY_frameIntFields: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=140, style='none') self.uiINF_test1 = pm.intField('uiINF_test1') self.uiINF_test2 = pm.intField('uiINF_test2') with self.uiCreateFrame('uiLAY_frameIntFieldGroups', 'Int Field Groups (PMIntFieldGrp#)') as self.uiLAY_frameIntFieldGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiINFGRP_test1 = pm.intFieldGrp( 'uiINFGRP_test1', numberOfFields=1, label='PMIntFieldGrp1' ) self.uiINFGRP_test2 = pm.intFieldGrp( 'uiINFGRP_test2', numberOfFields=2, label='PMIntFieldGrp2' ) self.uiINFGRP_test3 = pm.intFieldGrp( 'uiINFGRP_test3', numberOfFields=3, label='PMIntFieldGrp3' ) self.uiINFGRP_test4 = pm.intFieldGrp( 'uiINFGRP_test4', numberOfFields=4, label='PMIntFieldGrp4' ) with self.uiCreateFrame('uiLAY_frameIntScrollBars', 'Int Scroll Bars (PMIntScrollBar)') as self.uiLAY_frameIntScrollBars: with pm.columnLayout(adjustableColumn=True): pm.separator(style='none', height=2) self.uiINSCRL_test1 = pm.intScrollBar('uiINSCRL_test1') self.uiINSCRL_test2 = pm.intScrollBar('uiINSCRL_test2') with self.uiCreateFrame('uiLAY_frameIntSliders', 'Int Sliders (PMIntSlider)') as self.uiLAY_frameIntSliders: with pm.columnLayout(adjustableColumn=True): pm.separator(style='none', height=2) self.uiINTSLD_test1 = pm.intSlider('uiINTSLD_test1') self.uiINTSLD_test2 = pm.intSlider('uiINTSLD_test2') with self.uiCreateFrame('uiLAY_frameIntSliderGroups', 'Int Slider Groups (PMIntSliderGrp)') as self.uiLAY_frameIntSliderGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiINSGRP_test1 = pm.intSliderGrp( 'uiINSGRP_test1', label='test1', field=True ) self.uiINSGRP_test2 = pm.intSliderGrp( 'uiINSGRP_test2', label='test2', field=True ) with self.uiCreateFrame('uiLAY_frameOptionMenus', 'Option Menus (PMOptionMenu)') as self.uiLAY_frameOptionMenus: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=110, style='none') self.uiOPTMNU_test1 = pm.optionMenu('uiOPTMNU_test1', label='test1') pm.menuItem(label='one') pm.menuItem(label='two') pm.menuItem(label='three') self.uiOPTMNU_test2 = pm.optionMenu('uiOPTMNU_test2', label='test2') pm.menuItem(label='four') pm.menuItem(label='five') pm.menuItem(label='six') with self.uiCreateFrame('uiLAY_frameOptionMenuGroups', 'Option Menus Groups (PMOptionMenuGrp)') as self.uiLAY_frameOptionMenuGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiOPMGRP_test1 = pm.optionMenuGrp('uiOPMGRP_test1', label='test1', extraLabel='extraLabel') pm.menuItem(label='one') pm.menuItem(label='two') pm.menuItem(label='three') self.uiOPMGRP_test2 = pm.optionMenuGrp('uiOPMGRP_test2', label='test2', extraLabel='extraLabel') pm.menuItem(label='four') pm.menuItem(label='five') pm.menuItem(label='six') with self.uiCreateFrame('uiLAY_frameRadioButtons', 'Radio Buttons (PMRadioButton)') as self.uiLAY_frameRadioButtons: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=4): pm.separator(style='none', width=140) pm.radioCollection() self.uiRAD_test1 = pm.radioButton('uiRAD_test1', label='test1') self.uiRAD_test2 = pm.radioButton('uiRAD_test2', label='test2') self.uiRAD_test3 = pm.radioButton('uiRAD_test3', label='test3') with self.uiCreateFrame('uiLAY_frameRadioButtonGroups', 'Radio Button Groups (PMRadioButtonGrp#)') as self.uiLAY_frameRadioButtonGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiRADGRP_test1 = pm.radioButtonGrp( 'uiRADGRP_test1', numberOfRadioButtons=1, label='PMRadioButtonGrp1', label1='test1' ) self.uiRADGRP_test2 = pm.radioButtonGrp( 'uiRADGRP_test2', numberOfRadioButtons=2, label='PMRadioButtonGrp2', labelArray2=('test1', 'test2') ) self.uiRADGRP_test3 = pm.radioButtonGrp( 'uiRADGRP_test3', numberOfRadioButtons=3, label='PMRadioButtonGrp3', labelArray3=('test1', 'test2', 'test3') ) self.uiRADGRP_test4 = pm.radioButtonGrp( 'uiRADGRP_test4', numberOfRadioButtons=4, label='PMRadioButtonGrp4', labelArray4=('test1', 'test2', 'test3', 'test4') ) with self.uiCreateFrame('uiLAY_frameSymbolCheckBoxes', 'Symbol Check Boxes (PMSymbolCheckBox)') as self.uiLAY_frameSymbolCheckBoxes: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiSYMCHK_test1 = pm.symbolCheckBox( 'uiSYMCHK_test1', image='polyCube' ) self.uiSYMCHK_test2 = pm.symbolCheckBox( 'uiSYMCHK_test2', image='polyCone' ) with self.uiCreateFrame('uiLAY_frameScriptTables', 'Script Tables (PMScriptTable)') as self.uiLAY_frameScriptTables: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiSCRTBL_test1 = pm.scriptTable( 'uiSCRTBL_test1', selectionMode=3, rows=4, columns=2 ) self.uiSCRTBL_test2 = pm.scriptTable( 'uiSCRTBL_test2', selectionMode=3, rows=4, columns=2 ) with self.uiCreateFrame('uiLAY_frameScrollField', 'Scroll Field (PMScrollField)') as self.uiLAY_frameScrollField: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiSCRFLD_test1 = pm.scrollField( 'uiSCRFLD_test1', wordWrap=True ) self.uiSCRFLD_test2 = pm.scrollField( 'uiSCRFLD_test2', wordWrap=True ) with self.uiCreateFrame('uiLAY_frameShelfTabLayout', 'Shelf Tab Layout (PMShelfTabLayout)') as self.uiLAY_frameShelfTabLayout: with pm.columnLayout(adjustableColumn=True): with pm.shelfTabLayout('uiSHLTAB_test1') as self.uiSHLTAB_test1: with pm.shelfLayout('test1'): pass with pm.shelfLayout('test2'): pass with pm.shelfLayout('test3'): pass with pm.shelfTabLayout('uiSHLTAB_test2') as self.uiSHLTAB_test2: with pm.shelfLayout('test4'): pass with pm.shelfLayout('test5'): pass with pm.shelfLayout('test6'): pass with self.uiCreateFrame('uiLAY_frameTabLayout', 'Tab Layout (PMTabLayout)') as self.uiLAY_frameTabLayout: with pm.columnLayout(adjustableColumn=True): with pm.tabLayout('uiTAB_test1') as self.uiTAB_test1: with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow1: pass with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow2: pass with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow3: pass pm.tabLayout( self.uiTAB_test1, edit=True, tabLabel=((uiLAY_tabRow1, 'test1'), (uiLAY_tabRow2, 'test2'), (uiLAY_tabRow3, 'test3'),) ) with pm.tabLayout('uiTAB_test2') as self.uiTAB_test2: with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow4: pass with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow5: pass with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow6: pass pm.tabLayout( self.uiTAB_test2, edit=True, tabLabel=((uiLAY_tabRow4, 'test4'), (uiLAY_tabRow5, 'test5'), (uiLAY_tabRow6, 'test6'),) ) with self.uiCreateFrame('uiLAY_frameTextFields', 'Text Fields (PMTextField)') as self.uiLAY_frameTextFields: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=140, style='none') self.uiTXT_test1 = pm.textField('uiTXT_test1') self.uiTXT_test2 = pm.textField('uiTXT_test2') with self.uiCreateFrame('uiLAY_frameTextFieldButtonGroups', 'Text Field Button Groups (PMTextFieldButtonGrp)') as self.uiLAY_frameTextFieldButtonGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiTXBTGR_test1 = pm.textFieldButtonGrp( 'uiTXBTGR_test1', label='test1', buttonLabel='button1' ) self.uiTXBTGR_test2 = pm.textFieldButtonGrp( 'uiTXBTGR_test2', label='test2', buttonLabel='button2' ) with self.uiCreateFrame('uiLAY_frameTextFieldGroups', 'Text Field Groups (PMTextFieldGrp)') as self.uiLAY_frameTextFieldGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiTXTGRP_test1 = pm.textFieldGrp( 'uiTXTGRP_test1', label='test1' ) self.uiTXTGRP_test2 = pm.textFieldGrp( 'uiTXTGRP_test2', label='test2' ) with self.uiCreateFrame('uiLAY_frameTextScrollLists', 'Text Scroll Lists (PMTextScrollList)') as self.uiLAY_frameTextScrollLists: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiTXTLST_test1 = pm.textScrollList( 'uiTXTLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) self.uiTXTLST_test2 = pm.textScrollList( 'uiTXTLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) self.uiBTN_savePrefs = pm.button( label='Save Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onSavePrefsClicked ) self.uiBTN_loadPrefs = pm.button( label='Load Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onLoadPrefsClicked ) self.uiBTN_resetPrefs = pm.button( label='Reset Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onResetPrefsClicked ) uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'top', 2) uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'left', 2) uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'right', 2) uiLAY_mainForm.attachControl(self.uiLAY_mainScroll, 'bottom', 2, self.uiBTN_savePrefs) uiLAY_mainForm.attachNone(self.uiBTN_savePrefs, 'top') uiLAY_mainForm.attachForm(self.uiBTN_savePrefs, 'left', 2) uiLAY_mainForm.attachPosition(self.uiBTN_savePrefs, 'right', 2, 33) uiLAY_mainForm.attachForm(self.uiBTN_savePrefs, 'bottom', 2) uiLAY_mainForm.attachNone(self.uiBTN_loadPrefs, 'top') uiLAY_mainForm.attachPosition(self.uiBTN_loadPrefs, 'left', 2, 33) uiLAY_mainForm.attachPosition(self.uiBTN_loadPrefs, 'right', 2, 66) uiLAY_mainForm.attachForm(self.uiBTN_loadPrefs, 'bottom', 2) uiLAY_mainForm.attachNone(self.uiBTN_resetPrefs, 'top') uiLAY_mainForm.attachPosition(self.uiBTN_resetPrefs, 'left', 2, 66) uiLAY_mainForm.attachForm(self.uiBTN_resetPrefs, 'right', 2) uiLAY_mainForm.attachForm(self.uiBTN_resetPrefs, 'bottom', 2) self.window.setTitle(self.window.__class__)
def uiCreate(self): self.uiClose() self.window = pm.window( WIN_NAME, title=SCRIPT_NAME, maximizeButton=False ) with self.window: pm.setUITemplate('DefaultTemplate', pushTemplate=True) with pm.formLayout() as self.ui_LAY_mainForm: with pm.tabLayout(tabsVisible=False) as self.ui_TAB_top: pm.tabLayout(self.ui_TAB_top, e=True, height=1) with pm.formLayout() as self.ui_LAY_attachForm: with pm.tabLayout(tabsVisible=False, scrollable=True, innerMarginWidth=4) as self.ui_TAB_inner: with pm.columnLayout(adjustableColumn=True) as self.ui_LAY_mainColumn: with pm.frameLayout( label='Parameters', collapsable=True, collapse=False, marginHeight=3 ): with pm.columnLayout(adjustableColumn=True, columnOffset=('both', 2)): self.ui_FLTFLDGRP_xPos = pm.floatFieldGrp(numberOfFields=1, label='+X', precision=6) self.ui_FLTFLDGRP_xNeg = pm.floatFieldGrp(numberOfFields=1, label='-X', precision=6) self.ui_FLTFLDGRP_yPos = pm.floatFieldGrp(numberOfFields=1, label='+Y', precision=6) self.ui_FLTFLDGRP_yNeg = pm.floatFieldGrp(numberOfFields=1, label='-Y', precision=6) self.ui_FLTFLDGRP_zPos = pm.floatFieldGrp(numberOfFields=1, label='+Z', precision=6) self.ui_FLTFLDGRP_zNeg = pm.floatFieldGrp(numberOfFields=1, label='-Z', precision=6) self.ui_BTN_create = pm.button( label='Create', height=MAIN_BUTTONS_HEIGHT, command=self.ui_on_BTN_create_clicked ) self.ui_BTN_close = pm.button( label='Close', height=MAIN_BUTTONS_HEIGHT, command=self.uiClose ) pm.setUITemplate('DefaultTemplate', popTemplate=True) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'top', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'left', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'right', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'bottom', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'top', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'left', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'right', 0) self.ui_LAY_mainForm.attachControl(self.ui_TAB_top, 'bottom', 5, self.ui_BTN_close) self.ui_LAY_mainForm.attachNone(self.ui_BTN_create, 'top') self.ui_LAY_mainForm.attachForm(self.ui_BTN_create, 'left', 5) self.ui_LAY_mainForm.attachPosition(self.ui_BTN_create, 'right', 2, 50) self.ui_LAY_mainForm.attachForm(self.ui_BTN_create, 'bottom', 5) self.ui_LAY_mainForm.attachNone(self.ui_BTN_close, 'top') self.ui_LAY_mainForm.attachPosition(self.ui_BTN_close, 'left', 2, 50) self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'right', 5) self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'bottom', 5) self.setupInitialValues()
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 buildUI(self, filter=None): count = 0 #self.form = formLayout() with pm.frameLayout(collapsable=False, label='%s (%s)' % (self.className, self.apiClassName), width = FRAME_WIDTH) as self.frame: #labelAlign='top') with pm.tabLayout() as tab: invertibles = factories.apiClassInfo[self.apiClassName]['invertibles'] usedMethods = [] with pm.formLayout() as pairdForm: tab.setTabLabel( [pairdForm, 'Paired'] ) with pm.scrollLayout() as pairedScroll: with pm.columnLayout(visible=False, adjustableColumn=True) as pairedCol: for setMethod, getMethod in invertibles: pm.setParent(pairedCol) # column frame = pm.frameLayout(label = '%s / %s' % (setMethod, getMethod), labelVisible=True, collapsable=True, collapse=True, width = FRAME_WIDTH) col2 = pm.columnLayout() pairCount = 0 pairCount += self.rows[setMethod].buildUI(filter) pairCount += self.rows[getMethod].buildUI(filter) usedMethods += [setMethod, getMethod] if pairCount == 0: #deleteUI(col2) frame.setVisible(False) frame.setHeight(1) count += pairCount pairedCol.setVisible(True) pairdForm.attachForm( pairedScroll, 'top', 5 ) pairdForm.attachForm( pairedScroll, 'left', 5 ) pairdForm.attachForm( pairedScroll, 'right', 5 ) pairdForm.attachForm( pairedScroll, 'bottom', 5 ) with pm.formLayout() as unpairedForm: tab.setTabLabel( [unpairedForm, 'Unpaired'] ) with pm.scrollLayout() as unpairedScroll: with pm.columnLayout(visible=False ) as unpairedCol: # For some reason, on linux, the unpairedCol height is wrong... # track + set it ourselves unpairedHeight = 10 # a little extra buffer... #rowSpace = unpairedCol.getRowSpacing() for methodName in sorted( self.classInfo.keys() ): pm.setParent(unpairedCol) if methodName not in usedMethods: frame = pm.frameLayout(label = methodName, labelVisible=True, collapsable=True, collapse=True, width = FRAME_WIDTH) col2 = pm.columnLayout() count += self.rows[methodName].buildUI(filter) unpairedHeight += self.rows[methodName].frame.getHeight()# + rowSpace unpairedCol.setHeight(unpairedHeight) #self.form.attachForm( self.frame, 'left', 2) #self.form.attachForm( self.frame, 'right', 2) #self.form.attachForm( self.frame, 'top', 2) #self.form.attachForm( self.frame, 'bottom', 2) unpairedCol.setVisible(True) unpairedForm.attachForm( unpairedScroll, 'top', 5 ) unpairedForm.attachForm( unpairedScroll, 'left', 5 ) unpairedForm.attachForm( unpairedScroll, 'right', 5 ) unpairedForm.attachForm( unpairedScroll, 'bottom', 5 ) return self.frame
def __init__(self): ui_labelWidth = 140 ui_inputWidth = 240 if pm.window(WIN_NAME, exists=True): pm.deleteUI(WIN_NAME, window=True) with pm.window( WIN_NAME, title=WIN_TITLE, maximizeButton=False, menuBar=True, menuBarVisible=True ) as self.window: pm.setUITemplate('DefaultTemplate', pushTemplate=True) pm.menu(label='Edit', tearOff=False) pm.menuItem(label='Reset Settings', command=self.ui_resetSettings) pm.menu(label='Help', tearOff=False) pm.menuItem(label='Help on ' + WIN_TITLE, command=self.ui_showHelp) with pm.formLayout() as self.ui_LAY_mainForm: with pm.tabLayout(tabsVisible=False) as self.ui_TAB_top: pm.tabLayout(self.ui_TAB_top, e=True, height=1) with pm.formLayout() as self.ui_LAY_attachForm: with pm.tabLayout(tabsVisible=False, scrollable=True, innerMarginWidth=4) as self.ui_TAB_inner: with pm.columnLayout(adjustableColumn=True) as self.ui_LAY_mainColumn: with pm.frameLayout( label='Control Panel', collapsable=True, collapse=False, marginHeight=3 ) as self.ui_LAY_frameControlPanel: with pm.rowColumnLayout( numberOfColumns=12, columnSpacing=([3, 2], [4, 2], [5, 2], [6, 2]), rowSpacing=[1, 5], # Label X Y Z XYZ Mag Sep Reset Bias Sep Min Max columnWidth=[(1, 60), (2, 20), (3, 20), (4, 20), (5, 80), (6, 60), (7, 20), (8, 20), (9, 120), (10, 20), (11, 60), (12, 60)] ) as self.ui_LAY_mainRowColumn: # ----- Header Row ----- pm.text(label='') pm.text(label='') pm.text(label='') pm.text(label='') pm.text(label='') pm.text(label='Magnitude', ) pm.text(label='') pm.text(label='') pm.text(label='Bias', ) pm.text(label='') pm.text(label='Min', ) pm.text(label='Max', ) # ----- Translate Row ----- pm.text(label='Translate ', align='right') pm.button(label='X', command=pm.Callback(self.randomizeTranslate, ['tx'])) pm.button(label='Y', command=pm.Callback(self.randomizeTranslate, ['ty'])) pm.button(label='Z', command=pm.Callback(self.randomizeTranslate, ['tz'])) pm.button(label='XYZ', command=pm.Callback(self.randomizeTranslate, ['tx', 'ty', 'tz'])) self.ui_FLTFLD_translateMagnitude = pm.floatField('ui_FLTFLD_translateMagnitude', changeCommand=self.ui_refresh, value=10) pm.text(label='') self.ui_BTN_translateBiasReset = pm.button(label='0') pm.setUITemplate('DefaultTemplate', popTemplate=True) # strange slider group visual with default template self.ui_INTSLGRP_translateBias = pm.intSliderGrp( 'ui_INTSLGRP_translateBias', columnWidth=[1, 30], field=True, minValue=-100, maxValue=100, fieldMinValue=-100, fieldMaxValue=100, value=0, step=1, fieldStep=1, sliderStep=1, changeCommand=self.ui_refresh, dragCommand=self.ui_refresh ) pm.setUITemplate('DefaultTemplate', pushTemplate=True) pm.button(self.ui_BTN_translateBiasReset, edit=True, command=pm.Callback(self.ui_resetBias, self.ui_INTSLGRP_translateBias)) pm.text(label='=') self.ui_FLTFLD_translateMin = pm.floatField(enable=False, value=-5) self.ui_FLTFLD_translateMax = pm.floatField(enable=False, value=95) # ----- Rotate Row ----- pm.text(label='Rotate ', align='right') pm.button(label='X', command=pm.Callback(self.randomizeRotate, ['rx'])) pm.button(label='Y', command=pm.Callback(self.randomizeRotate, ['ry'])) pm.button(label='Z', command=pm.Callback(self.randomizeRotate, ['rz'])) pm.button(label='XYZ', command=pm.Callback(self.randomizeRotate, ['rx', 'ry', 'rz'])) self.ui_FLTFLD_rotateMagnitude = pm.floatField('ui_FLTFLD_rotateMagnitude', changeCommand=self.ui_refresh, value=90) pm.text(label='') self.ui_BTN_rotateBiasReset = pm.button(label='0') pm.setUITemplate('DefaultTemplate', popTemplate=True) # strange slider group visual with default template self.ui_INTSLGRP_rotateBias = pm.intSliderGrp( 'ui_INTSLGRP_rotateBias', columnWidth=[1, 30], field=True, minValue=-100, maxValue=100, fieldMinValue=-100, fieldMaxValue=100, value=0, step=1, fieldStep=1, sliderStep=1, changeCommand=self.ui_refresh, dragCommand=self.ui_refresh ) pm.setUITemplate('DefaultTemplate', pushTemplate=True) pm.button(self.ui_BTN_rotateBiasReset, edit=True, command=pm.Callback(self.ui_resetBias, self.ui_INTSLGRP_rotateBias)) pm.text(label='=') self.ui_FLTFLD_rotateMin = pm.floatField(enable=False, value=-5) self.ui_FLTFLD_rotateMax = pm.floatField(enable=False, value=95) # ----- Scale Row ----- pm.text(label='Scale ', align='right') pm.button(label='X', command=pm.Callback(self.randomizeScale, ['sx'])) pm.button(label='Y', command=pm.Callback(self.randomizeScale, ['sy'])) pm.button(label='Z', command=pm.Callback(self.randomizeScale, ['sz'])) pm.flowLayout(columnSpacing=2) pm.button(label='XYZ', command=pm.Callback(self.randomizeScale, ['sx', 'sy', 'sz'])) pm.button(label='Uniform', command=pm.Callback(self.randomizeScale, ['uniform'])) pm.setParent('..') self.ui_FLTFLD_scaleMagnitude = pm.floatField('ui_FLTFLD_scaleMagnitude', changeCommand=self.ui_refresh, value=2) pm.text(label='') self.ui_BTN_scaleBiasReset = pm.button(label='0') pm.setUITemplate('DefaultTemplate', popTemplate=True) # strange slider group visual with default template self.ui_INTSLGRP_scaleBias = pm.intSliderGrp( 'ui_INTSLGRP_scaleBias', columnWidth=[1, 30], field=True, minValue=-100, maxValue=100, fieldMinValue=-100, fieldMaxValue=100, value=0, step=1, fieldStep=1, sliderStep=1, changeCommand=self.ui_refresh, dragCommand=self.ui_refresh ) pm.setUITemplate('DefaultTemplate', pushTemplate=True) pm.button(self.ui_BTN_scaleBiasReset, edit=True, command=pm.Callback(self.ui_resetBias, self.ui_INTSLGRP_scaleBias)) pm.text(label='=') self.ui_FLTFLD_scaleMin = pm.floatField(enable=False, value=-5) self.ui_FLTFLD_scaleMax = pm.floatField(enable=False, value=95) with pm.frameLayout( label='Seed Control', collapsable=True, collapse=False, marginHeight=3 ) as self.ui_LAY_frameSeedControl: with pm.columnLayout(adjustableColumn=False): with pm.rowLayout( numberOfColumns=2, columnWidth2=[ui_labelWidth, ui_inputWidth], columnAttach=[1, 'right', 5] ): pm.text(label='Use Seed') self.ui_CHK_useSeed = pm.checkBox( 'ui_CHK_useSeed', value=True, label='', changeCommand=self.ui_refresh ) with pm.rowLayout( numberOfColumns=2, columnWidth2=[ui_labelWidth, ui_inputWidth], columnAttach=[1, 'right', 5] ): pm.text(label='Seed') pm.setUITemplate('DefaultTemplate', popTemplate=True) # strange slider group visual with default template self.ui_INTSLGRP_seedValue = pm.intSliderGrp( 'ui_INTSLGRP_seedValue', field=True, minValue=1, maxValue=10000, fieldMinValue=1, fieldMaxValue=10000, value=1234, step=1, fieldStep=1, sliderStep=1 ) pm.setUITemplate('DefaultTemplate', pushTemplate=True) # pm.setParent(self.ui_mainForm) self.ui_BTN_close = pm.button( label='Close', command=self.ui_close ) pm.setUITemplate('DefaultTemplate', popTemplate=True) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'top', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'left', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'right', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'bottom', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'top', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'left', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'right', 0) self.ui_LAY_mainForm.attachControl(self.ui_TAB_top, 'bottom', 5, self.ui_BTN_close) self.ui_LAY_mainForm.attachNone(self.ui_BTN_close, 'top') self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'left', 5) self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'bottom', 5) self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'right', 5) self.prefSaver = prefsaver.PrefSaver(serializers.SerializerOptVar(OPT_VAR_NAME)) self.ui_initSettings() self.ui_loadSettings() self.window.show() pm.refresh()
def tabSelect(self): selIndex = pm.tabLayout( self.mid, q=True, sti=True) pm.optionVar[win] = selIndex