def commonOptUI(self, name, parent, collapse=False): """ Create common options panel UI controls. """ mc.frameLayout("commonOptRollout", width=400, collapsable=True, cl=collapse, label="Render Layer Overrides") mc.columnLayout(name) mc.separator(height=4, style="none") mc.optionMenuGrp("renderLayer_comboBox", label="Layer: ", changeCommand=lambda *args: self.listOverrides()) for rl in self.renderLayers: mc.menuItem(label=rl) mc.optionMenuGrp("renderLayer_comboBox", edit=True, value=self.currentLayer) mc.separator(height=2, style="none") mc.rowLayout(numberOfColumns=2, columnAttach2=["left", "left"], columnAlign2=["both", "both"], columnOffset2=[4, 0]) mc.iconTextScrollList("listView_overrides", width=360, height=108, allowMultiSelection=True) # table = mc.scriptTable(rows=4, columns=2, label=[(1,"Column 1"), (2,"Column 2")], cellChangedCmd=self.editCell) mc.setParent(name) mc.separator(height=4, style="none") mc.setParent(parent)
def displayUI(self): windowName = 'LCMTUIWindow' if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) window = cmds.window(windowName, menuBar = True,t="LCMT v3.1.1") fileMenu = cmds.menu( label='Manage Light Types') cmds.menuItem( label='Add More Light Types',command=lambda *args:self.addLightTypes()) cmds.menuItem( label='See Current Light Types', command=lambda *args:self.displayLightTypes()) cmds.menuItem( label='Reset Light Types to Default Values', command=lambda *args:self.resetLightTypesToDefault()) cmds.paneLayout( configuration='vertical2' ) lightStageColumn = cmds.columnLayout(adjustableColumn=True) cmds.text('Lights in the SCENE') lights = cmds.ls(dag =True,visible=True,lights=True, type='mentalrayIblShape') lightList = cmds.iconTextScrollList(allowMultiSelection=True, append=lights) cmds.rowLayout(numberOfColumns = 2) useGroupLights = cmds.checkBox( label='Group Lights', onCommand = lambda *args: self.updateScollList(True, lightList), offCommand = lambda *args: self.updateScollList(False, lightList)) cmds.checkBox( label='Save Images?', cc = lambda *args: self.toggleSaveImages()) cmds.setParent('..') cmds.iconTextScrollList(lightList,edit=True,selectCommand=lambda *args: cmds.select(self.getElementsFromLightScrollList(lightList,useGroupLights),vis=True)) cmds.button(label='Render Lights!', command = lambda *args: self.renderAllLights(self.getElementsFromLightScrollList(lightList,useGroupLights),cmds.checkBox(useGroupLights, query=True, value=True))) cmds.setParent('..') renderLayersColumn = cmds.columnLayout(adjustableColumn=True) #new column cmds.text('Geometry in the SCENE') geometry = cmds.ls(geometry=True) #take out the ibl shapes from the geo selection geometry = list(set(geometry) - set(lights)) geoList = cmds.iconTextScrollList(allowMultiSelection=True, append=geometry,selectCommand=lambda *args: cmds.select(cmds.iconTextScrollList(geoList, query=True, si=True )) ) cmds.text('Create Render Layers from selected geometry and lights') cmds.button(label='Create Render Layers!', command = lambda *args: self.createLayersFromLights(cmds.iconTextScrollList(geoList, query=True, si=True ),self.getElementsFromLightScrollList(lightList,useGroupLights))) cmds.setParent('..') cmds.showWindow()
def UI(): mc.frameLayout('Furioso',w=ui.rowWidth,cll=1,bgc=[.2,.2,.2],fn='smallBoldLabelFont',bs='in',l='Furioso') mc.columnLayout('furiosoObjectConform',cal='center',w=ui.rowWidth-10) mc.rowColumnLayout(numberOfColumns=8) mc.iconTextButton(w=ui.iconSize,h=ui.iconSize,ann="Create 10x10 Tile",l= "Tile" ,i= "polyPlane.png",c=partial(delay,'mel.eval','("polyPlane -w 10 -h 10 -sx 10 -sy 10 -ax 0 1 0 -cuv 2 -ch 1")')) mc.iconTextButton(w=ui.iconSize,h=ui.iconSize,ann="Create 1x1 Tile",l= "Tile" ,i= "plane.png",c=partial(delay,'mel.eval','("polyPlane -w 10 -h 10 -sx 1 -sy 1 -ax 0 1 0 -cuv 2 -ch 1;")')) mc.iconTextButton(w=ui.iconSize,h=ui.iconSize,i= "cube.png",c=partial(delay,'mel.eval','("polyCube -w 10 -h 10 -d 10 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1;")')) mc.iconTextButton(w=ui.iconSize,h=ui.iconSize,i= "historyPulldownIcon.png",bgc=[.5,0,0],c=partial(delay,'mel.eval','("DeleteHistory")')) mc.iconTextButton(w=ui.iconSize,h=ui.iconSize,i= "",en=0,c=partial(delay,'mel.eval','("polyPlane -w 10 -h 10 -sx 1 -sy 1 -ax 0 1 0 -cuv 2 -ch 1;")')) mc.iconTextButton(w=ui.iconSize,h=ui.iconSize,ann="Set Camera to Meters",en=1,l= "Set Camera" ,i= "CameraAE.png",c=partial(delay,'mel.eval','("rcSetCameraClip .5 100000")')) mc.iconTextButton(w=ui.iconSize,h=ui.iconSize,i= "polyQuad",c=partial(delay,'mel.eval','("TogglePolyCount")')) mc.iconTextCheckBox(w=ui.iconSize,h=ui.iconSize,ann="Snap",l= "Tile" ,i= "snapGrid.png",onc=partial(delay,'rc.stepSnap','(5,1)'),ofc=partial(delay,'rc.stepSnap','(5,0)'),v=mc.manipMoveContext('Move',q=1,s=1)) mc.setParent('..') mc.rowLayout(w=ui.rowWidth,numberOfColumns=3) mc.button(w=ui.rowWidth/3,h=ui.btn_large,al='left',l=' + ',c=partial(delay,'btnPlus','(mc.ls(sl=1))')) # mc.button(h=ui.btn_large,w=ui.rowWidth/3,al='center',l=' - ',c=partial(delay,'btnDel','("sel")')) mc.button(h=ui.btn_large,w=ui.rowWidth/3,al='right',l='NUKE',c=partial(delay,'btnDel','("all")')) mc.setParent('..') mc.checkBox('Object',vis=0,l='Object',v=int(furiosoPrefs.get('Object')),cc=partial(delay,'furiosoPrefs.checkBox',"('Object')")) mc.checkBox('Material',l='Material',vis=1,v=int(furiosoPrefs.get('Material')),cc=partial(delay,'furiosoPrefs.checkBox',"('Material')")) mc.checkBox('Flag',l='Flag',vis=0,v=int(furiosoPrefs.get('Flag')),cc=partial(delay,'furiosoPrefs.checkBox',"('Flag')")) mc.iconTextScrollList('FuriosoObjScroll',w=ui.rowWidth,h=500) mc.setParent('furiosoObjectConform') mc.setParent('..') buildUILists()
def displayUnappliedEdits(unappliedEdits, textScrollList, index): """ Add all the unappliedEdits in the list to the textScrollList. Assumes proper filter has been handled by the caller and only unappliedEdits that should be displayed have been added to the filter unappliedEdits = list of unapplied edits to display textScrollList = 'List Assembly Edits' list widget index = first unoccupied index in textScrollList Returns the next unoccupied index in the textScrollList """ # if we had any unapplied edits, show them at the end if len(unappliedEdits) > 0: # leave a gap between the last edit (if any) and the header index = printDivider('Unapplied Edits', textScrollList, index) for edit in unappliedEdits: if edit.isTopLevel(): # Show the edit in normal white color cmds.iconTextScrollList(textScrollList, edit=True, append=edit.getString()) else: # Show the edit in grey color cmds.iconTextScrollList(textScrollList, edit=True, itemTextColor=(index, 0.373, 0.373, 0.373), append=edit.getString()) index = index + 1 return index
def detectTiles(self): """Detect all other texture tiles from the selected filename. """ self.lsTiles = [] # Clear list of texture tiles lsTilesDisplay = [ ] # Create a new list purely to display the UV offset coords # List directory contents and find tiles relating to current file if self.method != "Not detected": for item in os.listdir(self.txDir): if self.checkTile(item): self.lsTiles.append(item) lsTilesDisplay.append(item + ' [%d, %d]' % self.getUVOffset(item)) msg = "Found %d tiles:" % len(self.lsTiles) self.lsTiles.sort() lsTilesDisplay.sort() # Update UI elements mc.text("labelTiles", edit=True, label=msg) mc.iconTextScrollList("txList", edit=True, removeAll=True, deselectAll=True) mc.iconTextScrollList("txList", edit=True, append=lsTilesDisplay) return len(self.lsTiles)
def bldBrowseList_nav(opt): if opt=='up': bldBrowseList_scroll(mc.iconTextScrollList('browserlist',q=1,ann=1).rsplit('/',1)[0]) if not mc.iconTextScrollList('browserlist',q=1,si=1)==None: if len (mc.iconTextScrollList('browserlist',q=1,si=1))==1: if opt=='down': bldBrowseList_scroll( os.path.join(str(mc.iconTextScrollList('browserlist',q=1,ann=1)),str(mc.iconTextScrollList('browserlist',q=1,si=1)[0])).replace('\\','/'))
def __init__(self, text_scroll_list=None, indexes=None, edit_strings=None, edit_count=None): if text_scroll_list: self._indexes = set( cmds.iconTextScrollList(text_scroll_list, q=True, selectIndexedItem = True) ) self._edit_strings = set ( cmds.iconTextScrollList(text_scroll_list, q=True, selectItem = True) ) self._edit_count = cmds.iconTextScrollList(text_scroll_list, q=True, numberOfRows = True) else: self._indexes = indexes self._edit_strings = edit_strings self._edit_count = edit_count
def buildUILists(): mc.iconTextScrollList('FuriosoObjScroll',e=1,ams=1,ra=1) mc.popupMenu('menuObj',p='FuriosoObjScroll') mc.menuItem('Rename Material',l='Rename Material',c=partial(delay,'aePrefs.write',"('Behavior','New')")) mc.menuItem('Pivot Conform',l='Pivot Conform',c=partial(delay,'refreeze',"('Behavior','New')")) index=0 for each in mc.ls(): if mc.objExists(each+'.FuriosoFlag'): fileColor=[index+1,1,0,0] if checkConform(each) : fileColor=[index+1,0,1,0] index=index+1 mc.iconTextScrollList('FuriosoObjScroll',e=1,a=each.rsplit('_mesh')[0],itc=fileColor,sc=tagListCallBack)
def updateScollList(self, mode, listName): lights = cmds.ls(dag =True,visible=True,lights=True, type='mentalrayIblShape') lightGroups = self.groupLightsByName(lights) if mode: cmds.iconTextScrollList(listName,edit=True, ra=True) cmds.iconTextScrollList(listName,edit=True, allowMultiSelection=True, append=lightGroups.keys()) else: cmds.iconTextScrollList(listName,edit=True, ra=True) cmds.iconTextScrollList(listName,edit=True, allowMultiSelection=True, append=lights)
def btnApplyFm(): sel=mc.iconTextScrollList('browserlist',q=1,si=1) selIndex=mc.iconTextScrollList('browserlist',q=1,sii=1) sourcedir=mc.iconTextScrollList('browserlist',q=1,ann=1) opt=mc.optionMenu('targetOpt',q=1,sl=1) sourceFiles=[] targetFiles=[] if opt==1:#Layers2Files exportL2F() #Change to output mc.optionMenu('browseOpt',e=1,sl=4) sourcedir=l2fOutputFolder() if opt==2:#AfterEffectsExport AE.btnExport() if not sel==None: for index,each in enumerate(sel) : sourceFiles.append(sourcedir+sel[index]) if opt==3:#Backup if not os.path.exists(sourcedir+backupFolder()): os.makedirs(sourcedir+backupFolder()) for index,each in enumerate(sel): targetFiles.append(sourcedir+backupFolder()+'/'+each) for index,each in enumerate(sourceFiles): if os.path.isfile(each): shutil.copyfile(sourceFiles[index],targetFiles[index]) if os.path.isdir(each): shutil.copytree(sourceFiles[index],targetFiles[index]) if opt==4:#Archive for index,each in enumerate(sel): targetFiles.append(sourcedir+ strArchive(sel[index])) for index,each in enumerate(targetFiles): try: os.rename(sourceFiles[index],targetFiles[index]) except: pass if opt==5:#Archive for index,each in enumerate(sel): targetFiles.append(sourcedir+ strArchive(sel[index],add=-1)) for index,each in enumerate(targetFiles): try: os.rename(sourceFiles[index],targetFiles[index]) except: pass #Refresh bldBrowseList_scroll(sourcedir) bldTargetList_column('browser') if not selIndex== None : for each in selIndex : if opt==3: each+=1#account for added backed up folder mc.iconTextScrollList('browserlist',e=1,sii=int(each))
def listOverrides(self): #, layer=None): """ Return layer overrides for 'layer'. """ layer = mc.optionMenuGrp("renderLayer_comboBox", query=True, value=True) results = [] adjustments = mc.editRenderLayerAdjustment(layer, query=True, layer=True) if adjustments: for adj in adjustments: results.append("%s = %s" % (adj, mc.getAttr(adj))) print(results) mc.iconTextScrollList("listView_overrides", edit=True, removeAll=True, deselectAll=True) mc.iconTextScrollList("listView_overrides", edit=True, append=results) return results
def tagListCallBack(): sel=[] try: [sel.append(each+'_mesh') for each in mc.iconTextScrollList('FuriosoObjScroll',q=1,si=1) if mc.iconTextScrollList('FuriosoObjScroll',q=1,si=1) ] except: pass if sel: if sel=='_mesh': mc.select(cl=1) else: mc.select(sel) else: mc.select(cl=1)
def getElementsFromLightScrollList(self, listName, useGroups): lights = cmds.ls(dag=True, visible=True, type=self.lightTypes) lightGroups = self.groupLightsByName(lights) selectedGroups = cmds.iconTextScrollList(listName, query=True, si=True) if selectedGroups == None: return None if cmds.checkBox(useGroups, query=True, value=True): returnLights = [] for group in selectedGroups: returnLights.extend(lightGroups[group]) return returnLights else: return selectedGroups
def getElementsFromLightScrollList(self, listName, useGroups): lights = cmds.ls(dag =True,visible=True,lights=True, type='mentalrayIblShape') lightGroups = self.groupLightsByName(lights) selectedGroups = cmds.iconTextScrollList(listName, query=True, si=True ) if selectedGroups == None: return None if cmds.checkBox(useGroups, query=True, value=True): returnLights = [] for group in selectedGroups: returnLights.extend(lightGroups[group]) return returnLights else: return selectedGroups
def bldBrowseList_scroll(source):#init and refresh #Delete if mc.iconTextScrollList('browserlist',q=1,ex=1):mc.deleteUI('browserlist') #Build mc.iconTextScrollList('browserlist',parent='browser',ams=1,w=browselistWidth,h=600,ra=1,dcc=partial(runMethod,'bldBrowseList_dcc','()'),sc=partial(runMethod,'bldTargetList_column','("%s")'%('browser'))) #Right-Click mc.popupMenu() mc.menuItem(l='Archive') mc.menuItem(l='Restore') try: files=[each for each in os.listdir(source) if os.path.isfile(os.path.join(source,each))] directories=[each for each in os.listdir(source) if os.path.isdir(os.path.join(source,each))] except: files=[];directories=[] #Decide if (files,directories)== ([],[]) : mc.iconTextScrollList('browserlist',e=1,ann=source)#Annotate if empty else: for index, each in enumerate(directories): mc.iconTextScrollList('browserlist',e=1,a=each,ann=source,itc=[index+1,.9,.5,0]) for each in files: mc.iconTextScrollList('browserlist',ann=source,e=1,a=each)
def updateScollList(self, mode, listName): lights = cmds.ls(dag=True, visible=True, type=self.lightTypes) lightGroups = self.groupLightsByName(lights) if mode: cmds.iconTextScrollList(listName, edit=True, ra=True) cmds.iconTextScrollList(listName, edit=True, allowMultiSelection=True, append=lightGroups.keys()) else: cmds.iconTextScrollList(listName, edit=True, ra=True) cmds.iconTextScrollList(listName, edit=True, allowMultiSelection=True, append=lights)
def printDivider(title, textScrollList, index): index = index +1 cmds.iconTextScrollList(textScrollList, edit=True, append='----------------------------------------') titleString = "-------- " + title + " --------" index = index +1 cmds.iconTextScrollList(textScrollList, edit=True, append=titleString) index = index +1 cmds.iconTextScrollList(textScrollList, edit=True, append='----------------------------------------') return index
def bldTargetList_scroll(source):#init and refresh opt=mc.optionMenu('targetOpt',q=1,sl=1) #Delete if mc.iconTextScrollList('targetlist',q=1,ex=1):mc.deleteUI('target'+'list') if mc.iconTextScrollList('targetObj',q=1,ex=1):mc.deleteUI('target'+'Obj') if mc.button('btnApply',q=1,ex=1): mc.deleteUI('btnApply') #Build mc.iconTextScrollList('targetlist',w=350,ams=1,ra=1) sel=mc.iconTextScrollList(source+'list',q=1,si=1) #Decide if opt==1:#Layers2Files for each in l2fOutputFiles(): mc.iconTextScrollList('targetlist',e=1,a=each,en=0,ann=l2fOutputFolder()) if opt==2:#Not Called!! for each in sceneData.outputLayers(): mc.iconTextScrollList('targetlist',e=1,a=each,ann=l2fOutputFolder()) mc.iconTextScrollList('targetObj',ams=1,ra=1) if not sel==None : if opt==3:#Backup mc.iconTextScrollList('targetlist',e=1,a=backupFolder()+'/',itc=[1,.9,.5,0]) for each in sel: mc.iconTextScrollList('targetlist',e=1,a='\t'+each) if opt==4:#Archive for each in sel: mc.iconTextScrollList('targetlist',e=1,a=strArchive(src=each)) if opt==5:#Restore for each in sel: mc.iconTextScrollList('targetlist',e=1,a=strArchive(src=each,add=(-1))) mc.button('btnApply',align='center',w=350,l=' ',bgc=[.9,.5,0],c=partial(runMethod,'btnApplyFm','()'))
def detectTileMethod(self): """Attempt to auto-detect texture tiling method. """ filepath = mc.textField("txPath", query=True, text=True) filename = os.path.basename(filepath) self.txDir = os.path.dirname(filepath) # Compile Regular Expressions to match each texture tiling method reUDIM = re.compile(r"^[\.\w-]+\.\d{4}$") reUV = re.compile(r"^[\.\w-]+_[uU]\d+_[vV]\d+$") # Store filename root and extension root, self.ext = os.path.splitext(filename) self.prefix = root # Check file exists fileExists = os.path.isfile(filepath) if fileExists: # UDIM method: if reUDIM.match(root) is not None: self.tileRegex = r'\.\d{4}$' tileRE = re.compile(self.tileRegex) match = tileRE.search(root) # Store filename prefix if match is not None: self.prefix = root[:root.rfind(match.group())] # Set tiling method to UDIM self.method = "UDIM" mc.radioButtonGrp("uvOffset", edit=True, enable=False) print "Auto-detected UDIM texture tiling method." # UV offset method: elif reUV.match(root) is not None: self.tileRegex = r'_[uU]\d+_[vV]\d+$' tileRE = re.compile(self.tileRegex) match = tileRE.search(root) # Store filename prefix if match is not None: self.prefix = root[:root.rfind(match.group())] # Set tiling method to UV self.method = "UV" # Detect numbering start based on selected file temp = match.group().split('_') u = int(temp[1][1:]) v = int(temp[2][1:]) # Base 1: if u or v: mc.radioButtonGrp("uvOffset", edit=True, select=2, enable=True) print "Auto-detected UV (1-based) texture tiling method." # Base 0: else: mc.radioButtonGrp("uvOffset", edit=True, select=1, enable=True) print "Auto-detected UV (0-based) texture tiling method." # Method could not be determined: else: self.tileRegex = "" mc.radioButtonGrp("uvOffset", edit=True, enable=False) self.method = "Not detected" mc.warning("Unable to auto-detect texture tiling method.") # File doesn't exist: else: self.tileRegex = "" mc.radioButtonGrp("uvOffset", edit=True, enable=False) self.method = "Not detected" mc.warning("File doesn't exist: %s" % filepath) # Find other texture tiles fileCheckPass = self.detectTiles() # Update UI elements mc.text("labelTiles", edit=True, enable=fileCheckPass) mc.iconTextScrollList("txList", edit=True, enable=fileCheckPass) mc.textFieldGrp("tileMethod", edit=True, text=self.method) mc.button("btnCreate", edit=True, enable=fileCheckPass) # Select Vray Gamma checkbox if filetype is not OpenEXR if (self.ext == '.exr'): mc.checkBoxGrp("vrayAttr", edit=True, value1=False) else: mc.checkBoxGrp("vrayAttr", edit=True, value1=True)
def uiCreate(self): self.onCloseClicked() self.window = m.window( WIN_NAME, title='Maya Window', maximizeButton=False ) uiLAY_mainForm = m.formLayout() self.uiLAY_mainScroll = m.scrollLayout(childResizable=True) mainColumn = m.columnLayout(adjustableColumn=True) # main column layout with frames # -------- self.uiLAY_frameCheckBoxes = self.uiCreateFrame('uiLAY_frameCheckBoxes', 'Check Boxes (PMCheckBox)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiCHK_test1 = m.checkBox('uiCHK_test1', label='test1') self.uiCHK_test2 = m.checkBox('uiCHK_test2', label='test2') m.setParent(mainColumn) # -------- self.uiLAY_frameCheckBoxGroups = self.uiCreateFrame('uiLAY_frameCheckBoxGroups', 'Check Box Groups (PMCheckBoxGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiCHKGRP_test1 = m.checkBoxGrp( 'uiCHKGRP_test1', numberOfCheckBoxes=1, label='PMCheckBoxGrp1', label1='test1' ) self.uiCHKGRP_test2 = m.checkBoxGrp( 'uiCHKGRP_test2', numberOfCheckBoxes=2, label='PMCheckBoxGrp2', labelArray2=('test1', 'test2') ) self.uiCHKGRP_test3 = m.checkBoxGrp( 'uiCHKGRP_test3', numberOfCheckBoxes=3, label='PMCheckBoxGrp3', labelArray3=('test1', 'test2', 'test3') ) self.uiCHKGRP_test4 = m.checkBoxGrp( 'uiCHKGRP_test4', numberOfCheckBoxes=4, label='PMCheckBoxGrp4', labelArray4=('test1', 'test2', 'test3', 'test4') ) m.setParent(mainColumn) # -------- self.uiLAY_frameColorSliders = self.uiCreateFrame('uiLAY_frameColorSliders', 'Color Slider Groups (PMColorSliderGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiCLRGRP_test1 = m.colorSliderGrp( 'uiCLRGRP_test1', label='test1' ) self.uiCLRGRP_test2 = m.colorSliderGrp( 'uiCLRGRP_test2', label='test2' ) m.setParent(mainColumn) # -------- self.uiLAY_frameFloatFields = self.uiCreateFrame('uiLAY_frameFloatFields', 'Float Fields (PMFloatField)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiFLF_test1 = m.floatField('uiFLF_test1') self.uiFLF_test2 = m.floatField('uiFLF_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatFieldGroups = self.uiCreateFrame('uiLAY_frameFloatFieldGroups', 'Float Field Groups (PMFloatFieldGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiFLFGRP_test1 = m.floatFieldGrp( 'uiFLFGRP_test1', numberOfFields=1, label='PMFloatFieldGrp1' ) self.uiFLFGRP_test2 = m.floatFieldGrp( 'uiFLFGRP_test2', numberOfFields=2, label='PMFloatFieldGrp2' ) self.uiFLFGRP_test3 = m.floatFieldGrp( 'uiFLFGRP_test3', numberOfFields=3, label='PMFloatFieldGrp3' ) self.uiFLFGRP_test4 = m.floatFieldGrp( 'uiFLFGRP_test4', numberOfFields=4, label='PMFloatFieldGrp4' ) m.setParent(mainColumn) # -------- self.uiLAY_frameFloatScrollBars = self.uiCreateFrame('uiLAY_frameFloatScrollBars', 'Float Scroll Bars (PMFloatScrollBar)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiFLSCRL_test1 = m.floatScrollBar('uiFLSCRL_test1') self.uiFLSCRL_test2 = m.floatScrollBar('uiFLSCRL_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatSliders = self.uiCreateFrame('uiLAY_frameFloatSliders', 'Float Sliders (PMFloatSlider)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiFLTSLD_test1 = m.floatSlider('uiFLTSLD_test1') self.uiFLTSLD_test2 = m.floatSlider('uiFLTSLD_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatSliderGroups = self.uiCreateFrame('uiLAY_frameFloatSliderGroups', 'Float Slider Groups (PMFloatSliderGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiFLSGRP_test1 = m.floatSliderGrp( 'uiFLSGRP_test1', label='test1', field=True ) self.uiFLSGRP_test2 = m.floatSliderGrp( 'uiFLSGRP_test2', label='test2', field=True ) m.setParent(mainColumn) # -------- self.uiLAY_frameIconTextCheckBoxes = self.uiCreateFrame('uiLAY_frameIconTextCheckBoxes', 'Icon Text Check Boxes (PMIconTextCheckBox)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiITCHK_test1 = m.iconTextCheckBox( 'uiITCHK_test1', style='iconAndTextHorizontal', label='cube', image1='cube' ) self.uiITCHK_test2 = m.iconTextCheckBox( 'uiITCHK_test2', style='iconAndTextHorizontal', label='cone', image1='cone' ) m.setParent(mainColumn) # -------- self.uiLAY_frameIconTextRadioButtons = self.uiCreateFrame('uiLAY_frameIconTextRadioButtons', 'Icon Text Radio Buttons (PMIconTextRadioButton)') m.columnLayout() m.rowLayout(numberOfColumns=4) m.separator(style='none', width=140) m.iconTextRadioCollection() self.uiITRAD_test1 = m.iconTextRadioButton( 'uiITRAD_test1', style='iconAndTextHorizontal', label='cube', image1='cube' ) self.uiITRAD_test2 = m.iconTextRadioButton( 'uiITRAD_test2', style='iconAndTextHorizontal', label='cone', image1='cone' ) self.uiITRAD_test3 = m.iconTextRadioButton( 'uiITRAD_test3', style='iconAndTextHorizontal', label='torus', image1='torus' ) m.setParent(mainColumn) # -------- self.uiLAY_frameIconTextScrollLists = self.uiCreateFrame('uiLAY_frameIconTextScrollLists', 'Icon Text Scroll Lists (PMIconTextScrollList)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiITSLST_test1 = m.iconTextScrollList( 'uiITSLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) self.uiITSLST_test2 = m.iconTextScrollList( 'uiITSLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) m.setParent(mainColumn) # -------- self.uiLAY_frameIntFields = self.uiCreateFrame('uiLAY_frameIntFields', 'Int Fields (PMIntField)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiINF_test1 = m.intField('uiINF_test1') self.uiINF_test2 = m.intField('uiINF_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameIntFieldGroups = self.uiCreateFrame('uiLAY_frameIntFieldGroups', 'Int Field Groups (PMIntFieldGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiINFGRP_test1 = m.intFieldGrp( 'uiINFGRP_test1', numberOfFields=1, label='PMIntFieldGrp1' ) self.uiINFGRP_test2 = m.intFieldGrp( 'uiINFGRP_test2', numberOfFields=2, label='PMIntFieldGrp2' ) self.uiINFGRP_test3 = m.intFieldGrp( 'uiINFGRP_test3', numberOfFields=3, label='PMIntFieldGrp3' ) self.uiINFGRP_test4 = m.intFieldGrp( 'uiINFGRP_test4', numberOfFields=4, label='PMIntFieldGrp4' ) m.setParent(mainColumn) # -------- self.uiLAY_frameIntScrollBars = self.uiCreateFrame('uiLAY_frameIntScrollBars', 'Int Scroll Bars (PMIntScrollBar)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiINSCRL_test1 = m.intScrollBar('uiINSCRL_test1') self.uiINSCRL_test2 = m.intScrollBar('uiINSCRL_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameIntSliders = self.uiCreateFrame('uiLAY_frameIntSliders', 'Int Sliders (PMIntSlider)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiINTSLD_test1 = m.intSlider('uiINTSLD_test1') self.uiINTSLD_test2 = m.intSlider('uiINTSLD_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameIntSliderGroups = self.uiCreateFrame('uiLAY_frameIntSliderGroups', 'Int Slider Groups (PMIntSliderGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiINSGRP_test1 = m.intSliderGrp( 'uiINSGRP_test1', label='test1', field=True ) self.uiINSGRP_test2 = m.intSliderGrp( 'uiINSGRP_test2', label='test2', field=True ) m.setParent(mainColumn) # -------- self.uiLAY_frameOptionMenus = self.uiCreateFrame('uiLAY_frameOptionMenus', 'Option Menus (PMOptionMenu)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=110, style='none') self.uiOPTMNU_test1 = m.optionMenu('uiOPTMNU_test1', label='test1') m.menuItem(label='one') m.menuItem(label='two') m.menuItem(label='three') self.uiOPTMNU_test2 = m.optionMenu('uiOPTMNU_test2', label='test2') m.menuItem(label='four') m.menuItem(label='five') m.menuItem(label='six') m.setParent(mainColumn) # -------- self.uiLAY_frameOptionMenuGroups = self.uiCreateFrame('uiLAY_frameOptionMenuGroups', 'Option Menus Groups (PMOptionMenuGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiOPMGRP_test1 = m.optionMenuGrp('uiOPMGRP_test1', label='test1', extraLabel='extraLabel') m.menuItem(label='one') m.menuItem(label='two') m.menuItem(label='three') self.uiOPMGRP_test2 = m.optionMenuGrp('uiOPMGRP_test2', label='test2', extraLabel='extraLabel') m.menuItem(label='four') m.menuItem(label='five') m.menuItem(label='six') m.setParent(mainColumn) # -------- self.uiLAY_frameRadioButtons = self.uiCreateFrame('uiLAY_frameRadioButtons', 'Radio Buttons (PMRadioButton)') m.columnLayout() m.rowLayout(numberOfColumns=4) m.separator(style='none', width=140) m.radioCollection() self.uiRAD_test1 = m.radioButton('uiRAD_test1', label='test1') self.uiRAD_test2 = m.radioButton('uiRAD_test2', label='test2') self.uiRAD_test3 = m.radioButton('uiRAD_test3', label='test3') m.setParent(mainColumn) # -------- self.uiLAY_frameRadioButtonGroups = self.uiCreateFrame('uiLAY_frameRadioButtonGroups', 'Radio Button Groups (PMRadioButtonGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiRADGRP_test1 = m.radioButtonGrp( 'uiRADGRP_test1', numberOfRadioButtons=1, label='PMRadioButtonGrp1', label1='test1' ) self.uiRADGRP_test2 = m.radioButtonGrp( 'uiRADGRP_test2', numberOfRadioButtons=2, label='PMRadioButtonGrp2', labelArray2=('test1', 'test2') ) self.uiRADGRP_test3 = m.radioButtonGrp( 'uiRADGRP_test3', numberOfRadioButtons=3, label='PMRadioButtonGrp3', labelArray3=('test1', 'test2', 'test3') ) self.uiRADGRP_test4 = m.radioButtonGrp( 'uiRADGRP_test4', numberOfRadioButtons=4, label='PMRadioButtonGrp4', labelArray4=('test1', 'test2', 'test3', 'test4') ) m.setParent(mainColumn) # -------- self.uiLAY_frameSymbolCheckBoxes = self.uiCreateFrame('uiLAY_frameSymbolCheckBoxes', 'Symbol Check Boxes (PMSymbolCheckBox)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiSYMCHK_test1 = m.symbolCheckBox( 'uiSYMCHK_test1', image='polyCube' ) self.uiSYMCHK_test2 = m.symbolCheckBox( 'uiSYMCHK_test2', image='polyCone' ) m.setParent(mainColumn) # -------- self.uiLAY_frameScriptTables = self.uiCreateFrame('uiLAY_frameScriptTables', 'Script Tables (PMScriptTable)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiSCRTBL_test1 = m.scriptTable( 'uiSCRTBL_test1', selectionMode=3, rows=4, columns=2 ) self.uiSCRTBL_test2 = m.scriptTable( 'uiSCRTBL_test2', selectionMode=3, rows=4, columns=2 ) m.setParent(mainColumn) # -------- self.uiLAY_frameScrollField = self.uiCreateFrame('uiLAY_frameScrollField', 'Scroll Field (PMScrollField)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiSCRFLD_test1 = m.scrollField( 'uiSCRFLD_test1', wordWrap=True ) self.uiSCRFLD_test2 = m.scrollField( 'uiSCRFLD_test2', wordWrap=True ) m.setParent(mainColumn) # -------- self.uiLAY_frameShelfTabLayout = self.uiCreateFrame('uiLAY_frameShelfTabLayout', 'Shelf Tab Layout (PMShelfTabLayout)') m.columnLayout(adjustableColumn=True) self.uiSHLTAB_test1 = m.shelfTabLayout() m.shelfLayout('test1') m.setParent('..') m.shelfLayout('test2') m.setParent('..') m.shelfLayout('test3') m.setParent('..') m.setParent('..') self.uiSHLTAB_test2 = m.shelfTabLayout() m.shelfLayout('test4') m.setParent('..') m.shelfLayout('test5') m.setParent('..') m.shelfLayout('test6') m.setParent('..') m.setParent(mainColumn) # -------- self.uiLAY_frameTabLayout = self.uiCreateFrame('uiLAY_frameTabLayout', 'Tab Layout (PMTabLayout)') m.columnLayout(adjustableColumn=True) self.uiTAB_test1 = m.tabLayout() uiLAY_tabRow1 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow2 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow3 = m.rowLayout(numberOfColumns=1) m.setParent('..') m.setParent('..') m.tabLayout( self.uiTAB_test1, edit=True, tabLabel=((uiLAY_tabRow1, 'test1'), (uiLAY_tabRow2, 'test2'), (uiLAY_tabRow3, 'test3'),) ) self.uiTAB_test2 = m.tabLayout() uiLAY_tabRow4 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow5 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow6 = m.rowLayout(numberOfColumns=1) m.setParent('..') m.setParent('..') m.tabLayout( self.uiTAB_test2, edit=True, tabLabel=((uiLAY_tabRow4, 'test4'), (uiLAY_tabRow5, 'test5'), (uiLAY_tabRow6, 'test6'),) ) m.setParent(mainColumn) # -------- self.uiLAY_frameTextFields = self.uiCreateFrame('uiLAY_frameTextFields', 'Text Fields (PMTextField)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiTXT_test1 = m.textField('uiTXT_test1') self.uiTXT_test2 = m.textField('uiTXT_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameTextFieldButtonGroups = self.uiCreateFrame('uiLAY_frameTextFieldButtonGroups', 'Text Field Button Groups (PMTextFieldButtonGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiTXBTGR_test1 = m.textFieldButtonGrp( 'uiTXBTGR_test1', label='test1', buttonLabel='button1' ) self.uiTXBTGR_test2 = m.textFieldButtonGrp( 'uiTXBTGR_test2', label='test2', buttonLabel='button2' ) m.setParent(mainColumn) # -------- self.uiLAY_frameTextFieldGroups = self.uiCreateFrame('uiLAY_frameTextFieldGroups', 'Text Field Groups (PMTextFieldGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiTXTGRP_test1 = m.textFieldGrp( 'uiTXTGRP_test1', label='test1' ) self.uiTXTGRP_test2 = m.textFieldGrp( 'uiTXTGRP_test2', label='test2' ) m.setParent(mainColumn) # -------- self.uiLAY_frameTextScrollLists = self.uiCreateFrame('uiLAY_frameTextScrollLists', 'Text Scroll Lists (PMTextScrollList)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiTXTLST_test1 = m.textScrollList( 'uiTXTLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) self.uiTXTLST_test2 = m.textScrollList( 'uiTXTLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) # -------- m.setParent(uiLAY_mainForm) self.uiBTN_savePrefs = m.button( label='Save Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onSavePrefsClicked ) self.uiBTN_loadPrefs = m.button( label='Load Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onLoadPrefsClicked ) self.uiBTN_resetPrefs = m.button( label='Reset Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onResetPrefsClicked ) m.setParent('..') # -> window m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'top', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'left', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'right', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachControl=[(self.uiLAY_mainScroll, 'bottom', 2, self.uiBTN_savePrefs)]) m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_savePrefs, 'top')]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_savePrefs, 'left', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_savePrefs, 'right', 2, 33)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_savePrefs, 'bottom', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_loadPrefs, 'top')]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_loadPrefs, 'left', 2, 33)]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_loadPrefs, 'right', 2, 66)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_loadPrefs, 'bottom', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_resetPrefs, 'top')]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_resetPrefs, 'left', 2, 66)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_resetPrefs, 'right', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_resetPrefs, 'bottom', 2)]) m.showWindow(self.window)
def displayEditsWithIter(it, textScrollList, filterWidget, index, unappliedEdits, failedEditsMenuItem, unappliedEditsMenuItem, nonRemovableEditsMenuItem): """ Iterate over edits using given iterator, and add them to the textScrollList. Make sure we comply with the appropriate the show options and colours. it = MItEdits setup with the appropriate owner/targetNode textScrollList = 'List Assembly Edits' list widget filterWidget = 'List Assembly Edits' filter widget index = first unoccupied index in textScrollList unappliedEdits = list to gather all the unapplied edits, since they should be displayed at the end of the textScrollList. The calling function will be responsible for display of these edits failedEditsMenuItem = 'List Assembly Edits' show failed edit menu item unappliedEditsMenuItem = 'List Assembly Edits' show unapplied edit menu item nonRemovableEditsMenuItem = 'List Assembly Edits' show non-removable edit menu item Returns the next unoccupied index in the textScrollList """ showUnapplied = cmds.menuItem( unappliedEditsMenuItem, q=True, checkBox=True ) showFailed = cmds.menuItem( failedEditsMenuItem, q=True, checkBox=True ) showNested = cmds.menuItem( nonRemovableEditsMenuItem, q=True, checkBox=True ) filterStr = cmds.textFieldGrp(filterWidget, query=True, text=True) filterObj = None if len(filterStr) > 0: filterObj = re.compile('.*' + filterStr + '.*') while not it.isDone(): edit = it.edit() # 1) if an edit was removed, it will be NULL, so skip # 2) if this is a failed edit and we're not displaying # failed edits, skip to the next one # 3) if this is a nested edit (i.e. it was made in a child # assembly, and is thus, not removable) and we're not # displaying nested edits, skip # 4) if this edit is unapplied and we're not showing unapplied # edits, skip # 5) if we have a filter string, and this edit doesn't match # the filter, skip if ((edit is None) or (len(edit.getString()) == 0) or (not showFailed and edit.isFailed()) or (not showNested and not edit.isTopLevel()) or (not showUnapplied and not edit.isApplied()) or (filterObj is not None and filterObj.match(edit.getString()) is None) ): it.next() continue if edit.isFailed(): # is this a failed edit? if edit.isTopLevel(): # Show top-level failed edits in red cmds.iconTextScrollList(textScrollList, edit=True, itemTextColor=(index, 1.0, 0, 0), append=edit.getString()) index = index + 1 elif showNested: # Show nested, failed edits in subdued red cmds.iconTextScrollList(textScrollList, edit=True, itemTextColor=(index, 0.600, 0.122, 0.122), append=edit.getString()) index = index + 1 elif not edit.isApplied(): # is this an unapplied edit? # gather all unapplied edits. The calling function will display them at the bottom of the list # under a separate header unappliedEdits.append(edit) elif edit.isTopLevel(): # this is applied, successful and top-level # Show the edit in normal white color cmds.iconTextScrollList(textScrollList, edit=True, append=edit.getString()) index = index + 1 else: # this is an applied, successful, nested edit # Show the edit in grey color cmds.iconTextScrollList(textScrollList, edit=True, itemTextColor=(index, 0.373, 0.373, 0.373), append=edit.getString()) index = index + 1 it.next() return index
def displayUI(self): windowName = 'LCMTUIWindow' if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) window = cmds.window(windowName, menuBar=True, t=self.version) fileMenu = cmds.menu(label='Manage Light Types') cmds.menuItem(label='Add More Light Types', command=lambda *args: self.addLightTypes()) cmds.menuItem(label='See Current Light Types', command=lambda *args: self.displayLightTypes()) cmds.menuItem(label='Reset Light Types to Default Values', command=lambda *args: self.resetLightTypesToDefault()) changesMenu = cmds.menu(label='Edit Multiple Light Param') cmds.menuItem(label='Intensity', command=lambda *args: self.changeLightParams( lightList, useGroupLights, "intensity")) cmds.menuItem(label='Rename', command=lambda *args: self.changeLightParams( lightList, useGroupLights, "rename")) createMenu = cmds.menu(label='Create new lights') cmds.menuItem( label='Area Light', command=lambda *args: self.createLight("area", lightList)) if self.isRenderEngineInstalled('mentalRay'): cmds.menuItem( label='Area Light (MR)', command=lambda *args: self.createLight("areaMR", lightList)) cmds.menuItem( label='Spot Light', command=lambda *args: self.createLight("spot", lightList)) if self.isRenderEngineInstalled('mentalRay'): cmds.menuItem( label='Spot Light (MR)', command=lambda *args: self.createLight("spotMR", lightList)) if self.isRenderEngineInstalled('vray'): cmds.menuItem( label='Rect Light (VRay)', command=lambda *args: self.createLight("vrayRect", lightList)) if self.isRenderEngineInstalled('vray'): cmds.menuItem( label='Dome Light (VRay)', command=lambda *args: self.createLight("vrayDome", lightList)) if self.isRenderEngineInstalled('vray'): cmds.menuItem( label='IES Light (VRay)', command=lambda *args: self.createLight("vrayIES", lightList)) cmds.paneLayout(configuration='vertical2') lightStageColumn = cmds.columnLayout(adjustableColumn=True) cmds.rowLayout(numberOfColumns=2) cmds.text('Lights in the SCENE') cmds.button(label='Refresh!', command=lambda *args: self.refreshList(lightList)) cmds.setParent('..') print self.lightTypes lights = cmds.ls(dag=True, visible=True, type=self.lightTypes) print "lights", lights lightList = cmds.iconTextScrollList(allowMultiSelection=True, append=lights) cmds.rowLayout(numberOfColumns=2) useGroupLights = cmds.checkBox( label='Group Lights', onCommand=lambda *args: self.updateScollList(True, lightList), offCommand=lambda *args: self.updateScollList(False, lightList)) cmds.checkBox(label='Save Images?', cc=lambda *args: self.toggleSaveImages()) cmds.setParent('..') cmds.iconTextScrollList( lightList, edit=True, selectCommand=lambda *args: cmds.select( self.getElementsFromLightScrollList(lightList, useGroupLights), vis=True)) cmds.button( label='Render Lights!', command=lambda *args: self.renderAllLights( self.getElementsFromLightScrollList(lightList, useGroupLights), cmds.checkBox(useGroupLights, query=True, value=True))) cmds.text('*****@*****.**') cmds.setParent('..') #new column renderLayersColumn = cmds.columnLayout(adjustableColumn=True) cmds.text('Geometry in the SCENE') geometry = cmds.ls(geometry=True) #take out the ibl shapes from the geo selection # Bug fix Issue #1 and #8 geometry = list( set(geometry) - set(lights) - set(cmds.ls(type=self.NonGeoTypes))) geoList = cmds.iconTextScrollList( allowMultiSelection=True, append=geometry, selectCommand=lambda *args: cmds.select( cmds.iconTextScrollList(geoList, query=True, si=True))) cmds.text('Create Render Layers from selected geometry and lights') cmds.button(label='Create Render Layers!', command=lambda *args: self.createLayersFromLights( cmds.iconTextScrollList(geoList, query=True, si=True), self.getElementsFromLightScrollList( lightList, useGroupLights))) if self.isRenderEngineInstalled('vray'): cmds.button( label='Create Render Elements (VRay Only)', command=lambda *args: self.createRenderElementsFromLights( cmds.iconTextScrollList(geoList, query=True, si=True), self.getElementsFromLightScrollList( lightList, useGroupLights))) cmds.setParent('..') cmds.showWindow()
def btnSpawnBrowser(): spawnBrowser(mc.iconTextScrollList('browserlist',q=1,ann=1)) ##############Procedures def spawnBrowser(path):
def fileUI(self, name, parent, collapse=False): """Create panel UI controls - texture files. """ mc.frameLayout(width=400, collapsable=True, cl=collapse, borderStyle="etchedIn", label="Texture Files") mc.columnLayout(name) mc.separator(height=4, style="none") mc.rowLayout(numberOfColumns=1, columnAttach1="left", columnAlign1="both", columnOffset1=4) mc.text(label="Texture File: (tiles will be detected automatically)", wordWrap=True, align="left", width=392) mc.setParent(name) mc.separator(height=2, style="none") mc.rowLayout(numberOfColumns=2, columnAttach2=["left", "left"], columnAlign2=["both", "both"], columnOffset2=[4, 0]) mc.textField("txPath", text="", width=360, height=24, changeCommand=lambda *args: self.detectTileMethod()) mc.symbolButton( image="navButtonBrowse.png", width=26, height=26, command=lambda *args: self.fileBrowse( "txPath", "Image files (%s)" % self.imageFileTypes)) mc.setParent(name) mc.separator(height=4, style="none") mc.rowLayout(numberOfColumns=1, columnAttach1="left", columnAlign1="both", columnOffset1=4) mc.text("labelTiles", label="Tiles:", wordWrap=True, align="left", width=392, enable=False) mc.setParent(name) mc.separator(height=2, style="none") mc.rowLayout(numberOfColumns=2, columnAttach2=["left", "left"], columnAlign2=["both", "both"], columnOffset2=[4, 0]) mc.iconTextScrollList("txList", width=360, height=108, allowMultiSelection=True, enable=False) mc.setParent(name) mc.separator(width=396, height=12, style="in") mc.textFieldGrp("tileMethod", label="Tiling Method: ", text=self.method, editable=False) mc.radioButtonGrp( "uvOffset", label="UV Tile Coordinates: ", labelArray2=['0-based', '1-based'], numberOfRadioButtons=2, columnWidth3=[140, 78, 156], select=2, annotation= "Select 0-based if the UV tile numbering starts from zero, or 1-based if is starts from one", enable=False, changeCommand=lambda *args: self.detectTiles()) mc.separator(height=8, style="none") mc.setParent(parent)
def displayUI(self): windowName = 'LCMTUIWindow' if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) window = cmds.window(windowName, menuBar = True,t=self.version) fileMenu = cmds.menu( label='Manage Light Types') cmds.menuItem( label='Add More Light Types',command=lambda *args:self.addLightTypes()) cmds.menuItem( label='See Current Light Types', command=lambda *args:self.displayLightTypes()) cmds.menuItem( label='Reset Light Types to Default Values', command=lambda *args:self.resetLightTypesToDefault()) changesMenu = cmds.menu( label='Edit Multiple Light Param') cmds.menuItem( label='Intensity',command=lambda *args:self.changeLightParams(lightList,useGroupLights,"intensity")) cmds.menuItem( label='Rename',command=lambda *args:self.changeLightParams(lightList,useGroupLights,"rename")) createMenu = cmds.menu( label='Create new lights') cmds.menuItem( label='Area Light',command=lambda *args:self.createLight("area",lightList)) if self.isRenderEngineInstalled('mentalRay'): cmds.menuItem( label='Area Light (MR)',command=lambda *args:self.createLight("areaMR",lightList)) cmds.menuItem( label='Spot Light',command=lambda *args:self.createLight("spot",lightList)) if self.isRenderEngineInstalled('mentalRay'): cmds.menuItem( label='Spot Light (MR)',command=lambda *args:self.createLight("spotMR",lightList)) if self.isRenderEngineInstalled('vray'): cmds.menuItem( label='Rect Light (VRay)',command=lambda *args:self.createLight("vrayRect",lightList)) if self.isRenderEngineInstalled('vray'): cmds.menuItem( label='Dome Light (VRay)',command=lambda *args:self.createLight("vrayDome",lightList)) if self.isRenderEngineInstalled('vray'): cmds.menuItem( label='IES Light (VRay)',command=lambda *args:self.createLight("vrayIES",lightList)) cmds.paneLayout( configuration='vertical2' ) lightStageColumn = cmds.columnLayout(adjustableColumn=True) cmds.rowLayout(numberOfColumns = 2) cmds.text('Lights in the SCENE') cmds.button(label='Refresh!', command = lambda *args: self.refreshList(lightList)) cmds.setParent('..') print self.lightTypes lights = cmds.ls(dag =True,visible=True,type =self.lightTypes) print "lights", lights lightList = cmds.iconTextScrollList(allowMultiSelection=True, append=lights) cmds.rowLayout(numberOfColumns = 2) useGroupLights = cmds.checkBox( label='Group Lights', onCommand = lambda *args: self.updateScollList(True, lightList), offCommand = lambda *args: self.updateScollList(False, lightList)) cmds.checkBox( label='Save Images?', cc = lambda *args: self.toggleSaveImages()) cmds.setParent('..') cmds.iconTextScrollList(lightList,edit=True,selectCommand=lambda *args: cmds.select(self.getElementsFromLightScrollList(lightList,useGroupLights),vis=True)) cmds.button(label='Render Lights!', command = lambda *args: self.renderAllLights(self.getElementsFromLightScrollList(lightList,useGroupLights),cmds.checkBox(useGroupLights, query=True, value=True))) cmds.text('*****@*****.**') cmds.setParent('..') #new column renderLayersColumn = cmds.columnLayout(adjustableColumn=True) cmds.text('Geometry in the SCENE') geometry = cmds.ls(geometry=True) #take out the ibl shapes from the geo selection # Bug fix Issue #1 and #8 geometry = list(set(geometry) - set(lights)- set(cmds.ls(type =self.NonGeoTypes))) geoList = cmds.iconTextScrollList(allowMultiSelection=True, append=geometry,selectCommand=lambda *args: cmds.select(cmds.iconTextScrollList(geoList, query=True, si=True )) ) cmds.text('Create Render Layers from selected geometry and lights') cmds.button(label='Create Render Layers!', command = lambda *args: self.createLayersFromLights(cmds.iconTextScrollList(geoList, query=True, si=True ),self.getElementsFromLightScrollList(lightList,useGroupLights))) if self.isRenderEngineInstalled('vray'): cmds.button(label='Create Render Elements (VRay Only)', command = lambda *args: self.createRenderElementsFromLights(cmds.iconTextScrollList(geoList, query=True, si=True ),self.getElementsFromLightScrollList(lightList,useGroupLights))) cmds.setParent('..') cmds.showWindow()
############################################################################### #"""# IMPORT LIST # ############################################################################### py.columnLayout(w=590, h=800) py.rowColumnLayout(nc=1, cw=[(1, 570)], co=[(10, "both", 50)]) py.separator(h=20, st="none") py.button("importListOrderBar", en=0, l="BATCH FILES", h=30) topLIST = LINE[6].split(",") C = 0 LIST = [] while (C < len(topLIST)): LIST.append(topLIST[C].split("/")[-1]) C += 1 iLIST = py.iconTextScrollList("importList1", bgc=COLOR2, append=LIST, ams=1, h=450) ############################################################################### #"""# EXECUTE # ############################################################################### py.columnLayout(w=590, h=800) py.rowColumnLayout(nc=3, cw=[(1, 215), (2, 155), (3, 190)], co=[(1, "left", 5), (2, "left", 25), (3, "right", 5)]) py.separator(h=50, st="none") py.separator(h=50, st="none") py.separator(h=50, st="none") IN = py.button("IMPORT", c="IMPORTFILE()", w=90) OUT = py.button("EXPORT", c="EXPORTFILE()", w=90) ############################################################################################################################
def displayUI(self): windowName = 'LCMTUIWindow' if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) window = cmds.window(windowName, menuBar=True, t="LCMT v3.1.1") fileMenu = cmds.menu(label='Manage Light Types') cmds.menuItem(label='Add More Light Types', command=lambda *args: self.addLightTypes()) cmds.menuItem(label='See Current Light Types', command=lambda *args: self.displayLightTypes()) cmds.menuItem(label='Reset Light Types to Default Values', command=lambda *args: self.resetLightTypesToDefault()) cmds.paneLayout(configuration='vertical2') lightStageColumn = cmds.columnLayout(adjustableColumn=True) cmds.text('Lights in the SCENE') lights = cmds.ls(dag=True, visible=True, lights=True, type='mentalrayIblShape') lightList = cmds.iconTextScrollList(allowMultiSelection=True, append=lights) cmds.rowLayout(numberOfColumns=2) useGroupLights = cmds.checkBox( label='Group Lights', onCommand=lambda *args: self.updateScollList(True, lightList), offCommand=lambda *args: self.updateScollList(False, lightList)) cmds.checkBox(label='Save Images?', cc=lambda *args: self.toggleSaveImages()) cmds.setParent('..') cmds.iconTextScrollList( lightList, edit=True, selectCommand=lambda *args: cmds.select( self.getElementsFromLightScrollList(lightList, useGroupLights), vis=True)) cmds.button( label='Render Lights!', command=lambda *args: self.renderAllLights( self.getElementsFromLightScrollList(lightList, useGroupLights), cmds.checkBox(useGroupLights, query=True, value=True))) cmds.setParent('..') renderLayersColumn = cmds.columnLayout(adjustableColumn=True) #new column cmds.text('Geometry in the SCENE') geometry = cmds.ls(geometry=True) #take out the ibl shapes from the geo selection geometry = list(set(geometry) - set(lights)) geoList = cmds.iconTextScrollList( allowMultiSelection=True, append=geometry, selectCommand=lambda *args: cmds.select( cmds.iconTextScrollList(geoList, query=True, si=True))) cmds.text('Create Render Layers from selected geometry and lights') cmds.button(label='Create Render Layers!', command=lambda *args: self.createLayersFromLights( cmds.iconTextScrollList(geoList, query=True, si=True), self.getElementsFromLightScrollList( lightList, useGroupLights))) cmds.setParent('..') cmds.showWindow()
def uiCreate(self): self.onCloseClicked() self.window = m.window(WIN_NAME, title='Maya Window', maximizeButton=False) uiLAY_mainForm = m.formLayout() self.uiLAY_mainScroll = m.scrollLayout(childResizable=True) mainColumn = m.columnLayout( adjustableColumn=True) # main column layout with frames # -------- self.uiLAY_frameCheckBoxes = self.uiCreateFrame( 'uiLAY_frameCheckBoxes', 'Check Boxes (PMCheckBox)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiCHK_test1 = m.checkBox('uiCHK_test1', label='test1') self.uiCHK_test2 = m.checkBox('uiCHK_test2', label='test2') m.setParent(mainColumn) # -------- self.uiLAY_frameCheckBoxGroups = self.uiCreateFrame( 'uiLAY_frameCheckBoxGroups', 'Check Box Groups (PMCheckBoxGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiCHKGRP_test1 = m.checkBoxGrp('uiCHKGRP_test1', numberOfCheckBoxes=1, label='PMCheckBoxGrp1', label1='test1') self.uiCHKGRP_test2 = m.checkBoxGrp('uiCHKGRP_test2', numberOfCheckBoxes=2, label='PMCheckBoxGrp2', labelArray2=('test1', 'test2')) self.uiCHKGRP_test3 = m.checkBoxGrp('uiCHKGRP_test3', numberOfCheckBoxes=3, label='PMCheckBoxGrp3', labelArray3=('test1', 'test2', 'test3')) self.uiCHKGRP_test4 = m.checkBoxGrp('uiCHKGRP_test4', numberOfCheckBoxes=4, label='PMCheckBoxGrp4', labelArray4=('test1', 'test2', 'test3', 'test4')) m.setParent(mainColumn) # -------- self.uiLAY_frameColorSliders = self.uiCreateFrame( 'uiLAY_frameColorSliders', 'Color Slider Groups (PMColorSliderGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiCLRGRP_test1 = m.colorSliderGrp('uiCLRGRP_test1', label='test1') self.uiCLRGRP_test2 = m.colorSliderGrp('uiCLRGRP_test2', label='test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatFields = self.uiCreateFrame( 'uiLAY_frameFloatFields', 'Float Fields (PMFloatField)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiFLF_test1 = m.floatField('uiFLF_test1') self.uiFLF_test2 = m.floatField('uiFLF_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatFieldGroups = self.uiCreateFrame( 'uiLAY_frameFloatFieldGroups', 'Float Field Groups (PMFloatFieldGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiFLFGRP_test1 = m.floatFieldGrp('uiFLFGRP_test1', numberOfFields=1, label='PMFloatFieldGrp1') self.uiFLFGRP_test2 = m.floatFieldGrp('uiFLFGRP_test2', numberOfFields=2, label='PMFloatFieldGrp2') self.uiFLFGRP_test3 = m.floatFieldGrp('uiFLFGRP_test3', numberOfFields=3, label='PMFloatFieldGrp3') self.uiFLFGRP_test4 = m.floatFieldGrp('uiFLFGRP_test4', numberOfFields=4, label='PMFloatFieldGrp4') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatScrollBars = self.uiCreateFrame( 'uiLAY_frameFloatScrollBars', 'Float Scroll Bars (PMFloatScrollBar)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiFLSCRL_test1 = m.floatScrollBar('uiFLSCRL_test1') self.uiFLSCRL_test2 = m.floatScrollBar('uiFLSCRL_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatSliders = self.uiCreateFrame( 'uiLAY_frameFloatSliders', 'Float Sliders (PMFloatSlider)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiFLTSLD_test1 = m.floatSlider('uiFLTSLD_test1') self.uiFLTSLD_test2 = m.floatSlider('uiFLTSLD_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatSliderGroups = self.uiCreateFrame( 'uiLAY_frameFloatSliderGroups', 'Float Slider Groups (PMFloatSliderGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiFLSGRP_test1 = m.floatSliderGrp('uiFLSGRP_test1', label='test1', field=True) self.uiFLSGRP_test2 = m.floatSliderGrp('uiFLSGRP_test2', label='test2', field=True) m.setParent(mainColumn) # -------- self.uiLAY_frameIconTextCheckBoxes = self.uiCreateFrame( 'uiLAY_frameIconTextCheckBoxes', 'Icon Text Check Boxes (PMIconTextCheckBox)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiITCHK_test1 = m.iconTextCheckBox('uiITCHK_test1', style='iconAndTextHorizontal', label='cube', image1='cube') self.uiITCHK_test2 = m.iconTextCheckBox('uiITCHK_test2', style='iconAndTextHorizontal', label='cone', image1='cone') m.setParent(mainColumn) # -------- self.uiLAY_frameIconTextRadioButtons = self.uiCreateFrame( 'uiLAY_frameIconTextRadioButtons', 'Icon Text Radio Buttons (PMIconTextRadioButton)') m.columnLayout() m.rowLayout(numberOfColumns=4) m.separator(style='none', width=140) m.iconTextRadioCollection() self.uiITRAD_test1 = m.iconTextRadioButton( 'uiITRAD_test1', style='iconAndTextHorizontal', label='cube', image1='cube') self.uiITRAD_test2 = m.iconTextRadioButton( 'uiITRAD_test2', style='iconAndTextHorizontal', label='cone', image1='cone') self.uiITRAD_test3 = m.iconTextRadioButton( 'uiITRAD_test3', style='iconAndTextHorizontal', label='torus', image1='torus') m.setParent(mainColumn) # -------- self.uiLAY_frameIconTextScrollLists = self.uiCreateFrame( 'uiLAY_frameIconTextScrollLists', 'Icon Text Scroll Lists (PMIconTextScrollList)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiITSLST_test1 = m.iconTextScrollList( 'uiITSLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')) self.uiITSLST_test2 = m.iconTextScrollList( 'uiITSLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')) m.setParent(mainColumn) # -------- self.uiLAY_frameIntFields = self.uiCreateFrame( 'uiLAY_frameIntFields', 'Int Fields (PMIntField)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiINF_test1 = m.intField('uiINF_test1') self.uiINF_test2 = m.intField('uiINF_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameIntFieldGroups = self.uiCreateFrame( 'uiLAY_frameIntFieldGroups', 'Int Field Groups (PMIntFieldGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiINFGRP_test1 = m.intFieldGrp('uiINFGRP_test1', numberOfFields=1, label='PMIntFieldGrp1') self.uiINFGRP_test2 = m.intFieldGrp('uiINFGRP_test2', numberOfFields=2, label='PMIntFieldGrp2') self.uiINFGRP_test3 = m.intFieldGrp('uiINFGRP_test3', numberOfFields=3, label='PMIntFieldGrp3') self.uiINFGRP_test4 = m.intFieldGrp('uiINFGRP_test4', numberOfFields=4, label='PMIntFieldGrp4') m.setParent(mainColumn) # -------- self.uiLAY_frameIntScrollBars = self.uiCreateFrame( 'uiLAY_frameIntScrollBars', 'Int Scroll Bars (PMIntScrollBar)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiINSCRL_test1 = m.intScrollBar('uiINSCRL_test1') self.uiINSCRL_test2 = m.intScrollBar('uiINSCRL_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameIntSliders = self.uiCreateFrame( 'uiLAY_frameIntSliders', 'Int Sliders (PMIntSlider)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiINTSLD_test1 = m.intSlider('uiINTSLD_test1') self.uiINTSLD_test2 = m.intSlider('uiINTSLD_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameIntSliderGroups = self.uiCreateFrame( 'uiLAY_frameIntSliderGroups', 'Int Slider Groups (PMIntSliderGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiINSGRP_test1 = m.intSliderGrp('uiINSGRP_test1', label='test1', field=True) self.uiINSGRP_test2 = m.intSliderGrp('uiINSGRP_test2', label='test2', field=True) m.setParent(mainColumn) # -------- self.uiLAY_frameOptionMenus = self.uiCreateFrame( 'uiLAY_frameOptionMenus', 'Option Menus (PMOptionMenu)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=110, style='none') self.uiOPTMNU_test1 = m.optionMenu('uiOPTMNU_test1', label='test1') m.menuItem(label='one') m.menuItem(label='two') m.menuItem(label='three') self.uiOPTMNU_test2 = m.optionMenu('uiOPTMNU_test2', label='test2') m.menuItem(label='four') m.menuItem(label='five') m.menuItem(label='six') m.setParent(mainColumn) # -------- self.uiLAY_frameOptionMenuGroups = self.uiCreateFrame( 'uiLAY_frameOptionMenuGroups', 'Option Menus Groups (PMOptionMenuGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiOPMGRP_test1 = m.optionMenuGrp('uiOPMGRP_test1', label='test1', extraLabel='extraLabel') m.menuItem(label='one') m.menuItem(label='two') m.menuItem(label='three') self.uiOPMGRP_test2 = m.optionMenuGrp('uiOPMGRP_test2', label='test2', extraLabel='extraLabel') m.menuItem(label='four') m.menuItem(label='five') m.menuItem(label='six') m.setParent(mainColumn) # -------- self.uiLAY_frameRadioButtons = self.uiCreateFrame( 'uiLAY_frameRadioButtons', 'Radio Buttons (PMRadioButton)') m.columnLayout() m.rowLayout(numberOfColumns=4) m.separator(style='none', width=140) m.radioCollection() self.uiRAD_test1 = m.radioButton('uiRAD_test1', label='test1') self.uiRAD_test2 = m.radioButton('uiRAD_test2', label='test2') self.uiRAD_test3 = m.radioButton('uiRAD_test3', label='test3') m.setParent(mainColumn) # -------- self.uiLAY_frameRadioButtonGroups = self.uiCreateFrame( 'uiLAY_frameRadioButtonGroups', 'Radio Button Groups (PMRadioButtonGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiRADGRP_test1 = m.radioButtonGrp('uiRADGRP_test1', numberOfRadioButtons=1, label='PMRadioButtonGrp1', label1='test1') self.uiRADGRP_test2 = m.radioButtonGrp('uiRADGRP_test2', numberOfRadioButtons=2, label='PMRadioButtonGrp2', labelArray2=('test1', 'test2')) self.uiRADGRP_test3 = m.radioButtonGrp('uiRADGRP_test3', numberOfRadioButtons=3, label='PMRadioButtonGrp3', labelArray3=('test1', 'test2', 'test3')) self.uiRADGRP_test4 = m.radioButtonGrp('uiRADGRP_test4', numberOfRadioButtons=4, label='PMRadioButtonGrp4', labelArray4=('test1', 'test2', 'test3', 'test4')) m.setParent(mainColumn) # -------- self.uiLAY_frameSymbolCheckBoxes = self.uiCreateFrame( 'uiLAY_frameSymbolCheckBoxes', 'Symbol Check Boxes (PMSymbolCheckBox)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiSYMCHK_test1 = m.symbolCheckBox('uiSYMCHK_test1', image='polyCube') self.uiSYMCHK_test2 = m.symbolCheckBox('uiSYMCHK_test2', image='polyCone') m.setParent(mainColumn) # -------- self.uiLAY_frameScriptTables = self.uiCreateFrame( 'uiLAY_frameScriptTables', 'Script Tables (PMScriptTable)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiSCRTBL_test1 = m.scriptTable('uiSCRTBL_test1', selectionMode=3, rows=4, columns=2) self.uiSCRTBL_test2 = m.scriptTable('uiSCRTBL_test2', selectionMode=3, rows=4, columns=2) m.setParent(mainColumn) # -------- self.uiLAY_frameScrollField = self.uiCreateFrame( 'uiLAY_frameScrollField', 'Scroll Field (PMScrollField)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiSCRFLD_test1 = m.scrollField('uiSCRFLD_test1', wordWrap=True) self.uiSCRFLD_test2 = m.scrollField('uiSCRFLD_test2', wordWrap=True) m.setParent(mainColumn) # -------- self.uiLAY_frameShelfTabLayout = self.uiCreateFrame( 'uiLAY_frameShelfTabLayout', 'Shelf Tab Layout (PMShelfTabLayout)') m.columnLayout(adjustableColumn=True) self.uiSHLTAB_test1 = m.shelfTabLayout() m.shelfLayout('test1') m.setParent('..') m.shelfLayout('test2') m.setParent('..') m.shelfLayout('test3') m.setParent('..') m.setParent('..') self.uiSHLTAB_test2 = m.shelfTabLayout() m.shelfLayout('test4') m.setParent('..') m.shelfLayout('test5') m.setParent('..') m.shelfLayout('test6') m.setParent('..') m.setParent(mainColumn) # -------- self.uiLAY_frameTabLayout = self.uiCreateFrame( 'uiLAY_frameTabLayout', 'Tab Layout (PMTabLayout)') m.columnLayout(adjustableColumn=True) self.uiTAB_test1 = m.tabLayout() uiLAY_tabRow1 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow2 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow3 = m.rowLayout(numberOfColumns=1) m.setParent('..') m.setParent('..') m.tabLayout(self.uiTAB_test1, edit=True, tabLabel=( (uiLAY_tabRow1, 'test1'), (uiLAY_tabRow2, 'test2'), (uiLAY_tabRow3, 'test3'), )) self.uiTAB_test2 = m.tabLayout() uiLAY_tabRow4 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow5 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow6 = m.rowLayout(numberOfColumns=1) m.setParent('..') m.setParent('..') m.tabLayout(self.uiTAB_test2, edit=True, tabLabel=( (uiLAY_tabRow4, 'test4'), (uiLAY_tabRow5, 'test5'), (uiLAY_tabRow6, 'test6'), )) m.setParent(mainColumn) # -------- self.uiLAY_frameTextFields = self.uiCreateFrame( 'uiLAY_frameTextFields', 'Text Fields (PMTextField)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiTXT_test1 = m.textField('uiTXT_test1') self.uiTXT_test2 = m.textField('uiTXT_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameTextFieldButtonGroups = self.uiCreateFrame( 'uiLAY_frameTextFieldButtonGroups', 'Text Field Button Groups (PMTextFieldButtonGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiTXBTGR_test1 = m.textFieldButtonGrp('uiTXBTGR_test1', label='test1', buttonLabel='button1') self.uiTXBTGR_test2 = m.textFieldButtonGrp('uiTXBTGR_test2', label='test2', buttonLabel='button2') m.setParent(mainColumn) # -------- self.uiLAY_frameTextFieldGroups = self.uiCreateFrame( 'uiLAY_frameTextFieldGroups', 'Text Field Groups (PMTextFieldGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiTXTGRP_test1 = m.textFieldGrp('uiTXTGRP_test1', label='test1') self.uiTXTGRP_test2 = m.textFieldGrp('uiTXTGRP_test2', label='test2') m.setParent(mainColumn) # -------- self.uiLAY_frameTextScrollLists = self.uiCreateFrame( 'uiLAY_frameTextScrollLists', 'Text Scroll Lists (PMTextScrollList)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiTXTLST_test1 = m.textScrollList( 'uiTXTLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')) self.uiTXTLST_test2 = m.textScrollList( 'uiTXTLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')) # -------- m.setParent(uiLAY_mainForm) self.uiBTN_savePrefs = m.button(label='Save Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onSavePrefsClicked) self.uiBTN_loadPrefs = m.button(label='Load Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onLoadPrefsClicked) self.uiBTN_resetPrefs = m.button(label='Reset Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onResetPrefsClicked) m.setParent('..') # -> window m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'top', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'left', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'right', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachControl=[(self.uiLAY_mainScroll, 'bottom', 2, self.uiBTN_savePrefs)]) m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_savePrefs, 'top')]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_savePrefs, 'left', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_savePrefs, 'right', 2, 33)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_savePrefs, 'bottom', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_loadPrefs, 'top')]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_loadPrefs, 'left', 2, 33)]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_loadPrefs, 'right', 2, 66)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_loadPrefs, 'bottom', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_resetPrefs, 'top')]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_resetPrefs, 'left', 2, 66)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_resetPrefs, 'right', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_resetPrefs, 'bottom', 2)]) m.showWindow(self.window)