def initUI(self): pm.setUITemplate("DefaultTemplate", pushTemplate=True) form = pm.formLayout() versionData = pm.mayatoCorona(version=True) license = versionData[7].split("\r\n") with pm.columnLayout('AboutLayout') as StandinLayout: with pm.rowColumnLayout('AboutColumnLayout', nc=2, columnWidth=((1, 160), (2, 220)), co=(2, "left", 10)): pm.text(label="mayaToCorona:", align="right") pm.text(label=versionData[0], align="left") pm.text(label="Corna version:", align="right") pm.text(label=versionData[1], align="left") pm.text(label="OIIO:", align="right") pm.text(label=versionData[2], align="left") pm.text(label="OSL:", align="right") pm.text(label=versionData[3], align="left") pm.text(label="BOOST:", align="right") pm.text(label=versionData[4], align="left") pm.text(label="OpenEXR:", align="right") pm.text(label=versionData[5], align="left") pm.text(label="License type:", align="right") pm.text(label=license[0], align="left") pm.text(label="Valid until:", align="right") pm.text(label=license[1].replace("Activated until: ", ""), align="left") pm.separator() with pm.columnLayout(): pm.text(label="Corona Renderer\n(c) Render Legion s.r.o., 2014-2015", align="center") #pm.textField(text="Corona Renderer (c) Render Legion s.r.o., 2014-2015") pm.formLayout(form, edit=True, attachForm=[(StandinLayout, 'top', 5), (StandinLayout, 'bottom', 5), (StandinLayout, 'right', 5), (StandinLayout, 'left', 5)]) pm.setUITemplate("DefaultTemplate", popTemplate=True)
def GUI(): winName = 'squishy_ik_win' if pmc.window(winName, exists=1): pmc.deleteUI(winName) win = pmc.window(winName, t='Squishy IK') pmc.formLayout(numberOfDivisions=100) pmc.rowColumnLayout(nc=2, rs=[15, 15], columnOffset=(1, 'both', 5)) pmc.text(l='1 - Create Placement Locators') pmc.button(l='Make Locators', c=pmc.Callback(makeAutoRigLocators)) pmc.separator() pmc.separator() pmc.text(l='2 - Place locators where the spine begins and ends') pmc.button(l='Select Locators', c=pmc.Callback(selectAutoRigLocators)) pmc.separator() pmc.separator() pmc.text(l='3 - With the locators place, go ahead and create the rig!') pmc.button(l='Create Squishy Spine', c=pmc.Callback(squishySplineIkCallback)) pmc.separator() pmc.separator() pmc.text(l='4 - Select the joints to add to the skin cluster') pmc.button(l='Select Bind Joints', c=pmc.Callback(selectSquishyJointsCallback)) win.show()
def show(self): self.window = pm.window(self.name, wh=(self.w, self.h), title=self.name) self.fl = pm.formLayout(nd=100) #create the main form layout of the window self.frame_layout = pm.frameLayout(bgc=(.3,.1,.25), li=self.w/4, la='center', fn='boldLabelFont', label='AW Binary Proxy Tools', borderStyle='in', mh=self.h/12,h=self.h-40) self.cl = pm.columnLayout(adj=True, cal='left', cat=['both',0], rs=5) pm.text(label='mip_renderProxy Creation', al='center') pm.button (label='Create Render Proxies', bgc=(.4,.5,.2), command= lambda *args: self._createRenderProxy( pm.ls(sl=True) )) pm.separator(st='doubleDash', h=25) pm.text(label='mip_renderProxy Assignment', al='center') self.fileInput = TextFieldBrowserInput( width=300, name='Proxy Input', option_name='Proxy Browse Type', options=['from file', 'from folder'], button_name='Browse', parent=self.cl ) pm.button (label='Assign Render Proxies', bgc=(.4,.5,.2), command= lambda *args: self._attachRenderProxy( pm.ls(sl=True) )) pm.button (label='DELETE ALL BINARY PROXIES', bgc=(.4, .2, .2), command=self._removeAllBipx) pm.setParent('..') pm.setParent('..') #add the close window button self.close_btn = pm.button (w=self.bw, label='Close', bgc = (.4, .2, .2), command=self.close_UI) #finalize form layout pm.formLayout(self.fl, edit=True, attachForm = [(self.frame_layout, 'top', 0), (self.frame_layout, 'left', 0), (self.frame_layout, 'right', 0), (self.close_btn, 'bottom', 10), (self.close_btn, 'right', 10)]) pm.showWindow(self.window)
def initUI(self): pm.setUITemplate("DefaultTemplate", pushTemplate=True) form = pm.formLayout() binMeshExportPath = pm.optionVar.get('mtap_binMeshExportPath', pm.workspace.path + "/geo/export.binarymesh") prefix = pm.optionVar.get('mtap_binMeshExportPathPrefix', "prefix") createProxy = pm.optionVar.get('mtap_binMeshCreateProxy', True) percentage = pm.optionVar.get('mtap_binMeshPercentage', 0.1) createStandin = pm.optionVar.get('mtap_binMeshCreateStandin', True) oneFilePerMesh = pm.optionVar.get('mtap_binMeshOneFilePerMesh', False) useTransform = pm.optionVar.get('mtap_binMeshUseTransform', False) with pm.columnLayout('StandinLayout') as StandinLayout: with pm.frameLayout('StandinLayout', label="Standin export options", collapsable=False): with pm.columnLayout('StandinColumnLayout'): self.pathUI = pm.textFieldButtonGrp(label="Standin directory", text=binMeshExportPath, buttonLabel="File", buttonCommand=self.fileBrowser) self.prefixUI = pm.textFieldGrp(label="Prefix", text=prefix) self.createProxyUI = pm.checkBoxGrp(label="Create proxy", value1=createProxy) self.percentageUI = pm.floatFieldGrp(label="Percentage", value1=percentage) self.createStdInUI = pm.checkBoxGrp(label="Create StandIn", value1=createStandin) self.oneFilePerMeshUI = pm.checkBoxGrp(label="One File Per Mesh", value1=oneFilePerMesh) self.doTransformUI = pm.checkBoxGrp(label="Use Transform", value1=useTransform) with pm.rowColumnLayout(numberOfColumns=2): pm.button(label="Create BinaryMesh", c=self.doit) pm.button(label="Cancel", c=self.cancel) pm.formLayout(form, edit=True, attachForm=[(StandinLayout, 'top', 5), (StandinLayout, 'bottom', 5), (StandinLayout, 'right', 5), (StandinLayout, 'left', 5)]) pm.setUITemplate("DefaultTemplate", popTemplate=True)
def ui_fixComponentShading(*args): ### UI setup global UI_name UI_name = [ 'chk_find', 'chk_fix', 'chk_layer', 'btn_run' ] if pm.window( 'fix_component_shading', exists=True ): pm.deleteUI( 'fix_component_shading', window=True ) ui_layout['window'] = pm.window( 'fix_component_shading', title='Fix Component Shading', sizeable=False, h=200, w=200 ) ui_layout['mainLayout'] = pm.columnLayout( columnAlign='left', columnAttach=['left', 0] ) pm.checkBox( UI_name[0], label=' Find Component Shading Object', value=1, w=200, p=ui_layout['mainLayout'] ) pm.checkBox( UI_name[1], label=' Fix Component Shading Object', w=200, p=ui_layout['mainLayout'] ) pm.checkBox( UI_name[2], label=' Fix Ecah Render Layer', w=200, p=ui_layout['mainLayout'] ) ui_layout['ui_sub1'] = pm.formLayout(p=ui_layout['mainLayout'] ) btn = pm.button( UI_name[3] ,label=' Execute !', command=pm.Callback( doExecution ), w=100, p=ui_layout['ui_sub1'] ) pm.formLayout( ui_layout['ui_sub1'], e=True, attachForm=[ (btn, 'left', 50 ) ] ) pm.separator( h=8, w=200, style='single', p=ui_layout['mainLayout'] ) ui_layout['ui_sub2'] = pm.columnLayout(p=ui_layout['mainLayout'] ) pm.text(label=' --- This script will keep the material \n in the CURRENT render layer, so \n it better to run it in MASTER layer! --- ', bgc=[0.05, 0.05, 0.05], align='left', p=ui_layout['ui_sub2'] ) pm.showWindow( ui_layout['window'] )
def displayOptions( self ): """Build the interface""" self.interface['TimeRange'] = cmds.radioButtonGrp( numberOfRadioButtons=2, label='Time Range', labelArray2=['Time Slider', 'Start/End'], onCommand=self.disableTimeRange ) self.interface['StartTime'] = cmds.intFieldGrp( label='Start Time' ) self.interface['EndTime'] = cmds.intFieldGrp( label='End Time' ) self.interface['Focals'] = cmds.textFieldGrp( label='Focals' ) self.interface['Cameras'] = cmds.textScrollList( allowMultiSelection=True, width=200, height=100 ) # self.interface['CamerasLabel'] = cmds.text( label='Cameras' ) self.formAttachPosition() cmds.formLayout( self.optionsForm, e=True, attachForm=( [ self.interface['TimeRange'], 'top', 10 ], [ self.interface['Cameras'], 'bottom', 100 ], [ self.interface['Cameras'], 'left', 150 ], ), attachControl=( [ self.interface['StartTime'], 'top', 0, self.interface['TimeRange'] ], [ self.interface['EndTime'], 'top', 0, self.interface['StartTime'] ], [ self.interface['Focals'], 'top', 0, self.interface['EndTime'] ], [ self.interface['Cameras'], 'top', 10, self.interface['Focals'] ], # [ self.interface['CamerasLabel'], 'top', 10, self.interface['Focals'] ], # [ self.interface['CamerasLabel'], 'right', -90, self.interface['Cameras'] ], ), attachNone=( [ self.interface['Cameras'], 'left' ], [ self.interface['Cameras'], 'right' ], ) ) self.editMenuResetCmd() # Set the default values in the interface
def buildHeader(self): """ Create buttons at the top of the view. These link to other views, and display the current view by highlighting it in white. If a custom header is desired, this method should be overridden. """ links = self.links() if links != []: with pm.frameLayout(lv=False, bs='out'): with pm.formLayout('{0}LinkForm'.format(self.viewName), bgc=self._linkBgc) as form: last = None for viewName in links: name = None if self.gui.hasView(viewName): name = self.gui.getViewClass(viewName).displayName if name is None: name = viewName btn = pm.button(l=name, c=Callback(self.showView, viewName), h=18) if viewName == self.viewName: btn.setBackgroundColor([.86, .86, .86]) if last is None: pm.formLayout(form, e=True, af=[(btn, 'left', 0)]) else: pm.formLayout(form, e=True, ac=[(btn, 'left', 2, last)]) last = btn self._headFrame.setManage(len(links) > 0)
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 TheaEnvironmentCreateTab(self): log.debug("TheaEnvironmentCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "EnvScrollLayout" if self.rendererTabUiDict.has_key('environment'): self.rendererTabUiDict.pop('environment') uiDict = {} self.rendererTabUiDict['environment'] = uiDict cb = self.TheaEnvironmentUpdateTab with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="Environment Lighting", collapsable=False): with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName = 'illumination', uiType = 'enum', displayName = 'Illumination', default='0', data='NoIllumination:DomeIllumination:IBLIllumination:PhysicalSkyIllumination', uiDict=uiDict, callback=cb) self.addRenderGlobalsUIElement(attName='backgroundColor', uiType='color', displayName='Background Color', default='0.4:0.4:1.0', uiDict=uiDict) with pm.frameLayout(label="Physical Sky", collapsable=False) as uiDict['physSkyFrame']: with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName = 'turbidity', uiType = 'float', displayName = 'Turbidity', default='2.5', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'ozone', uiType = 'float', displayName = 'Ozone', default='0.35', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'waterVapor', uiType = 'float', displayName = 'Water Vapour', default='2.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'turbidityCoefficient', uiType = 'float', displayName = 'Turbidity Coeff', default='0.046', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'wavelengthExponent', uiType = 'float', displayName = 'Wavelength Exponent', default='1.3', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'albedo', uiType = 'float', displayName = 'Albedo', default='0.5', uiDict=uiDict) with pm.frameLayout(label="Physical Sun", collapsable=False) as uiDict['physSunFrame']: with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName = 'sunPolarAngle', uiType = 'float', displayName = 'Sun Polar Angle', default='-1.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'sunAzimuth', uiType = 'float', displayName = 'Sun Azimuth', default='-1.0', uiDict=uiDict) #self.addRenderGlobalsUIElement(attName = 'sunDirection', uiType = 'vector', displayName = 'Sun Direction', default='0:0:0', uiDict=uiDict) with pm.frameLayout(label="Time Zone", collapsable=False) as uiDict['timeZoneFrame']: with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName = 'latitude', uiType = 'float', displayName = 'Latitude', default='0.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'longitude', uiType = 'float', displayName = 'Longitude', default='0.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'timezone', uiType = 'int', displayName = 'Timezone', default='0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'date', uiType = 'string', displayName = 'Date', default='"1/6/2014"', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'localtime', uiType = 'string', displayName = 'Localtime', default='"12:00:00"', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'ior', uiType = 'float', displayName = 'IOR', default='1.0', uiDict=uiDict) with pm.frameLayout(label="IBL", collapsable=False) as uiDict['iblFrame']: with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName = 'illuminationMap', uiType = 'color', displayName = 'Illumination Map', default='0:0:0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'backgroundMap', uiType = 'color', displayName = 'Background Map', default='0:0:0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'reflectionMap', uiType = 'color', displayName = 'Reflection Map', default='0:0:0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'RefractionMap', uiType = 'color', displayName = 'Refraction Map', default='0:0:0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'medium', uiType = 'message', displayName = 'Medium', default='', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName='useSunLightConnection', uiType='bool', displayName='Use Sun', uiDict=uiDict) # buttonLabel = "Create Sun" # suns = pm.ls("CoronaSun") # if len(suns) > 0: # buttonLabel = "Delete Sun" # uiDict['sunButton'] = pm.button(label=buttonLabel, command=self.editSun) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ]) self.TheaEnvironmentUpdateTab()
def createWindow(): """ try to get data from shotgun project fields need to get context's project context's shotgun instance """ app = self.parent project = app.context.project sg = app.context.tank.shotgun # set filters and search fields for entity type "Project" filters=[["id", "is", project['id']],] fields=["sg_width", "sg_height"] result=sg.find_one("Project", filters, fields) # with result, set parameters accordingly or use default otherwise if result: videoWidth = result.get("sg_width", DEFAULT_WIDTH) videoHeight = result.get("sg_height", DEFAULT_HEIGHT) # Find first camera matching pattern and set as active camera # if not use default current active camera camera_name_pattern = app.get_setting( "camera_name_pattern", "persp" ) cameraList = [c.name() for c in pm.ls(type="camera", r=True) if re.search( camera_name_pattern, c.name() )] if not "cam" in MODEL_EDITOR_PARAMS.keys() and cameraList: MODEL_EDITOR_PARAMS["cam"] = cameraList[0] # Give Viewport 2.0 renderer only for Maya 2015++ # mayaVersionString = cmds.about(version=True) # mayaVersion = int(mayaVersionString[:4]) if len(mayaVersionString) >= 4 else 0 # if mayaVersion >= 2015: # params[ "rendererName" ] = "vp2Renderer" # Create window if pm.windowPref( PLAYBLAST_WINDOW, exists=True ): pm.windowPref( PLAYBLAST_WINDOW, remove=True ) window = pm.window( PLAYBLAST_WINDOW, titleBar=True, iconify=True, leftEdge = 100, topEdge = 100, width = videoWidth, height = videoHeight, sizeable = False) # Create editor area layout = pm.formLayout() editor = pm.modelEditor( **MODEL_EDITOR_PARAMS ) pm.setFocus( editor ) pm.formLayout( layout, edit=True, attachForm = ( ( editor, "left", 0 ), ( editor, "top", 0 ), ( editor, "right", 0 ), ( editor, "bottom", 0 ) ) ) # Show window pm.setFocus( editor ) pm.showWindow( window ) pm.refresh() try: yield True except: traceback.print_exc() finally: pm.deleteUI(window)
def MakeFormLayout(title=None): """ Creates & returns a new PyMel form layout. :param title: string, title of the layout, or None. """ if(title is not None): return pm.formLayout(title) else: return pm.formLayout()
def AppleseedEnvironmentCreateTab(self): self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "AOScrollLayout" envDict = {} self.rendererTabUiDict['environment'] = envDict uiDict = envDict with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="Environment Lighting", collapsable=False): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): attr = pm.Attribute(self.renderGlobalsNodeName + ".environmentType") envDict['environmentType'] = pm.attrEnumOptionMenuGrp(label="Environment Type", at=self.renderGlobalsNodeName + ".environmentType", ei=self.getEnumList(attr)) with pm.frameLayout(label="Environment Colors", collapsable=False) as envDict['commonEnvFrame']: with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): ui = pm.floatFieldGrp(label="Environment Intensity:", value1=1.0, numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".environmentIntensity", index=2) envDict['environmentColor'] = pm.attrColorSliderGrp(label="Environment Color:", at=self.renderGlobalsNodeName + ".environmentColor") envDict['gradientHorizon'] = pm.attrColorSliderGrp(label="Gradient Horizon Color:", at=self.renderGlobalsNodeName + ".gradientHorizon") envDict['gradientZenit'] = pm.attrColorSliderGrp(label="Gradient Zenith Color:", at=self.renderGlobalsNodeName + ".gradientZenit") envDict['environmentMap'] = pm.attrColorSliderGrp(label="Environment Map:", at=self.renderGlobalsNodeName + ".environmentMap") self.addRenderGlobalsUIElement(attName='latlongHoShift', uiType='float', displayName='Lat-Long Horizontal Shift:', uiDict=uiDict) self.addRenderGlobalsUIElement(attName='latlongVeShift', uiType='float', displayName='Lat-Long Vertical Shift:', uiDict=uiDict) with pm.frameLayout(label="Physical Sky", collapsable=False) as envDict['pysSkyFrame']: with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): attr = pm.Attribute(self.renderGlobalsNodeName + ".skyModel") envDict['pskModel'] = pm.attrEnumOptionMenuGrp(label="Sky Model:", at=self.renderGlobalsNodeName + ".skyModel", ei=self.getEnumList(attr)) uiDict['sunLightOptionMenu'] = pm.optionMenuGrp(label="Sun Light:", changeCommand=self.updateSunLightOptionMenu) envDict['pskGrAlbedo'] = pm.floatFieldGrp(label="Ground Albedo:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskGrAlbedo'], self.renderGlobalsNodeName + ".ground_albedo", index=2) envDict['pskGrHShit'] = pm.floatFieldGrp(label="Horizon Shift:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskGrHShit'], self.renderGlobalsNodeName + ".horizon_shift", index=2) envDict['pskLumMulti'] = pm.floatFieldGrp(label="Luminance Multiplier:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskLumMulti'], self.renderGlobalsNodeName + ".luminance_multiplier", index=2) envDict['pskSatMulti'] = pm.floatFieldGrp(label="Saturation Multiplier:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskSatMulti'], self.renderGlobalsNodeName + ".saturation_multiplier", index=2) envDict['pskTurb'] = pm.floatFieldGrp(label="Turbidity:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskTurb'], self.renderGlobalsNodeName + ".turbidity", index=2) envDict['pskTurbMin'] = pm.floatFieldGrp(label="Turbidity Min:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskTurbMin'], self.renderGlobalsNodeName + ".turbidity_min", index=2) envDict['pskTurbMax'] = pm.floatFieldGrp(label="Turbidity Max:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskTurbMax'], self.renderGlobalsNodeName + ".turbidity_max", index=2) with pm.frameLayout(label="OSL", collapsable=False) as envDict['oslFrame']: with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): envDict['environmentOSL'] = pm.attrColorSliderGrp(label="OSL Background", at=self.renderGlobalsNodeName + ".environmentOSL") pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ]) pm.scriptJob(attributeChange=[self.renderGlobalsNode.environmentType, pm.Callback(self.uiCallback, tab="environment")]) pm.scriptJob(attributeChange=[self.renderGlobalsNode.skyModel, pm.Callback(self.uiCallback, tab="environment")]) self.updateEnvironment()
def FujiRendererCreateTab(self): log.debug("FujiRendererCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query = True) pm.setUITemplate("attributeEditorTemplate", pushTemplate = True) scLo = self.rendererName + "ScrollLayout" if self.rendererTabUiDict.has_key('common'): self.rendererTabUiDict.pop('common') parentForm = pm.setParent(query = True) uiDict = {} self.rendererTabUiDict['common'] = uiDict with pm.scrollLayout(scLo, horizontalScrollBarThickness = 0): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn = True, width = 400): with pm.frameLayout(label="Sampling", collapsable = True, collapse=False): self.addRenderGlobalsUIElement(attName = 'sampleJitter', uiType = 'float', displayName = 'SampleJitter', default='1.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'sample_time_range_min', uiType = 'float', displayName = 'Sample Time Range Min', default='0.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'sample_time_range_max', uiType = 'float', displayName = 'Sample Time Range Max', default='1.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'samplesX', uiType = 'int', displayName = 'Pixel Samples x', default=3, uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'samplesY', uiType = 'int', displayName = 'Pixel Samples y', default=3, uiDict=uiDict) pm.separator() self.addRenderGlobalsUIElement(attName = 'cast_shadow', uiType = 'bool', displayName = 'Cast Shadows', default='true', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'max_reflect_depth', uiType = 'int', displayName = 'Max Reflection Depth', default='3', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'max_refract_depth', uiType = 'int', displayName = 'Max Refraction Depth', default='3', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'raymarch_step', uiType = 'float', displayName = 'Raymarching Stepsize', default='0.05', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'raymarch_shadow_step', uiType = 'float', displayName = 'Raymarching Shadow Stepsize', default='0.1', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'raymarch_reflect_ste', uiType = 'float', displayName = 'Raymarching Reflection Stepsize', default='0.1', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'raymarch_refract_ste', uiType = 'float', displayName = 'Raymarching Refraction Stepsize', default='0.1', uiDict=uiDict) pm.separator() self.addRenderGlobalsUIElement(attName = 'doMotionBlur', uiType = 'bool', displayName = 'Motionblur:', default=False, uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'doDof', uiType = 'bool', displayName = 'Depth of Field:', default=False, uiDict=uiDict) with pm.frameLayout(label="Output", collapsable = True, collapse=False): attr = pm.Attribute(self.renderGlobalsNodeName + ".imageFormat") ui = pm.attrEnumOptionMenuGrp(label = "Image Format", at=self.renderGlobalsNodeName + ".imageFormat", ei = self.getEnumList(attr)) with pm.frameLayout(label="Filtering", collapsable = True, collapse=False): attr = pm.Attribute(self.renderGlobalsNodeName + ".filtertype") ui = pm.attrEnumOptionMenuGrp(label = "Filter Type", at=self.renderGlobalsNodeName + ".filtertype", ei = self.getEnumList(attr)) ui = pm.intFieldGrp(label="Filter Size:", numberOfFields = 1) pm.connectControl(ui, self.renderGlobalsNodeName + ".filtersize", index = 2 ) with pm.frameLayout(label="Renderer", collapsable = True, collapse=False): self.addRenderGlobalsUIElement(attName = 'use_max_thread', uiType = 'bool', displayName = 'Use Max Threads', default='true', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'threads', uiType = 'int', displayName = 'Threads', default=8, uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'tilesize', uiType = 'int', displayName = 'Tile Size', default=64, uiDict=uiDict) ui = pm.intFieldGrp(label="Verbosity:", numberOfFields = 1) pm.connectControl(ui, self.renderGlobalsNodeName + ".rendererVerbosity", index = 2 ) pm.setUITemplate("attributeEditorTemplate", popTemplate = True) pm.formLayout(parentForm, edit = True, attachForm = [ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ]) self.FujiRendererUpdateTab()
def create(self, stationary_count, offset_count): ''' Create the fgshooter window. ''' if pm.window(self.window_name, exists=True): pm.deleteUI(self.window_name) pm.window(self.window_name, title=self.window_title) main_form = pm.formLayout(numberOfDivisions=2) self.column = pm.columnLayout(adjustableColumn=True) # Render Camera self.render_camera_field = pm.checkBoxGrp(label="Include Render Camera", value1=self.render_camera, changeCommand=self.updateRenderCamera) # Stationary Cameras pm.separator(height=20, style="in") pm.rowLayout(numberOfColumns=3, columnWidth3=(140, 80, 80), columnAlign=(1, 'right'), columnAttach3=("right", "both", "both")) pm.text("Stationary Cameras") self.stationary_field = pm.intField(value=stationary_count) pm.button(label="Update", height=22, command=self.update) pm.setParent('..') self.stationary = [] i = 0 while i < stationary_count: self.stationary.append(pm.floatFieldGrp(value1=self.stationary_frames[i], label="frame")) i += 1 # Offset Cameras pm.separator(height=20, style="in") pm.rowLayout(numberOfColumns=3, columnWidth3=(140, 80, 80), columnAlign=(1, 'right'), columnAttach3=("right", "both", "both")) pm.text("Offset Cameras") self.offset_field = pm.intField(value=offset_count) pm.button(label="Update", height=22, command=self.update) pm.setParent('..') self.offset = [] i = 0 while i < offset_count: self.offset.append(pm.intFieldGrp(value1=self.offset_frames[i], label="frame offset")) i += 1 pm.setParent('..') # remove/apply buttons self.remove_button = pm.button(label="Remove All", height=30, command=self.remove) self.apply_button = pm.button(label="Apply / Refresh", height=30, command=self.apply) pm.formLayout(main_form, edit=True, attachForm=[(self.column, "top", 2),(self.column, "left", 2),(self.column, "right", 2), (self.remove_button, "bottom", 2), (self.remove_button, "left", 2), (self.apply_button, "bottom", 2), (self.apply_button, "right", 2)], attachControl=(self.remove_button, "right", 1, self.apply_button), attachPosition=[ (self.remove_button, "right", 0, 1), (self.apply_button, "left", 1, 1)] ) pm.setParent('..') pm.showWindow()
def MantraTranslatorCreateTab(self): log.debug("MantraTranslatorCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "TrScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "TrColumnLayout", adjustableColumn=True): mantraAttributes.mantraTranslatorATList.createUi(self.renderGlobalsNodeName) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
def gui(): 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='Testing' , sizeable = True, mnb = True, width = 480, height = 900, backgroundColor = [.5, .5, .5]) pm.scrollLayout() main01 = pm.columnLayout( adjustableColumn=True ) main02 = pm.columnLayout( adjustableColumn=True ) pm.setParent(main02) # file info section pm.frameLayout(label = 'File Info', cll = True, cl = False, borderStyle = 'etchedIn', w = 480) global fileInfo fileInfo = sal.Images() pm.setParent(main02) # grade total section infoFrame = pm.frameLayout( label = 'Grades Total', cll = True, cl = True , borderStyle = 'etchedIn', w = 480 ) infoLayout = pm.formLayout() # isntancing the total grade section global totalGrades totalGrades = sal.UpperSection() totalGrades.create() pm.setParent(infoFrame) pm.button( label = 'Output Grade and Comment' , command = checkWeighting) pm.setParent(main02) pm.frameLayout( label = 'Grade', cll = True, cl = True , borderStyle = 'etchedIn', w = 480 ) mainLayout = pm.formLayout() # grading / commenting section # first intance of Section for antiAliasing / Noise Quality global antiAlising, compFocalLenght, prof antiAlising = sal.Section( name = 'Anitalias/Noise Qual', layout = mainLayout , updateCommand = totalGrades, fileRead = "/Users/Fearman/Library/Preferences/Autodesk/maya/2011-x64/scripts/proj01_antiAlisaing.txt",updateField= totalGrades.queryAnti()) section01 = antiAlising.create() # second intance of Section for Composition / Focal Lenght compFocalLenght = sal.Section( name = 'Comp/Focal Length', layout = mainLayout , updateCommand = totalGrades, fileRead = "/Users/Fearman/Library/Preferences/Autodesk/maya/2011-x64/scripts/proj01_compFocal.txt", updateField = totalGrades.queryComp(), control=section01) section02 = compFocalLenght.create() # first intance of Section for proffesionalism prof = sal.Section( name = 'Professionalism', layout = mainLayout , updateCommand = totalGrades, fileRead = "/Users/Fearman/Library/Preferences/Autodesk/maya/2011-x64/scripts/proj01_prof.txt", updateField = totalGrades.queryPro(), control=section02) section03 = prof.create() myWin.show()
def KrayFinalGatheringCreateTab(self): log.debug("KrayFinalGatheringCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "PhotonsScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="Photons frame", collapsable=True, collapse=False): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): ui = pm.floatFieldGrp(label="Threshold:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgThreshold", index=2) pm.separator() ui = pm.intFieldGrp(label="Min Rays:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgMinRays", index=2) ui = pm.intFieldGrp(label="Max Rays:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgMaxRays", index=2) ui = pm.floatFieldGrp(label="Prerender:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgPrerender", index=2) ui = pm.intFieldGrp(label="Passes:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgPasses", index=2) pm.separator() ui = pm.floatFieldGrp(label="Sploth Detect:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgSplotchDetect", index=2) ui = pm.floatFieldGrp(label="Sensitivity:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgSensitivity", index=2) pm.separator() ui = pm.checkBoxGrp(label="FG Reflections:", value1=False) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgReflections", index=2) ui = pm.checkBoxGrp(label="FG Refractions:", value1=False) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgRefractions", index=2) pm.separator() ui = pm.floatFieldGrp(label="Spatial Tolerance:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgSpatialTolerance", index=2) ui = pm.floatFieldGrp(label="Angular Tolerance:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgAngularTolerance", index=2) ui = pm.floatFieldGrp(label="FG Min Dist:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgDistMin", index=2) ui = pm.floatFieldGrp(label="FG Dist Max:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgDistMax", index=2) ui = pm.floatFieldGrp(label="Density/Brightness:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgBrightness", index=2) pm.separator() ui = pm.intFieldGrp(label="Path Passes:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgPathPasses", index=2) ui = pm.floatFieldGrp(label="Corner Dist:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgCornerDist", index=2) ui = pm.checkBoxGrp(label="Show Samples:", value1=False) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgShowSamples", index=2) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
def _createLayout(self): self.fl_main = pm.formLayout('main_formLayout',nd=100)#,bgc=[.025,.045,.07]) self.introText = pm.text(al='center', l=('\n\n'+self.title+'\n\n'),fn='boldLabelFont',bgc=self.title_blue_cl,w=self.wh[0]) self.frl_main = pm.frameLayout('main_frameLayout', l=self.descr, bgc=self.title_blue_cl, la='center') self._createTabs() self.close_btn = pm.button('close_btn', label='Exit', w=100, h=40,p=self.fl_main, bgc=self.close_red_cl, command=self.closeUI) self.dock_btn = pm.button('dock_btn', label='Dock', w=100, h=40,p=self.fl_main, bgc=self.go_green_cl, command=self.dock) pm.formLayout (self.fl_main, edit=True, attachForm=( [(self.close_btn,'bottom',5), (self.close_btn,'right', 5), (self.dock_btn, 'bottom',5)])) pm.formLayout (self.fl_main, edit=True, attachControl=([(self.frl_main, 'top', 5, self.introText), (self.frl_main, 'bottom', 20, self.close_btn), (self.dock_btn, 'right',20,self.close_btn)] ))
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 showUI(self): if pc.window(self._UI_WINDOW_NAME, q=True, exists=True): pc.deleteUI(self._UI_WINDOW_NAME, wnd=True) win = pc.window(self._UI_WINDOW_NAME, title='Cam noise tool', w=150, h=100, s=False) form = pc.formLayout() # Create UI buttons depending on current camera noise status status = self.getCameraNoiseStatus() if status == 0: b = pc.button(l='Add noise', w=140, h=40, c=partial(self.addNoise)) elif status == 1: b = pc.button(l='Remove noise', w=140, h=40, c=partial(self.disconnectNoise)) else: b = pc.button(l='Reapply noise', w=140, h=40, c=partial(self.reapplyNoise)) pc.formLayout(form, e=True, attachForm=[(b, 'top', 10), (b, 'left', 10), (b, 'right', 10), (b, 'bottom', 10)]) pc.showWindow(win)
def insert_script_editor_ui(self, *args): if pmc.window(self.script_panel + "Window", exists=True): pmc.deleteUI(self.script_panel + "Window", window=True) pmc.scriptedPanel(self.script_panel, e=True, unParent=True) pmc.scriptedPanel(self.script_panel, e=True, parent=self.form_scriptEditor) marge = 1 pmc.formLayout(self.form_scriptEditor, edit=True, attachForm=[ (self.script_panel, "top", marge), (self.script_panel, "left", marge), (self.script_panel, "right", marge), (self.script_panel, "bottom", marge), ], )
def UI(): """The UI """ if pm.window("selectionManagerWindow", ex=True): pm.deleteUI("selectionManagerWindow", wnd=True) selection_manager_window = pm.window( 'selectionManagerWindow', wh=(300, 200), title=("Selection Manager %s" % __version__) ) form_layout1 = pm.formLayout("selectionManager_formLayout1", nd=100) with form_layout1: button1 = pm.button(l="Add selection to List") scroll_layout1 = pm.scrollLayout("selectionManager_scrollLayout1", cr=True) with scroll_layout1: pm.gridLayout( "selectionManager_gridLayout1", nc=1, cwh=(((17 * 4) + 204), 22), aec=False, cr=False ) pm.formLayout( form_layout1, edit=True, attachForm=[ (button1, "left", 0), (button1, "right", 0), (button1, "top", 0), (scroll_layout1, "left", 0), (scroll_layout1, "right", 0), (scroll_layout1, "bottom", 0) ], attachControl=[(scroll_layout1, "top", 0, button1)], attachNone=[(button1, "bottom")]) def create_row(parent): row = SelectionRowFactory.create_row(parent) row._draw() button1.setCommand(pm.Callback(create_row, scroll_layout1)) # restore rows from Maya scene for row in SelectionRowFactory.restore_rows(scroll_layout1): row._draw() pm.showWindow(selection_manager_window)
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 test_rowGroupLayout(self): self.assertEqual(pm.currentParent(), self.win) self.assertEqual(pm.currentMenuParent(), None) with pm.textFieldButtonGrp( label='Label', text='Text', buttonLabel='Button' ) as tfbg: self.assertEqual(pm.currentParent(), tfbg) self.assertEqual(pm.currentMenuParent(), None) cmds.button() with pm.popupMenu() as m: self.assertEqual(pm.currentParent(), tfbg) self.assertEqual(pm.currentMenuParent(), m) with pm.menuItem(subMenu=1) as sm: self.assertEqual(pm.currentParent(), tfbg) self.assertEqual(pm.currentMenuParent(), sm) self.assertEqual(pm.currentParent(), tfbg) self.assertEqual(pm.currentMenuParent(), m) self.assertEqual(pm.currentParent(), tfbg) self.assertEqual(pm.currentParent(), self.win) fl = pm.formLayout() tfbg2 = pm.textFieldButtonGrp( label='Label', text='Text', buttonLabel='Button' ) self.assertEqual(pm.currentParent(), fl) with pm.columnLayout() as cl: cmds.button() with pm.popupMenu() as m: self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentMenuParent(), m) with pm.menuItem(subMenu=1) as sm: self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentMenuParent(), sm) self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentMenuParent(), m) self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentParent(), fl)
def test_selectItemEmptyList(self): with ui.Window(self.win): with pm.formLayout(): tsl = pm.textScrollList() tsl.extend(['a','b','c']) # Make sure this is NOT None self.assertEqual(tsl.getSelectItem(), [])
def CoronaEnvironmentCreateTab(self): log.debug("CoronaEnvironmentCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "EnvScrollLayout" if self.rendererTabUiDict.has_key('environment'): self.rendererTabUiDict.pop('environment') uiDict = {} self.rendererTabUiDict['environment'] = uiDict with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName = 'bgType', uiType = 'enum', displayName = 'Background', default='0', data='Color/Image:PhysicalSky', uiDict=uiDict, callback=self.CoronaEnvironmentUpdateTab) envLightingFrame = None physSkyFrame = None physSkyPreetham = None physSkyRawafake = None self.addRenderGlobalsUIElement(attName='useSunLightConnection', uiType='bool', displayName='Use Sun', uiDict=uiDict, callback=self.editSun) self.addRenderGlobalsUIElement(attName = 'sunSizeMulti', uiType = 'float', displayName = 'Sun Size Multiplier', default='1.0', uiDict=uiDict) with pm.frameLayout(label="Color/Image", collapsable=False) as envLightingFrame: with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName='bgColor', uiType='color', displayName='Background Color', default='0.4:0.4:1.0', uiDict=uiDict) with pm.frameLayout(label="Physical Sky", collapsable=True, collapse=False) as physSkyFrame: with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName = 'pSkyModel', uiType = 'enum', displayName = 'Sky Model', default='0', data='Preetham:Rawafake:Hosek', uiDict=uiDict, callback=self.CoronaEnvironmentUpdateTab) self.addRenderGlobalsUIElement(attName = 'pSkyMultiplier', uiType = 'float', displayName = 'Sky Multiplier', default='1.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'pSkyHorizBlur', uiType = 'float', displayName = 'Sky Horizon Blur', default='0.1', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'pSkyGroundColor', uiType = 'color', displayName = 'Ground Color', default='0.25:0.25:0.25', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'pSkyAffectGround', uiType = 'bool', displayName = 'Sky Affect Ground', default='true', uiDict=uiDict) with pm.columnLayout(self.rendererName + 'ColumnLayoutphysSkyPreetham', adjustableColumn=True, width=400) as physSkyPreetham: self.addRenderGlobalsUIElement(attName = 'pSkyPreethamTurb', uiType = 'float', displayName = 'Turbidity', default='2.5', uiDict=uiDict) with pm.columnLayout(self.rendererName + 'ColumnLayoutphysSkyRawafake', adjustableColumn=True, width=400) as physSkyRawafake: self.addRenderGlobalsUIElement(attName = 'pSkySunFalloff', uiType = 'float', displayName = 'Sun Falloff', default='3.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'pSkyZenith', uiType = 'color', displayName = 'Zenith Color', default='0.1:0.1:0.5', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'pSkyHorizon', uiType = 'color', displayName = 'Horizon Color', default='0.25:0.5:0.5', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'pSkySunGlow', uiType = 'float', displayName = 'Sun Glow', default='1.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'pSkySunSideGlow', uiType = 'float', displayName = 'Sun Side Glow', default='0.2', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'pSkySunBleed', uiType = 'float', displayName = 'Sun Bleed', default='1.0', uiDict=uiDict) uiDict['envLightingFrame'] = envLightingFrame uiDict['physSkyFrame'] = physSkyFrame uiDict['physSkyPreetham'] = physSkyPreetham uiDict['physSkyRawafake'] = physSkyRawafake pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ]) self.CoronaEnvironmentUpdateTab()
def uiCreate(self): self.uiClose() self.window = pm.window( WIN_NAME, title=SCRIPT_NAME, maximizeButton=False ) with self.window: with pm.formLayout() as ui_LAY_mainForm: with pm.scrollLayout(childResizable=True) as ui_LAY_mainScroll: with pm.frameLayout( label='Parameters', collapsable=True, marginHeight=3, borderStyle='etchedIn', borderVisible=True, collapse=False ): 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) pm.separator(style='none', height=5) 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 ) ui_LAY_mainForm.attachForm(ui_LAY_mainScroll, 'top', 2) ui_LAY_mainForm.attachForm(ui_LAY_mainScroll, 'left', 2) ui_LAY_mainForm.attachForm(ui_LAY_mainScroll, 'right', 2) ui_LAY_mainForm.attachControl(ui_LAY_mainScroll, 'bottom', 2, self.ui_BTN_create) ui_LAY_mainForm.attachNone(self.ui_BTN_create, 'top') ui_LAY_mainForm.attachForm(self.ui_BTN_create, 'left', 2) ui_LAY_mainForm.attachPosition(self.ui_BTN_create, 'right', 2, 50) ui_LAY_mainForm.attachForm(self.ui_BTN_create, 'bottom', 2) ui_LAY_mainForm.attachNone(self.ui_BTN_close, 'top') ui_LAY_mainForm.attachPosition(self.ui_BTN_close, 'left', 2, 50) ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'right', 2) ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'bottom', 2) self.setupInitialValues()
def __init__(self, template, mode='add'): self.template = template self.win = "arnold_attribute_win" if pm.window(self.win, exists=True): pm.deleteUI(self.win) modeLabel = mode.capitalize() wintitle = "%s Override Attribute" % modeLabel pm.window(self.win, title=wintitle, sizeable=True, resizeToFitChildren=False) #pm.windowPref(removeAll=True) form = pm.formLayout('form') filterText = pm.textField('alf_filter_text', height=20) self.filterText = filterText pm.textField(self.filterText, edit=True, changeCommand=Callback(self.filterAttributes)) txList = pm.textScrollList('alf_attribute_list', ams=True) self.scrollList = txList if mode == 'add': cmd = self.addAttrAndHide else: cmd = self.removeAttrAndHide pm.textScrollList(self.scrollList, edit=True, doubleClickCommand=Callback(cmd)) self.handleAttributes(mode) if self._attributes : labels = self._attributes.keys() labels.sort() for attr in labels: pm.textScrollList(self.scrollList, edit=True, append=attr) row = pm.rowLayout(numberOfColumns=2, columnAlign2=("center", "center")) # pm.button(width=100, label=modeLabel, c=lambda *args: self.addAttrAndHide()) pm.button(width=100, label=modeLabel, command=Callback(cmd)) pm.button(width=100, label="Cancel", c=lambda *args: pm.deleteUI(self.win, window=True)) pm.setParent('..') pm.setParent('..') pm.formLayout(form, edit=True, attachForm=[(filterText, 'top', 5), (filterText, 'left', 5), (filterText, 'right', 5), (txList, 'left', 5), (txList, 'right', 5), (row, 'bottom', 5), (row, 'left', 5), (row, 'right', 5)], attachControl=[(txList, 'bottom', 5, row), (txList, 'top', 5, filterText)]) pm.showWindow(self.win)
def KrayQualityCreateTab(self): log.debug("KrayFinalGatheringCreateTab()") self.createGlobalsNode() qDict = {} self.rendererTabUiDict['quality'] = qDict parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "PhotonsScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="Quality", collapsable=True, collapse=False): with pm.columnLayout(self.rendererName + "ColumnLayoutA", adjustableColumn=True, width=400): attr = pm.Attribute(self.renderGlobalsNodeName + ".qLuminosityModel") ui = pm.attrEnumOptionMenuGrp(label="Luminosity Model", at=self.renderGlobalsNodeName + ".qLuminosityModel", ei=self.getEnumList(attr)) attr = pm.Attribute(self.renderGlobalsNodeName + ".qAreaLights") ui = pm.attrEnumOptionMenuGrp(label="Area Lights Computation", at=self.renderGlobalsNodeName + ".qAreaLights", ei=self.getEnumList(attr)) attr = pm.Attribute(self.renderGlobalsNodeName + ".qAreaLightVisibility") ui = pm.attrEnumOptionMenuGrp(label="Area Light Visibility", at=self.renderGlobalsNodeName + ".qAreaLightVisibility", ei=self.getEnumList(attr)) pm.separator() attr = pm.Attribute(self.renderGlobalsNodeName + ".qOctreeDetail") ui = pm.attrEnumOptionMenuGrp(label="Octree Detail", at=self.renderGlobalsNodeName + ".qOctreeDetail", ei=self.getEnumList(attr)) # float qLevel; // float # bool qDoubleSided; // bool # bool qSpotlightsToArea; // bool # float qAreaLightsThreshold; // float # int qAMinRecursion; // int # int qAMaxRecursion; // int # float qLinearLightsThreshold; // float # int qLMinRecursion; // int # int qLMaxRecursion; // int # float qLuminosityThreshold; // float # int qLumMinRays; // int # int qLumMaxRays; // int # float qBlurringThreshold; // float # int qBLumMinRays; // int # int qBLumMaxRays; // int # float qBAccuracyLimit; // float # bool qTraceDirectLightReflections; // bool # pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
def AppleseedTranslatorCreateTab(self): log.debug("AppleseedTranslatorCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "TrScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "TrColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="Translator", collapsable=True, collapse=False): attr = pm.Attribute(self.renderGlobalsNodeName + ".translatorVerbosity") ui = pm.attrEnumOptionMenuGrp(label="Translator Verbosity", at=self.renderGlobalsNodeName + ".translatorVerbosity", ei=self.getEnumList(attr)) with pm.frameLayout(label="{0} export".format(self.rendererName), collapsable=True, collapse=False): ui = pm.checkBoxGrp(label="Export {0} Scene file:".format(self.rendererName), value1=False) pm.connectControl(ui, self.renderGlobalsNodeName + ".exportSceneFile", index=2) # xmlDict = {} # self.rendererTabUiDict['xml'] = xmlDict # defaultXMLPath = pm.workspace.path + "/" + pm.sceneName().basename().split(".")[0] + ".appleseed" # if not defaultXMLPath.dirname().exists(): # defaultXMLPath.dirname().makedirs() # with pm.rowLayout(nc=3): # xmlDict['xmlFileText'] = pm.text(label="Export to") # xmlDict['xmlFile'] = pm.textField(text=defaultXMLPath) # pm.symbolButton(image="navButtonBrowse.png", c=self.xmlFileBrowse) # pm.connectControl(xmlDict['xmlFile'], self.renderGlobalsNodeName + ".exportSceneFileName", index=2) with pm.frameLayout(label="Optimize Textures", collapsable=True, collapse=False): optiDict = {} ui = pm.checkBoxGrp(label="Use Optimized Textures:", value1=False) pm.connectControl(ui, self.renderGlobalsNodeName + ".useOptimizedTextures", index=2) with pm.rowLayout(nc=3): self.rendererTabUiDict['opti'] = optiDict pm.text(label="OptimizedTex Dir:") optiDict['optiField'] = pm.textField(text=self.renderGlobalsNode.optimizedTexturePath.get()) pm.symbolButton(image="navButtonBrowse.png", c=self.dirBrowse) pm.connectControl(optiDict['optiField'], self.renderGlobalsNodeName + ".optimizedTexturePath", index=2) with pm.frameLayout(label="Additional Settings", collapsable=True, collapse=False): ui = pm.floatFieldGrp(label="Scene scale:", value1=1.0, numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".sceneScale", index=2) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
def _draw(self): # create buttons under parent and save them in local variables grid_layout_width = pm.gridLayout("selectionManager_gridLayout1", q=True, w=True) form_layout = pm.formLayout(p="selectionManager_gridLayout1", w=grid_layout_width, nd=100) with form_layout: self.replaceButton = pm.button(ann="Replace", l="R", w=17) self.addButton = pm.button(ann="Add", l="+", w=17) self.subtractButton = pm.button(ann="Subtract", l="-", w=17) self.saveButton = pm.button( ann="Save as quick selection set with the description as the " "name of the set", l="S", w=17) self.updateButton = pm.button( ann="Updates the list with the current selection", l="U", w=17) self.deleteButton = pm.button(ann="Deletes this button set", l="D", w=17) self.descriptionField = pm.textField(text=self.description, w=204) self.description = self.description self.layout = pm.formLayout( form_layout, edit=True, attachForm=[(self.replaceButton, "left", 0), (self.replaceButton, "top", 0), (self.replaceButton, "bottom", 0), (self.addButton, "top", 0), (self.addButton, "bottom", 0), (self.subtractButton, "top", 0), (self.subtractButton, "bottom", 0), (self.saveButton, "top", 0), (self.saveButton, "bottom", 0), (self.updateButton, "top", 0), (self.updateButton, "bottom", 0), (self.deleteButton, "top", 0), (self.deleteButton, "bottom", 0), (self.descriptionField, "top", 0), (self.descriptionField, "bottom", 0), (self.descriptionField, "right", 0)], attachControl=[(self.addButton, "left", 0, self.replaceButton), (self.subtractButton, "left", 0, self.addButton), (self.saveButton, "left", 0, self.subtractButton), (self.updateButton, "left", 0, self.saveButton), (self.deleteButton, "left", 0, self.updateButton), (self.descriptionField, "left", 0, self.deleteButton)], attachPosition=[(self.replaceButton, "right", 0, 5), (self.addButton, "right", 0, 10), (self.subtractButton, "right", 0, 15), (self.saveButton, "right", 0, 20), (self.updateButton, "right", 0, 25), (self.deleteButton, "right", 0, 30)]) self.replaceButton.setCommand(pm.Callback(self.selection_set.replace)) self.addButton.setCommand(pm.Callback(self.selection_set.add)) self.subtractButton.setCommand(pm.Callback( self.selection_set.subtract)) self.saveButton.setCommand(pm.Callback(self.save_button)) self.updateButton.setCommand(pm.Callback(self.selection_set.update)) self.deleteButton.setCommand(pm.Callback(self.delete_button))
def rename_character_btn_cmd(self, *args): """ Rename the selected character folder from the text scroll field by opening another window :return: None """ def rename_character_name_cmd(*args): """ Rename the selected character folder :return: None """ src = pm.textField("RenameCName", q=True, tx=True) if src is None or len(src) < 1: None else: if src == self.selectedCharacter: new_character = str(self.dirName + src) else: new_character = str(self.dirName + src + "/") if os.path.exists(self.characterList): os.rename(self.characterList, new_character) quit_character_win_cmd() self.selectedCharacter = src self.characterList = str(new_character+"/") populate_characters(self.dirName, self.selectedCharacter, self.characterList, self.selectedFile) else: pm.confirmDialog(t='Error', b=['OK'], m='This folder name exists.') return None def quit_character_win_cmd(*args): """ This command checks the side window is open or not. :return: None """ if pm.window(rename_character_win, exists=True): pm.deleteUI(rename_character_win, window=True) # side windows tag name rename_character_win = 'renameCharacterWin' # activation the delete_set_cmd to check the window quit_character_win_cmd() # size of the side window size = (250, 100) if len(self.selectedCharacter) > size[0]: size[0] = len(self.selectedCharacter)+250 # initialize the side window pm.window(rename_character_win, wh=size, s=False, t='Rename Character Name') # main form layout main_form = pm.formLayout() # controls rename_character_layout = pm.columnLayout(cat=['both', 2], cw=size[0], rs=10) pm.text(label='Rename Character Name') pm.text(label=self.selectedCharacter, w=len(self.selectedCharacter)+50) pm.setParent(main_form) rename_character_text_field = pm.textField("RenameCName", text=self.selectedCharacter, ec=rename_character_name_cmd, aie=True) rename_character_text_btn = pm.button(label='RENAME', c=rename_character_name_cmd, p=main_form, w=100, h=26) cancel_btn = pm.button(label='CANCEL', c=quit_character_win_cmd, p=main_form, w=100, h=26) # attach the controls to main form ac = [] af = [] ac.append([rename_character_text_field, 'top', 5, rename_character_layout]) ac.append([rename_character_text_field, 'bottom', 5, rename_character_text_btn]) ac.append([rename_character_text_field, 'bottom', 5, cancel_btn]) af.append([rename_character_layout, 'top', 5]) af.append([rename_character_layout, 'left', 5]) af.append([rename_character_layout, 'right', 5]) af.append([rename_character_text_field, 'left', 5]) af.append([rename_character_text_field, 'right', 5]) af.append([rename_character_text_btn, 'left', 5]) af.append([rename_character_text_btn, 'bottom', 5]) af.append([cancel_btn, 'right', 5]) af.append([cancel_btn, 'bottom', 5]) pm.formLayout(main_form, e=True, attachControl=ac, attachForm=af) # force the window size pm.window(rename_character_win, e=True, wh=size) # initialize the window pm.showWindow(rename_character_win)
def ui(self): ''' main ui creator ''' #TODO: only run once. use singleton instance if pm.window(self.name, q = True, ex = True): pm.deleteUI(self.name) #main window self.widgets['mainWindow'] = pm.window(self.name, title = self.name, widthHeight = (720, 400)) self.widgets['mainForm'] = pm.formLayout(parent = self.widgets['mainWindow']) #top left column self.widgets['topLColumn'] = pm.columnLayout(adjustableColumn = True, parent = self.widgets['mainForm'], h = 168) self.widgets['cameraText'] = pm.text(label = "Cameras", h = 20) self.widgets['cameraList'] = pm.iconTextScrollList(h = 105, allowMultiSelection = True, selectCommand = pm.Callback(self.updateLayers)) self.widgets['nameSep'] = pm.separator(horizontal = True, style = 'none', h = 13) self.widgets['sceneName'] = pm.textFieldGrp(label = 'Scene Name', text = self.scene.namebase, adjustableColumn = 2, columnWidth2 = [80, 0]) #top right column self.widgets['topRColumn'] = pm.columnLayout(parent = self.widgets['mainForm'], h = 168, adjustableColumn = True, rowSpacing = 1) self.widgets['outputDir'] = pm.textFieldButtonGrp(label = 'Output Path', tx = self.output, adjustableColumn = 2, columnWidth = [1, 80], buttonLabel = 'Browse...', bc = pm.Callback(self.changeOutputDestination)) self.widgets['project'] = pm.textFieldGrp(label = 'Project', adjustableColumn = 2, columnWidth = [1, 80], text = self.fileInfo.getProject()) self.widgets['department'] = pm.textFieldGrp(label = 'Department', adjustableColumn = 2, columnWidth = [1, 80], text = MusterSubmit.defaults['department']) self.widgets['pool'] = pm.optionMenuGrp(label = 'Pool', adjustableColumn = 2, columnWidth = [1, 80], cc = pm.Callback(self.savePoolOpt)) self.widgets['renderer'] = pm.optionMenuGrp(label = 'Renderer', adjustableColumn = 2, columnWidth = [1, 80], cc = pm.Callback(self.saveRendererOpt)) self.widgets['user'] = pm.optionMenuGrp(label = 'User', adjustableColumn = 2, columnWidth = [1, 80], cc = pm.Callback(self.saveUserOpt)) self.widgets['memPri'] = pm.rowLayout(parent = self.widgets['topRColumn'], numberOfColumns = 2, adjustableColumn2 = 1) self.widgets['memory'] = pm.intSliderGrp(parent = self.widgets['memPri'], label = 'Memory', columnWidth = [1,80], field = True, step = 512, value = 16384, maxValue = 65536, minValue = 512, w = 200) self.widgets['priority'] = pm.intFieldGrp(parent = self.widgets['memPri'], label = 'Priority', columnWidth = [1,50], value1 = self.priority) #top middle row self.widgets['topMRow'] = pm.rowLayout(parent = self.widgets['mainForm'], numberOfColumns = 6, adjustableColumn6 = 3) self.widgets['sep'] = pm.separator(style = "none", w = 15) self.widgets['allLayers'] = pm.checkBox(label = 'All Layers', w = 110, value = True, cc = pm.Callback(self.setAllRenderable)) self.widgets['postCopy'] = pm.checkBox(label = 'Post Copy', w = 100, value = True) self.widgets['byFrame'] = pm.intFieldGrp(label = 'By Frame', columnWidth = [1, 50], value1 = int(pm.SCENE.defaultRenderGlobals.byFrame.get())) self.widgets['padding'] = pm.intFieldGrp(label = 'Padding', columnWidth = [1, 50], value1 = int(pm.SCENE.defaultRenderGlobals.extensionPadding.get())) self.widgets['packet'] = pm.intFieldGrp(label = 'Packet', columnWidth = [1, 50], value1 = int(MusterSubmit.defaults['packet'])) #main layout self.widgets['scrollLayout'] = pm.scrollLayout(parent = self.widgets['mainForm'], childResizable = True) #bottom row self.widgets['bottomRow'] = pm.rowLayout(numberOfColumns = 3, parent = self.widgets['mainForm'], adjustableColumn = 1) self.widgets['progress'] = pm.progressBar(w = 300, progress = -1) self.widgets['paused'] = pm.checkBox(label = 'Paused', w = 60) self.widgets['Submit'] = pm.button(label = 'Submit', w = 150, c = pm.Callback(self.submit)) #form Layout self.widgets['mainForm'].attachForm(self.widgets['topLColumn'], 'top', 0) self.widgets['mainForm'].attachForm(self.widgets['topLColumn'], 'left', 0) self.widgets['mainForm'].attachNone(self.widgets['topLColumn'], 'bottom') self.widgets['mainForm'].attachPosition(self.widgets['topLColumn'], 'right', 0, 40) self.widgets['mainForm'].attachForm(self.widgets['topRColumn'], 'top', 0) self.widgets['mainForm'].attachControl(self.widgets['topRColumn'], 'left', 0, self.widgets['topLColumn']) self.widgets['mainForm'].attachNone(self.widgets['topRColumn'], 'bottom') self.widgets['mainForm'].attachForm(self.widgets['topRColumn'], 'right', 0) self.widgets['mainForm'].attachControl(self.widgets['topMRow'], 'top', 0, self.widgets['topRColumn']) self.widgets['mainForm'].attachForm(self.widgets['topMRow'], 'left', 0) self.widgets['mainForm'].attachNone(self.widgets['topMRow'], 'bottom') self.widgets['mainForm'].attachForm(self.widgets['topMRow'], 'right', 0) self.widgets['mainForm'].attachControl(self.widgets['scrollLayout'], 'top', 0, self.widgets['topMRow']) self.widgets['mainForm'].attachForm(self.widgets['scrollLayout'], 'left', 0) self.widgets['mainForm'].attachControl(self.widgets['scrollLayout'], 'bottom', 0, self.widgets['bottomRow']) self.widgets['mainForm'].attachForm(self.widgets['scrollLayout'], 'right', 0) self.widgets['mainForm'].attachNone(self.widgets['bottomRow'], 'top') self.widgets['mainForm'].attachForm(self.widgets['bottomRow'], 'left', 0) self.widgets['mainForm'].attachForm(self.widgets['bottomRow'], 'bottom', 0) self.widgets['mainForm'].attachForm(self.widgets['bottomRow'], 'right', 0) #end form layout self._populateUI() pm.scriptJob(uiDeleted = [self.widgets['mainWindow'].name(), pm.Callback(self.saveUI)]) #saves ui settings to optionVar pm.scriptJob(e = ['renderLayerChange', pm.Callback(self.updateLayers)], p = self.widgets['mainWindow'].name()) #reloads layers scroll when a layer is created or deleted #show created ui self.widgets['mainWindow'].show() self.getOptionVars()
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()
import pymel.core as pm from pymel.core import * if window('TheRiggersToolkitX',ex=True): deleteUI('TheRiggersToolkitX') if window('ExamplaeWindow',ex=True): deleteUI('ExamplaeWindow') if pm.windowPref('TheRiggersToolkitX', exists=True ): pm.windowPref( 'TheRiggersToolkitX', r=1 ) template = uiTemplate('TheRiggersToolkitXtemplate', force=True) template.define(formLayout) wind = pm.window( 'TheRiggersToolkitX',t = 'RigToolkitX',w=300,h=330,s=1,bgc = [(.17),(.18),(.19)]) Tab = tabLayout('Tabs',p='TheRiggersToolkitX',tc =1,stb=1,snt=1,ntc = 'NewTab()') out = pm.formLayout('Outliner',p='Tabs',w=300,h=330) outpanel = pm.outlinerPanel(p = 'Outliner') outliner = pm.outlinerPanel(outpanel, query=True,outlinerEditor=True) pm.outlinerEditor( outliner, edit=True, mainListConnection='worldList', selectionConnection='modelList', showShapes=False, showReferenceNodes=False, showReferenceMembers=False, showAttributes=False, showConnected=False, showAnimCurvesOnly=False, autoExpand=False, showDagOnly=True, ignoreDagHierarchy=False, expandConnections=False, showNamespace=True, showCompounds=True, showNumericAttrsOnly=False, highlightActive=True, autoSelectNewObjects=False, doNotSelectNewObjects=False, transmitFilters=False, showSetMembers=True, setFilter='defaultSetFilter' ) pm.formLayout('Outliner',e =1,af=[(outpanel,'top',0),(outpanel,'left',0),(outpanel,'right',0),(outpanel,'bottom',0)]) channelbox = pm.channelBox('ChannelBox',p = 'Tabs',ac = [(.8),(.9),(1)],bc = [(.3),(.3),(.3)],ekf =1,fw=150,hlc=[(.2),(.6),(.4)],hol =1,ln=1,nn=0,m=1,pre = 5,) ScriptEdt = pm.scrollLayout('MelCmd',p='Tabs') pmhll = pm.cmdShell(p='MelCmd',w=290,h=260 , bgc = [(.17),(.18),(.19)]) clearBtn = pm.symbolButton('minusBtn',p = 'MelCmd',i = 'clearAll.png',w = 285,h=43,ebg =1 , bgc = [(.1),(.11),(.11)],en = 1,command=('cmds.cmdShell(\"' + cmdShll + '\", edit=True, clear=True)' )) pm.showWindow('TheRiggersToolkitX')
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 show_panel(self, panel_id, title, bundle, widget_class, *args, **kwargs): """ Docks an app widget in a maya panel. :param panel_id: Unique identifier for the panel, as obtained by register_panel(). :param title: The title of the panel :param bundle: The app, engine or framework object that is associated with this window :param widget_class: The class of the UI to be constructed. This must derive from QWidget. Additional parameters specified will be passed through to the widget_class constructor. :returns: the created widget_class instance """ from tank.platform.qt import QtCore, QtGui tk_maya = self.import_module("tk_maya") self.log_debug("Begin showing panel %s" % panel_id) # The general approach below is as follows: # # 1. First create our qt tk app widget using QT. # parent it to the maya main window to give it # a well established parent. If the widget already # exists, don't create it again, just retrieve its # handle # # 2. Now create a native maya window and layout and # attach our QT control to this. For this, we use # the QT objectname property to do the bind. Note that # the window won't show in the UI, this is all just # setting up the hiearchy. # # 3. If a panel already exists, delete it. The panel # no longer has the tk widget inside it, since that is # parented to the window that was just created # # 4. Create a new panel using the dockControl command and # pass our maya window in as the object to dock. # # 5. Lastly, since our widgets won't get notified about # when the parent dock is closed (and sometimes when it # needs redrawing), attach some QT event watchers to it # # # Note: It is possible that the close event and some of the # refresh doesn't propagate down to the widget because # of a misaligned parenting: The tk widget exists inside # the pane layout but is still parented to the main # maya window. It's possible that by setting up the parenting # explicitly, the missing signals we have to compensate for # may start to work. I tried a bunch of stuff but couldn't get # it to work and instead resorted to the event watcher setup. # make a unique id for the app widget based off of the panel id widget_id = "wdgt_%s" % panel_id # create a maya window and layout window = pm.window() self.log_debug("Created window: %s" % window) maya_layout = pm.formLayout(parent=window) self.log_debug("Created layout %s" % maya_layout) if pm.control(widget_id, query=1, exists=1): self.log_debug("Toolkit widget already exists. Reparenting it...") # find the widget for later use for widget in QtGui.QApplication.allWidgets(): if widget.objectName() == widget_id: widget_instance = widget break else: self.log_debug("Toolkit widget does not exist - creating it...") # parent the UI to the main maya window parent = self._get_dialog_parent() widget_instance = widget_class(*args, **kwargs) widget_instance.setParent(parent) # set its name - this means that it can also be found via the maya API widget_instance.setObjectName(widget_id) self.log_debug("Created %s (Object Name '%s')" % (widget_instance, widget_id)) # apply external stylesheet self._apply_external_styleshet(bundle, widget_instance) # now reparent the widget instance to the layout # we can now refer to the QT widget via the widget name self.log_debug("Parenting widget %s to temporary window %s..." % (widget_id, maya_layout)) pm.control(widget_id, edit=True, parent=maya_layout) # now attach our widget in all four corners to the maya layout so that it fills # the entire panel space pm.formLayout(maya_layout, edit=True, attachForm=[(widget_id, 'top', 1), (widget_id, 'left', 1), (widget_id, 'bottom', 1), (widget_id, 'right', 1)] ) if pm.control(panel_id, query=1, exists=1): # exists already - delete it self.log_debug("Panel exists. Deleting it.") pm.deleteUI(panel_id) # lastly, move the maya window into a dock pm.dockControl(panel_id, area="right", content=window, label=title) self.log_debug("Created panel %s" % panel_id) # Once Maya will have completed its UI update and be idle, # raise (with "r=True") the docked panel window to the top dock tab. maya.utils.executeDeferred("cmds.dockControl('%s', edit=True, r=True)" % panel_id) # just like nuke, maya doesn't give us any hints when a panel is being closed. # QT widgets contained within this panel are just unparented and the floating # around, taking up memory. # # the visibleChangeCommand callback offered by the dockControl command # doesn't seem to work # # instead, install a QT event watcher to track when the parent # is closed and make sure that the tk widget payload is closed and # deallocated at the same time. # # Also, there are some obscure issues relating to UI refresh. These are also # resolved by looking at the stream of event and force triggering refreshes at the # right locations # tk_maya.install_callbacks(panel_id, widget_id) return widget_instance
def __init__(self, renderOptions=None, nodeTypes=None, listAOVGroups=True, showGroupsColumn=True): ''' renderOptions : an aovs.AOVInterface instance, or None to use the default nodeTypes : a list of node types to display in the available nodes column, or None to display the complete list of nodes with AOVs ''' self.allAOVs = set([]) self.renderOptions = aovs.AOVInterface( ) if renderOptions is None else renderOptions self.allNodeTypes = set(aovs.getNodeTypesWithAOVs()) if nodeTypes: self.setNodeTypes(nodeTypes) else: self.nodeTypes = sorted(self.allNodeTypes) self.doAOVGroups = listAOVGroups self.doGroups = showGroupsColumn self.form = pm.formLayout() if self.doGroups: groupsLbl = pm.text(_uiName('groupsLbl'), align='center', label='AOV Groups') availableLbl = pm.text(_uiName('availableLbl'), align='center', label='Available AOVs') activeLbl = pm.text(_uiName('activeLbl'), align='center', label='Active AOVs') if self.doGroups: self.groupLst = pm.textScrollList( _uiName('groupLst'), numberOfRows=10, allowMultiSelection=True, selectCommand=self.updateActiveAOVs) self.availableLst = pm.textScrollList(_uiName('availableLst'), numberOfRows=10, allowMultiSelection=True, doubleClickCommand=self.addAOVs) self.activeLst = pm.textScrollList(_uiName('activeLst'), numberOfRows=10, allowMultiSelection=True, doubleClickCommand=self.removeAOVs) addBtn = pm.button(_uiName('addBtn'), label='>>', command=self.addAOVs) remBtn = pm.button(_uiName('remBtn'), label='<<', command=self.removeAOVs) pm.formLayout(self.form, edit=True, attachForm=[ (groupsLbl, 'top', 1), (availableLbl, 'top', 1), (activeLbl, 'top', 1), (groupsLbl, 'left', 1), (self.groupLst, 'left', 1), (activeLbl, 'right', 1), (self.activeLst, 'right', 1), (remBtn, 'right', 1), (addBtn, 'bottom', 1), (remBtn, 'bottom', 1), ]) pm.formLayout( self.form, edit=True, attachControl=[ #(availableLbl, 'left', 1, groupsLbl), (self.groupLst, 'top', 1, groupsLbl), (self.activeLst, 'top', 1, activeLbl), (self.availableLst, 'top', 1, availableLbl), (self.groupLst, 'bottom', 1, addBtn), (self.activeLst, 'bottom', 1, addBtn), (self.availableLst, 'bottom', 1, remBtn), (addBtn, 'right', 1, remBtn), # (addBtn, 'top', 1, self.activeLst), # (remBtn, 'top', 1, self.availableLst) ]) pm.formLayout(self.form, edit=True, attachPosition=[ (groupsLbl, 'right', 1, 33), (availableLbl, 'left', 1, 33), (availableLbl, 'right', 1, 66), (activeLbl, 'left', 1, 66), (self.groupLst, 'right', 1, 33), (self.availableLst, 'left', 1, 33), (self.availableLst, 'right', 1, 66), (self.activeLst, 'left', 1, 66), (addBtn, 'left', 1, 33), (addBtn, 'right', 1, 66), (remBtn, 'left', 1, 66), ])
def UI(self): # create window if pm.window('ehm_JntToCrv_UI', exists=True): pm.deleteUI('ehm_JntToCrv_UI') pm.window('ehm_JntToCrv_UI', title='Create Curve Shape On Joints', w=270, h=100, mxb=False, mnb=False, sizeable=False) # main layout mainLayout = pm.columnLayout(w=270, h=130) formLayout = pm.formLayout(w=260, h=120) frameLayout = pm.frameLayout(borderStyle='etchedIn', labelVisible=False) pm.setParent(formLayout) # num of joints slider self.shapeType = pm.optionMenuGrp(label='shape type: ', h=30, columnAttach2=('left', 'left'), columnOffset2=(20, 0), columnWidth2=(90, 60)) pm.menuItem(label="sphere") pm.menuItem(label="cube") pm.menuItem(label="circle") # size of shapes self.sizeSlider = pm.floatSliderGrp(label='shape size: ', value=1, minValue=0.0, maxValue=20, fieldMaxValue=10000, h=30, field=True, columnAttach3=('left', 'left', 'left'), columnOffset3=(20, 0, 0), columnWidth3=(80, 50, 80)) # button button = pm.button(label='apply', w=100, h=30, c=partial(self.jntToCrv, None, 1.0, 'sphere')) # place controls pm.formLayout(formLayout, edit=True, attachForm=(frameLayout, 'left', 3)) pm.formLayout(formLayout, edit=True, attachForm=(frameLayout, 'right', 3)) pm.formLayout(formLayout, edit=True, attachForm=(frameLayout, 'top', 3)) pm.formLayout(formLayout, edit=True, attachForm=(frameLayout, 'bottom', 38)) pm.formLayout(formLayout, edit=True, attachForm=(self.shapeType, 'left', 0)) pm.formLayout(formLayout, edit=True, attachForm=(self.shapeType, 'top', 8)) pm.formLayout(formLayout, edit=True, attachForm=(self.sizeSlider, 'left', 5)) pm.formLayout(formLayout, edit=True, attachForm=(self.sizeSlider, 'top', 40)) pm.formLayout(formLayout, edit=True, attachForm=(button, 'left', 5)) pm.formLayout(formLayout, edit=True, attachForm=(button, 'right', 5)) pm.formLayout(formLayout, edit=True, attachForm=(button, 'bottom', 5)) # show window pm.showWindow('ehm_JntToCrv_UI')
def TheaEnvironmentCreateTab(self): log.debug("TheaEnvironmentCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "EnvScrollLayout" if self.rendererTabUiDict.has_key('environment'): self.rendererTabUiDict.pop('environment') uiDict = {} self.rendererTabUiDict['environment'] = uiDict cb = self.TheaEnvironmentUpdateTab with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="Environment Lighting", collapsable=False): with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement( attName='illumination', uiType='enum', displayName='Illumination', default='0', data= 'NoIllumination:DomeIllumination:IBLIllumination:PhysicalSkyIllumination', uiDict=uiDict, callback=cb) self.addRenderGlobalsUIElement( attName='backgroundColor', uiType='color', displayName='Background Color', default='0.4:0.4:1.0', uiDict=uiDict) with pm.frameLayout( label="Physical Sky", collapsable=False) as uiDict['physSkyFrame']: with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName='turbidity', uiType='float', displayName='Turbidity', default='2.5', uiDict=uiDict) self.addRenderGlobalsUIElement(attName='ozone', uiType='float', displayName='Ozone', default='0.35', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='waterVapor', uiType='float', displayName='Water Vapour', default='2.0', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='turbidityCoefficient', uiType='float', displayName='Turbidity Coeff', default='0.046', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='wavelengthExponent', uiType='float', displayName='Wavelength Exponent', default='1.3', uiDict=uiDict) self.addRenderGlobalsUIElement(attName='albedo', uiType='float', displayName='Albedo', default='0.5', uiDict=uiDict) with pm.frameLayout( label="Physical Sun", collapsable=False) as uiDict['physSunFrame']: with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement( attName='sunPolarAngle', uiType='float', displayName='Sun Polar Angle', default='-1.0', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='sunAzimuth', uiType='float', displayName='Sun Azimuth', default='-1.0', uiDict=uiDict) #self.addRenderGlobalsUIElement(attName = 'sunDirection', uiType = 'vector', displayName = 'Sun Direction', default='0:0:0', uiDict=uiDict) with pm.frameLayout( label="Time Zone", collapsable=False) as uiDict['timeZoneFrame']: with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName='latitude', uiType='float', displayName='Latitude', default='0.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName='longitude', uiType='float', displayName='Longitude', default='0.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName='timezone', uiType='int', displayName='Timezone', default='0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName='date', uiType='string', displayName='Date', default='"1/6/2014"', uiDict=uiDict) self.addRenderGlobalsUIElement(attName='localtime', uiType='string', displayName='Localtime', default='"12:00:00"', uiDict=uiDict) self.addRenderGlobalsUIElement(attName='ior', uiType='float', displayName='IOR', default='1.0', uiDict=uiDict) with pm.frameLayout(label="IBL", collapsable=False) as uiDict['iblFrame']: with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement( attName='illuminationMap', uiType='color', displayName='Illumination Map', default='0:0:0', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='backgroundMap', uiType='color', displayName='Background Map', default='0:0:0', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='reflectionMap', uiType='color', displayName='Reflection Map', default='0:0:0', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='RefractionMap', uiType='color', displayName='Refraction Map', default='0:0:0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName='medium', uiType='message', displayName='Medium', default='', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName='useSunLightConnection', uiType='bool', displayName='Use Sun', uiDict=uiDict) # buttonLabel = "Create Sun" # suns = pm.ls("CoronaSun") # if len(suns) > 0: # buttonLabel = "Delete Sun" # uiDict['sunButton'] = pm.button(label=buttonLabel, command=self.editSun) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[(scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0)]) self.TheaEnvironmentUpdateTab()
def TheaRendererCreateTab(self): log.debug("TheaRendererCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "ScrollLayout" if self.rendererTabUiDict.has_key('common'): self.rendererTabUiDict.pop('common') uiDict = {} self.rendererTabUiDict['common'] = uiDict with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="Renderer", collapsable=True, collapse=False): with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement( attName='engine', uiType='enum', displayName='Render Engine', uiDict=uiDict) self.addRenderGlobalsUIElement(attName='threads', uiType='int', displayName='Threads', default=8, uiDict=uiDict) self.addRenderGlobalsUIElement( attName='maxRenderSeconds', uiType='int', displayName='Max Time (sec)', default='0', uiDict=uiDict) pm.separator() self.addRenderGlobalsUIElement( attName='doDof', uiType='bool', displayName='Depth of Field:', default='True', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='doMotionBlur', uiType='bool', displayName='Motion Blur:', default='True', uiDict=uiDict) #self.addRenderGlobalsUIElement(attName = 'tilesize', uiType = 'int', displayName = 'Tile Size', default=64, uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'giChannel', uiType = 'bool', displayName = 'GiChannel', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'frameRate', uiType = 'int', displayName = 'FrameRate', default='25', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'gatherRays', uiType = 'int', displayName = 'GatherRays', default='100', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'normalChannel', uiType = 'bool', displayName = 'NormalChannel', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'clayReflectance', uiType = 'float', displayName = 'ClayReflectance', default='0.5', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'selectedFrames', uiType = 'string', displayName = 'SelectedFrames', default='None', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'aoMultiply', uiType = 'bool', displayName = 'AoMultiply', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'irradianceCacheForceInterpolation', uiType = 'bool', displayName = 'IrradianceCacheForceInterpolation', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'currentFrame', uiType = 'int', displayName = 'CurrentFrame', default='0', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'fieldMaxError', uiType = 'float', displayName = 'FieldMaxError', default='0.02', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'irradianceCacheSampleDensity', uiType = 'float', displayName = 'IrradianceCacheSampleDensity', default='0.70', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'antialiasingMaxContrast', uiType = 'float', displayName = 'AntialiasingMaxContrast', default='0.02', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'antialiasingClampLevel', uiType = 'float', displayName = 'AntialiasingClampLevel', default='1.0', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'rayTraceDispersion', uiType = 'bool', displayName = 'RayTraceDispersion', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'progressiveRayTracingDepth', uiType = 'int', displayName = 'ProgressiveRayTracingDepth', default='4', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'rayTraceTransparencies', uiType = 'bool', displayName = 'RayTraceTransparencies', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'irradianceCachePrepassSamples', uiType = 'int', displayName = 'IrradianceCachePrepassSamples', default='1', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'irradianceCacheDensityBoost', uiType = 'float', displayName = 'IrradianceCacheDensityBoost', default='1.0', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'blurredEvaluateGI', uiType = 'bool', displayName = 'BlurredEvaluateGI', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'filmSaving', uiType = 'bool', displayName = 'FilmSaving', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'walkthroughPrepassFrames', uiType = 'int', displayName = 'WalkthroughPrepassFrames', default='1', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'repaint', uiType = 'bool', displayName = 'Repaint', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'sssChannel', uiType = 'bool', displayName = 'SssChannel', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'gatherTraceReflections', uiType = 'bool', displayName = 'GatherTraceReflections', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'gatherTraceGlossyReflections', uiType = 'bool', displayName = 'GatherTraceGlossyReflections', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'depthChannel', uiType = 'bool', displayName = 'DepthChannel', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'renderFrames', uiType = 'enum', displayName = 'RenderFrames', default='RenderFramesCurrent', data='RenderFramesCurrent:RenderFramesAll:RenderFramesSelected', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'gatherTraceRefractions', uiType = 'bool', displayName = 'GatherTraceRefractions', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'biasedGlossyTracingDepth', uiType = 'int', displayName = 'BiasedGlossyTracingDepth', default='2', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'skyAnimationEnd', uiType = 'string', displayName = 'SkyAnimationEnd', default='18:20:00', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'blurredReflections', uiType = 'bool', displayName = 'BlurredReflections', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'transparentChannel', uiType = 'bool', displayName = 'TransparentChannel', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'alphaChannel', uiType = 'bool', displayName = 'AlphaChannel', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'aoLowColor', uiType = 'color', displayName = 'AoLowColor', default='0:0:0', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'displacement', uiType = 'bool', displayName = 'Displacement', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'devices', uiType = 'int', displayName = 'Devices', default='0', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'animationOutputFilename', uiType = 'string', displayName = 'AnimationOutputFilename', default='output.png', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'irradianceCachePrepassOnly', uiType = 'bool', displayName = 'IrradianceCachePrepassOnly', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'network', uiType = 'enum', displayName = 'Network', default='NoNetwork', data='NoNetwork:ClientNetwork:ServerNetwork', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'progressiveClampLevel', uiType = 'float', displayName = 'ProgressiveClampLevel', default='1.0', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'gatherTraceGlossyRefractions', uiType = 'bool', displayName = 'GatherTraceGlossyRefractions', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'directAdaptiveSampling', uiType = 'bool', displayName = 'DirectAdaptiveSampling', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'russianRouletteDepth', uiType = 'int', displayName = 'RussianRouletteDepth', default='4', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'causticPhotonsCaptured', uiType = 'int', displayName = 'CausticPhotonsCaptured', default='10000', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'causticSharpening', uiType = 'bool', displayName = 'CausticSharpening', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'gatherMaxError', uiType = 'float', displayName = 'GatherMaxError', default='0.04', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'irradianceCacheMaxConstrast', uiType = 'float', displayName = 'IrradianceCacheMaxConstrast', default='0.02', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'irradianceCacheMinPixelsDistance', uiType = 'float', displayName = 'IrradianceCacheMinPixelsDistance', default='4.0', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'aoAffectGI', uiType = 'bool', displayName = 'AoAffectGI', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'aoSamples', uiType = 'int', displayName = 'AoSamples', default='100', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'reflectionChannel', uiType = 'bool', displayName = 'ReflectionChannel', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'progressiveAmbientIntensity', uiType = 'float', displayName = 'ProgressiveAmbientIntensity', default='10.0', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'minAASubdivs', uiType = 'int', displayName = 'MinAASubdivs', default='0', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'deviceMask', uiType = 'int', displayName = 'DeviceMask', default='0', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'progressiveCaustics', uiType = 'bool', displayName = 'ProgressiveCaustics', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'progressiveGlossyTracingDepth', uiType = 'int', displayName = 'ProgressiveGlossyTracingDepth', default='2', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'maxPasses', uiType = 'int', displayName = 'MaxPasses', default='10000', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'animationOutputAlpha', uiType = 'bool', displayName = 'AnimationOutputAlpha', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'warmUpLevel', uiType = 'int', displayName = 'WarmUpLevel', default='2', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'aoChannel', uiType = 'bool', displayName = 'AoChannel', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'rayTraceRefractions', uiType = 'bool', displayName = 'RayTraceRefractions', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'maxBlurredSubdivs', uiType = 'int', displayName = 'MaxBlurredSubdivs', default='3', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'causticEstimationPhotons', uiType = 'int', displayName = 'CausticEstimationPhotons', default='100', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'volumetricScattering', uiType = 'bool', displayName = 'VolumetricScattering', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'antialiasingClampRadiance', uiType = 'bool', displayName = 'AntialiasingClampRadiance', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'aoDistance', uiType = 'float', displayName = 'AoDistance', default='10', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'priority', uiType = 'enum', displayName = 'Priority', default='LowPriority', data='InheritPriority:LowerPriority:LowPriority:NormalPriority:HighPriority:HighestPriority', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'skyAnimationStart', uiType = 'string', displayName = 'SkyAnimationStart', default='12:00:00', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'maxSamples', uiType = 'int', displayName = 'MaxSamples', default='0', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'progressiveClampRadiance', uiType = 'bool', displayName = 'ProgressiveClampRadiance', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'walkthroughAnimation', uiType = 'bool', displayName = 'WalkthroughAnimation', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'russianRoulette', uiType = 'bool', displayName = 'RussianRoulette', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'irradianceCacheMaxPixelsDistance', uiType = 'float', displayName = 'IrradianceCacheMaxPixelsDistance', default='40.0', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'brightnessTermination', uiType = 'bool', displayName = 'BrightnessTermination', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'progressiveDiffuseTracingDepth', uiType = 'int', displayName = 'ProgressiveDiffuseTracingDepth', default='0', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'progressiveAmbientOcclusion', uiType = 'bool', displayName = 'ProgressiveAmbientOcclusion', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'fieldMapping', uiType = 'bool', displayName = 'FieldMapping', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'ambientOcclusion', uiType = 'bool', displayName = 'AmbientOcclusion', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'clayRender', uiType = 'bool', displayName = 'ClayRender', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'minBlurredSubdivs', uiType = 'int', displayName = 'MinBlurredSubdivs', default='0', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'finalGathering', uiType = 'bool', displayName = 'FinalGathering', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'maxAASubdivs', uiType = 'int', displayName = 'MaxAASubdivs', default='4', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'biasedSupersampling', uiType = 'bool', displayName = 'BiasedSupersampling', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'irradianceCaching', uiType = 'bool', displayName = 'IrradianceCaching', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'supersampling', uiType = 'enum', displayName = 'Supersampling', default='AutoSS', data='AutoSS:NoneSS:NormalSS:HighSS', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'fieldDensity', uiType = 'int', displayName = 'FieldDensity', default='100000', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'imageSaving', uiType = 'bool', displayName = 'ImageSaving', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'brightnessThreshold', uiType = 'float', displayName = 'BrightnessThreshold', default='0.001', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'relight', uiType = 'bool', displayName = 'Relight', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'progressiveAmbientColor', uiType = 'color', displayName = 'ProgressiveAmbientColor', default='1:1:1', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'biasedRayTracingDepth', uiType = 'int', displayName = 'BiasedRayTracingDepth', default='4', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'irradianceCacheVisualize', uiType = 'bool', displayName = 'IrradianceCacheVisualize', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'objectIdChannel', uiType = 'bool', displayName = 'ObjectIdChannel', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'directLighting', uiType = 'bool', displayName = 'DirectLighting', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'gatherDiffuseDepth', uiType = 'int', displayName = 'GatherDiffuseDepth', default='3', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'seed', uiType = 'int', displayName = 'Seed', default='None', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'rayTraceReflections', uiType = 'bool', displayName = 'RayTraceReflections', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'adaptiveBias', uiType = 'float', displayName = 'AdaptiveBias', default='0.25', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'irradianceCacheAdaptiveDensity', uiType = 'bool', displayName = 'IrradianceCacheAdaptiveDensity', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'refractionChannel', uiType = 'bool', displayName = 'RefractionChannel', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'subsurfaceScattering', uiType = 'bool', displayName = 'SubsurfaceScattering', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'fieldForceNearestCell', uiType = 'bool', displayName = 'FieldForceNearestCell', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'materialIdChannel', uiType = 'bool', displayName = 'MaterialIdChannel', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'serveraddress', uiType = 'string', displayName = 'Serveraddress', default='127.0.0.1', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'networkCooperation', uiType = 'enum', displayName = 'NetworkCooperation', default='FrameCooperation', data='FrameCooperation:BucketPixelCooperation', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'motionBlur', uiType = 'bool', displayName = 'MotionBlur', default='true', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'endFrame', uiType = 'int', displayName = 'EndFrame', default='100', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'caustics', uiType = 'bool', displayName = 'Caustics', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'aoClamp', uiType = 'bool', displayName = 'AoClamp', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'irradianceChannel', uiType = 'bool', displayName = 'IrradianceChannel', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'sssMaxSamples', uiType = 'int', displayName = 'SssMaxSamples', default='10000', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'fieldCellSize', uiType = 'int', displayName = 'FieldCellSize', default='1000', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'directChannel', uiType = 'bool', displayName = 'DirectChannel', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'progressiveAmbientDistance', uiType = 'float', displayName = 'ProgressiveAmbientDistance', default='10.0', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'irradianceCachePrepassPixels', uiType = 'int', displayName = 'IrradianceCachePrepassPixels', default='1', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'directMaxError', uiType = 'float', displayName = 'DirectMaxError', default='0.02', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'walkthroughPrepassSamples', uiType = 'int', displayName = 'WalkthroughPrepassSamples', default='1', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'skyAnimation', uiType = 'bool', displayName = 'SkyAnimation', default='false', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'aoHighColor', uiType = 'color', displayName = 'AoHighColor', default='1:1:1', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName = 'threads', uiType = 'int', displayName = 'Threads', default='0', uiDict=uiDict) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[(scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0)]) self.updateEnvironment() self.TheaRendererUpdateTab()
def TheaTranslatorCreateTab(self): log.debug("TheaTranslatorCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "TrScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "TrColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="Translator", collapsable=True, collapse=False): attr = pm.Attribute(self.renderGlobalsNodeName + ".translatorVerbosity") ui = pm.attrEnumOptionMenuGrp( label="Translator Verbosity", at=self.renderGlobalsNodeName + ".translatorVerbosity", ei=self.getEnumList(attr)) with pm.frameLayout(label="Thea XML export", collapsable=True, collapse=False): ui = pm.checkBoxGrp(label="Export scene XML file:", value1=False) pm.connectControl(ui, self.renderGlobalsNodeName + ".exportXMLFile", index=2) xmlDict = {} self.rendererTabUiDict['xml'] = xmlDict with pm.rowColumnLayout(nc=3, width=120): pm.text(label="XMLFileName:", width=60, align="right") defaultXMLPath = pm.workspace.path + "/" + pm.sceneName( ).basename().split(".")[0] + ".Thea" xmlDict['xmlFile'] = pm.textField(text=defaultXMLPath, width=60) pm.symbolButton(image="navButtonBrowse.png", c=self.xmlFileBrowse) pm.connectControl(xmlDict['xmlFile'], self.renderGlobalsNodeName + ".exportXMLFileName", index=2) with pm.frameLayout(label="Optimize Textures", collapsable=True, collapse=False): with pm.rowColumnLayout(nc=3, width=120): optiDict = {} pm.text(label="OptimizedTex Dir:", width=60, align="right") self.rendererTabUiDict['opti'] = optiDict pm.symbolButton(image="navButtonBrowse.png", c=self.dirBrowse) optiDict['optiField'] = pm.textField( text=self.renderGlobalsNode.optimizedTexturePath. get(), width=60) pm.connectControl(optiDict['optiField'], self.renderGlobalsNodeName + ".optimizedTexturePath", index=2) with pm.frameLayout(label="Additional Settings", collapsable=True, collapse=False): ui = pm.floatFieldGrp(label="Scene scale:", value1=1.0, numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".sceneScale", index=2) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[(scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0)])
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 createEditUI(self, *args): _logger.debug('createEditUI') self.editGrpForm = pm.columnLayout(columnOffset=("left", -1), columnAlign="left", adjustableColumn=True) pm.setParent(self.editGrpFrame) if (self.numberOfImagePlanesInScene() <= 0): pm.text("No image planes in scene to edit", align="center") pm.setParent(self.editGrpForm) else: self.alignGrpForm = pm.rowLayout(nc=5) pm.setParent(self.alignGrpForm) pm.text(" Camera ") pm.button(label='Select', width=120, command=pm.Callback(self.on_camselect_btn)) pm.button(label='Look through', width=120, command=pm.Callback(self.on_camlookthrough_btn)) pm.text(" ") _logger.debug('currentImgPlane[0] is %s' % self.currentImgPlane) # pm.checkBox( label='In all views', width=99, value=pm.imagePlane(self.currentImgPlane[0], q=1, showInAllViews=1), onc=self.on_views_change_all, ofc=self.on_views_change_current) pm.setParent(self.editGrpFrame) pm.floatSliderGrp("opacitySlider", label="Opacity", columnWidth3=(80, 50, 80), columnAlign3=("right", "left", "left"), adjustableColumn=0, field=True, fieldMinValue=0, fieldMaxValue=1, minValue=0, maxValue=1, step=0.01, cc=pm.Callback(self.on_opacity_change)) pm.floatSliderGrp("colorOffsetSlider", label="Brightness", columnWidth3=(80, 50, 60), columnAlign3=("right", "left", "left"), adjustableColumn=0, field=True, fieldMinValue=0, fieldMaxValue=1, minValue=0, maxValue=1, step=0.01, cc=pm.Callback(self.on_colorOffset_change)) pm.floatSliderGrp("sizeSlider", label="Size", columnWidth3=(80, 60, 80), columnAlign3=("right", "left", "left"), adjustableColumn=0, field=True, fieldMinValue=0.1, fieldMaxValue=5.0, minValue=0.1, maxValue=5.0, step=0.1, cc=pm.Callback(self.on_size_change)) pm.floatSliderGrp("offsetXSlider", label="Offset X", columnWidth3=(80, 50, 80), columnAlign3=("right", "left", "left"), adjustableColumn=0, field=True, fieldMinValue=-1.0, fieldMaxValue=1.0, minValue=-1.0, maxValue=1.0, step=0.01, cc=pm.Callback(self.on_offsetX_change)) pm.floatSliderGrp("offsetYSlider", label="Offset Y", columnWidth3=(80, 50, 80), columnAlign3=("right", "left", "left"), adjustableColumn=0, field=True, fieldMinValue=-1.0, fieldMaxValue=1.0, minValue=-1.0, maxValue=1.0, step=0.01, cc=pm.Callback(self.on_offsetY_change)) #set slider values to current values self.updateImagePlaneEditSliders() pm.setParent(self.editGrpFrame) pm.formLayout( self.mainForm, e=True, attachForm=([self.editGrpFrame, 'left', 6]), attachControl=([self.editGrpFrame, 'top', 3, self.modeGrpFrame])) pm.setParent(self.mainForm)
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 create(self): # create window "Imageplane Manager" ## destroy the window if it already exists try: pm.deleteUI(self.WINDOW_NAME, window=True) except: pass # draw the window self.WINDOW_NAME = pm.window(self.WINDOW_NAME, title=self.WINDOW_TITLE, width=self.WINDOW_SIZE[0], height=self.WINDOW_SIZE[1], sizeable=False) #main form _logger.debug("Creating Main Form") topLevelColumn = pm.columnLayout(adjustableColumn=True, columnAlign="center") self.mainForm = pm.formLayout(nd=100) #FIRST FL Manage Plane Manages control frame Layout***************************************************** self.modeGrpFrame = pm.frameLayout(label='Image Planes', collapsable=True, width=self.WINDOW_SIZE[0], borderStyle='etchedIn') #attach 'Manage Plane Manages control' group to main pm.formLayout(self.mainForm, e=True, attachForm=( [self.modeGrpFrame, 'top', 16], [self.modeGrpFrame, 'left', 6], )) self.modeGrpForm = pm.formLayout(nd=100) #Option Menu: available image planes self.imgplanesOptionMenu = pm.optionMenu(label='Image Planes', width=200, changeCommand=pm.Callback( self.on_imp_change)) # create menu item list for all image planes in scene _logger.debug("Creat item for all image planes in scnee") self.imp_option_list() pm.formLayout(self.modeGrpForm, e=True, attachForm=([self.imgplanesOptionMenu, 'top', 10], [self.imgplanesOptionMenu, 'left', 20])) #Del, Del All, Select Button self.Sel_btn = pm.button(label='Sel', width=50, command=pm.Callback(self.on_select_btn)) self.Del_btn = pm.button(label='Del', width=50, command=pm.Callback(self.on_delete_btn)) pm.formLayout(self.modeGrpForm, e=True, attachForm=([self.Sel_btn, 'top', 10]), attachControl=([ self.Sel_btn, 'left', 10, self.imgplanesOptionMenu ])) pm.formLayout(self.modeGrpForm, e=True, attachForm=([self.Del_btn, 'top', 10]), attachControl=([self.Del_btn, 'left', 10, self.Sel_btn])) _logger.debug("Import new Btn") #File open: import new imageplane self.import_btn = pm.button(label='Import New', width=self.WINDOW_SIZE[0], command=pm.Callback(self.importWindowUI)) _logger.debug("ImportOption Menu") pm.formLayout(self.modeGrpForm, e=True, attachForm=([self.import_btn, 'left', 20]), attachControl=([ self.import_btn, 'top', 5, self.imgplanesOptionMenu ])) pm.setParent(self.mainForm) #SEC FL Edit Image Plane ************************************************************************** _logger.debug("Framelayout: Edit Image Plane") self.editGrpFrame = pm.frameLayout(label='Edit Image Plane', collapsable=True, width=self.WINDOW_SIZE[0], borderStyle='etchedIn') _logger.debug("createEditUI()") self.createEditUI() _logger.debug("attach 'Manage Plane Manages control' group to main") #attach 'Manage Plane Manages control' group to main pm.formLayout( self.mainForm, e=True, attachForm=([self.editGrpFrame, 'left', 6]), attachControl=([self.editGrpFrame, 'top', 3, self.modeGrpFrame])) pm.setParent(self.mainForm) _logger.debug("Camera Retarget UI") #THIRD Camera Retarget ************************************************************************* self.cameraGrpFrame = pm.frameLayout(label='Camera Retarget', collapsable=True, width=self.WINDOW_SIZE[0], borderStyle='etchedIn', cl=True) self.createCameraUI() self.cameraGrpForm = pm.formLayout(nd=100) #self.audioGrpForm = pm.formLayout(nd=100) #attach 'Manage Plane Manages control' group to main pm.formLayout( self.mainForm, e=True, attachForm=([self.cameraGrpFrame, 'left', 6]), attachControl=([self.cameraGrpFrame, 'top', 3, self.editGrpFrame])) pm.setParent(self.mainForm) _logger.debug("Tools UI") #FOURTH FL Pro-Tools ************************************************************************* self.toolsGrpFrame = pm.frameLayout(label=' Pro - Tools', collapsable=True, width=self.WINDOW_SIZE[0], borderStyle='etchedIn') _logger.debug("Create Tools UI") self.createToolsUI() self.toolsGrpForm = pm.formLayout(nd=100) #self.audioGrpForm = pm.formLayout(nd=100) #attach 'Manage Plane Manages control' group to main pm.formLayout( self.mainForm, e=True, attachForm=([self.toolsGrpFrame, 'left', 6]), attachControl=([self.toolsGrpFrame, 'top', 3, self.cameraGrpFrame])) #self.modeGrpForm = pm.formLayout(nd=100) pm.setParent(self.mainForm) #FIFTH FL Audio ************************************************************************* _logger.debug("Audio UI") self.audioGrpFrame = pm.frameLayout(label='Audio', collapsable=True, width=self.WINDOW_SIZE[0], borderStyle='etchedIn') self.audioGrpForm = pm.formLayout(nd=100) #self.audioGrpForm = pm.formLayout(nd=100) #attach 'Manage Plane Manages control' group to main pm.formLayout( self.mainForm, e=True, attachForm=([self.audioGrpFrame, 'left', 6]), attachControl=([self.audioGrpFrame, 'top', 3, self.toolsGrpFrame])) pm.showWindow()
def child_tab_export(self): layout = pm.formLayout(numberOfDivisions=100) file_export_list_frame = pm.frameLayout(label=u"数据文件列表:", mw=10, mh=10, bgs=True) pm.textFieldButtonGrp('template_file_setter', label=u"模板文件", bl=u"指定", adj=2, cw3=[52, 100, 60], cat=[(2, "left", 5), (3, "left", 5)], text=self.template_file, bc=lambda *args: self._set_template_file()) pm.textScrollList('export_list_input', ams=True) pm.popupMenu() pm.menuItem(label=u"移除选择", c=lambda *args: self._remove_selected_item()) pm.menuItem(label=u"移除所有", c=lambda *args: self._remove_all_item()) pm.setParent("..") export_options_frame = pm.frameLayout(label=u"输出选项:", mw=10, mh=10, bgs=True) pm.textFieldButtonGrp('output_path_setter', label=u"存放路径", bl=u"设置", adj=2, cw3=[52, 100, 60], cat=[(2, "left", 5), (3, "left", 5)], text=self.output_path, bc=lambda *args: self._set_output_location()) pm.rowColumnLayout(nr=1) pm.checkBoxGrp('cleanFileChecked', label=u"清理文件", value1=self.clean_file, cw2=[52, 30], cat=[(2, "left", 5)], cc=lambda *args: self._set_clean_file_check()) pm.checkBoxGrp('exportAtomFileChecked', label=u"输出Atom动画数据", value1=self.export_atom, cw2=[120, 30], cat=[(2, "left", 5)], cc=lambda *args: self._set_export_atom_check()) pm.setParent("..") pm.setParent("..") execute_button = pm.button(label=u"输出!", c=lambda *args: self.start_export_work()) pm.formLayout( layout, edit=True, attachForm=[(file_export_list_frame, 'top', 10), (file_export_list_frame, 'left', 10), (file_export_list_frame, 'right', 10), (export_options_frame, 'left', 10), (export_options_frame, 'right', 10), (execute_button, 'left', 10), (execute_button, 'right', 10), (execute_button, 'bottom', 10)], attachControl=[ # (file_export_list_frame, 'top', 5, project_store_path_frame), (file_export_list_frame, 'bottom', 5, export_options_frame), (export_options_frame, 'bottom', 5, execute_button) ], # attachPosition=[(b1, 'right', 5, 75), # (column, 'left', 0, 75)], # attachNone=(b2, 'top')) ) pm.setParent("..") return layout
def UI(self): width = 250 height = 100 # create window if pm.window('ehm_Renamer_UI', exists=True): pm.deleteUI('ehm_Renamer_UI') pm.window('ehm_Renamer_UI', title='rename multiple objects', w=width, h=height, mxb=False, mnb=False, sizeable=False) # main layout mainLayout = pm.columnLayout(w=width, h=height) formLayout = pm.formLayout(w=width - 10, h=height - 10) frameLayout = pm.frameLayout(borderStyle='etchedIn', labelVisible=False) # left column and form pm.setParent(formLayout) leftLayout = pm.columnLayout(adj=True) leftForm = pm.formLayout(w=(width - 10) / 3, h=height - 10) # right column and form pm.setParent(formLayout) rightLayout = pm.columnLayout(adj=True) rightForm = pm.formLayout(w=(width - 10) / 3 * 2, h=height - 10) # num of joints slider text = pm.text(label="New name:", parent=leftForm) self.nameTF = pm.textField(text='newName_###', h=20, parent=rightForm) # button button = pm.button(label='apply', w=100, h=30, c=partial(self.renamer, None, 'newName_###', False), parent=formLayout) # place controls pm.formLayout(formLayout, edit=True, attachForm=(frameLayout, 'left', 3)) pm.formLayout(formLayout, edit=True, attachForm=(frameLayout, 'right', 3)) pm.formLayout(formLayout, edit=True, attachForm=(frameLayout, 'top', 3)) pm.formLayout(formLayout, edit=True, attachForm=(frameLayout, 'bottom', 38)) pm.formLayout(formLayout, edit=True, attachForm=(leftLayout, 'left', 3)) pm.formLayout(formLayout, edit=True, attachForm=(leftLayout, 'right', width / 3 * 2)) pm.formLayout(formLayout, edit=True, attachForm=(leftLayout, 'top', 3)) pm.formLayout(formLayout, edit=True, attachForm=(leftLayout, 'bottom', 38)) pm.formLayout(formLayout, edit=True, attachForm=(rightLayout, 'left', width / 3)) pm.formLayout(formLayout, edit=True, attachForm=(rightLayout, 'right', 3)) pm.formLayout(formLayout, edit=True, attachForm=(rightLayout, 'top', 3)) pm.formLayout(formLayout, edit=True, attachForm=(rightLayout, 'bottom', 38)) pm.formLayout(leftForm, edit=True, attachForm=(text, 'right', 5)) pm.formLayout(leftForm, edit=True, attachForm=(text, 'top', 13)) pm.formLayout(rightForm, edit=True, attachForm=(self.nameTF, 'left', 0)) pm.formLayout(rightForm, edit=True, attachForm=(self.nameTF, 'right', 15)) pm.formLayout(rightForm, edit=True, attachForm=(self.nameTF, 'top', 13)) pm.formLayout(formLayout, edit=True, attachForm=(button, 'left', 5)) pm.formLayout(formLayout, edit=True, attachForm=(button, 'right', 5)) pm.formLayout(formLayout, edit=True, attachForm=(button, 'bottom', 5)) # show window pm.showWindow('ehm_Renamer_UI')
def ui_createUI(self): self.winName = WIN_NAME self.winTitle = WIN_TITLE 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) 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, ): with pm.columnLayout( adjustableColumn=True): with pm.rowLayout( numberOfColumns=2, columnWidth2=[ UI_LABEL_WIDTH, UI_INPUT_WIDTH ], columnAttach=[1, 'right', 5]): pm.text( label='Curvature Threshold') pm.setUITemplate( 'DefaultTemplate', popTemplate=True ) # strange slider group visual with default template self.ui_FLTSLGRP_curveThresh = pm.floatSliderGrp( 'ui_FLTSLGRP_curveThresh', field=True, minValue=0.001, maxValue=0.2, fieldMinValue=0.001, fieldMaxValue=10, value=0.09, step=0.001, fieldStep=0.001, sliderStep=0.001, changeCommand=self. ui_FLTSLGRP_curveThresh_change, dragCommand=self. ui_FLTSLGRP_curveThresh_change) pm.setUITemplate('DefaultTemplate', pushTemplate=True) with pm.rowLayout( numberOfColumns=2, columnWidth2=[ UI_LABEL_WIDTH, UI_INPUT_WIDTH ], columnAttach=[1, 'right', 5]): pm.text(label='Grow Angle') pm.setUITemplate( 'DefaultTemplate', popTemplate=True ) # strange slider group visual with default template self.ui_FLTSLGRP_growAngle = pm.floatSliderGrp( 'ui_FLTSLGRP_growAngle', field=True, minValue=0, maxValue=10, fieldMinValue=0, fieldMaxValue=30, value=5, step=0.001, fieldStep=0.001, sliderStep=0.001, changeCommand=self. ui_FLTSLGRP_growAngle_change, dragCommand=self. ui_FLTSLGRP_growAngle_change) pm.setUITemplate('DefaultTemplate', pushTemplate=True) with pm.frameLayout( label='Display', collapsable=True, collapse=False, marginHeight=3, ): with pm.columnLayout( adjustableColumn=True): with pm.rowLayout( numberOfColumns=2, columnWidth2=[ UI_LABEL_WIDTH, UI_INPUT_WIDTH ], columnAttach=[1, 'right', 5]): pm.text(label='Display Curvature') self.ui_CHK_displayCurve = pm.checkBox( 'ui_CHK_highlight', label='', changeCommand=self. ui_CHK_displayCurve_change) with pm.rowLayout( numberOfColumns=2, columnWidth2=[ UI_LABEL_WIDTH, UI_INPUT_WIDTH ], columnAttach=[1, 'right', 5]): pm.text(label='Curvature Scale') pm.setUITemplate( 'DefaultTemplate', popTemplate=True ) # strange slider group visual with default template self.ui_FLTSLGRP_curveScale = pm.floatSliderGrp( 'ui_FLTSLGRP_curveScale', field=True, minValue=0.001, maxValue=1, fieldMinValue=0.001, fieldMaxValue=10, value=1, step=0.001, fieldStep=0.001, sliderStep=0.001, changeCommand=self. ui_FLTSLGRP_curveScale_change, dragCommand=self. ui_FLTSLGRP_curveScale_change) pm.setUITemplate('DefaultTemplate', pushTemplate=True) self.ui_BTN_ok = pm.button(label='OK', command=self.onOkClicked) self.ui_BTN_cancel = pm.button(label='Cancel', command=self.onCancelClicked) 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_ok) self.ui_LAY_mainForm.attachNone(self.ui_BTN_ok, 'top') self.ui_LAY_mainForm.attachForm(self.ui_BTN_ok, 'left', 5) self.ui_LAY_mainForm.attachPosition(self.ui_BTN_ok, 'right', 2, 50) self.ui_LAY_mainForm.attachForm(self.ui_BTN_ok, 'bottom', 5) self.ui_LAY_mainForm.attachNone(self.ui_BTN_cancel, 'top') self.ui_LAY_mainForm.attachPosition(self.ui_BTN_cancel, 'left', 2, 50) self.ui_LAY_mainForm.attachForm(self.ui_BTN_cancel, 'right', 5) self.ui_LAY_mainForm.attachForm(self.ui_BTN_cancel, 'bottom', 5) pm.setUITemplate('DefaultTemplate', popTemplate=True) pm.scriptJob(uiDeleted=(self.window, self.onUiDeleted)) self.window.show() m.refresh()
def create(self): createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("renderGlobalsTemplate", pushTemplate=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) with pm.scrollLayout("customMayaRendererScrollLayout", horizontalScrollBarThickness=0): with pm.columnLayout("customMayaRendererColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout("generalFrameLayout", label="General", collapsable=True, collapse=False): with pm.columnLayout("generalColumnLayout", adjustableColumn=True, width=380, rowSpacing=2): pm.separator(height=2) pm.attrFieldSliderGrp( label="Minimal distance", columnWidth=(3, 160), columnAttach=(1, "left", 4), minValue=0, attribute="customMayaRendererGlobalsNode.minDist") pm.attrFieldSliderGrp( label="Maximal distance", columnWidth=(3, 160), columnAttach=(1, "left", 4), minValue=0, attribute="customMayaRendererGlobalsNode.maxDist") pm.attrFieldSliderGrp( label="Number of samples:", columnWidth=(3, 160), columnAttach=(1, "left", 4), minValue=1, maxValue=100, fieldMinValue=1, fieldMaxValue=100, attribute="customMayaRendererGlobalsNode.samples") pm.attrFieldSliderGrp( label="Number of bounces:", columnWidth=(3, 160), columnAttach=(1, "left", 4), minValue=1, maxValue=100, fieldMinValue=1, fieldMaxValue=50, attribute="customMayaRendererGlobalsNode.maxBounces" ) pm.setUITemplate("renderGlobalsTemplate", popTemplate=True) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[ ("customMayaRendererScrollLayout", "top", 0), ("customMayaRendererScrollLayout", "bottom", 0), ("customMayaRendererScrollLayout", "left", 0), ("customMayaRendererScrollLayout", "right", 0) ])
def dock_panel(engine, shotgun_panel, title): # Retrieve the Shotgun app panel name. shotgun_panel_name = shotgun_panel.objectName() # Create a Maya panel name. maya_panel_name = MAYA_PANEL_PREFIX + shotgun_panel_name # Use the proper Maya panel docking method according to the Maya version. if mel.eval("getApplicationVersionAsFloat()") < 2017: import pymel.core as pm # When the Maya panel already exists, it can be deleted safely since its embedded # Shotgun app panel has already been reparented under Maya main window. if pm.control(maya_panel_name, query=True, exists=True): engine.logger.debug("Deleting existing Maya panel %s.", maya_panel_name) pm.deleteUI(maya_panel_name) # Create a new Maya window. maya_window = pm.window() engine.logger.debug("Created Maya window %s.", maya_window) # Add a layout to the Maya window. maya_layout = pm.formLayout(parent=maya_window) engine.logger.debug("Created Maya layout %s.", maya_layout) # Reparent the Shotgun app panel under the Maya window layout. engine.logger.debug( "Reparenting Shotgun app panel %s under Maya layout %s.", shotgun_panel_name, maya_layout, ) pm.control(shotgun_panel_name, edit=True, parent=maya_layout) # Keep the Shotgun app panel sides aligned with the Maya window layout sides. pm.formLayout( maya_layout, edit=True, attachForm=[ (shotgun_panel_name, "top", 1), (shotgun_panel_name, "left", 1), (shotgun_panel_name, "bottom", 1), (shotgun_panel_name, "right", 1), ], ) # Dock the Maya window into a new tab of Maya Channel Box dock area. engine.logger.debug("Creating Maya panel %s.", maya_panel_name) pm.dockControl(maya_panel_name, area="right", content=maya_window, label=title) # Since Maya does not give us any hints when a panel is being closed, # install an event filter on Maya dock control to monitor its close event # in order to gracefully close and delete the Shotgun app panel widget. # Some obscure issues relating to UI refresh are also resolved by the event filter. panel_util.install_event_filter_by_name(maya_panel_name, shotgun_panel_name) # Once Maya will have completed its UI update and be idle, # raise (with "r=True") the new dock tab to the top. maya.utils.executeDeferred( "import maya.cmds as cmds\n" "cmds.dockControl('%s', edit=True, r=True)" % maya_panel_name ) else: # Maya 2017 and later import uuid # When the current Maya workspace contains our Maya panel workspace control, # embed the Shotgun app panel into this workspace control. # This can happen when the engine has just been started and the Shotgun app panel is # displayed for the first time around, or when the user reinvokes a displayed panel. if cmds.workspaceControl(maya_panel_name, exists=True): engine.logger.debug("Restoring Maya workspace panel %s.", maya_panel_name) # Set the Maya default parent to be our Maya panel workspace control. cmds.setParent(maya_panel_name) # Embed the Shotgun app panel into the Maya panel workspace control. build_workspace_control_ui(shotgun_panel_name) if cmds.control(maya_panel_name, query=True, isObscured=True): # When the panel is not visible, raise it to the top of its workspace area. engine.logger.debug("Raising workspace panel %s.", maya_panel_name) cmds.workspaceControl(maya_panel_name, edit=True, r=True) else: # When the panel is visible, use a workaround to force Maya 2017 to refresh the panel size. # We encased this workaround in a try/except since we cannot be sure # that it will still work without errors in future versions of Maya. try: engine.logger.debug( "Forcing Maya to refresh workspace panel %s size.", maya_panel_name, ) # Create a new empty workspace control tab. name = cmds.workspaceControl( uuid.uuid4().hex, tabToControl=(maya_panel_name, -1), # -1 to append a new tab uiScript="", r=True, ) # raise at the top of its workspace area # Delete the empty workspace control. cmds.deleteUI(name) # Delete the empty workspace control state that was created # when deleting the empty workspace control. cmds.workspaceControlState(name, remove=True) except: engine.logger.debug( "Cannot force Maya to refresh workspace panel %s size.", maya_panel_name, ) return maya_panel_name # Retrieve the Channel Box dock area, with error reporting turned off. # This MEL function is declared in Maya startup script file UIComponents.mel. # It returns an empty string when a dock area cannot be found, but Maya will # retrieve the Channel Box dock area even when it is not shown in the current workspace. dock_area = mel.eval( 'getUIComponentDockControl("Channel Box / Layer Editor", false)' ) engine.logger.debug("Retrieved Maya dock area %s.", dock_area) # This UI script will be called to build the UI of the new dock tab. # It will embed the Shotgun app panel into a Maya workspace control. # Since Maya 2017 expects this script to be passed in as a string, # not as a function pointer, it must retrieve the current module in order # to call function build_workspace_control_ui() that actually builds the UI. # Note that this script will be saved automatically with the workspace control state # in the Maya layout preference file when the user quits Maya, and will be executed # automatically when Maya is restarted later by the user. ui_script = ( "import sys\n" "import maya.api.OpenMaya\n" "import maya.utils\n" "for m in sys.modules:\n" " if 'tk_maya.panel_generation' in m:\n" " try:\n" " sys.modules[m].build_workspace_control_ui('%(panel_name)s')\n" " except Exception, e:\n" " msg = 'Shotgun: Cannot restore %(panel_name)s: %%s' %% e\n" " fct = maya.api.OpenMaya.MGlobal.displayError\n" " maya.utils.executeInMainThreadWithResult(fct, msg)\n" " break\n" "else:\n" " msg = 'Shotgun: Cannot restore %(panel_name)s: Shotgun is not currently running'\n" " fct = maya.api.OpenMaya.MGlobal.displayError\n" " maya.utils.executeInMainThreadWithResult(fct, msg)\n" % {"panel_name": shotgun_panel_name} ) # Dock the Shotgun app panel into a new workspace control in the active Maya workspace. engine.logger.debug("Creating Maya workspace panel %s.", maya_panel_name) kwargs = { "uiScript": ui_script, "retain": False, # delete the dock tab when it is closed "label": title, "r": True, } # raise at the top of its workspace area # When we are in a Maya workspace where the Channel Box dock area can be found, # dock the Shotgun app panel into a new tab of this Channel Box dock area # since the user was used to this behaviour in previous versions of Maya. # When we are in a Maya workspace where the Channel Box dock area can not be found, # let Maya embed the Shotgun app panel into a floating workspace control window. kwargs["tabToControl"] = (dock_area, -1) # -1 to append a new tab cmds.workspaceControl(maya_panel_name, **kwargs) return maya_panel_name
def create(self): """Main UI function @usage: selectedCM.UI() :return: None """ # delete the window if exists if pm.window(self.window, exists=True): pm.deleteUI(self.window, window=True) # initialize the window pm.window(self.window, title=self.title, wh=self.size, s=False) # main form layout self.mainForm = pm.formLayout() # frame for Stored files self.textscroll_listFrame = pm.frameLayout(label='Stored Component Files') # Stored files grid 2x1 and text_scroll_list which has double_click_cmd and select_cmd self.textscroll_listGrid = pm.columnLayout(w=self.size[0]/2-2, h=self.size[1]-2, cw=self.size[0]/2-2) pm.separator(h=5) self.optionMenuLbl = pm.optionMenuGrp("character_menu", label="Characters:", w=self.size[0]/2-10, h=30, ct2=['left', 'both'], co2=[5, 0], cw2=[65, 95], cc=self.get_files_cmd) pm.separator(h=10) # pm.setParent(self.textscroll_listForm) self.txtScrlLs = pm.textScrollList("txtScrlLs", w=self.size[0]/2-4, h=410, dcc=self.double_click_cmd, sc=self.select_cmd) # setting the parent to the main form and frame for control buttons pm.setParent(self.mainForm) self.controlFrame = pm.frameLayout(label='Control') # control buttons grid 10x1 and buttons to control the selections and files self.controlGrid = pm.columnLayout(w=self.size[0]/2-2, cw=self.size[0]/2-2) pm.separator(h=10) self.newCharacterBtn = pm.button(label='New Character', w=self.size[0]/2-4, h=30, c=self.new_character_btn_cmd) self.renameCharacterBtn = pm.button(label='Rename Character', w=self.size[0]/2-4, h=30, c=self.rename_character_btn_cmd) self.deleteCharacterBtn = pm.button(label='Delete Character', w=self.size[0]/2-4, h=30, c=self.delete_character_btn_cmd) pm.separator(h=40) self.newSetBtn = pm.button(label='New Set', w=self.size[0]/2-4, h=30, c=self.new_set_btn_cmd) self.updateSetBtn = pm.button(label='Update Set', w=self.size[0]/2-4, h=30, c=self.update_set_btn_cmd) self.deleteSetBtn = pm.button(label='Delete Set', w=self.size[0]/2-4, h=30, c=self.delete_set_btn_cmd) pm.separator(h=40) self.addToSelectionBtn = pm.button(label='Add To Selection', w=self.size[0]/2-4, h=30, c=self.add_to_selection_btn_cmd) self.subFromSelectionBtn = pm.button(label='Sub From Selection', w=self.size[0]/2-4, h=30, c=self.sub_from_selection_btn_cmd) pm.separator(h=40) self.doneBtn = pm.button(label='QUIT', w=self.size[0]/2-4, h=30, c=self.done_btn_cmd) # attach stored files frame and control buttons frame in main form ac = [] af = [] ac.append([self.controlFrame, 'left', 0, self.textscroll_listFrame]) af.append([self.textscroll_listFrame, 'left', 0]) af.append([self.textscroll_listFrame, 'top', 0]) af.append([self.textscroll_listFrame, 'bottom', 0]) af.append([self.controlFrame, 'right', 0]) af.append([self.controlFrame, 'top', 0]) af.append([self.controlFrame, 'bottom', 0]) pm.formLayout(self.mainForm, e=True, attachControl=ac, attachForm=af) # show the window pm.showWindow(self.window) # force the window size pm.window(self.window, e=True, wh=self.size) self.characterList = init_folder(self.dirName) populate_characters(self.dirName, self.selectedCharacter, self.characterList, self.selectedFile)
def build(self): #check for pre-existing window if pm.window(self.winName, ex=True): pm.deleteUI(self.winName, wnd=True) if not pm.windowPref(self.winName, ex=True): pm.windowPref(self.winName, tlc=(200, 200)) pm.windowPref(self.winName, e=True, w=280, h=100) with pm.window(self.winName, rtf=1, mb=1, tlb=True, t='Resetter %s' % __version__) as self.win: imenu = pm.menu(l='Info') pm.setParent(imenu, m=True) pm.menuItem(l='List Objects with Defaults', c=pm.Callback(listObjectsWithDefaults)) pm.menuItem(l='Select Objects with Defaults', c=pm.Callback(selectObjectsWithDefaults)) pm.menuItem(l='List Defaults', c=pm.Callback(listDefaults)) with pm.formLayout(nd=100) as form: with pm.frameLayout(l='Set/Remove Defaults', bs='out', mw=2, mh=2, cll=True, cl=True) as setFrame: with pm.columnLayout(rs=2, adj=True): pm.button( l='Set Defaults', c=pm.Callback(setDefaults), bgc=self.colSet, ann= 'Set defaults on the selected objects using all keyable attributes' ) pm.button( l='Set Defaults Include Non-Keyable', c=pm.Callback(setDefaultsNonkeyable), bgc=self.colSet, ann= 'Set defaults on the selected objects using keyable and non-keyable attributes in the channel box' ) pm.button( l='Set Defaults with CB Selection', c=pm.Callback(setDefaultsCBSelection), bgc=self.colSet, ann= 'Set defaults on the selected objects using the selected channel box attributes' ) pm.button( l='Remove Defaults', c=pm.Callback(removeDefaults), bgc=self.colRemove, ann='Remove all defaults from the selected objects' ) pm.button( l='Remove from All Objects', c=pm.Callback(removeAllDefaults), bgc=self.colRemove, ann='Remove defaults from all objects in the scene' ) with pm.frameLayout(l='Reset', bs='out', mw=2, mh=2) as resetFrame: with pm.formLayout(nd=100) as resetForm: b6 = pm.button( l='Smart', c=pm.Callback(resetSmart), bgc=self.colReset, ann= 'Reset the selected objects. Uses transform standards if no defaults are defined for translate, rotate, and scale' ) b7 = pm.button( l='Default', c=pm.Callback(reset), bgc=self.colReset, ann= 'Reset the selected objects using only stored defaults, if any' ) b8 = pm.button( l='Transform', c=pm.Callback(resetTransform), bgc=self.colReset, ann= 'Reset the selected objects using only transform standards for translate, rotate, scale (eg. 0, 0, 1)' ) b9 = pm.button( l='All', c=pm.Callback(resetAll), bgc=self.colReset2, ann='Reset all objects in the scene with defaults') pm.formLayout(resetForm, e=True, ap=[ (b6, 'left', 0, 0), (b6, 'right', 2, 25), (b7, 'left', 2, 25), (b7, 'right', 2, 50), (b8, 'left', 2, 50), (b8, 'right', 2, 75), (b9, 'left', 2, 75), (b9, 'right', 2, 100), ]) mw = 4 pm.formLayout( form, e=True, af=[(setFrame, 'left', mw), (setFrame, 'right', mw), (resetFrame, 'left', mw), (resetFrame, 'right', mw)], ac=[(resetFrame, 'top', 2, setFrame)], )
def new_character_btn_cmd(self, *args): """ This button command opens a new character naming window and creates a new character folder on the directory folder. :return: None """ def store_character_name_cmd(*args): """ This command stores the written name for new character and populate it by using the populate characters module :return: None """ src = pm.textField("NewCName", q=True, tx=True) if src is None or len(src) < 1: None else: new_character = self.dirName + src if not os.path.exists(new_character): os.makedirs(new_character) quit_character_win_cmd() self.selectedCharacter = src self.characterList = str(new_character+"/") populate_characters(self.dirName, self.selectedCharacter, self.characterList, self.selectedFile) else: pm.confirmDialog(t='Error', b=['OK'], m='This folder name exists.') return None # this command checks the side window is open or not. def quit_character_win_cmd(*args): """ Checks the new character window exists :return: None """ if pm.window('newCharacterWin', exists=True): pm.deleteUI('newCharacterWin', window=True) # side windows tag name new_character_win = 'newCharacterWin' # activation the delete_set_cmd to check the window quit_character_win_cmd() # size of the side window size = (250, 80) # initialize the side window pm.window(new_character_win, wh=size, s=False, t='New Character Name') # main form layout mainForm = pm.formLayout() # controls new_character_text = pm.text(label='New Character Name') new_character_text_field = pm.textField("NewCName", text="") new_character_text_btn = pm.button(label='ADD CHARACTER', c=store_character_name_cmd, p=mainForm, w=100, h=26) cancel_btn = pm.button(label='CANCEL', c=quit_character_win_cmd, p=mainForm, w=100, h=26) # attach the controls to main form ac = [] af = [] ac.append([new_character_text_field, 'top', 5, new_character_text]) ac.append([new_character_text_field, 'bottom', 5, new_character_text_btn]) ac.append([new_character_text_field, 'bottom', 5, cancel_btn]) af.append([new_character_text, 'top', 5]) af.append([new_character_text, 'left', 5]) af.append([new_character_text, 'right', 5]) af.append([new_character_text_field, 'left', 5]) af.append([new_character_text_field, 'right', 5]) af.append([new_character_text_btn, 'left', 5]) af.append([new_character_text_btn, 'bottom', 5]) af.append([cancel_btn, 'right', 5]) af.append([cancel_btn, 'bottom', 5]) pm.formLayout(mainForm, e=True, attachControl=ac, attachForm=af) # force the window size pm.window(new_character_win, e=True, wh=size) # initialize the window pm.showWindow(new_character_win)
def new_set_btn_cmd(self, *args): """This function is for creating a new selecting set getting the selected component list from get_selection func. :return: """ selected_component_list = self.get_selection() if selected_component_list is None: return # this function activates when the user presses the ADD SET btn it gets the file names from the path to compare # the new file name otherwise it sends the new file name in the path and the selected component list to # export_component function if selected_component_list[0].startswith("vtx["): suffix = "_vtx" elif selected_component_list[0].startswith("vtxFace["): suffix = "_vtxFace" elif selected_component_list[0].startswith("e["): suffix = "_edge" elif selected_component_list[0].startswith("f["): suffix = "_poly" else: None def store_set_name_cmd(*args): """ Stores the new set :return: None """ src = pm.textField("NewSName", q=True, tx=True) src = src + suffix if src is None or len(src) < 1: None else: comp_files = os.listdir(self.characterList) if comp_files is None or len(comp_files) < 1: new_path = self.characterList + "/" + src + ".cse" delete_set_cmd() export_component(new_path, selected_component_list) populate_characters(self.dirName, self.selectedCharacter, self.characterList, self.selectedFile) else: for comp_file in comp_files: if comp_file.endswith(".cse"): test = str(src+".cse") if test == comp_file: pm.confirmDialog(t='Error', b=['OK'], m='This file name exists.') return None else: new_path = self.characterList + "/" + src + ".cse" delete_set_cmd() export_component(new_path, selected_component_list) populate_characters(self.dirName, self.selectedCharacter, self.characterList, self.selectedFile) def delete_set_cmd(*args): """ This command checks the side window is open or not. :return: None """ if pm.window('newSetWin', exists=True): pm.deleteUI('newSetWin', window=True) # side windows tag name new_set_win = 'newSetWin' # activation the delete_set_cmd to check the window delete_set_cmd() # size of the side window size = (250, 80) # initialize the side window pm.window(new_set_win, wh=size, s=False, t='New Set Name') # main form layout main_form = pm.formLayout() # controls new_set_text = pm.text(label='New Set Name') new_set_text_field = pm.textField("NewSName", text="") new_set_text_btn = pm.button(label='ADD SET', c=store_set_name_cmd, p=main_form, w=100, h=26) cancel_btn = pm.button(label='CANCEL', c=delete_set_cmd, p=main_form, w=100, h=26) # attach the controls to main form ac = [] af = [] ac.append([new_set_text_field, 'top', 5, new_set_text]) ac.append([new_set_text_field, 'bottom', 5, new_set_text_btn]) ac.append([new_set_text_field, 'bottom', 5, cancel_btn]) af.append([new_set_text, 'top', 5]) af.append([new_set_text, 'left', 5]) af.append([new_set_text, 'right', 5]) af.append([new_set_text_field, 'left', 5]) af.append([new_set_text_field, 'right', 5]) af.append([new_set_text_btn, 'left', 5]) af.append([new_set_text_btn, 'bottom', 5]) af.append([cancel_btn, 'right', 5]) af.append([cancel_btn, 'bottom', 5]) pm.formLayout(main_form, e=True, attachControl=ac, attachForm=af) # force the window size pm.window(new_set_win, e=True, wh=size) # initialize the window pm.showWindow(new_set_win)
def dock_panel(engine, panel_id, widget_instance, title): """ Docks a Shotgun app panel widget in a new panel tab of Maya Channel Box dock area. :param engine: :class:`MayaEngine` instance running in Maya. :param panel_id: Unique string identifier for the Shotgun app panel. :param widget_instance: Qt widget at the root of the Shotgun app panel. This Qt widget is assumed to be child of Maya main window. Its name can be used in standard Maya commands to reparent it under a Maya panel. :param title: Title to give to the new dock tab. """ # The imports are done here rather than at the module level to avoid spurious imports # when this module is reloaded in the context of a workspace control UI script. import maya.mel as mel import maya.utils import pymel.core as pm # Retrieve the unique string identifier naming the Qt widget. widget_id = widget_instance.objectName() # Create the Maya panel name. maya_panel_id = "panel_%s" % panel_id # When the Maya panel already exists, it can be deleted safely since its embedded # Shotgun app panel widget has already been reparented under Maya main window. if pm.control(maya_panel_id, query=True, exists=True): engine.log_debug("Deleting existing Maya panel %s." % maya_panel_id) pm.deleteUI(maya_panel_id) # Use the proper Maya panel docking method according to the Maya version. if mel.eval("getApplicationVersionAsFloat()") < 2017: # Create a new Maya window. maya_window = pm.window() engine.log_debug("Created Maya window %s." % maya_window) # Add a layout to the Maya window. maya_layout = pm.formLayout(parent=maya_window) engine.log_debug("Created Maya layout %s." % maya_layout) # Reparent the Shotgun app panel widget under the Maya window layout. engine.log_debug("Reparenting Shotgun app panel widget %s under Maya layout %s." % (widget_id, maya_layout)) pm.control(widget_id, edit=True, parent=maya_layout) # Keep the Shotgun app panel widget sides aligned with the Maya window layout sides. pm.formLayout(maya_layout, edit=True, attachForm=[(widget_id, 'top', 1), (widget_id, 'left', 1), (widget_id, 'bottom', 1), (widget_id, 'right', 1)] ) # Dock the Maya window into a new tab of Maya Channel Box dock area. engine.log_debug("Creating Maya panel %s." % maya_panel_id) pm.dockControl(maya_panel_id, area="right", content=maya_window, label=title) # Once Maya will have completed its UI update and be idle, # raise (with "r=True") the new dock tab to the top. maya.utils.executeDeferred("cmds.dockControl('%s', edit=True, r=True)" % maya_panel_id) else: # Maya 2017 and later # Delete any default workspace control state that might have been automatically # created by Maya when a previously existing Maya panel was closed and deleted. if pm.workspaceControlState(maya_panel_id, exists=True): engine.log_debug("Deleting existing Maya workspace panel state %s." % maya_panel_id) pm.workspaceControlState(maya_panel_id, remove=True) # Retrieve the Channel Box dock area, with error reporting turned off. # This MEL function is declared in Maya startup script file UIComponents.mel. # It returns an empty string when this dock area cannot be found in the active Maya workspace. dock_area = mel.eval('getUIComponentDockControl("Channel Box / Layer Editor", false)') engine.log_debug("Retrieved Maya dock area %s." % dock_area) # This UI script will be called to build the UI of the new dock tab. # It will embed the Shotgun app panel widget into a Maya workspace control. # Maya 2017 expects this script to be passed in as a string, not as a function pointer. # See function _build_workspace_control_ui() below for a commented version of this script. ui_script = "import pymel.core as pm\n" \ "workspace_control = pm.setParent(query=True)\n" \ "pm.control('%s', edit=True, parent=workspace_control)" \ % widget_id # The following UI script can be used for development and debugging purposes. # This script has to retrieve and import the current source file in order to call # function _build_workspace_control_ui() below to build the workspace control UI. # ui_script = "import imp\n" \ # "panel_generation = imp.load_source('%s', '%s')\n" \ # "panel_generation._build_workspace_control_ui('%s')" \ # % (__name__, __file__.replace(".pyc", ".py"), widget_id) # Give an initial width to the docked Shotgun app panel widget when first shown. # Otherwise, the workspace control would use the width of the currently displayed tab. size_hint = widget_instance.sizeHint() if size_hint.isValid(): # Use the widget layout preferred size. widget_width = size_hint.width() else: # Since no size is recommended for the widget, use its current width. widget_width = widget_instance.width() engine.log_debug("Widget %s width: %s" % (widget_id, widget_width)) # Dock the Shotgun app panel widget into a new tab of the Channel Box dock area. # When this dock area was not found in the active Maya workspace, # the Shotgun app panel widget is embedded into a floating workspace control window. # This floating workspace control can then be docked into an existing dock area by the user. engine.log_debug("Creating Maya workspace panel %s." % maya_panel_id) dock_tab = pm.workspaceControl(maya_panel_id, tabToControl=(dock_area, -1), # -1 to append a new tab uiScript=ui_script, loadImmediately=True, retain=False, # delete the dock tab when it is closed label=title, initialWidth=widget_width, minimumWidth=True, # set the minimum width to the initial width r=True # raise the new dock tab to the top ) # Now that the workspace dock tab has been created, let's update its UI script. # This updated script will be saved automatically with the workspace control state # in the Maya layout preference file when the user will choose to quit Maya, # and will be executed automatically when Maya is restarted later by the user. # The script will delete the empty workspace dock tab that Maya will recreate on startup # when the user previously chose to quit Maya while the panel was opened. deferred_script = "import maya.cmds as cmds\\n" \ "if cmds.workspaceControl('%(id)s', exists=True):\\n" \ " cmds.deleteUI('%(id)s')" \ % {"id": maya_panel_id} # The previous script will need to be executed once Maya has completed its UI update and be idle. ui_script = "import maya.utils\n" \ "maya.utils.executeDeferred(\"%s\")\n" \ % deferred_script # Update the workspace dock tab UI script. pm.workspaceControl(maya_panel_id, edit=True, uiScript=ui_script)
def inspectProperties(self, *args): modeSet = ["FK", "IK", "IK/FK"] rotOrderSet = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"] guideModeSet = ["Final", "WIP"] # apply changes def applyCloseGuide(root, *args): if pm.attributeQuery("mode", node=root, ex=True): root.attr("mode").set(guideModeSet.index(pMode.getValue())) pm.select(root, r=True) pm.deleteUI(window, window=True) def skinLoad(root, *args): startDir = root.attr("skin").get() filePath = pm.fileDialog2(dialogStyle=2, fileMode=1, startingDirectory=startDir, fileFilter='mGear skin (*%s)' % skin.FILE_EXT) if not filePath: return if not isinstance(filePath, basestring): filePath = filePath[0] root.attr("skin").set(filePath) def applyCloseComp(root, *args): newName = pName.getText() newSide = pSide.getValue() newIndex = pIndex.getValue1() if pm.attributeQuery("mode", node=root, ex=True): root.attr("mode").set(modeSet.index(pMode.getValue())) if pm.attributeQuery("default_rotorder", node=root, ex=True): root.attr("default_rotorder").set( rotOrderSet.index(pRotOrder.getValue())) guide = shifter.RigGuide() guide.updateProperties(root, newName, newSide, newIndex) pm.select(root, r=True) pm.deleteUI(window, window=True) if pm.window("compProperties", exists=True): pm.deleteUI("compProperties") oSel = pm.selected() if oSel: root = oSel[0] else: mgear.log("Select one root Guide or component to edit properties", mgear.sev_error) return if pm.attributeQuery("comp_type", node=root, ex=True): #property window constructor customAttr = pm.listAttr(root, ud=True) window = pm.window(title=root.name()) pm.columnLayout(adjustableColumn=True, cal="right") for attr in customAttr: if attr == "comp_name": fl = pm.formLayout() oriVal = root.attr("comp_name").get() pName = pm.textFieldGrp(l="comp_name") pm.setParent('..') pm.formLayout(fl, e=True, af=(pName, "left", 0)) pName.setText(oriVal) elif attr == "comp_side": sideSet = ["C", "L", "R"] fl = pm.formLayout() pSide = pm.optionMenu(l="comp_side") pSide.addMenuItems(sideSet) pSide.setWidth(120) pm.setParent('..') pm.formLayout(fl, e=1, af=(pSide, "left", 90)) oriVal = root.attr("comp_side").get() pSide.setValue(oriVal) elif attr == "mode": fl = pm.formLayout() pMode = pm.optionMenu(l="mode") pMode.addMenuItems(modeSet) pMode.setWidth(120) pm.setParent('..') pm.formLayout(fl, e=1, af=(pMode, "left", 115)) oriVal = root.attr("mode").get() pMode.setValue(modeSet[oriVal]) elif attr == "default_rotorder": fl = pm.formLayout() pRotOrder = pm.optionMenu(l="default_rotorder") pRotOrder.addMenuItems(rotOrderSet) pRotOrder.setWidth(140) pm.setParent('..') pm.formLayout(fl, e=1, af=(pRotOrder, "left", 60)) oriVal = root.attr("default_rotorder").get() pRotOrder.setValue(rotOrderSet[oriVal]) elif attr == "comp_index": fl = pm.formLayout() oriVal = root.attr("comp_index").get() pIndex = pm.intFieldGrp(v1=oriVal, l="comp_index") pm.setParent('..') pm.formLayout(fl, e=True, af=(pIndex, "left", 0)) else: editable = True if attr == "comp_type": editable = False pm.columnLayout(cal="right") pm.attrControlGrp(attribute=root.attr(attr), po=True, en=editable) pm.setParent('..') pm.button(label='Apply', command=partial(applyCloseComp, root), h=100) pm.setParent('..') pm.showWindow(window) elif pm.attributeQuery("ismodel", node=root, ex=True): #property window constructor customAttr = pm.listAttr(root, ud=True) window = pm.window(title=root.name()) pm.columnLayout(adjustableColumn=True, cal="right") for attr in customAttr: if attr.split("_")[-1] not in ["r", "g", "b"]: if attr == "mode": fl = pm.formLayout() pMode = pm.optionMenu(l="mode") pMode.addMenuItems(guideModeSet) pMode.setWidth(120) pm.setParent('..') pm.formLayout(fl, e=1, af=(pMode, "left", 115)) oriVal = root.attr("mode").get() pMode.setValue(guideModeSet[oriVal]) elif attr == "skin": pm.columnLayout(cal="right") pm.attrControlGrp(attribute=root.attr(attr), po=True) pm.setParent('..') pm.button(label='Load Skin ', command=partial(skinLoad, root)) else: pm.columnLayout(cal="right") pm.attrControlGrp(attribute=root.attr(attr), po=True) pm.setParent('..') pm.button(label='Apply', command=partial(applyCloseGuide, root), h=50) pm.setParent('..') pm.showWindow(window) else: mgear.log("Select a root Guide or component to edit properties", mgear.sev_error) return
def createWindow(): """ try to get data from shotgun project fields need to get context's project context's shotgun instance """ app = self.parent project = app.context.project sg = app.context.tank.shotgun # set filters and search fields for entity type "Project" filters = [ ["id", "is", project['id']], ] fields = ["sg_width", "sg_height"] result = sg.find_one("Project", filters, fields) # with result, set parameters accordingly or use default otherwise if result: videoWidth = result.get("sg_width", DEFAULT_WIDTH) videoHeight = result.get("sg_height", DEFAULT_HEIGHT) # Find first camera matching pattern and set as active camera # if not use default current active camera camera_name_pattern = app.get_setting("camera_name_pattern", "persp") cameraList = [ c.name() for c in pm.ls(type="camera", r=True) if re.search(camera_name_pattern, c.name()) ] #print cameraList if not "cam" in MODEL_EDITOR_PARAMS.keys() and cameraList: MODEL_EDITOR_PARAMS["cam"] = cameraList[0] #print MODEL_EDITOR_PARAMS # Give Viewport 2.0 renderer only for Maya 2015++ # mayaVersionString = cmds.about(version=True) # mayaVersion = int(mayaVersionString[:4]) if len(mayaVersionString) >= 4 else 0 # if mayaVersion >= 2015: # params[ "rendererName" ] = "vp2Renderer" # Create window if pm.windowPref(PLAYBLAST_WINDOW, exists=True): pm.windowPref(PLAYBLAST_WINDOW, remove=True) window = pm.window(PLAYBLAST_WINDOW, titleBar=True, iconify=True, leftEdge=100, topEdge=100, width=videoWidth, height=videoHeight, sizeable=False) # Create editor area layout = pm.formLayout() editor = pm.modelEditor(**MODEL_EDITOR_PARAMS) pm.setFocus(editor) pm.formLayout(layout, edit=True, attachForm=((editor, "left", 0), (editor, "top", 0), (editor, "right", 0), (editor, "bottom", 0))) # Show window pm.setFocus(editor) pm.showWindow(window) pm.refresh() try: yield True except: traceback.print_exc() finally: pm.deleteUI(window)
ToolsSc = pm.scrollLayout('Controls', p='Tabs', w=300, h=350) ToolsSc = pm.scrollLayout('Tools', p='Tabs') channelbox = pm.channelBox( 'ChannelBox', p='Tabs', ac=[(.8), (.9), (1)], bc=[(.3), (.3), (.3)], fw=150, hlc=[(.2), (.6), (.4)], hol=1, ln=1, nn=0, m=1, pre=5, ) out = pm.formLayout('Outliner', p='Tabs', w=300, h=330) outpanel = pm.outlinerPanel(p='Outliner') SkinSc = pm.scrollLayout('Skin', p='Tabs') ScriptEdt = pm.scrollLayout('MelCmd', p='Tabs') MiscSc = pm.scrollLayout('Misc', p='Tabs') cmdShll = cmds.cmdShell(p='MelCmd', w=295, h=302, bgc=[(.17), (.18), (.19)]) clearBtn = pm.symbolButton('minusBtn', p='MelCmd', i='clearAll.png', w=295, h=43, ebg=1, bgc=[(.1), (.11), (.11)], en=1,
def OpenMayaCommonGlobalsCreateTab(self): log.debug("OpenMayaCommonGlobalsCreateTab()") scLo = "scrollLayout" parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) if self.rendererTabUiDict.has_key('common'): self.rendererTabUiDict.pop('common') uiDict = {} self.rendererTabUiDict['common'] = uiDict clo = "clo" with pm.frameLayout(clo, labelVisible=False, collapsable=False, mw=8, mh=5, borderVisible=False): with pm.columnLayout(adj=True): uiDict['imgpath'] = pm.text(label="Path:", align="left", font="smallBoldLabelFont") uiDict['imgname'] = pm.text(label="File Name:", align="left", font="smallBoldLabelFont") uiDict['imgsize'] = pm.text(label="Image Size:", align="left", font="smallBoldLabelFont") with pm.scrollLayout(scLo, horizontalScrollBarThickness=0) as sl: print "Scroll layout", sl with pm.columnLayout("commonTabColumn", adjustableColumn=True, width=400) as ctc: print "common", ctc with pm.frameLayout(label="File Output", collapsable=True, collapse=False): with pm.columnLayout(adjustableColumn=True, width=400): pm.textFieldGrp(label="File Name Prefix:") pm.attrEnumOptionMenuGrp( "imageMenuMayaSW", label="Image Format:", attribute=self.renderNode.imageFormat) uiDict['imageNumbering'] = pm.optionMenuGrp( label="Frame/Animation ext:", changeCommand=self.setFrameNumbering) for value in ["name.ext", "name.#.ext"]: pm.menuItem(value) if self.defaultGlobals.animation.get(): uiDict['imageNumbering'].setSelect(2) self.addRenderDefaultGlobalsUIElement( attName='extensionPadding', uiType='int', displayName='Frame Padding:', uiDict=uiDict) with pm.frameLayout(label="Frame Range", collapsable=True, collapse=False) as frameRangeLayout: uiDict['frameRangeLayout'] = frameRangeLayout with pm.columnLayout(adjustableColumn=True, width=400): self.addRenderDefaultGlobalsUIElement( attName='startFrame', uiType='float', displayName='Start Frame:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='endFrame', uiType='float', displayName='End Frame:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='byFrame', uiType='float', displayName='By Frame:', uiDict=uiDict) with pm.frameLayout(label="Renderable Cameras", collapsable=True, collapse=False): with pm.columnLayout(adjustableColumn=True, width=400): for cam in pm.ls(type="camera"): pm.checkBoxGrp(label=cam.name(), value1=cam.renderable.get(), cc=pm.Callback( self.switchCamRenderable, cam)) with pm.frameLayout(label="Image Size", collapsable=True, collapse=False): with pm.columnLayout(adjustableColumn=True, width=400): uiDict['imageSizePresets'] = pm.optionMenuGrp( label="Presets:", changeCommand=self.setImageSize) for imgFormat in self.imageFormatData: pm.menuItem(imgFormat[0]) #uiDict['imageSizePresets'].setSelect(12) self.addRenderDefaultResGlobalsUIElement( attName='aspectLock', uiType='bool', displayName='Maintain aspect ratio', uiDict=uiDict) self.addRenderDefaultResGlobalsUIElement( attName='width', uiType='int', displayName='Width:', uiDict=uiDict, callback=pm.Callback(self.updateImageSize, "width")) self.addRenderDefaultResGlobalsUIElement( attName='height', uiType='int', displayName='Height:', uiDict=uiDict, callback=pm.Callback(self.updateImageSize, "height")) self.addRenderDefaultResGlobalsUIElement( attName='deviceAspectRatio', uiType='float', displayName='Device Aspect:', uiDict=uiDict, callback=pm.Callback(self.updateImageSize, "devAsp")) #self.addRenderDefaultResGlobalsUIElement(attName='pixelAspect', uiType='float', displayName='Pixel Aspect:', uiDict=uiDict, callback=self.updateImageSize) with pm.frameLayout(label="Render Scripts", collapsable=True, collapse=False): with pm.columnLayout(adjustableColumn=True, width=400): self.addRenderDefaultGlobalsUIElement( attName='preMel', uiType='string', displayName='Pre Render Mel:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='postMel', uiType='string', displayName='Post Render Mel:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='preRenderLayerMel', uiType='string', displayName='Pre Layer Mel:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='postRenderLayerMel', uiType='string', displayName='Post Layer Mel:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='preRenderMel', uiType='string', displayName='Pre Frame Mel:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='postRenderMel', uiType='string', displayName='Post Frame Mel:', uiDict=uiDict) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[(clo, "right", 0), (clo, "left", 0), (clo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0)], attachControl=[(scLo, "top", 0, clo)]) #self.setImageSize("HD_540") # set default self.OpenMayaCommonGlobalsUpdateTab()