def uiContents(): with pm.frameLayout(l='Export To AE Tools', cll=True, mw=3, mh=3, bs='etchedIn'): with pm.columnLayout(adj=True): with pm.rowLayout(nc=10): pm.text(l='Create Static Null : ', w=labelWidth, align='right') pm.button(l='Select Transform and Excute', c=pm.Callback( btn_createStaticNull ), w=160) #pm.button(l='d', w=20, c=pm.Callback( pm.launch, web="http://www.braverabbit.de/playground/dp=443") ) #pm.button(l='t', w=20, c=pm.Callback( pm.launch, web="https://www.youtube.com/watch?v=YvNdYseSNFs") ) #pm.button(l='t', w=20, c=pm.Callback( excuteWindowFile, 'alembicExporter.flv') ) with pm.rowLayout(nc=10): pm.text(l='Create Active Null : ', w=labelWidth, align='right') pm.button(l='Select Transform and Excute', c=pm.Callback( btn_createActiveNull ), w=160) #pm.button(l='d', w=20, c=pm.Callback( pm.launch, web="http://www.braverabbit.de/playground/dp=443") ) #pm.button(l='t', w=20, c=pm.Callback( pm.launch, web="https://www.youtube.com/watch?v=YvNdYseSNFs") ) #pm.button(l='t', w=20, c=pm.Callback( excuteWindowFile, 'alembicExporter.flv') ) with pm.rowLayout(nc=10): pm.text(l='Create aeCamera : ', w=labelWidth, align='right') pm.button(l='Select Camera and Excute', c=pm.Callback( btn_createAECam ), w=160) #pm.button(l='d', w=20, c=pm.Callback( pm.launch, web="http://www.braverabbit.de/playground/dp=443") ) #pm.button(l='t', w=20, c=pm.Callback( pm.launch, web="https://www.youtube.com/watch?v=YvNdYseSNFs") ) #pm.button(l='t', w=20, c=pm.Callback( excuteWindowFile, 'alembicExporter.flv') ) with pm.frameLayout(l='Support Tools', cll=True, mw=3, mh=3, bs='etchedIn'): with pm.columnLayout(adj=True): with pm.rowLayout(nc=10): pm.text(l='PrimaryVis : ', w=labelWidth, align='right') pm.button(l='OFF', c=pm.Callback( btn_primaryVisibilityOff ), w=160)
def layersReplace(self, attribute): if attribute is not "none": self.thisNode = pm.PyNode(attribute).node() log.debug("layersReplace {0}".format(attribute)) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) materialEntries = self.thisNode.materialEntryMtl.numElements() #print "layersReplace: node has ", self.thisNode.materialEntryMtl.numElements(), "layers" if self.layersUi is not None and pm.columnLayout(self.layersUi, q=True, exists=True): pm.deleteUI(self.layersUi) with pm.columnLayout(adj=True, parent=self.uiParent) as self.layersUi: for layerNumber in range(materialEntries): layerIndex = self.thisNode.materialEntryMtl.elementByPhysicalIndex(layerNumber).index() with pm.frameLayout(label="Layer {0}".format(layerNumber), collapsable=True, collapse=False, bv=True) as fl: log.debug("create layers UI {0}".format(self.thisNode.materialEntryMtl[layerIndex])) with pm.columnLayout(adj=True): attribute = self.thisNode.materialEntryMtl[layerIndex] if attribute.isConnected(): pm.frameLayout(fl, edit=True, label=attribute.inputs(p=1)[0]) pm.attrColorSliderGrp(label="Material", at=attribute) attribute = self.thisNode.materialEntryMsk[layerIndex] pm.attrFieldSliderGrp(label="Mask", at=attribute) attribute = self.thisNode.materialEntryMode[layerIndex] pm.attrEnumOptionMenuGrp(label="Mode", at=attribute) with pm.columnLayout(adj=True): pm.button(label="Remove Layer", c=pm.Callback(self.removeLayer, layerIndex), height=18) pm.button(label="Layer Up", c=pm.Callback(self.moveLayerUp, layerIndex), height=18) pm.button(label="Layer Down", c=pm.Callback(self.moveLayerDown, layerIndex), height=18) pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
def build(self): """ Build the main header and body for this view. """ with pm.frameLayout('%sHeadFrame' % self.viewName, mw=self._headMargins[0], mh=self._headMargins[1], lv=False, bv=False) as self._headFrame: self.buildHeader() with pm.frameLayout('%sFrame' % self.viewName, mw=self._bodyMargins[0], mh=self._bodyMargins[1], lv=False, bv=False) as self._bodyFrame: self.buildBody() utils.layoutForm(self._layout, (0, 1), spacing=2, vertical=True)
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 toggle_vis(self): value = pm.frameLayout(self.layout, query= True, visible= True) if value == True: pm.frameLayout(self.layout, edit= True, visible= False) if value == False: pm.frameLayout(self.layout, edit= True, visible= True)
def __init__(self, debug=0): title="TransferBlendShapes" if(pm.windowPref(title, q=True, ex=True)): pm.windowPref(title, remove=True) if(pm.window(title, q=True, ex=True)): pm.deleteUI(title) self.win = pm.window(title, title="Transfer BlendShapes Tool") self.rowColumnLayoutA = pm.rowColumnLayout() self.intro = pm.text( label='complete the following steps in order' ) self.frameLayoutA = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 1 Load Target Mesh', borderStyle='in' ) self.columnlayoutA = pm.columnLayout() self.frameLayoutB = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 2 Import Mask', borderStyle='in' ) self.columnlayoutA = pm.columnLayout() self.frameLayoutC = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 3 Manipulate Match Mesh', borderStyle='in' ) self.columnlayoutB = pm.columnLayout() self.frameLayoutD = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 4 Transfer Blends', borderStyle='in' ) self.columnlayoutC = pm.columnLayout() #self.dockControl = pm.dockControl(label=title, area='right', content=title, allowedArea=['right', 'left'], sizeable=True) # fameA content self.names = {'Target':None} # Generating x number of fields based on dictionary keys of self.names for name in self.names: self.names[name] = pm.textFieldButtonGrp(cw = ((1, 76), (2, 176)), parent=self.frameLayoutA, label = name, placeholderText = 'Enter Name Here or >>>> ', buttonLabel = 'load selected', tcc= self.prepTargetMeshOn, buttonCommand = pm.Callback(self.nameField_load, name)) self.btn_prepTgt = pm.button(parent=self.frameLayoutA, enable=False, w=40, h=20, label="Prep Target", command=self.prepTargetMesh) self.fA_fillText = pm.text(parent=self.frameLayoutA, label=' ' ) # fameB content self.importText = pm.text(parent=self.frameLayoutB, label='Import the desired facial mask' ) self.manipulateText = pm.text(parent=self.frameLayoutB, label='Use the avalable controls to manipulate the mask' ) self.fitText = pm.text(parent=self.frameLayoutB, label='Roughly fit the mask to the target mesh' ) self.btn_trueHuman = pm.button(parent=self.frameLayoutB, enable=True, w=40, h=20, label="Human Anatomy", command=self.humanAnatomyImport) self.btn_trueMuzzle = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Muzzle Anatomy", command=self.muzzleAnatomyImport) self.btn_toonHuman = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Human Toon", command=self.humanToonImport) self.btn_toonMuzzle = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Muzzle Toon", command=self.muzzleToonImport) self.fB_fillText = pm.text(parent=self.frameLayoutB, label=' ' ) # fameC content self.matchMeshText = pm.text(parent=self.frameLayoutC, label='activate match mesh and refine your geometry to better match the target' ) self.btn_trueHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="Activate Match Mesh", command=self.matchMesh) self.btn_templateHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="template Target Mesh", command=self.tempTgt) self.btn_referenceHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="reference Target Mesh", command=self.refTgt) self.sldr_smooth = pm.intSliderGrp(parent=self.frameLayoutC, field=True, label='Match Mesh Divisions', minValue=-0, maxValue=4, fieldMinValue=-0, fieldMaxValue=4, value=0, cc=self.div_Slider_change) self.fC_fillText = pm.text(parent=self.frameLayoutC, label=' ' ) # fameD content self.btn_go = pm.button(parent=self.frameLayoutD, enable=True, w=40, h=20, label="Transfer Shapes", command=self.execute) self.btn_no = pm.button(parent=self.frameLayoutD, enable=True, w=40, h=20, label="NO DONT DO IT!", command=self.close) self.fE_fillText = pm.text(parent=self.frameLayoutD, label=' ' ) self.win.show() if debug: test = ['mask_blendPipe_GEO', 'mask_hiRes_GEO'] for name, test_val in zip(self.names, test): self.names[name].setText(test_val)
def createUISet(self): self._childLayout = pm.columnLayout( adj=True ) with self._childLayout: pm.text(l="Click cage mesh first, then shift+click target mesh, and click the menu item.") self.deformers = pm.ls(type="cage") for i in range(len(self.deformers)): frameLayout = pm.frameLayout( label=self.deformers[i].name(), collapsable = True) with frameLayout: with pm.rowLayout(numberOfColumns=3) : pm.button( l="Del", c=pm.Callback( self.deleteNode, self.deformers[i].name())) pm.attrControlGrp( label="cage mode", attribute= self.deformers[i].cgm) pm.attrControlGrp( label="blend mode", attribute= self.deformers[i].bm) with pm.rowLayout(numberOfColumns=3) : pm.attrControlGrp( label="rotation consistency", attribute= self.deformers[i].rc) pm.attrControlGrp( label="Frechet sum", attribute= self.deformers[i].fs) self.deformers = pm.ls(type="cageARAP") for i in range(len(self.deformers)): frameLayout = pm.frameLayout( label=self.deformers[i].name(), collapsable = True) with frameLayout: with pm.rowLayout(numberOfColumns=4) : pm.button( l="Del", c=pm.Callback( self.deleteNode, self.deformers[i].name())) pm.attrControlGrp( label="cage mode", attribute= self.deformers[i].cgm) pm.attrControlGrp( label="blend mode", attribute= self.deformers[i].bm) pm.attrControlGrp( label="constraint mode", attribute= self.deformers[i].constraintMode) with pm.rowLayout(numberOfColumns=3) : pm.attrControlGrp( label="rotation consistency", attribute= self.deformers[i].rc) pm.attrControlGrp( label="Frechet sum", attribute= self.deformers[i].fs) pm.attrControlGrp( label="constraint weight", attribute= self.deformers[i].constraintWeight)
def ui(): columnWidth1st = 120 if pm.window('AlembicMasterUI', q=True, exists=True) : pm.deleteUI('AlembicMasterUI') with pm.window('AlembicMasterUI',menuBar=True, s=True): with pm.columnLayout(adj=True): with pm.frameLayout( label='Export Alembic', mw=3, mh=3,cll=True, bs='etchedIn'): with pm.columnLayout(adj=True): with pm.rowLayout(nc=3, adj=2): pm.text(label='file :', w=columnWidth1st, align='right') pm.textField('path_TFG', text="D:/") pm.symbolButton( image='navButtonBrowse.png', c=pm.Callback( browseIt, 'path_TFG', 0, 'Alembic (*.abc)' ) ) with pm.rowLayout(nc=2, adj=2 ): startFrame=pm.animation.playbackOptions(q=1, minTime=1) EndFrame=pm.animation.playbackOptions(q=1, maxTime=1) with pm.rowLayout(nc=2, adj=2): pm.text(l='',w=columnWidth1st) pm.button(l='Export',bgc=(0.19,0.29,0.19),c=pm.Callback(exportScene)) pm.radioButtonGrp( 'timeRange_RBG', label='Time range :', labelArray3=['Camera Setting','Time Slider', 'Start/End'], numberOfRadioButtons=3, select=1, cw = [1,columnWidth1st], on1=pm.Callback( callback_timerangeSelect, 1), on2=pm.Callback( callback_timerangeSelect, 2), on3=pm.Callback( callback_timerangeSelect, 3), ) pm.floatFieldGrp( 'timeRange_FFG', label='Start / End : ', value1=1, value2=24, numberOfFields=2, cw = [1,117], en=False) with pm.frameLayout( label='Rebuild Scene', mw=3, mh=3,cll=True, bs='etchedIn'): with pm.columnLayout(adj=True): with pm.rowLayout(nc=2, adj=2): pm.text(l='',w=columnWidth1st) pm.button(l='New Scene', bgc=(0.24,0.49,0.24), c=pm.Callback(buildscene)) with pm.frameLayout( label='Import Alembic', mw=3, mh=3,cll=True, bs='etchedIn'): with pm.columnLayout(adj=True): with pm.rowLayout(nc=3, adj=2): pm.text(label='file :', w=columnWidth1st, align='right') pm.textField('path_ABC2', text="D:/") pm.symbolButton( image='navButtonBrowse.png', c=pm.Callback( browseIt, 'path_ABC2', 1, 'Alembic (*.abc)' ) ) with pm.rowLayout(nc=2, adj=2): pm.text(l='',w=columnWidth1st) pm.button(l='Import', bgc=(0.19,0.19,0.28), c=pm.Callback(importAbcFile)) with pm.frameLayout( label='Save Scene', mw=3, mh=3,cll=True, bs='etchedIn'): with pm.columnLayout(adj=True): with pm.rowLayout(nc=3, adj=2): pm.text(label='file :', w=columnWidth1st, align='right') pm.textField('path_TFG2', text="D:/") pm.symbolButton( image='navButtonBrowse.png', c=pm.Callback( browseIt, 'path_TFG2', 0 ) ) with pm.rowLayout(nc=2, adj=2): pm.text(l='',w=columnWidth1st) pm.button(l='Save Scene', w=64, bgc=(0.22,0.23,0.43), c=pm.Callback(saveScene))
def _gatherEvents(self, instance): """event collector called once after the first Idle Event""" message = "Gathered events by '%s':\n" % instance # get the Id for the key inverseID=dict(zip(self.eventID.values(),self.eventID.keys())) # prompt Result for Id in self.eventRecord: token = str(" ID %4d Event: %s \n" % (Id, inverseID.get(Id,0))) message = message + token # --------------create new UI entry--------------- objUI = self._UIobject.createTextfieldObj(message, "eventID: %s" % inverseID.get(self.eventRecord[0],0),True) mel.setParent(objUI) mel.frameLayout(mw=self._optionMarginWidth,l = 'Command Inspect', collapse = True, collapsable = True) mel.columnLayout('subCol',adj=True) mel.separator(h=self._optionMarginWidth,style="none") mel.scrollField(numberOfLines=3, editable=False, wordWrap=False, h = self._optionInspectHeight, w = self._optionInspectWidth, text = "place Holder" ) mel.separator(h=self._optionMarginWidth,style="none") # reset Event Collection self.eventRecord = [] self.eventID["idle"] = 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 __init__(self): title = 'pbRenderableCurve' version = 1.02 if pm.window('pbRCurve', exists=True): pm.deleteUI('pbRCurve') with pm.window('pbRCurve', title='{0} | {1}'.format(title, version), s=False) as window: with pm.columnLayout(): with pm.frameLayout(l='Selection:', cll=True, bs='out'): with pm.columnLayout(): self.selField = pm.textFieldGrp(text='No Curves Selected', ed=False, l='Curve:', cw2=[72, 192]) with pm.rowLayout(nc=2): self.bRenderable = pm.checkBox(l='Renderable', cc=self.bcRenderable) with pm.frameLayout(l='Mesh Settings:', cll=True, bs='out') as self.meshUI: with pm.columnLayout(): with pm.rowLayout(nc=4): self.useNormal = pm.checkBox(l='Use Normal', cc=self.bcUseNormal) self.normalVector = [pm.intField(width=62, en=False, value=0, cc=self.setNormal), pm.intField(width=62, en=False, value=1, cc=self.setNormal), pm.intField(width=62, en=False, value=0, cc=self.setNormal)] self.meshAttrs = [AttrSlider(maxValue=128, name='Thickness', obj=getCurves, type_='float', fmn=0.0001), AttrSlider(value=3, minValue=3, maxValue=64, name='Sides', obj=getCurves, fmn=3, fmx=100), AttrSlider(minValue=1, maxValue=32, name='Samples', obj=getCurves, fmn=1, fmx=128)] with pm.frameLayout('Shell Settings:', cll=True, bs='out') as self.shellUI: with pm.columnLayout(): self.bShell = pm.checkBox(l='Enable Shell', cc=self.bcShell) self.shellAttrs = [AttrSlider(value=1, minValue=-64, maxValue=64, name='ShellThickness', obj=getCurves, type_='float'), AttrSlider(value=1, minValue=1, maxValue=64, name='ShellDivisions', obj=getCurves, fmn=1, fmx=32)] window.show() pm.scriptJob(event=['SelectionChanged', self.refresh], protected=True, p=window) self.refresh()
def __init__(self): self.window = 'sdkflip' self.title = 'ec Set Driven Key Utility' self.width_height = (312, 289) if py.window(self.window, exists=True): py.deleteUI(self.window) py.window(self.window, title=self.title, wh=self.width_height, sizeable=False) py.scrollLayout(horizontalScrollBarThickness=16, verticalScrollBarThickness=16) py.rowLayout("objRow", numberOfColumns=4, columnAlign2=("left", "right"), p="sdkflip") py.columnLayout("objCol", p="objRow") self.source_field = py.textField("sourceText", tx="Source Driver", p="objCol") py.columnLayout("objbutCol", p="objRow") py.button(label="<<", width=30, height=20, p="objbutCol", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_gui_fun, "sourcetxt")) py.columnLayout("tarCol", p="objRow") self.target_field = py.textField("targetText", tx="Target Driver", p="tarCol") py.columnLayout("tarbutCol", p="objRow") py.button(label="<<", width=30, height=20, p="tarbutCol", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_gui_fun, "targettxt")) py.frameLayout("scrollFrame", label="Driver Attributes", cll=False, borderStyle="etchedIn", p="sdkflip") py.rowLayout("scrollRow", p="scrollFrame") self.scroll_list = py.textScrollList("attrList", w=300, h=200, numberOfRows=8, allowMultiSelection=True, p="scrollRow") py.rowLayout("comRow", numberOfColumns=4, p="sdkflip") py.text("preText", l="Target Prefix", p="comRow") self.prefix_field = py.textField("prefixText", tx="rt", w=70, p="comRow") py.button(label="Mirror", width=80, height=30, p="comRow", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_sdk_flip, True)) py.button(label="Copy", width=80, height=30, p="comRow", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_sdk_flip, False)) py.showWindow(self.window)
def create(self): self.main_layout = pm.columnLayout(adjustableColumn= True, width= 400) main_frame = pm.frameLayout( label='%s' % (self.light), collapsable= True) pm.frameLayout( label='Light Attributes', collapsable= True) pm.attrColorSliderGrp( at='%s.color' % (self.light), columnWidth4= [100, 75, 175, 50]) pm.attrFieldSliderGrp( at='%s.intensity' % (self.light), columnWidth4= [100, 75, 175, 50]) pm.attrFieldSliderGrp(at='%s.ambientShade' % (self.light), columnWidth4= [100, 75, 175, 50]) pm.setParent(main_frame) pm.frameLayout(label= 'Shadows', collapsable= True) pm.attrColorSliderGrp( at='%s.shadowColor' % (self.light), columnWidth4= [100, 75, 175, 50]) self.check_box = pm.checkBox(label= 'Use Ray Trace Shadows', changeCommand= pm.Callback(self.shadows)) self.shadow_radius = pm.attrFieldSliderGrp( at='%s.shadowRadius' %(self.light), enable= False, columnWidth4= [100, 75, 175, 50]) self.shadow_rays = pm.attrFieldSliderGrp( at='%s.shadowRays' % (self.light), enable= False, columnWidth4= [100, 75, 175, 50]) self.ray_depth = pm.attrFieldSliderGrp( at='%s.rayDepthLimit' % (self.light), enable= False, columnWidth4= [100, 75, 175, 50]) pm.setParent(main_frame) pm.rowColumnLayout(numberOfColumns= 2, columnWidth= [200, 200]) pm.button(label= 'Select Light', width= 200, command= pm.Callback(self.select)) pm.button(label= 'Delete UI', width= 200, command= pm.Callback(self.delete)) pm.button(label= 'Hide', command= pm.Callback(self.hide)) pm.button(label= 'Show', command= pm.Callback(self.show)) return self.main_layout
def createUISet(self): self._childLayout = pm.columnLayout( adj=True ) with self._childLayout: pm.text(l="Click cage mesh first, then shift+click target mesh, and click the menu item.") # cageDeformer specific deformers = pm.ls(type=deformerTypes[0]) for node in deformers: frameLayout = pm.frameLayout( label=node.name(), collapsable = True) with frameLayout: self.createCommonAttr(node) # cageDeformerARAP specific deformers = pm.ls(type=deformerTypes[1]) for node in deformers: frameLayout = pm.frameLayout( label=node.name(), collapsable = True) with frameLayout: self.createCommonAttr(node) with pm.rowLayout(numberOfColumns=3) : pm.attrControlGrp( label="constraint mode", attribute= node.ctm) pm.attrFieldSliderGrp( label="constraint weight", min=1e-10, max=1000, attribute=node.cw) pm.attrFieldSliderGrp(label="constraint radius", min=0.001, max=10.0, attribute=node.cr) with pm.rowLayout(numberOfColumns=3) : pm.attrFieldSliderGrp( label="iteration", min=1, max=20, attribute=node.it) pm.attrControlGrp( label="tet mode", attribute= node.tm) pm.attrFieldSliderGrp( label="translation weight", min=0.0, max=1.0, attribute=node.tw)
def scriptWindow( document ): win = pm.window( title='Sniplet', wh=(700,300)) pm.frameLayout(labelVisible=False, borderVisible=False) # ----------------------------------------------- pm.cmdScrollFieldExecuter( sourceType="python", text=document ) # ----------------------------------------------- pm.showWindow(win)
def beginLayout(self, label, **kwargs): ''' begin a frameLayout. accepts any keyword args valid for creating a frameLayout ''' kwargs['label'] = label pm.setParent(self._layoutStack[-1]) pm.frameLayout(**kwargs) self._layoutStack.append(pm.columnLayout(adjustableColumn=True))
def initialize_modulesSettings(self): self.moduleListWidth = self.widthHeight[0] / 3 self.moduleOptionsWidth = self.widthHeight[0] - self.moduleListWidth - 12 self.moduleLayoutHeight = self.widthHeight[1] - 40 # creates the list of modules from Blueprints folder on the left hand side modulesLayoutSpacing = self.widthHeight[0] - self.moduleListWidth - self.moduleOptionsWidth # initializes layouts for modules list and modules options self.UIwidgets["modules_mainLayout"] = pm.columnLayout(adj=True, parent=self.UIwidgets["ui_main_layout"]) self.UIwidgets["modules_columnLayout"] = pm.rowColumnLayout( numberOfColumns=2, parent=self.UIwidgets["modules_mainLayout"] ) pm.rowColumnLayout( self.UIwidgets["modules_columnLayout"], edit=True, columnAlign=([1, "center"], [2, "center"]), columnOffset=([1, "left", 0], [3, "right", 5]), columnSpacing=[2, modulesLayoutSpacing], ) # self.UIwidgets['modulesList_scrollLayout'] = pm.scrollLayout(width = self.moduleListWidth, height = self.moduleLayoutHeight, hst = 6, vst = 6, parent = self.UIwidgets["modules_columnLayout"]) self.UIwidgets["modulesList_frameLayout"] = pm.frameLayout( w=self.moduleListWidth - 12, l="Module List", font="boldLabelFont", collapsable=False, labelIndent=self.moduleListWidth / 3.5, marginWidth=0, marginHeight=3, parent=self.UIwidgets["modules_columnLayout"], ) self.UIwidgets["modulesList_scrollLayout"] = pm.scrollLayout( width=self.moduleListWidth - 18, height=self.moduleLayoutHeight, hst=6, vst=6, parent=self.UIwidgets["modulesList_frameLayout"], ) # self.UIwidgets['modulesOptionScrollLayout'] = pm.scrollLayout(width = self.moduleOptionsWidth, height = self.moduleLayoutHeight, hst = 6, vst = 6, parent = self.UIwidgets["modules_columnLayout"]) self.UIwidgets["modulesOptions_frameLayout"] = pm.frameLayout( w=self.moduleOptionsWidth, l="Module Options", font="boldLabelFont", collapsable=False, labelIndent=self.moduleOptionsWidth / 3.35, marginWidth=3, marginHeight=3, parent=self.UIwidgets["modules_columnLayout"], ) self.initialize_moduleSettings() self.initialize_listAllModules()
def toggle_vis(self): ''' # this will toggle the visibility of the main frame layout self.layout ''' value = pm.frameLayout(self.layout, query= True, visible= True) if value == True: pm.frameLayout(self.layout, edit= True, visible= False) if value == False: pm.frameLayout(self.layout, edit= True, visible= True)
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 uiContents_tab3(): # Skinning ----------------------- with pm.frameLayout(l='Skninning', cll=True, mw=3, mh=3 ): with pm.columnLayout(adj=True): with pm.rowLayout(nc=5): pm.text(l=u'Set Weight : ', w=labelWidth, align='right') w= 155 / 4 pm.button(l='1.00', c=pm.Callback( btn_setWeight, 1.0 ), w=w) pm.button(l='0.75', c=pm.Callback( btn_setWeight, 0.75 ), w=w) pm.button(l='0.50', c=pm.Callback( btn_setWeight, 0.5 ), w=w) pm.button(l='0.25', c=pm.Callback( btn_setWeight, 0.25 ), w=w) with pm.rowLayout(nc=5, ann=u'skinCluster가 적용된 오브젝트를 선택하고 실행'): pm.text(l=u'Select Influences : ', w=labelWidth, align='right') pm.button( l='Select', w=160, c=pm.Callback( btn_getInfluences )) with pm.rowLayout(nc=5, ann=u'skinCluster가 적용된 오브젝트를 선택하고 실행'): pm.text(l=u'Transfer Weight : ', w=labelWidth, align='right') pm.button( l=u'vtxs, inf1, inf2 순으로선택', w=160, c=pm.Callback( pm.mel.MoveInfluence )) with pm.rowLayout(nc=5, ann=u'skinCluster가 적용된 여러 오브젝트를 먼저 선택. \n마지막에 skinMesh선택하고 실행'): pm.text(l=u'Multi Copy Skin Weights : ', w=labelWidth, align='right') pm.button( l='Copy Weight', w=160, c=pm.Callback( btn_multiCopySkinWeights )) # Blendshape ----------------------- with pm.frameLayout(l='Blendshape', cll=True, mw=3, mh=3 ): with pm.columnLayout(adj=True): with pm.columnLayout(adj=True): with pm.rowLayout(nc=10): pm.text(l=u'Split Blendshape (ext) : ', w=labelWidth, align='right') pm.button( l='Create', c=pm.Callback( btn_splitBlendShape ), w=160) pm.button(l='d', w=20, c=pm.Callback( pm.launch, web="http://www.jeffrosenthal.org/split-blendshape-script") ) pm.button(l='t', w=20, c=pm.Callback( pm.launch, web="https://www.youtube.com/watch?v=-JwXfnrX1wM") ) with pm.rowLayout(nc=10): pm.text(l=u'Mirror Blendshape (ext) : ', w=labelWidth, align='right') pm.button( l='Open UI..', c=pm.Callback( btn_mirrorBlendshape ), w=160) pm.button(l='d', w=20, c=pm.Callback( pm.launch, web="http://www.creativecrash.com/maya/script/mirror-blendshapes") ) #pm.button(l='t', w=20, c=pm.Callback( pm.launch, web="https://www.youtube.com/watch?v=-JwXfnrX1wM") ) with pm.rowLayout(nc=10): pm.text(l=u'Corrective Blendshape Creator (ext) : ', w=labelWidth, align='right') pm.button( l='Open UI..', c=pm.Callback( btn_correctiveBlendshapeCreator ), w=160) pm.button(l='d', w=20, c=pm.Callback( pm.launch, web="http://www.creativecrash.com/maya/script/46275/download_page") ) pm.button(l='t', w=20, c=pm.Callback( pm.launch, web="https://www.youtube.com/watchdv=0yuzPJTy3y0&index=6&list=PL4ZR92iL9G0FEcJI80PADVpzKypQv50Lp") ) with pm.rowLayout(nc=10): pm.text(l=u'Extract Deltas (ext) : ', w=labelWidth, align='right') pm.button(l='DupMesh', c=pm.Callback( btn_extractDeltasDuplicateMesh ), w=79) pm.button(l='Perform', c=pm.Callback( btn_performExtractDeltas ), w=79) pm.button(l='d', w=20, c=pm.Callback( pm.launch, web="http://www.braverabbit.de/playground/dp=443") ) pm.button(l='t', w=20, c=pm.Callback( pm.launch, web="https://www.youtube.com/watch?v=YvNdYseSNFs") )
def __init__(self): title="michaelTools" if(pm.windowPref(title, q=True, ex=True)): pm.windowPref(title, remove=True) if(pm.window(title, q=True, ex=True)): pm.deleteUI(title) # Michael's Tools UI self.win = pm.window(title, title="Michael's Tools") self.winlayout = pm.columnLayout() self.tabs = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5) # CTRL Tools TAB self.ctrlTools_layout = pm.columnLayout(parent = self.tabs) # grouping Functions frame and contents self.grpFrame = pm.frameLayout( parent = self.ctrlTools_layout, w =244, label='Grouping Functions', borderStyle='out', cll = True, cl = True ) self.grplayout = pm.rowColumnLayout(parent = self.grpFrame, numberOfColumns = 2, columnWidth = [(1, 120), (2, 120)] ) self.offSetGRP_Btn = pm.button(parent=self.grplayout,w = 100, h = 24, label="Add Offset Group", command = offSetGRP.add_offset_grps ) self.sdkGRP_Btn = pm.button(parent=self.grplayout,w = 100, h = 24, label="Add SDK Group", command = sdkGRP.add_SDK_grps ) self.conGRP_Btn = pm.button(parent=self.grplayout,w = 100, h = 24, label="Add Control Group", command = conGRP.add_con_grps ) self.underLoc_Btn = pm.button(parent=self.grplayout,w = 100, h = 24, label="Under Locator", command = unLoc.under_locator ) # color overrides frame and contents self.colorFrame = pm.frameLayout( parent = self.ctrlTools_layout, w =244, label='Color Overrides', borderStyle='out', cll = True, cl = True ) self.colorlayout = pm.columnLayout( parent = self.colorFrame, columnWidth = 120 ) self.colorSlider = pm.colorIndexSliderGrp( parent = self.colorlayout,cw3 = [40, 60, 130], label='Color ', min=1, max=32, value=0 ) self.changeColor_Btn = pm.button(parent=self.colorlayout,w = 240, h = 24, label="Override Color", command = self.exe_sliderColor ) self.orRGBText = pm.text( parent=self.colorlayout, w = 240, label='Or Use', align='center' ) self.changeColor_Btn = pm.button(parent=self.colorlayout,w = 240, h = 24, label="RGB Color Picker", command = rgbColor.rgbColorOverride ) # Shape Functions Frame and Contents self.shapeFrame = pm.frameLayout( parent = self.ctrlTools_layout, w =244, label='Shape Functions', borderStyle='out', cll = True, cl = True ) self.shapelayout = pm.columnLayout(parent = self.shapeFrame, columnWidth = 240 ) self.parentShape_Btn = pm.button(parent=self.shapelayout,w = 240, h = 24, label="Parent Shapes To Last", command = prntShps.parentShapes ) ctrlTools_gradParent=self.ctrlTools_layout ctrlTools_gradParent.getNumberOfChildren() color_range = ColorRange([0.0, 0.4, 0.4]) for ctrlTools_grad, color in zip(ctrlTools_gradParent.children(), color_range.get_range(len(ctrlTools_gradParent.children())) ): print ctrlTools_grad, color ctrlTools_grad.setBackgroundColor(color) # TRANSFORM TOOLS TAB self.transformTools_layout = pm.columnLayout(parent = self.tabs) self.newPivBtn = pm.button(parent = self.transformTools_layout, w = 244, h = 24, label="Match All Piviots To Last Selected", command = newPivot.set_newPivot ) self.newPosBtn = pm.button(parent = self.transformTools_layout, w = 244, h = 24, label="Match All Positions To Last Selected", command = newPosition.set_newPosition ) # Edit Tab Layout labels pm.tabLayout( self.tabs, edit=True, tabLabel=((self.ctrlTools_layout, 'Control Tools'), (self.transformTools_layout, 'Transform Tools')) ) # Window Functions self.closeToolBtn = pm.button(parent = self.winlayout,w = 251, h = 24, label="Close Tool", command = self.closeWin) self.delete = [] self.win.show()
def resizeWin4StripShape(self,*args): updateShapeFrameState = pm.frameLayout("updateShapeFrame",q=1,cl=1) stripShapeFrameState = pm.frameLayout("stripShapesFrame",q=1,cl=1) if updateShapeFrameState == 1 and stripShapeFrameState == 1: pm.window("blendshapeWin",e=1,h=(h-159-192)) elif updateShapeFrameState == 0 and stripShapeFrameState == 0: pm.window("blendshapeWin",e=1,h=h) elif updateShapeFrameState == 1 and stripShapeFrameState == 0: pm.window("blendshapeWin",e=1,h=(h-159)) elif updateShapeFrameState == 0 and stripShapeFrameState == 1: pm.window("blendshapeWin",e=1,h=(h-192))
def _UI(self): if pm.window("blendshapeWin",exists=1): pm.deleteUI("blendshapeWin",window=1) w=450 w2=190 self.window=pm.window("blendshapeWin",t="BlendShape Tools",s=0,mb=1,rtf=1,w=w) h=pm.window("blendshapeWin",q=1,h=1) pm.columnLayout("mainColumn",p="blendshapeWin",columnAttach=('both', 2), rowSpacing=10, columnWidth=w) pm.button(p="mainColumn",l="abSymMesh",c=self.abSymMeshFunc) pm.button(p="mirrorSepShapeFrame",l="Mirror Shape",c=self.mirrorSepratedShapes) # ---------------------------------------------------------------------------------------- pm.frameLayout("updateShapeFrame",p="mainColumn", label='Update Shapes', borderStyle='in',cll=1,cc=self.resizeWin4UpdateShape,ec=self.resizeWin4UpdateShape) pm.rowLayout("ShapeNamesRow",p="updateShapeFrame",w=w,numberOfColumns=3,columnWidth3=(w2,30,w2),adjustableColumn=2, columnAlign3=[('center'),('center'),('center')], columnAttach=[(1, 'both', 1), (2, 'both', 0), (3, 'both',5)]) pm.button(p="ShapeNamesRow",l="New Shapes",c=self.newShapeList) pm.text(p="ShapeNamesRow",l=" ") pm.button(p="ShapeNamesRow",l="Current Shapes",c=self.curShapeList) pm.rowLayout("shapeListRow",p="updateShapeFrame",w=w,numberOfColumns=3,columnWidth3=(30,30,30),adjustableColumn=2, columnAlign3=[('center'),('center'),('center')], columnAttach=[(1, 'both', 1), (2, 'both', 0), (3, 'both',5)]) pm.textScrollList("newShapeList",p="shapeListRow",w=w2,numberOfRows=8, allowMultiSelection=True) pm.popupMenu("newShapelistPopUp",p="newShapeList") pm.menuItem(p="newShapelistPopUp",l="Add To List",c=self.newShapeList) pm.menuItem(p="newShapelistPopUp",l="Remove All From List",c=self.rmvAllFromNewList) self.button=pm.button(p="shapeListRow",l="update",c=self.updateShape) pm.textScrollList("curShapeList",p="shapeListRow",w=w2,numberOfRows=8, allowMultiSelection=True) pm.popupMenu("curShapelistPopUp",p="curShapeList") pm.menuItem(p="curShapelistPopUp",l="Add To List",c=self.curShapeList) pm.menuItem(p="curShapelistPopUp",l="Remove All From List",c=self.rmvAllFromCurList) #--------------------------------------------------------------------- pm.frameLayout("stripShapesFrame",p="mainColumn", label='Strip Shapes', borderStyle='in',cll=1,cc=self.resizeWin4StripShape,ec=self.resizeWin4StripShape) pm.button(p="stripShapesFrame",l="Get BlendShapes",c=self.getBlendShapes) pm.rowLayout("stripShapesRow",p="stripShapesFrame",w=w,numberOfColumns=2,columnWidth2=(30,30),adjustableColumn=2, columnAlign2=[('center'),('center')], columnAttach=[(1, 'both', 0), (2, 'both', 0)]) pm.textScrollList("blendshapeList",p="stripShapesRow",w=140,numberOfRows=8, allowMultiSelection=False,sc=self.getTargetShapes) pm.popupMenu("blendShapeListPopUp",p="blendshapeList") pm.menuItem(p="blendShapeListPopUp",l="Remove All From List",c=self.rmvAllFromblendShapeList) pm.textScrollList("targetShapeList",p="stripShapesRow",w=140,numberOfRows=8, allowMultiSelection=True) self.button=pm.button(p="stripShapesFrame",l="Strip Shapes",c=self.stripShapes) pm.showWindow(self.window)
def gui(): ''' Triggers the interface for zoomerate. ''' # Warning this is causeing issues with 2012 panel = pm.getPanel(wf=True) try: whichCam = pm.modelPanel(panel, q=1, camera=True) except RuntimeError: whichCam = pm.modelPanel('modelPanel4', q=1, camera=True) print 'Using: %s' % whichCam whichCamShape = pm.ls(whichCam, dag=True, shapes=True, ap=True) # Figure out what cameras to use when building the menu cameras = pm.ls(ca=True) diffCams = [] diffCams.extend(whichCamShape) diffCams.extend(cameras) print diffCams, len(diffCams) win_name = 'zoomer_win2' if pm.window(win_name, ex=True): pm.deleteUI(win_name) win = pm.window(win_name, s=0, ip=True, iconName='zoomer', w=400, h=180, t='Camera zoomeratro v1.0') main = pm.columnLayout() pm.frameLayout(borderVisible=True, labelVisible=True, labelAlign='cener', label='Zoom Options', marginWidth=5, marginHeight=5) pm.columnLayout() global which_cam_menu which_cam_menu = pm.optionMenuGrp(label='Camera to Zoom', cc=connect) pm.menuItem(label=whichCamShape[0]) for i in xrange(len(diffCams)-1): pm.menuItem(label=cameras[i]) horizontal_attr = '%s.horizontalFilmOffset' % whichCamShape[0] vertical_attr = '%s.verticalFilmOffset' % whichCamShape[0] overscan_attr = '%s.overscan' % whichCamShape[0] global horizontal_slider, vertical_slider, overscan_slider horizontal_slider = pm.floatSliderGrp(field=True, label='Horizontal', min=-3, max=3, pre=3, step=0.001) vertical_slider = pm.floatSliderGrp(field=True, label='Vertical', min=-3, max=3, pre=3, step=0.001) overscan_slider = pm.floatSliderGrp(field=True, label='Overscan', min=-3, max=3, pre=3, step=0.001) pm.connectControl(horizontal_slider, horizontal_attr) pm.connectControl(vertical_slider, vertical_attr) pm.connectControl(overscan_slider, overscan_slider) pm.button(label='Reset', c=reset) win.show()
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 chris_start_gui(self): window = 'face_rig_gui' window_title = 'Simple Sync Setup' if py.window(window, exists=True): py.deleteUI(window, window=True) window_obj = py.window(window, title=window_title, widthHeight=(300, 100), sizeable=False) py.columnLayout('prompt_column', p=window) py.button('face_placement_button', label='Create Locators', p='prompt_column', w=325, command=py.Callback(self.create_locators)) py.rowLayout('deformer_row', p='prompt_column', numberOfColumns=2) py.button('deformer_export_placement_button', label='Export Mesh Weights', p='deformer_row', w=160, command=py.Callback(self.export_deformer)) py.button('deformer_import_placement_button', label='Import Mesh Weights', p='deformer_row', w=160, command=py.Callback(self.import_deformer)) py.frameLayout('fieldframe', p=window, l='Tell me what things are!') py.rowLayout('fieldrow', p='fieldframe', numberOfColumns=15) py.columnLayout('rt_eye', p='fieldrow') py.rowLayout('rt_row', p='rt_eye', numberOfColumns=2) py.button(label='>>', p='rt_row', command=py.Callback(df.set_text, 'rt_eye_text')) py.textField('rt_eye_text', tx='Right Eye', p='rt_row') py.columnLayout('lfeye', p='fieldrow') py.rowLayout('lfrow', p='lfeye', numberOfColumns=2) py.button(label='>>', p='lfrow', command=py.Callback(df.set_text, 'lfeye_text')) py.textField('lfeye_text', tx='Left Eye', p='lfrow') py.rowLayout('jaw_field_row', p='fieldframe', numberOfColumns=15) py.columnLayout('up_jaw', p='jaw_field_row') py.rowLayout('up_jaw_row', p='up_jaw', numberOfColumns=2) py.button(label='>>', p='up_jaw_row', command=py.Callback(df.set_text, 'up_jaw_text')) py.textField('up_jaw_text', tx='Up Teeth Group', p='up_jaw_row') py.columnLayout('low_jaw', p='jaw_field_row') py.rowLayout('low_jaw_row', p='low_jaw', numberOfColumns=2) py.button(label='>>', p='low_jaw_row', command=py.Callback(df.set_text, 'low_jaw_text')) py.textField('low_jaw_text', tx='Low Teeth Group', p='low_jaw_row') py.button(label='Create Rig', p='prompt_column', w=325, command=py.Callback(self.create_system)) py.button(label='Save Rig', p='prompt_column', w=325, command=py.Callback(df.save_file)) py.rowLayout('head_root_row', p='fieldframe', numberOfColumns=15) py.columnLayout('root', p='head_root_row') py.rowLayout('head_row', p='root', numberOfColumns=2) py.button(label='>>', p='head_row', command=py.Callback(df.set_text, 'head_text')) py.textField('head_text', tx='Head Root Joint', p='head_row') py.columnLayout('mesh_col', p='head_root_row') py.rowLayout('mesh_row', p='mesh_col', numberOfColumns=2) py.button(label='>>', p='mesh_row', command=py.Callback(df.set_text, 'mesh_text')) py.textField('mesh_text', tx='Skin Cluster', p='mesh_row') py.showWindow(window)
def UI_Build(self): """Build the static UI and define the main layouts. Keyword arguments: none """ # Delete windows if already existing if pc.window("lookdevAssistant", exists=True): pc.deleteUI("lookdevAssistant") # Main window self.globalWidgets['window'] = pc.window("lookdevAssistant", menuBar=True, title="Arnold Lookdev assistant", sizeable=False, h=430, w=500) # Menu bar # |-- Creation Menu self.globalWidgets['windowMenuCreate'] = pc.menu(label="Create") pc.menuItem(label='new aiStandard', parent=self.globalWidgets['windowMenuCreate'], c=partial(self.Maya_createNode, 'aiStandard')) pc.menuItem(label='new File', parent=self.globalWidgets['windowMenuCreate'], c=partial(self.Maya_createNode, 'file')) pc.menuItem(label='new ygColorCorrect', parent=self.globalWidgets['windowMenuCreate'], c=partial(self.Maya_createNode, 'ygColorCorrect')) pc.menuItem(divider=True) # --|-- Create complete network Menu self.globalWidgets['completeNetworkMenu'] = pc.menuItem(label='Complete network', parent=self.globalWidgets['windowMenuCreate'], subMenu=True, pmc=self.UI_refreshMenu) self.globalWidgets['fromFile'] = pc.menuItem(l="from existing File...", subMenu=True, p=self.globalWidgets['completeNetworkMenu']) pc.menuItem(l="from new File", c=partial(self.Maya_createFullNetwork, False, ''), p=self.globalWidgets['completeNetworkMenu']) # |-- See on flat Menu self.globalWidgets['windowMenuSeeOnFlat'] = pc.menu(label="See on flat") pc.menuItem(label='Diffuse Color', parent=self.globalWidgets['windowMenuSeeOnFlat'], c=partial(self.Maya_focusOn, 'color')) pc.menuItem(label='Specular Color', parent=self.globalWidgets['windowMenuSeeOnFlat'], c=partial(self.Maya_focusOn, 'KsColor')) pc.menuItem(label='Specular Roughness', parent=self.globalWidgets['windowMenuSeeOnFlat'], c=partial(self.Maya_focusOn, 'specularRoughness')) pc.menuItem(label='Bump', parent=self.globalWidgets['windowMenuSeeOnFlat'], c=partial(self.Maya_focusOn, 'normalCamera')) pc.menuItem(divider=True, parent=self.globalWidgets['windowMenuSeeOnFlat']) pc.menuItem(label='Revert to aiStandard', parent=self.globalWidgets['windowMenuSeeOnFlat'], c=self.Maya_revertToAiStd) # Main layout : 2 columns / 1 for the list of the ai* shaders / 1 to access selected shader attributes self.globalWidgets['mainLayout'] = pc.rowColumnLayout(nc=2, cw=[(1, 150), (2, 240)]) # Shaders list layout self.globalWidgets['sListLayout'] = pc.frameLayout(label='Shaders list', borderStyle='etchedIn', cll=True, h=430 , parent=self.globalWidgets['mainLayout']) self.sListWidgets['layout'] = pc.columnLayout(parent=self.globalWidgets['sListLayout']) self.sListWidgets['list'] = pc.textScrollList(h=340, parent=self.sListWidgets['layout']) self.sListWidgets['listRefreshButton'] = pc.button(l='Refresh', w=95, c=self.UI_refreshShaders) # Shaders attributes layout self.globalWidgets['sAttrLayout'] = pc.frameLayout(label='Shaders attributes', borderStyle='etchedIn', cll=True, h=430, parent=self.globalWidgets['mainLayout']) # Setup all callbacks self.UI_Callbacks()
def createUISet(self): self._childLayout = pm.columnLayout( adj=True ) with self._childLayout: self.deformers = [pm.ls(type=deformerTypes[i]) for i in range(len(deformerTypes))] for i in range(len(deformerTypes)): for node in self.deformers[i]: self.probes[node] = pm.listConnections(node.pm) # "probeDeformer" specific for node in self.deformers[0]: frameLayout = pm.frameLayout( label=node.name(), collapsable = True) with frameLayout: self.createRamp(node) self.createCommonAttr(node, deformerTypes[0]) indices = cmds.getAttr(node+".pm", multiIndices=True) if indices: for j in indices: with pm.rowLayout(numberOfColumns=1) : pm.attrFieldSliderGrp(label=node.prw[j].getAlias(), min=0, max=10.0, attribute=node.prw[j]) with pm.rowLayout(numberOfColumns=3) : pm.attrControlGrp( label="Frechet sum", attribute= node.fs) pm.attrControlGrp( label="visualisation", attribute= node.vm) pm.attrFieldSliderGrp( label="visualisation multiplier", min=0.001, max=1000, attribute=node.vmp) # "probeDeformerARAP" specific for node in self.deformers[1]: frameLayout = pm.frameLayout( label=node.name(), collapsable = True) with frameLayout: self.createRamp(node) self.createCommonAttr(node, deformerTypes[1]) indices = cmds.getAttr(node+".pm", multiIndices=True) if indices: for j in indices: with pm.rowLayout(numberOfColumns=2) : pm.attrFieldSliderGrp(label=node.prw[j].getAlias(), min=0, max=1.0, attribute=node.prw[j]) pm.attrFieldSliderGrp(label=node.prcr[j].getAlias(), min=0, max=1.0, attribute=node.prcr[j]) with pm.rowLayout(numberOfColumns=3) : pm.button( l="Set supervisor", c=pm.Callback( self.setSupervisor, node)) pm.attrControlGrp( label="tet mode", attribute= node.tm) pm.attrFieldSliderGrp( label="translation weight", min=0.0, max=1.0, attribute=node.tw) with pm.rowLayout(numberOfColumns=3) : pm.attrControlGrp( label="constraint mode", attribute= node.ctm) pm.attrFieldSliderGrp( label="constraint weight", min=0.001, max=1000, attribute=node.cw) pm.attrFieldSliderGrp(label="constraint radius", min=0.001, max=10.0, attribute=node.cr) with pm.rowLayout(numberOfColumns=3) : pm.attrFieldSliderGrp( label="iteration", min=1, max=20, attribute=node.it) pm.attrControlGrp( label="visualisation", attribute= node.vm) pm.attrFieldSliderGrp( label="visualisation multiplier", min=0.001, max=1000, attribute=node.vmp) with pm.rowLayout(numberOfColumns=3) : pm.attrControlGrp( label="stiffness mode", attribute=node.stiffnessMode)
def uiContents_tab1(): # Joint Layout ----------------------- with pm.frameLayout(l='Auto Rigging', cll=True, mw=3, mh=3 ): with pm.columnLayout( adj=True ): with pm.rowLayout(nc=4): pm.text(l='Joint Template (Biped) : ', w= labelWidth, align='right') pm.button( l=' Open UI..', w= 160, c=pm.Callback( btn_bipedTemplate )) # Rigging ----------------------- with pm.frameLayout(l='Modules', cll=True, mw=3, mh=3 ): with pm.columnLayout(adj=True): with pm.rowLayout(nc=4): pm.text(l='Create Character Group : ', w= labelWidth, align='right') pm.button( l='Create', w= 160, c=pm.Callback( btn_rigCharacterGrp )) with pm.rowLayout(nc=5): pm.text(l='Twist Helper (wip) : ', w= labelWidth, align='right') pm.button( l='Create..', w=160, c=pm.Callback( btn_rigTwistHelper ) ) with pm.rowLayout(nc=10): pm.text(l=u'Variable FK Rigger 1.0 (ext) : ', w=labelWidth, align='right') pm.button( l='Open UI..', c=pm.Callback( btn_variableFKRigger ), w=160) pm.button(l='d', w=20, c=pm.Callback( pm.launch, web="http://www.creativecrash.com/maya/script/variable-fk-rigger") ) pm.button(l='t', w=20, c=pm.Callback( pm.launch, web="https://vimeo.com/86643864") ) pm.button(l='t', w=20, c=pm.Callback( pm.launch, web="https://vimeo.com/72424469") ) #pm.separator( h=8, style='in') # Rigging ----------------------- with pm.frameLayout(l='Tools', cll=True, mw=3, mh=3 ): with pm.columnLayout(adj=True): with pm.rowLayout(nc=5): pm.text(l='Dynamic Chain Setup Tool (ext) : ', w= labelWidth, align='right') pm.button( l='Open UI..', w=160, c=pm.Callback( btn_dynamicChainSetupTool ) ) pm.button(l='d', w=20, c=pm.Callback( pm.launch, web="http://www.rihamtolan.com/blog/2015/1/1/dynamicchainsetuptool-is-here") ) pm.button(l='t', w=20, c=pm.Callback( pm.launch, web="https://www.youtube.com/watch?v=1BEAEJ2E01o") ) with pm.rowLayout(nc=10): pm.text(l=u'Geo Maya Hair 2 (ext) : ', w=labelWidth, align='right') pm.button( l='Open UI..', c=pm.Callback( btn_GMH2 ), w=160) pm.button(l='d', w=20, c=pm.Callback( pm.launch, web="http://www.thundercloud-studio.com/index.php?page=/shop/1.script/0.GMH2/GMH2_manual/") ) pm.button(l='t', w=20, c=pm.Callback( pm.launch, web="http://www.thundercloud-studio.com/index.php?page=tutorial#GMH2") ) with pm.rowLayout(nc=10): pm.text(l=u'Alfred Dynamic Joint Chain Tool (wip) : ', w=labelWidth, align='right') pm.button( l='Open UI..', c=pm.Callback( btn_dynamicJointChainTool ), w=160)
def _build_general_frame(parent_layout): general_frame = pm.frameLayout(label="General", collapsable=True) pm.columnLayout(adj=True, columnAttach=('both', 5)) pm.separator(height=5, style='none') pm.button(label='Save Pose', command=mimic_utils.save_pose_to_shelf, annotation='Saves selected robot\'s current configuration\n' \ 'to a button on the Mimic shelf') pm.separator(height=10, style='out') pm.gridLayout(numberOfColumns=2, cellWidth=109, cellHeight=25) # Zero target button pm.button(label='Zero Tool (TCS)', command=mimic_utils.zero_target, annotation='Sets target_CTRL (or tool_CTRL if it exists)\n' 'transform to Zero') # Zero robot local controller button pm.button(label='Zero Base (LCS)', command=mimic_utils.zero_base_local, annotation='Sets local_CTRL transform to Zero') # Zero robot world controller button pm.button(label='Zero Base (WCS)', command=mimic_utils.zero_base_world, annotation='Sets world_CTRL transform to Zero') # Zero all button pm.button(label='Zero All', command=mimic_utils.zero_all, annotation='Sets local_CTRL, world_CTRL, and target_CTRL (or ' \ 'tool_CTRL if it exists)\ntransforms\' to Zero') pm.setParent('..') pm.separator(height=10, style='out') # Toggle heads up display button pm.button(label='Toggle HUD', command=mimic_utils.axis_val_hud, annotation='Toggles the visibility of Mimic\'s Heads Up Display') pm.separator(height=5, style='none') pm.setParent(parent_layout)
def UI(self): width = 410 height = 210 # create window if pm.window('ehm_Colorize_UI', exists=True): pm.deleteUI('ehm_Colorize_UI') pm.window('ehm_Colorize_UI', title='change color', 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) buttonsLayout = pm.rowColumnLayout(nc=8) # find color icons iconPath = os.path.join(ehsan_script_directory, 'ui', 'icons') icons = os.listdir(iconPath) colorIcons = [] for icon in icons: if 'color_' in icon: colorIcons.append(icon) # button for icon in colorIcons: colorCode = int(icon.partition('.')[0].partition('_')[2]) pm.symbolButton(image=os.path.join(iconPath, icon), w=50, h=50, c=partial(self.colorize, None, colorCode)) # show window pm.showWindow('ehm_Colorize_UI')
def updateChildren(self, nodeName, currentTranslator): """ update the translator UI, which consists of an optionMenuGrp and a frameLayout per translator, so that only the frameLayout corresponding to the currently selected translator is visible """ if not pm.layout(self._optionMenu, exists=True): # not built yet return fullpath = pm.layout(self._optionMenu, query=True, fullPathName=True) # get the grand-parent columnLayout gparent = fullpath.rsplit('|', 2)[0] # get the great-grand parent frame layout frame = fullpath.rsplit('|', 3)[0] try: pm.frameLayout(frame, edit=True, collapsable=False, labelVisible=False, borderVisible=False) except RuntimeError: # this is a little dirty: it will only succeed when attaching to AE pass children = pm.layout(gparent, query=True, childArray=True) # hide all frameLayouts but ours assert currentTranslator, "we should have a translator set by now" for child in children: # is it a frame layout? objType = pm.objectTypeUI(child) if objType == 'frameLayout': label = pm.frameLayout(child, query=True, label=True) # turn collapsable and label off if showAllTranslators: pm.frameLayout(child, edit=True, collapsable=False, labelVisible=True, visible=True) else: pm.frameLayout(child, edit=True, collapsable=False, labelVisible=False, visible=(label == currentTranslator))
def _build_control_pane(self, parent_layout): """ """ # Create a frameLayout with a nested columnLayout to hold all of our # control pane elements control_pane_frameLayout = pm.frameLayout('control_pane_frameLayout', labelVisible=False) control_pane_columnLayout = pm.columnLayout( 'control_pane_columnLayout', adj=True) # Add the header image self._add_header_image(parent_layout=control_pane_columnLayout) # Add the control tabs self._add_control_tabs(parent_layout=control_pane_frameLayout) # Add text output field self._add_output_field(parent_layout=control_pane_frameLayout) pm.setParent(parent_layout)
def __init__(self, opts): self.opts = opts with pm.frameLayout('Physics', collapsable=True, cl=False, bs='out'): with pm.columnLayout(width=250): pm.text(l='Collision Type:') self.phyType = pm.radioButtonGrp( labelArray3=['Convex Hull', 'Box', 'Sphere'], sl=self.opts['phyType'], nrb=3, cc=self.save, cw3=[94, 64, 64], width=250) self.maxVerts = pm.intSliderGrp(field=True, l='Max Vertices:', v=self.opts['maxVerts'], cl3=['left', 'left', 'left'], cw3=[64, 48, 128], cc=self.save) pm.button(l='Add Hull', w=250, c=self._addHull) self.save()
def create(self): self.mainLayout = pm.columnLayout(adjustableColumn=True) self.infoLayout = pm.columnLayout(adjustableColumn=True) pm.setParent(self.mainLayout) self.layout = pm.columnLayout(adjustableColumn=True) pm.setParent(self.layout) self.total = sal.Total_Grades() self.total.create() pm.button(label = 'Output Grade and Comment', command = pm.Callback(self.check)) pm.setParent(self.layout) grading = pm.frameLayout( label= 'Grading', cll = True, cl = True , borderStyle = 'etchedIn', w = 480) self.compFocal = sal.Grading_Section(name = 'Comp/Focal Length', fileName = r"%s/Comments/proj01_compFocal.txt" % (self.path), field = self.total.queryComp(), toUpdate = self.total) self.compFocal.create() pm.setParent(grading) self.antiAliasing = sal.Grading_Section(name = 'Antialias/Noise Qual', fileName = r"%s/Comments/proj01_antiAliasing.txt" % (self.path), field = self.total.queryAnti(), toUpdate = self.total) self.antiAliasing.create() pm.setParent(grading) self.pro = sal.Grading_Prof(name = 'Professionalism', fileName = r"%s/Comments/proj01_prof.txt" % (self.path), field = self.total.queryPro(), fileStart = r"%s/Startup/proj01_start.db" % (self.path), toUpdate = self.total, infoParent= self.infoLayout) self.pro.create() pm.setParent(self.infoLayout) self.info = sal.Images(self.pro) return self.layout
def _build_add_robot_frame(parent_layout): # Create frame layout with one column add_robot_frame = pm.frameLayout(label="Add Robot", collapsable=True) add_robot_col = pm.columnLayout(adj=True, columnAttach=('both', 5)) pm.separator(height=5, style='none') # Create list of robots pm.rowLayout(numberOfColumns=2, adjustableColumn=1, columnAttach=(1, 'left', 3), columnWidth=[(1, 158), (2, 45)], height=20) pm.optionMenu('robotImportList') rigs = general_utils.get_rigs_dict() rig_names = general_utils.get_rigs_names(rigs) for rig_name in rig_names: pm.menuItem(label=rig_name) # Get required rigs directories dir_mimic = general_utils.get_mimic_dir() dir_rigs = dir_mimic + '/rigs' add_robot_command_string = \ 'import mimic_utils; reload(mimic_utils); ' \ 'mimic_utils.import_robot("{}"); ' \ 'mimic_utils.add_mimic_script_node(); ' \ 'mimic_utils.add_hud_script_node()' \ .format(dir_rigs) pm.button(label=' Add ', command=add_robot_command_string, width=45, height=20, annotation='Imports selected robot into the scene') pm.setParent(add_robot_frame) pm.separator(style='none') pm.setParent(parent_layout)
def AppleseedAOVsCreateTab(self): log.debug("AppleseedAOVsCreateTab()") aovDict = {} self.rendererTabUiDict['aovs'] = aovDict pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) with pm.window() as win: scLo = "AOScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout("ColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="AOVs", collapsable=True, collapse=False): with pm.columnLayout(): with pm.paneLayout(configuration="vertical2", paneSize=(1, 25, 100)): aovDict['aovSourceField'] = pm.textScrollList( "AOVSource", ams=True, append=self.aovShaders, selectCommand=pm.Callback( self.AppleseedAOVSelectCommand, "source")) aovList = self.AppleseedGetAOVConnections() aovDict['aovDestField'] = pm.textScrollList( "AOVDest", append=aovList, ams=True, dcc=self.AppleseedDoubleClickCommand, selectCommand=pm.Callback( self.AppleseedAOVSelectCommand, "dest")) aovDict['aovButton'] = pm.button( label="Selection", enable=False, c=self.AppleseedAOVButtonCommand) win.show() pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
def asset_widget(current_parent): ''' Single asset widget. ''' main = pm.frameLayout(labelVisible=False, parent=current_parent) form = pm.formLayout() # Creating Components asset_image = pm.button(width=48, height=48) asset_text = pm.text(height=48, width=125, label='streetLight1') asset_low = pm.button(height=32) asset_med = pm.button(height=32) asset_high = pm.button(height=32) # Positioning Components. # Symbol Button form.attachForm(asset_image, 'top', 5) form.attachForm(asset_image, 'left', 5) # asset text form.attachForm(asset_text, 'top', 5) form.attachForm(asset_low, 'top', 15) form.attachForm(asset_med, 'top', 15) form.attachForm(asset_high, 'top', 15) form.attachControl(asset_text, 'left', 5, asset_image) # form.attachControl(asset_text, 'right', 5, asset_low) form.attachControl(asset_low, 'left', 5, asset_text) form.attachControl(asset_med, 'left', 5, asset_low) form.attachControl(asset_high, 'left', 5, asset_med) form.attachForm(asset_high, 'right', 5) form.attachForm(asset_image, 'bottom', 5) # res buttons # Return parent to orginal layout pm.setParent(current_parent) return main
def _build_keyframing_tools_frame(parent_layout): keyframing_tools_frame = pm.frameLayout(label="Keyframing Tools", collapsable=True) pm.columnLayout(adj=True, columnAttach=('both', 5)) pm.separator(height=5, style='none') pm.button(label='Delete IK/FK Keyframe', command=mimic_utils.delete_ik_fk_keys, annotation='Deletes keyframes on all attributes ' \ 'at current frame created with\n' \ '"Set IK-FK Keyframe" buttons') pm.button(label='Select Keyframe Hierarchy', command=mimic_utils.select_keyframe_hierarchy, annotation='Selects all objects keyframed ' \ 'with "Set IK-FK Keyframe" buttons:\n' \ ' target_CTRL\n' \ ' FK_CTRLS\n' \ ' a*FK_CTRL\n' \ ' tool_CTRL if one exists') pm.separator(height=5, style='none') pm.setParent(parent_layout)
def create(self): ''' this function creates the components ''' self.layout = pm.frameLayout(label=str(self.node), width=340, collapsable=True, collapse=True) pm.attrEnumOptionMenu(label='Pre Infinity ', attribute='%s.preInfinity' % (self.node)) pm.attrEnumOptionMenu(label='Post Infinity ', attribute='%s.postInfinity' % (self.node)) pm.rowColumnLayout(numberOfColumns=5, columnWidth=([1, 10], [2, 50], [3, 50], [4, 115], [5, 115])) pm.text(label='') pm.text(label='Time') pm.text(label='Value') pm.text(label='inTan Type') pm.text(label='OutTan Type') # create components for each key for num in xrange(self.count): pm.text(label=str(num), annotation='Key Index') time = Time_int(index=num, node=self.node) time.create() value = Value_float(index=num, node=self.node) value.create() in_tan = In_Tangent(index=num, node=self.node) in_tan.create() out_tan = Out_Tangent(index=num, node=self.node) out_tan.create()
def componentsListRebuild(self, node): if node.passType.get() == 2: self.componentsButton = pm.button(label="Add Component", c=pm.Callback( self.showComponentList, node), parent=self.uiParent) componentString = node.components.get() if componentString is None or len(componentString) == 0: return pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) with pm.frameLayout(labelVisible=False, collapsable=False, w=240, parent=self.uiParent) as self.componentsListUI: with pm.rowColumnLayout(nc=2, cw=((1, 200), (2, 30))): for c in componentString.split(","): pm.text(label=c, align="right") pm.symbolButton(image="smallTrash.png", c=pm.Callback(self.removeComponent, node, c)) pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
def CreateClothWindow(self,*args): if pm.window("cloth", exists = True): pm.deleteUI("cloth") cloth = pm.window("Create Cloth", t = "Create Cloth", w = 400, h = 600) pm.columnLayout(adj = True, cal = "center", columnAttach=('both', 25)) pm.separator(h = 30) pm.text("Cloth Simulation with PBD and exact CCD", font = "boldLabelFont") pm.separator(h = 30) pm.frameLayout(label = "Cloth Subdivisions", collapsable = True, borderStyle = "etchedIn") self.GlobalVars["SubX"] = pm.intSliderGrp(l = "Subdivision X", min = 1, max = 20, value = 10, field = True) self.GlobalVars["SubY"] = pm.intSliderGrp(l = "Subdivision Y", min = 1, max = 20, value = 10, field = True) pm.setParent("..") pm.frameLayout(label = "Position Constraints", collapsable = True, borderStyle = "etchedIn") pm.gridLayout(numberOfColumns = 2, cellWidthHeight = (180,20)) self.GlobalVars["Locator_LeftTopCorner"] = pm.checkBox(label = "Locator_LeftTopCorner") self.GlobalVars["Locator_RightTopCorner"] = pm.checkBox(label = "Locator_RightTopCorner") self.GlobalVars["Locator_RightBottomCorner"] = pm.checkBox(label = "Locator_RightBottomCorner") self.GlobalVars["Locator_LeftBottomCorner"] = pm.checkBox(label = "Locator_LeftBottomCorner") self.GlobalVars["Locator_Middle"] = pm.checkBox(label = "Locator_Middle") pm.setParent("..") pm.setParent("..") pm.frameLayout(label = "Gravity", collapsable = True, borderStyle = "etchedIn") self.GlobalVars["GraV"] = pm.floatSliderGrp(l = "Gravity", min = 0.0, max = 9.8, field = True) pm.setParent("..") pm.frameLayout(label = "Wind Force", collapsable = True, borderStyle = "etchedIn") self.GlobalVars["Wind_X"] = pm.floatSliderGrp(l = "Wind Force_X", min = -10.0, max = 10, value = 0.0, field = True) self.GlobalVars["Wind_Y"] = pm.floatSliderGrp(l = "Wind Force_Y", min = -10.0, max = 10, value = 0.0, field = True) self.GlobalVars["Wind_Z"] = pm.floatSliderGrp(l = "Wind Force_Z", min = -10.0, max = 10, value = 0.0, field = True) self.GlobalVars["Noise"] = pm.floatSliderGrp(l = "Noise", min = 0.0, max = 2, value = 0.0, field = True) pm.setParent("..") pm.separator(h = 10) self.GlobalVars["DefaultText"] = pm.checkBox(label = "Default Texture") pm.separator(h = 10) pm.button(l = "Create", c = self.CreateCloth) pm.showWindow(cloth)
def _build_switcher_frame(parent_layout): # Create a frame for the IK/FK switcher tabs switcher_frame = pm.frameLayout(label="IK/FK Switching", collapsable=True) # Create Form Layout with embeded Tab Layout switcher_form = pm.formLayout() switcher_tab_layout = pm.tabLayout('switcher_tab_layout', height=271) pm.formLayout(switcher_form, edit=True, attachForm=[(switcher_tab_layout, "top", 3), (switcher_tab_layout, "bottom", 3), (switcher_tab_layout, "left", 3), (switcher_tab_layout, "right", 3)]) ik_tab_layout = _build_ik_tab(switcher_tab_layout) fk_tab_layout = _build_fk_tab(switcher_tab_layout) tabs = [[ik_tab_layout, 'IK Controls'], [fk_tab_layout, 'FK Controls']] change_command = mimic_utils.toggle_ik_fk assign_tabs(tabs, switcher_tab_layout, change_command) pm.setParent(parent_layout)
def _build_axis_limits_frame(parent_layout): limits_frame = pm.frameLayout(label="Axis Limits", collapsable=True) limits_tab_layout = pm.tabLayout('limits_tab_layout') position_limits_tab = _build_position_limits_tab(limits_tab_layout) velocity_limits_tab = _build_velocity_limits_tab(limits_tab_layout) accel_limits_tab = _build_accel_limits_tab(limits_tab_layout) jerk_limits_tab = _build_jerk_limits_tab(limits_frame) tabs = [(position_limits_tab, 'Position'), (velocity_limits_tab, 'Vel'), (accel_limits_tab, 'Accel'), (jerk_limits_tab, 'Jerk')] assign_tabs(tabs, limits_tab_layout) pm.columnLayout() pm.gridLayout(nc=2, cw=114, ch=25) pm.button(label='Get Axis Limits', command=mimic_utils.write_limits_to_ui) pm.button(label='Set Axis Limits', command=mimic_utils.set_axis_limits) pm.setParent('..') pm.button(label='Clear', width=228, command=mimic_utils.clear_limits_ui) pm.setParent(parent_layout)
def template_item_list(self): frame_layout = pm.frameLayout(label="Output Frame", mh=5, w=504) pm.textFieldGrp("namespaceField", adj=2, label="Namespace:", cw2=[80, 200], text=self.namespace, cc=lambda *args: self.set_namespace()) pm.textFieldButtonGrp("outputPathField", label="Output Path:", bl="Set Path", adj=2, text=self.output_path, cw3=[80, 200, 100], bc=lambda *args: self.set_output_location()) pm.textScrollList("outputItemScrollList", a=self.output_items) pm.popupMenu() pm.menuItem(label=u"载入数据", c=lambda *args: self.load_dict_data()) pm.menuItem(label=u"移除选择", c=lambda *args: self.remove_selected_item()) pm.menuItem(label=u"移除所有", c=lambda *args: self.remove_all_item()) pm.button(label="Build", c=lambda *args: self.write_output()) pm.setParent("..") return frame_layout
def IndigoEnvironmentCreateTab(self): log.debug("IndigoEnvironmentCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query = True) pm.setUITemplate("attributeEditorTemplate", pushTemplate = True) scLo = self.rendererName + "ScrollLayout" 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): with pm.frameLayout(label='Environment', collapsable = True, collapse=False): with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn = True, width = 400): self.addRenderGlobalsUIElement(attName = 'environmentType', uiType = 'enum', displayName = 'Environment Type', default='0', data='Color/Map:Sun', uiDict=uiDict) pm.separator() self.addRenderGlobalsUIElement(attName = 'environmentColor', uiType = 'color', displayName = 'Environment Color', default='0.4:0.4:1.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'environmentMapMultiplier', uiType = 'float', displayName = 'Emission Multiplier', default='10', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'environmentMapType', uiType = 'enum', displayName = 'Environment Map Type', default='0', data='Spherical:Lat-Long', uiDict=uiDict) pm.separator() self.addRenderGlobalsUIElement(attName = 'sky_model', uiType = 'enum', displayName = 'Sky Model', default='0', data='original:captured-simulation', uiDict=uiDict) buttonLabel = "Create Sun" suns = pm.ls("IndigoSun") if len(suns) > 0: buttonLabel = "Delete Sun" uiDict['sunButton'] = pm.button(label = buttonLabel, command = self.editSun) self.addRenderGlobalsUIElement(attName = 'turbidity', uiType = 'float', displayName = 'Sky Turbidity', default='2.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'extra_atmospheric', uiType = 'bool', displayName = 'Extra Atmospheric', default='false', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'sun_layer', uiType = 'int', displayName = 'Sun Layer', default='0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'sky_layer', uiType = 'int', displayName = 'Sky Layer', 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) ]) pm.scriptJob(attributeChange=[self.renderGlobalsNode.environmentType, pm.Callback(self.uiCallback, tab="environment")]) self.updateEnvironment()
def createUISet(self): self._childLayout = pm.columnLayout(adj=True) with self._childLayout: self.deformers = [ pm.ls(type=deformerTypes[i]) for i in range(len(deformerTypes)) ] for i in range(len(deformerTypes)): for node in self.deformers[i]: self.probes[node] = pm.listConnections(node.cp) # specific for node in self.deformers[0]: frameLayout = pm.frameLayout(label=node.name(), collapsable=True) with frameLayout: self.createCommonAttr(node, deformerTypes[0]) indices = cmds.getAttr(node + ".cp", multiIndices=True) if indices: for j in indices: with pm.rowLayout(numberOfColumns=1): pm.attrFieldSliderGrp( label=node.ctlw[j].getAlias(), min=0, max=10.0, attribute=node.ctlw[j])
def gui(dir_path): if(pm.window(win, ex = True)): pm.deleteUI(win) if(pm.windowPref(win, ex = True)): pm.windowPref(win, remove = True) myWin = pm.window(win, title='sal_testing' , sizeable = True, mnb = True, width = 480, height = 900, backgroundColor= [.68,.68,.68]) pm.scrollLayout() main01 = pm.columnLayout( adjustableColumn=True ) main02 = pm.columnLayout( adjustableColumn=True ) global antiAlising, compFocalLenght, prof pm.setParent(main02) # file info section pm.setParent(main02) infoColumn = pm.columnLayout(adjustableColumn=True) global fileInfo pm.setParent(main02) # grade total section infoFrame = pm.columnLayout(adjustableColumn=True) #infoLayout = pm.formLayout() # isntancing the total grade section global totalGrades totalGrades = sal.Total_Grades() 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 grading = pm.frameLayout( label= 'Grading', cll = True, cl = True , borderStyle = 'etchedIn', w = 480) pm.setParent(grading) antiAlising = sal.Grading_Section( name = 'Anitalias/Noise Qual', fileName = r"%s/Comments/proj01_antiAlisaing.txt" % dir_path, field = totalGrades.queryAnti(), toUpdate = totalGrades) section01 = antiAlising.create() pm.setParent(grading) # second intance of Section for Composition / Focal Lenght compFocalLenght = sal.Grading_Section( name = 'Comp/Focal Length', fileName = r"%s/Comments/proj01_compFocal.txt" % dir_path, field = totalGrades.queryComp(), toUpdate = totalGrades) section02 = compFocalLenght.create() pm.setParent(grading) prof = sal.Grading_Prof( name = 'Professionalism', fileName = r"%s/Comments/proj01_prof.txt" % (dir_path), field = totalGrades.queryPro(), fileStart = r"%s/Startup/proj01_start.db" % (dir_path), toUpdate = totalGrades) prof.create() # first intance of Section for proffesionalism #prof = sal.Checker( fileName= r"/Users/Fearman/Desktop/sal_package/Sartup/proj01_start") #section03 = prof.create() pm.setParent(infoColumn) fileInfo = sal.Images(prof) myWin.show()
def show_UI(self): # Init main window if (pm.window("main_window", exists=True)): pm.deleteUI("main_window") self.main_window = pm.window(t=MAIN_WINDOW_TITLE, wh=MAIN_WINDOW_DIMENSIONS, s=MAIN_WINDOW_RESIZEABLE) # Main vertical layout window_v_layout = pm.columnLayout(adj=True, rs=MAIN_WINDOW_CONTENT_SPACING, h=MAIN_WINDOW_DIMENSIONS[1]) # Checklist scroll layout checklist_scroll_layout = pm.scrollLayout(cr=True) # Checklist vertical layout checklist_vertical_layout = pm.columnLayout(adj=True) # Checklist header checklist_frame_layout = pm.frameLayout(l='Checker Options') opVars = pm.language.Env.optionVars # Show function checklist for fn_name in self.lookup_order: # If option is in opVars, use that value # Otherwise, use default value fn = self.functions[fn_name] if fn_name in opVars: option = opVars[fn_name] self.options[fn_name] = option else: option = self.options[fn_name] # Per-row layout checklist_row_layout = pm.rowLayout(nc=2, cl2=('right', 'center'), cw2=CHECKLIST_COLUMN_WIDTHS) # Function description label pm.text(l=fn.desc, align='right') # Begin radio buttons radio_row_layout = pm.rowLayout(nc=3) collection = pm.radioCollection() # Draw skip radio button set_skip = pm.Callback(self.set_option, fn_name, self.checker_option.SKIP) skip_button = pm.radioButton(l='Skip', onc=set_skip) # Draw check radio button if fn.checkFn: set_check = pm.Callback(self.set_option, fn_name, self.checker_option.CHECK) check_button = pm.radioButton(l='Check', onc=set_check) # Draw cleanup radio button if fn.cleanupFn: set_cleanup = pm.Callback(self.set_option, fn_name, self.checker_option.CLEANUP) cleanup_button = pm.radioButton(l='Cleanup', onc=set_cleanup) # End radio row collection pm.setParent('..') # End radio row layout pm.setParent('..') # End per-row layout pm.setParent('..') # Set selected radio button based on selected option if option is self.checker_option.SKIP: selected = skip_button elif option is self.checker_option.CHECK: selected = check_button else: selected = cleanup_button pm.radioCollection(collection, edit=True, select=selected) # End checklist vertical layout pm.setParent('..') # End checklist scroll layout pm.setParent('..') log_frame_layout = pm.frameLayout(l='Log Output') # Start log scroll layout log_scroll_layout = pm.scrollLayout(cr=True, h=LOG_SCROLL_AREA_HEIGHT) # Log text object # The -32 is prevent the horizontal scrollbar from appearing self.log_text = pm.text(l=self.log_results, h=MAX_LOG_HEIGHT, al='left', w=MAIN_WINDOW_DIMENSIONS[0] - 32, ww=True) # End log scroll layout pm.setParent('..') pm.setParent('..') # Start button horizontal layout button_h_layout = pm.rowLayout(nc=3, cw3=(128, 128, 128), ct3=('both', 'both', 'both'), h=MAIN_BUTTON_AREA_HEIGHT) # If Run and Export Selected, check and attempt to export pm.button(l='Run and Export Selected', c=self.check_and_export) # If Check/Cleanup, run check and cleanup pm.button(l='Run', c=self.check) # If Cancel, close the window pm.button(l='Close', c=self.close_main_window) # End button horizontal layout pm.setParent('..') # End main vertical layout pm.setParent('..') pm.showWindow(self.main_window)
def create_ui(): winID = 'aovUI' winWidth = 530 winHeight = 725 rowHeight = 30 if pm.window(winID, exists=True): pm.deleteUI(winID) aovWin = pm.window(winID, title='Light Group / AOV Manager', widthHeight=(winWidth, 580), sizeable=True) # Main layout refs mainCL = pm.columnLayout(adjustableColumn=False, columnAttach=('both', 5), rowSpacing=8, columnWidth=530, parent=winID) # 1st block - LG Assignment pm.frameLayout(label='Light Group Assignment') topDivide_LG = pm.columnLayout(adjustableColumn=True, columnAlign='center', rowSpacing=8) pm.rowLayout(numberOfColumns=2) # 1st row - LG L pm.columnLayout(adjustableColumn=True, columnAlign='center', rowSpacing=8) pm.text(label='Lights') pm.textScrollList('ui_light_list', numberOfRows=20, h=winHeight * .25, allowMultiSelection=True, append=lightListing(), dcc="getItemInList()") pm.setParent('..') #1st row - LG R pm.columnLayout(adjustableColumn=True, columnAlign='center', rowSpacing=8) pm.text(label='Light Groups') pm.textScrollList('ui_lightGroup_list', numberOfRows=20, h=winHeight * .25, allowMultiSelection=True, append=getLightGroups(), dcc="getItemInList()") pm.setParent('..') pm.setParent(topDivide_LG) # pm.separator() pm.gridLayout(numberOfColumns=3, cellWidthHeight=(winWidth * .33, 30)) pm.button(label='Refresh', command='refreshList()') pm.button(label='Remove', command='removeLgAov()') pm.button(label='Clear All', command='clearAllLG()') pm.setParent('..') pm.separator() pm.rowColumnLayout(numberOfRows=1, width=winWidth) pm.textField('ui_lightGroup_setName', height=30, width=310, pht='Light Group Name') pm.button(label='Create', w=winWidth * .2, command='createNewLG()') pm.button(label='Reset', w=winWidth * .2, command='resetLgNameInput()') pm.setParent('..') pm.separator() pm.gridLayout(numberOfColumns=3, cellWidthHeight=(winWidth * .5, 30)) pm.button(label='Get', command='getSingleLgAov()') pm.button(label='Set', command='applyLgAov()') pm.setParent('..') pm.separator() #2nd block - LPE assignment pm.frameLayout(label='LPE Assignment') topDivide_LPE = pm.columnLayout(adjustableColumn=True, columnAlign='center', rowSpacing=8) pm.rowLayout(numberOfColumns=2) #2nd Block aov list pm.columnLayout(adjustableColumn=True, columnAlign='center', rowSpacing=8) pm.text(label='Current AOVs') pm.textScrollList('ui_aov_list', numberOfRows=20, h=winHeight / 4, allowMultiSelection=True, append=getAovs()) pm.setParent('..') pm.columnLayout(adjustableColumn=True, columnAlign='center', rowSpacing=8) #2nd block - lpe list pm.text(label='LPE Keys') pm.textScrollList('ui_lpe_list', numberOfRows=20, h=winHeight / 4, allowMultiSelection=True, append=aovKeys) pm.setParent('..') pm.setParent(topDivide_LPE) pm.rowLayout(numberOfColumns=2) pm.button(label='Clear Aovs', width=winWidth * .488, command='clearCustomAovs()') pm.button(label='Clear Keys', width=winWidth * .488, command='clearAovkeys()') pm.setParent('..') pm.separator() pm.gridLayout(numberOfColumns=2, cellWidthHeight=(winWidth * .492, 30)) pm.button(label='Refresh', command='refreshLpeBlock()') pm.button(label='Remove', command='removeItemInList()') pm.setParent('..') pm.separator() pm.rowColumnLayout(numberOfRows=1, width=winWidth, cs=(1, 13)) pm.textField('ui_aov_setName', height=30, width=winWidth * .25, pht='Aov Name') pm.textField('ui_lpe_setName', height=30, width=winWidth * .25, pht='Custom LPE') pm.button(label='Create', w=winWidth * .2, command='aovSetName()') pm.button(label='Reset', w=winWidth * .2, command='resetLpeInput()') pm.setParent('..') pm.separator() pm.gridLayout(numberOfColumns=1, cellWidthHeight=(winWidth, 45)) pm.button(label='Create Custom Aovs', width=winWidth, ann='Click the button to do the thing.', command='createAov()') pm.setParent('..') pm.showWindow(aovWin)
def __init__(self): title = 'curvyEdges' version = '1.01' self.ceObj = spline(self) if pm.window('curvyEdgesWin', exists=True): pm.deleteUI('curvyEdgesWin') with pm.window('curvyEdgesWin', title='{0} | {1}'.format(title, version), mnb=False, mxb=False, sizeable=False) as window: with pm.columnLayout(): # curve Frame with pm.frameLayout(l='Curve Settings', cll=True, cl=False, bs='out'): with pm.columnLayout(): self.curveType = pm.radioButtonGrp( l='Curve Type:', sl=0, nrb=2, cw3=[96, 96, 128], labelArray2=['BezierCurve', 'NurbsCurve']) self.spans = pm.intSliderGrp(field=True, l='Curve Spans:', minValue=2, maxValue=24, fieldMinValue=2, fieldMaxValue=128, value=2, cw3=[96, 64, 128]) with pm.rowColumnLayout(nc=2, cw=[1, 96], co=[1, 'right', 1]): self.selOnly = pm.checkBox(v=False, l='Selection Only') pm.button(l='Create Curve', c=self._create, width=201) # Deformer Frame with pm.frameLayout(l='Deformer Settings', bs='out', cl=False, cll=True): with pm.columnLayout(): self.currentCrv = pm.textFieldGrp(editable=False, l='Current Curve:', cw2=[96, 195]) self.deformers = [ attrSlider(1, 0, 1, 'envelope', self.ceObj), attrSlider(1, -10, 10, 'tension', self.ceObj), attrSlider(0, 0, 256, 'dropoffDistance[0]', self.ceObj), attrSlider(1, 0, 2, 'scale[0]', self.ceObj), attrSlider(1, 0, 1, 'rotation', self.ceObj) ] window.show() pm.scriptJob(event=['SelectionChanged', self.select], protected=True, p=window) self.select()
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 FujiTranslatorCreateTab(self): log.debug("FujiTranslatorCreateTab()") 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="Fuji 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] + ".Fuji" # 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): 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 __init__(self): try: pm.deleteUI( 'PipeGenWin' ) except: pass win = pm.window('PipeGenWin') with win: with pm.columnLayout(): with pm.frameLayout( l='Creation', labelVisible=False): with pm.columnLayout(): with pm.rowLayout( nc=3, cw3=[80, 80, 240], cal=([1,'center'], [2,'right'])): pm.button( l='Create', w=80, c= lambda *args: self.newPipeCB()) pm.text( l='Name' ) self.createGrp = pm.textField( text='pipe', w=90) pm.separator(w=400) with pm.rowLayout( nc=2, cw2=[80, 320], cal=[1,'center']): #text( l='Segments' ) pm.button( l='Extend', w=80, c = lambda *args: self.extendPipeCB() ) self.numSegments = pm.intSliderGrp( cw3=[80,40,50], l='Segments', value=1, field=1, min=1, max=20 ) with pm.frameLayout( l='Pipe Properties', labelVisible=True): with pm.columnLayout(): self.pipeRadius = pm.floatSliderGrp( l='Radius', value=.22, field=True, precision = 3, min=.0001, max=10 ) self.subdivAxis = pm.intSliderGrp( l='Axis Segments', value=16, field=True, min=3, max=80 ) with pm.frameLayout( l='Connector Properties', labelVisible=True): with pm.columnLayout(): self.connectorRadius = pm.floatSliderGrp( l='Connector Radius', value=.1, field=True, precision = 3, min=0, max=10 ) self.connectorThickness = pm.floatSliderGrp( l='Connector Height', value=.2, field=True, precision = 3, min=.001, max=10 ) self.connectorOffset = pm.floatSliderGrp( l='Connector Offset', value=.001, field=True, precision = 3, min=0, max=4 ) with pm.frameLayout( l='Joint Properties', labelVisible=True): with pm.columnLayout(): self.jointRadius = pm.floatSliderGrp( l='Radius', value=0, field=True, precision = 3, min=0, max=10 ) self.subdivJoint = pm.intSliderGrp( l='Joint Segments', value=8, field=True, min=1, max=80 ) self.jointLength = pm.floatSliderGrp( l='Joint Length', value=1.2, field=True, precision = 3, min=0.0001, max=10 )
def ui(self): template = pm.uiTemplate('ExampleTemplate', force=True) template.define(pm.button, height=30, w=80) template.define(pm.frameLayout, mw=2, mh=2, borderVisible=False, labelVisible=False) if pm.window(self.name, q=1, ex=1): pm.deleteUI(self.name) with pm.window("TiltTool_win", t=self.title, s=False, tlb=True, mnb=True) as win: with template: with pm.frameLayout(): with pm.columnLayout(adj=True, rs=10): pm.text(label="OPTIONS", h=30, fn="boldLabelFont") with pm.frameLayout(): with pm.columnLayout(adj=True, rs=5): with pm.rowLayout(columnWidth3=(0, 0, 0), adj=True, numberOfColumns=4): pm.text(label="Tilt Control ", align='left') self.tiltCtrl = pm.textFieldGrp( pht="Select the tilt control", cw1=150, tx=self.tiltCtrl_txt) pm.text(label="< < < ") pm.button(label="Add", h=25, backgroundColor=colordic['green3'], c=pm.Callback(self.getCtrl)) with pm.rowLayout(columnWidth3=(0, 0, 0), adj=True, numberOfColumns=4): pm.text(label="Mesh ", align='left') self.mesh = pm.textFieldGrp( pht="Select the mesh", cw1=150, tx=self.mesh_txt) pm.text(label="< < < ") pm.button(label="Add", h=25, backgroundColor=colordic['green3'], c=pm.Callback(self.getMesh)) with pm.rowLayout(columnWidth3=(0, 0, 0), adj=True, numberOfColumns=4): pm.text(label="Target Parent Group", align='left') self.target = pm.textFieldGrp( pht="Select the target", cw1=150, tx=self.parent_txt) pm.text(label="< < < ") pm.button(label="Add", h=25, backgroundColor=colordic['green3'], c=pm.Callback(self.getTarget)) with pm.rowLayout(columnWidth3=(0, 0, 0), adj=True, numberOfColumns=4): pm.text(label="Mesh Last Offset Ctrl", align='left') self.offset_ctrl = pm.textFieldGrp( pht="Select the target", cw1=150, tx=self.offset_txt) pm.text(label="< < < ") pm.button(label="Add", h=25, backgroundColor=colordic['green3'], c=pm.Callback(self.getOffsetCtrl)) pm.separator() pm.text(label="RIGGING", h=20, fn="boldLabelFont") pm.separator() with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=7): pm.text( label=" CHOOSE AXIS ", h=50, ) if self.axisZ_setdata == 'True': pm.checkBox("myChBxZ", l="Z axis", h=25, value=True) else: pm.checkBox("myChBxZ", l="Z axis", h=25, value=False) if self.axisX_setdata == 'True': pm.checkBox("myChBxX", l="X axis", h=25, value=True) else: pm.checkBox("myChBxX", l="X axis", h=25, value=False) pm.button(label="Save Data", w=88, h=25, backgroundColor=colordic['blue'], c=pm.Callback(self.saveData)) pm.button(label="Clear Info", w=88, h=25, backgroundColor=colordic['darkblue'], c=pm.Callback(self.refresh)) with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=2): pm.button(label="Build Basic Guide", w=197, backgroundColor=colordic['grey'], c=pm.Callback(self.buildGuide)) pm.button(label="Build Basic Rig", w=197, backgroundColor=colordic['grey'], c=pm.Callback(self.buildRig))
def UI(self): # create window if pm.window('ehm_ReverseShape_UI', exists=True): pm.deleteUI('ehm_ReverseShape_UI') pm.window('ehm_ReverseShape_UI', title='Reverse shape', w=300, h=80, mxb=False, mnb=True, sizeable=True) # main layout #mainLayout = pm.rowColumnLayout() formLayout = pm.formLayout(w=300, h=80) frameLayout = pm.frameLayout(borderStyle='etchedIn', labelVisible=False) pm.setParent(formLayout) # radio buttons self.AxisText = pm.text(label='Axis: ', align='right') self.AxisRC = pm.radioCollection() self.xRB = pm.radioButton(label="x", select=True) self.yRB = pm.radioButton(label="y") self.zRB = pm.radioButton(label="z") # buttons self.applyButton = pm.button(label='Apply', h=30, c=partial(self.reverseShape, None, 'x')) # place frame layout 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)) # place radio buttons #pm.formLayout( formLayout, edit=True, attachPosition=(self.AxisText,'left', 5, 0) ) pm.formLayout(formLayout, edit=True, attachPosition=(self.AxisText, 'right', 0, 25)) pm.formLayout(formLayout, edit=True, attachForm=(self.AxisText, 'top', 17)) #pm.formLayout( formLayout, edit=True, attachPosition=(self.xRB,'left', 5, 25) ) pm.formLayout(formLayout, edit=True, attachPosition=(self.xRB, 'right', 10, 50)) pm.formLayout(formLayout, edit=True, attachForm=(self.xRB, 'top', 15)) #pm.formLayout( formLayout, edit=True, attachPosition=(self.yRB,'left', 5, 50) ) pm.formLayout(formLayout, edit=True, attachPosition=(self.yRB, 'right', 10, 75)) pm.formLayout(formLayout, edit=True, attachForm=(self.yRB, 'top', 15)) #pm.formLayout( formLayout, edit=True, attachPosition=(self.zRB,'left', 5, 75) ) pm.formLayout(formLayout, edit=True, attachPosition=(self.zRB, 'right', 20, 100)) pm.formLayout(formLayout, edit=True, attachForm=(self.zRB, 'top', 15)) # place buttons pm.formLayout(formLayout, edit=True, attachPosition=(self.applyButton, 'left', 4, 25)) pm.formLayout(formLayout, edit=True, attachPosition=(self.applyButton, 'right', 2, 75)) pm.formLayout(formLayout, edit=True, attachForm=(self.applyButton, 'bottom', 5)) # show window pm.showWindow('ehm_ReverseShape_UI')
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].get( '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 make_ui(self): window_title = 'L-System' window_name = 'lSystem' width = 300 height = 445 default_radius = 2 radius_min = 0 raduis_max = 10 if pm.window(window_name, exists=True): pm.deleteUI(window_name) self.window = pm.window( window_name, title=window_title, widthHeight=(width, height), mnb=False, mxb=False, rtf=True, sizeable=False, ) pm.columnLayout() pm.text(l='L-System Generator', w=300, h=30, bgc=(.7, .7, .7), fn='boldLabelFont') pm.text(l='', h=5) pm.frameLayout(l='Input Rules') pm.rowLayout(nc=2, cw2=(50, 245), ct2=('both', 'both')) pm.text('AxiomText', l='Axiom:', h=30) pm.textField('AxiomField', h=30) pm.setParent('..') pm.rowLayout(nc=2, cw2=(50, 245), ct2=('both', 'both')) pm.text('RuleText1', l='Rule 1:', h=30) pm.textField('RuleField1', h=30) pm.setParent('..') pm.rowLayout(nc=2, cw2=(50, 245), ct2=('both', 'both')) pm.text('RuleText2', l='Rule 2:', h=30) pm.textField('RuleField2', h=30) pm.setParent('..') pm.rowLayout(nc=2, cw2=(50, 245), ct2=('both', 'both')) pm.text('RuleText3', l='Rule 3:', h=30) pm.textField('RuleField3', h=30) pm.setParent('..') pm.rowLayout(nc=2, cw2=(50, 245), ct2=('both', 'both')) pm.text('RuleText4', l='Rule 4:', h=30) pm.textField('RuleField4', h=30) pm.setParent('..') pm.rowLayout(nc=2, cw2=(60, 100), ct2=('both', 'both')) pm.text('Iterations', l='Iterations', h=20) pm.intField('IterationsField', h=20) pm.setParent('..') pm.rowLayout(nc=2, cw2=(60, 100), ct2=('both', 'both')) pm.text('Angle', l='Angle', h=20) pm.floatField('AngleField', h=20) pm.setParent('..') pm.text(l='', h=5) # Finish frame layout for input rules pm.setParent('..') pm.frameLayout(l='Predefined Trees') pm.text(l='', h=5) pm.radioButtonGrp(la3=['Shape 1', 'Shape 2', 'Shape 3'], nrb=3, on1=pm.Callback(self.preset, 1), on2=pm.Callback(self.preset, 2), on3=pm.Callback(self.preset, 3)) pm.text(l='', h=5) pm.setParent('..') pm.frameLayout(l='Select') pm.rowLayout(nc=3, ct3=('both', 'both', 'both')) pm.button(l='Create', w=97, h=30, c=pm.Callback(self.draw)) pm.button(l='Combine', w=97, h=30, c=pm.Callback(self.combine)) pm.button(l='Delete', w=97, h=30, c=pm.Callback(self.delete_all)) pm.setParent('..') # Finish frame layout for select pm.setParent('..') self.window.show() self.window.setWidthHeight((width, height))
def buildUI(self, filter=None): if filter: match = False for i, info in enumerate(self.methodInfoList): argUtil = factories.ApiArgUtil(self.apiClassName, self.apiMethodName, i) if filter.intersection(argUtil.getInputTypes() + argUtil.getOutputTypes()): match = True break if match == False: return False self.layout = { 'columnAlign': [1, 'right'], 'columnAttach': [1, 'right', 8] } #print className, self.methodName, melMethods isOverloaded = len(self.methodInfoList) > 1 self.frame = pm.frameLayout(w=FRAME_WIDTH, labelVisible=False, collapsable=False) logger.debug("building row for %s - %s" % (self.methodName, self.frame)) col = pm.columnLayout() enabledArray = [] self.rows = [] self.overloadPrecedenceColl = None self.enabledChBx = pm.checkBox(label=self.methodName, changeCommand=pm.CallbackWithArgs( MethodRow.enableCB, self)) if isOverloaded: self.overloadPrecedenceColl = pm.radioCollection() for i in range(len(self.methodInfoList)): self.createMethodInstance(i) else: #row = rowLayout( self.methodName + '_rowMain', nc=2, cw2=[200, 400] ) #self.enabledChBx = checkBox(label=self.methodName, changeCommand=CallbackWithArgs( MethodRow.enableCB, self ) ) #text(label='') self.createMethodInstance(0) #setParent('..') pm.setParent(col) pm.separator(w=800, h=6) #self.row = rowLayout( self.methodName + '_rowSettings', nc=4, cw4=[200, 160, 180, 160] ) #self.rows.append(row) self.row = pm.rowLayout(self.methodName + '_rowSettings', nc=2, cw2=[200, 220], **self.layout) self.rows.append(self.row) # create ui elements pm.text(label='Mel Equivalent') self.melNameTextField = pm.textField(w=170, editable=False) self.melNameOptMenu = pm.popupMenu(parent=self.melNameTextField, button=1, postMenuCommand=pm.Callback( MethodRow.populateMelNameMenu, self)) pm.setParent('..') self.row2 = pm.rowLayout(self.methodName + '_rowSettings2', nc=3, cw3=[200, 180, 240], **self.layout) self.rows.append(self.row2) pm.text(label='Use Name') self.nameMode = pm.radioButtonGrp(label='', nrb=3, cw4=[1, 50, 50, 50], labelArray3=['api', 'mel', 'other']) self.altNameText = pm.textField(w=170, enable=False) self.altNameText.changeCommand( pm.CallbackWithArgs(MethodRow.alternateNameCB, self)) self.nameMode.onCommand(pm.Callback(MethodRow.nameTypeCB, self)) isEnabled = self.data.get('enabled', True) # UI SETUP melName = self.data.get('melName', '') try: #self.melNameOptMenu.setValue( melName ) self.melNameTextField.setText(melName) if melName != '': self.parent.parent.assignMelMethod(melName) except RuntimeError: # it is possible for a method name to be listed here that was set from a different view, # where this class was a super class and more mel commands were available. expand the option list, # and make this frame read-only pm.menuItem(label=melName, parent=self.melNameOptMenu) self.melNameOptMenu.setValue(melName) logger.debug("making %s frame read-only" % self.methodName) self.frame.setEnable(False) self.enabledChBx.setValue(isEnabled) self.row.setEnable(isEnabled) self.row2.setEnable(isEnabled) name = self.data['useName'] if name == 'API': self.nameMode.setSelect(1) self.altNameText.setEnable(False) elif name == 'MEL': self.nameMode.setSelect(2) self.altNameText.setEnable(False) else: self.nameMode.setSelect(3) self.altNameText.setText(name) self.altNameText.setEnable(True) if self.overloadPrecedenceColl: items = self.overloadPrecedenceColl.getCollectionItemArray() try: val = self.data.get('overloadIndex', 0) if val is None: logger.info("no wrappable options for method %s" % self.methodName) self.frame.setEnable(False) else: self.overloadPrecedenceColl.setSelect(items[val]) except: pass # # ensure we don't use a value that is not valid # for val in range(val, len(enabledArray)+1): # try: # if enabledArray[val]: # break # except IndexError: # val = None # if val is not None: # self.overloadPrecedenceColl.setSelect( items[ val ] ) pm.setParent('..') pm.setParent('..') # frame pm.setParent('..') # column return True