def __sceneToCalc(*args): """ Copies the DMC-related V-Ray globals settings to the calculator UI.""" # V-ray globals globals = pm.PyNode('vraySettings') # V-ray scene settings to dictionary settings = { 'dmc_min_subdiv': globals.dmcMinSubdivs.get(), 'dmc_max_subdiv': globals.dmcMaxSubdivs.get(), 'dmc_threshold': globals.dmcs_adaptiveThreshold.get(), 'adaptive_min': globals.dmcs_adaptiveMinSamples.get(), 'adaptive_amt': globals.dmcs_adaptiveAmount.get(), 'subdivs_mult': globals.dmcs_subdivsMult.get() } # Transfer scene settings to UI pm.intSliderGrp('min_subdivs_in', e=True, v=settings['dmc_min_subdiv']) pm.intSliderGrp('max_subdivs_in', e=True, v=settings['dmc_max_subdiv']) pm.floatSliderGrp('thresh_val_in', e=True, v=settings['dmc_threshold']) pm.intSliderGrp('adapt_min_in', e=True, v=settings['adaptive_min']) pm.floatSliderGrp('adapt_amt_in', e=True, v=settings['adaptive_amt']) pm.floatFieldGrp('subdivs_mult_in', e=True, v=(settings['subdivs_mult'], 0, 0, 0)) # .. and refresh __uiUpdate() return True
def KrayRendererUpdateTab(self, dummy=None): self.createGlobalsNode() #self.updateEnvironment() log.debug("KrayRendererUpdateTab()") sDict = self.rendererTabUiDict['sampling'] sType = self.renderGlobalsNode.samplingType.get() if sType != 1: #grid pm.intFieldGrp(sDict['gridSize'], edit=True, enable=False) pm.checkBoxGrp(sDict['gridRotate'], edit=True, enable=False) else: pm.intFieldGrp(sDict['gridSize'], edit=True, enable=True) pm.checkBoxGrp(sDict['gridRotate'], edit=True, enable=True) fType = self.renderGlobalsNode.filtertype.get() if fType in [4, 5, 6]: pm.floatFieldGrp(sDict['filterSize'], edit=True, enable=False) else: pm.floatFieldGrp(sDict['filterSize'], edit=True, enable=True) iFormat = self.renderGlobalsNode.imageFormat.get() if iFormat in [2, 3]: pm.attrEnumOptionMenuGrp(sDict['bitdepth'], edit=True, enable=True) else: pm.attrEnumOptionMenuGrp(sDict['bitdepth'], edit=True, enable=False) if iFormat == 1: pm.intFieldGrp(sDict['jpgQuality'], edit=True, enable=True) else: pm.intFieldGrp(sDict['jpgQuality'], edit=True, enable=False)
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 addUIElement(self, uiType, attribute, uiLabel, callback): ui = None if uiType == 'bool': ui = pm.checkBoxGrp(label=uiLabel) if callback is not None: pm.checkBoxGrp(ui, edit=True, cc=callback) if uiType == 'int': ui = pm.intFieldGrp(label=uiLabel, numberOfFields = 1) if callback is not None: pm.intFieldGrp(ui, edit=True, cc = callback) if uiType == 'float': ui = pm.floatFieldGrp(label=uiLabel, numberOfFields = 1) if callback is not None: pm.floatFieldGrp(ui, edit=True, cc= callback) if uiType == 'enum': ui = pm.attrEnumOptionMenuGrp(label = uiLabel, at=attribute, ei = self.getEnumList(attribute)) # attrEnumOptionGrp has no cc callback, so I create a script job if callback is not None: attribute = pm.Attribute(self.renderGlobalsNodeName + "." + attribute) pm.scriptJob(attributeChange=[attribute, callback], parent=ui) if uiType == 'color': ui = pm.attrColorSliderGrp(label=uiLabel, at=attribute) if uiType == 'string': ui = pm.textFieldGrp(label=uiLabel) if callback is not None: pm.textFieldGrp(ui, edit=True, cc=callback) return ui
def createRigCallback(self, *args): reaply = pm.checkBox(self.reapplySkinCheckbox, q=True, v=True) armRibChk= pm.checkBox(self.hasArmRibbonsCheckbox,q=True, v=True) armRibbons = pm.intField(self.armRibbonJointsIntField, q=True, v=True) armOffset = pm.floatFieldGrp(self.armRibbonFirstJointOffsetFloatField, q=True, v1=True) legRibChk= pm.checkBox(self.hasLegRibbonsCheckbox,q=True, v=True) legRibbons = pm.intField(self.legRibbonJointsIntField, q=True, v=True) legOffset = pm.floatFieldGrp(self.legRibbonFirstJointOffsetFloatField, q=True, v1=True) spineJnts = pm.intField(self.spineJointsIntField, q=True, v=True) if not legRibChk: legRibbons=0 if not armRibChk: armRibbons=0 if reaply: self.bipedInstance.saveSkin() self.bipedInstance.generateRig(armRibbons=armRibbons, armOffsetStart=armOffset, armOffsetEnd=armOffset, legRibbons=legRibbons, legOffsetStart=legOffset, legOffsetEnd=legOffset, parentModules=True, spineJnts=spineJnts) if reaply: try: self.bipedInstance.loadSkin() except: logger.warn('no rig...')
def binMeshTranslatorOpts(parent, action, initialSettings, resultCallback): print "Parent", parent print "Action", action print "InitialSettings", initialSettings print "ResultCallback", resultCallback useTransform = True oneFilePerMesh = False createProxies = True proxyRes = 0.1 exportDir = "" if initialSettings is not None and len(initialSettings) > 0: #oneFilePerMesh=0;createProxies=1;proxyRes=0.1;exportDir=;createProxies=1 opts = initialSettings.split(";") for opt in opts: name, value = opt.split("=") if name == "oneFilePerMesh": oneFilePerMesh = int(value) if name == "createProxies": createProxies = int(value) if name == "useTransform": useTransform = int(value) if name == "proxyRes": proxyRes = float(proxyRes) if action == "post": print "post action" pm.setParent(parent) with pm.columnLayout(adj = True): pm.checkBox("MSH_OPTS_DOTRANSFORM", label = "Use Transform", v=useTransform) pm.checkBox("MSH_OPTS_ONEFILE", label = "One File Per Mesh", v=oneFilePerMesh) pm.checkBox("MSH_OPTS_DOPROX", label = "Create ProxyFiles", v=createProxies) pm.floatFieldGrp("MSH_OPTS_PROXPERC", label="Proxy Resolution", v1 = proxyRes) #pm.textFieldGrp("MSH_OPTS_PATH", label="ExportDir:", text=exportDir) if action == "query": resultOptions = "" print "Query action" oneFilePerMesh = pm.checkBox("MSH_OPTS_ONEFILE", query=True, v=True) resultOptions += "oneFilePerMesh={0}".format(int(oneFilePerMesh)) doProx = pm.checkBox("MSH_OPTS_DOPROX", query=True, v=True) resultOptions += ";createProxies={0}".format(int(doProx)) proxyRes = pm.floatFieldGrp("MSH_OPTS_PROXPERC", query=True, v1 = True) resultOptions += ";proxyRes={0}".format(proxyRes) #exportDir = pm.textFieldGrp("MSH_OPTS_PATH", query=True, text = True) #resultOptions += ";exportDir='{0}'".format(exportDir) doTransform = pm.checkBox("MSH_OPTS_DOTRANSFORM", query=True, v=True) resultOptions += ";useTransform={0}".format(int(doTransform)) melCmd = '{0} "{1}"'.format(resultCallback,resultOptions) pm.mel.eval(melCmd) return 1
def create(self): if pm.window(self.window, exists=True): pm.deleteUI(self.window) pm.window(self.window, t=self.title) # source & targets pm.rowColumnLayout(nc=3,cal=[(1,'right')], cw=[(1,80),(2,200),(3,100)]) pm.text(l='Source: ') self.sourceObjTf = pm.textField() pm.button(l='Select', c=self.selectSource) pm.text(l='Target(s): ') self.targetObjsTf = pm.textField() pm.button(l='Select', c=self.selectTarget) pm.setParent('..') # number pm.rowColumnLayout(w=self.size[0]) self.copyNum = pm.intSliderGrp(l='Copies: ', v=10, cw3=[80,80,220], min=1, max=500, fmx=5000, f=True) pm.separator(h=10, st='in') # rotation pm.rowColumnLayout(nc=2, cal=[(1,'right')], cw=[(1,80), (2,300)]) pm.text(l='Rotation: ') self.rotationModeRC = pm.radioCollection() self.rotBtnFixed = pm.radioButton(l='Fixed', sl=True) pm.text(l='') self.rotBtnAlign = pm.radioButton(l='Align with Target') pm.text(l='') self.rotBtnRand = pm.radioButton(l='Random', onc=lambda *args: self.rotationRange.setEnable(True), ofc=lambda *args: self.rotationRange.setEnable(False)) pm.setParent('..') self.rotationRange = pm.floatFieldGrp(l='Range: ', nf=3, v1=30, v2=30, v3=30, cw4=[80,100,100,100], en=False) pm.separator(h=10, st='in') # scale pm.rowColumnLayout(nc=2, cal=[(1,'right')], cw=[(1,80), (2,300)]) pm.text(l='Scale: ') self.scaleModeRC = pm.radioCollection() self.scaleBtnFixed = pm.radioButton(l='Fixed', sl=True) pm.text(l='') self.scaleBtnRand = pm.radioButton(l='Random', onc=lambda *args: self.scaleRange.setEnable(True), ofc=lambda *args: self.scaleRange.setEnable(False)) pm.setParent( '..' ) self.scaleRange = pm.floatFieldGrp(l='Min Max: ', nf=2, v1=1, v2=1, cw3=[80,100,100], en=False) pm.separator(h=10, st='in') # disperse button pm.button(l='Disperse', c=self.disperse, w=380, al='center') pm.showWindow(self.window)
def exportScene(): filePath= pm.textField('path_TFG', q=True, text=True ) #pm.selected() #directory = 'C:/Users/Administrator/Desktop/alembic/' #fileName = 'B_02' deleteUnknownNodes() print u'"%s" 로 출력됩니다.' % filePath startFrame = pm.floatFieldGrp( 'timeRange_FFG', q=True, value1=True ) endFrame = pm.floatFieldGrp( 'timeRange_FFG', q=True, value2=True ) export( filePath, startFrame, endFrame, 1 )
def KrayFinalGatheringCreateTab(self): log.debug("KrayFinalGatheringCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "PhotonsScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="Photons frame", collapsable=True, collapse=False): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): ui = pm.floatFieldGrp(label="Threshold:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgThreshold", index=2) pm.separator() ui = pm.intFieldGrp(label="Min Rays:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgMinRays", index=2) ui = pm.intFieldGrp(label="Max Rays:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgMaxRays", index=2) ui = pm.floatFieldGrp(label="Prerender:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgPrerender", index=2) ui = pm.intFieldGrp(label="Passes:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgPasses", index=2) pm.separator() ui = pm.floatFieldGrp(label="Sploth Detect:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgSplotchDetect", index=2) ui = pm.floatFieldGrp(label="Sensitivity:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgSensitivity", index=2) pm.separator() ui = pm.checkBoxGrp(label="FG Reflections:", value1=False) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgReflections", index=2) ui = pm.checkBoxGrp(label="FG Refractions:", value1=False) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgRefractions", index=2) pm.separator() ui = pm.floatFieldGrp(label="Spatial Tolerance:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgSpatialTolerance", index=2) ui = pm.floatFieldGrp(label="Angular Tolerance:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgAngularTolerance", index=2) ui = pm.floatFieldGrp(label="FG Min Dist:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgDistMin", index=2) ui = pm.floatFieldGrp(label="FG Dist Max:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgDistMax", index=2) ui = pm.floatFieldGrp(label="Density/Brightness:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgBrightness", index=2) pm.separator() ui = pm.intFieldGrp(label="Path Passes:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgPathPasses", index=2) ui = pm.floatFieldGrp(label="Corner Dist:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgCornerDist", index=2) ui = pm.checkBoxGrp(label="Show Samples:", value1=False) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgShowSamples", index=2) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
def getModuleInstance(self): baseNameT = pm.textFieldGrp(self.baseNameT,q = 1,text = 1) sideT = pm.textFieldGrp(self.sideT,q = 1,text = 1) cntAxisT = pm.textFieldGrp(self.cntAxisT,q = 1,text = 1) cntSizeBodyV = pm.floatFieldGrp(self.cntSizeBody,q = 1,value1 = 1) cntSizeIkV = pm.floatFieldGrp(self.cntSizeIk,q = 1,value1 = 1) segmentN = pm.intFieldGrp(self.segment,q = 1,v = 1) mainMetaNode = pm.optionMenu(self.mainMetaNodeM,q = 1,v = 1) self.__pointerClass = SpineModule(baseName = baseNameT,side = sideT,bodySize = cntSizeBodyV,ctrlAxis = cntAxisT, ikSize = cntSizeIkV,segment = segmentN,metaMain = mainMetaNode) return self.__pointerClass
def createRigCallback(self, *args): reaply = pm.checkBox(self.reapplySkinCheckbox, q=True, v=True) armRibChk = pm.checkBox(self.hasArmRibbonsCheckbox, q=True, v=True) armRibbons = pm.intField(self.armRibbonJointsIntField, q=True, v=True) armOffset = pm.floatFieldGrp(self.armRibbonFirstJointOffsetFloatField, q=True, v1=True) legRibChk = pm.checkBox(self.hasLegRibbonsCheckbox, q=True, v=True) legRibbons = pm.intField(self.legRibbonJointsIntField, q=True, v=True) legOffset = pm.floatFieldGrp(self.legRibbonFirstJointOffsetFloatField, q=True, v1=True) parentModulesSel = pm.radioButtonGrp(self.modulesConnectionRadioButton, q=True, sl=True) spineJnts = pm.intField(self.spineJointsIntField, q=True, v=True) print 'parent', parentModulesSel if parentModulesSel == 1: parentModules = True else: parentModules = False print armRibbons, legRibbons if not legRibChk: legRibbons = 0 if not armRibChk: armRibbons = 0 if reaply: self.quadrupedInstance.saveSkin() self.quadrupedInstance.generateRig(armRibbons=armRibbons, armOffsetStart=armOffset, armOffsetEnd=armOffset, legRibbons=legRibbons, legOffsetStart=legOffset, legOffsetEnd=legOffset, parentModules=parentModules, spineJnts=spineJnts) if reaply: try: self.quadrupedInstance.loadSkin() except: logger.error('nao tem rig ainda...')
def main( *args ): if( pm.window('selInvertNormalFace', exists=True) ): pm.deleteUI('selInvertNormalFace') uiLayout['window'] = pm.window('selInvertNormalFace', menuBar=True, title='select face with invert normal', sizeable=False, h=60, w=180) uiLayout['mainLayout'] = pm.columnLayout(columnAlign='left', columnAttach=['left', 0] ) pm.floatFieldGrp( 'valDir', numberOfFields=3, label='Direction:', value1=0.0, value2=1.0, value3=0.0, cw4=[ 50, 30, 30, 30 ], parent=uiLayout['mainLayout'] ) uiLayout['ui_sub1'] = pm.rowColumnLayout( w=180, nc=2, cw=[(1, 85), ( 2,80 ) ], parent=uiLayout['mainLayout'] ) pm.floatFieldGrp( 'valOffset', numberOfFields=1, label='Offset:', value1=0.5, cw2=[ 50, 30 ], parent=uiLayout['ui_sub1'] ) pm.button( label=' Select Face! ', ebg=True, c=doSelInvNRMFace, parent=uiLayout['ui_sub1'] ) pm.showWindow( uiLayout['window'] )
def binMeshTranslatorOpts(parent, action, initialSettings, resultCallback): useTransform = True oneFilePerMesh = False createProxies = True proxyRes = 0.1 exportDir = "" if initialSettings is not None and len(initialSettings) > 0: #oneFilePerMesh=0;createProxies=1;proxyRes=0.1;exportDir=;createProxies=1 opts = initialSettings.split(";") for opt in opts: name, value = opt.split("=") if name == "oneFilePerMesh": oneFilePerMesh = int(value) if name == "createProxies": createProxies = int(value) if name == "useTransform": useTransform = int(value) if name == "proxyRes": proxyRes = float(proxyRes) if action == "post": pm.setParent(parent) with pm.columnLayout(adj=True): pm.checkBox("MSH_OPTS_DOTRANSFORM", label="Use Transform", v=useTransform) pm.checkBox("MSH_OPTS_ONEFILE", label="One File Per Mesh", v=oneFilePerMesh) pm.checkBox("MSH_OPTS_DOPROX", label="Create ProxyFiles", v=createProxies) pm.floatFieldGrp("MSH_OPTS_PROXPERC", label="Proxy Resolution", v1=proxyRes) if action == "query": resultOptions = "" oneFilePerMesh = pm.checkBox("MSH_OPTS_ONEFILE", query=True, v=True) resultOptions += "oneFilePerMesh={0}".format(int(oneFilePerMesh)) doProx = pm.checkBox("MSH_OPTS_DOPROX", query=True, v=True) resultOptions += ";createProxies={0}".format(int(doProx)) proxyRes = pm.floatFieldGrp("MSH_OPTS_PROXPERC", query=True, v1=True) resultOptions += ";proxyRes={0}".format(proxyRes) doTransform = pm.checkBox("MSH_OPTS_DOTRANSFORM", query=True, v=True) resultOptions += ";useTransform={0}".format(int(doTransform)) melCmd = '{0} "{1}"'.format(resultCallback, resultOptions) pm.mel.eval(melCmd) return 1
def getUIData(self, *args): self.prefix = pm.textFieldGrp(self.nameFld, query=True, text=True) self.loc1 = pm.textFieldButtonGrp(self.loc1Fld, query=True, text=True) self.loc2 = pm.textFieldButtonGrp(self.loc2Fld, query=True, text=True) self.loc3 = pm.textFieldButtonGrp(self.loc3Fld, query=True, text=True) self.shoulder = pm.textFieldButtonGrp(self.upperTorsoFld, query=True, text=True) self.cog = pm.textFieldButtonGrp(self.lowerTorsoFld, query=True, text=True) self.world = pm.textFieldButtonGrp(self.worldFld, query=True, text=True) self.hand_cnt = pm.textFieldButtonGrp(self.handCntFld, query=True, text=True) self.aim = pm.radioButtonGrp(self.aimFld, q=True, sl=True) self.aimPolarity = pm.radioButtonGrp(self.aimPolarityFld, q=True, sl=True) self.up = pm.radioButtonGrp(self.upFld, q=True, sl=True) self.upPolarity = pm.radioButtonGrp(self.upPolarityFld, q=True, sl=True) self.normal = pm.radioButtonGrp(self.nrFld, query=True, sl=True) self.radius = pm.floatFieldGrp(self.rFld, query=True, value1=True) self.build = pm.radioButtonGrp(self.buildFld, query=True, sl=True)
def layerCreate(self, attribute): print "layerCreate attr", attribute pmAttr = pm.Attribute(attribute) self.thisNode = pmAttr.node() parent = pm.setParent(query=True) with pm.columnLayout(adjustableColumn=True, parent=parent): pm.button(label="Create New Layer") with pm.columnLayout(adjustableColumn=True): for i in range(pmAttr.numElements()): with pm.frameLayout(collapsable=False, label="Layer {0}".format(i)): with pm.columnLayout(adjustableColumn=True): nameCtrl = pm.textFieldGrp(label="Name") pm.connectControl(nameCtrl, pmAttr[i].layerName, index=2) weightCtrl = pm.floatFieldGrp(label="Weight", value1=0.0) pm.connectControl(weightCtrl, pmAttr[i].layerWeight, index=2) texCtrl = pm.attrColorSliderGrp( at=pmAttr[i].layerTexture, label="Texture") shdCtrl = pm.attrColorSliderGrp( at=pmAttr[i].layerShader, label="Shader") with pm.columnLayout(adjustableColumn=True): with pm.rowLayout(nc=3): pm.button(label="Up") pm.button(label="Delete") pm.button(label="Down")
def MakeVectorField(vectorAttribute, annotation=None): """ Creates & returns an input field, linked to given Vector3Attribute, which allows user to input x,y,z values. :param vectorAttribute: Vector3Attribute instance. :param annotation: toolTip annotation, or None. """ if(not isinstance(vectorAttribute, at.Vector3Attribute)): raise TypeError("Expected %s, got %s" % (at.Vector3Attribute, type(vectorAttribute))) rowLayout = MakeRowLayout(2) MakeText(vectorAttribute.attributeLabel, annotation) vectorField = pm.floatFieldGrp(numberOfFields=3, precision=3, columnWidth3=(__MIDDLE_COLUMN_WIDTH__, __MIDDLE_COLUMN_WIDTH__, __MIDDLE_COLUMN_WIDTH__), value1=vectorAttribute.x, value2=vectorAttribute.y, value3=vectorAttribute.z) vectorField.changeCommand(lambda *args: vectorAttribute._setValue(vectorField.getValue())) vectorAttribute.updateUiCommand = (lambda *args: vectorField.setValue((vectorAttribute.x, vectorAttribute.y, vectorAttribute.z, 0.0))) vectorAttribute.uiEnableMethod = vectorField.setEnable if(annotation is not None): vectorField.setAnnotation(annotation) elif(vectorAttribute.annotation is not None): vectorField.setAnnotation(vectorAttribute.annotation) SetAsChildLayout(rowLayout) return vectorField
def build(self, light_obj, parent): """ Generates the frameLayout element, along with its children. Returns the element as a pymel object. """ self.element = pm.frameLayout( l=self.name, fn='smallBoldLabelFont', mh=5, bv=True, ebg=True, cll=True, cl=True, parent=parent ) col = pm.columnLayout() # light color selector slider = pm.colorSliderGrp( label='Light Color', rgb=light_obj.color.get(), cw=[self.labelWidth,(2,75),(3,0)], p=col ) pm.colorSliderGrp ( slider, edit=True, cc=lambda *args: light_obj.color.set(pm.colorSliderGrp(slider, q=True, rgbValue=True)) ) # intensity intensity = pm.floatFieldGrp( value=(light_obj.intensity.get(),0,0,0), label='Intensity', cw=[self.labelWidth,(2,75)], nf=1, p=col ) #self.element.redistribute() return self.element
def _addLocMultiOptions(): pm.setParent(q=True) pm.columnLayout(adjustableColumn=True, cal="right") pm.text(l='', al="center") fl = pm.formLayout() jNumber = pm.intFieldGrp(v1=3, l="Joint Number") pm.setParent('..') pm.formLayout(fl, e=True, af=(jNumber, "left", -30)) dirSet = ["X", "-X", "Y", "-Y", "Z", "-Z"] fl = pm.formLayout() dirAxis = pm.optionMenu(l="Direction") dirAxis.addMenuItems(dirSet) pm.setParent('..') pm.formLayout(fl, e=True, af=(dirAxis, "left", 70)) fl = pm.formLayout() jSpac = pm.floatFieldGrp(v1=1.0, l="spacing") pm.setParent('..') pm.formLayout(fl, e=True, af=(jSpac, "left", -30)) pm.text(l='', al="center") pm.button(l='Continue', c=partial(_retriveOptions, jNumber, dirAxis, jSpac)) pm.setParent('..')
def initUI(self): pm.setUITemplate("DefaultTemplate", pushTemplate=True) form = pm.formLayout() binMeshExportPath = pm.optionVar.get('mtap_binMeshExportPath', pm.workspace.path + "/geo/export.binarymesh") prefix = pm.optionVar.get('mtap_binMeshExportPathPrefix', "prefix") createProxy = pm.optionVar.get('mtap_binMeshCreateProxy', True) percentage = pm.optionVar.get('mtap_binMeshPercentage', 0.1) createStandin = pm.optionVar.get('mtap_binMeshCreateStandin', True) oneFilePerMesh = pm.optionVar.get('mtap_binMeshOneFilePerMesh', False) useTransform = pm.optionVar.get('mtap_binMeshUseTransform', False) with pm.columnLayout('StandinLayout') as StandinLayout: with pm.frameLayout('StandinLayout', label="Standin export options", collapsable=False): with pm.columnLayout('StandinColumnLayout'): self.pathUI = pm.textFieldButtonGrp(label="Standin directory", text=binMeshExportPath, buttonLabel="File", buttonCommand=self.fileBrowser) self.prefixUI = pm.textFieldGrp(label="Prefix", text=prefix) self.createProxyUI = pm.checkBoxGrp(label="Create proxy", value1=createProxy) self.percentageUI = pm.floatFieldGrp(label="Percentage", value1=percentage) self.createStdInUI = pm.checkBoxGrp(label="Create StandIn", value1=createStandin) self.oneFilePerMeshUI = pm.checkBoxGrp(label="One File Per Mesh", value1=oneFilePerMesh) self.doTransformUI = pm.checkBoxGrp(label="Use Transform", value1=useTransform) with pm.rowColumnLayout(numberOfColumns=2): pm.button(label="Create BinaryMesh", c=self.doit) pm.button(label="Cancel", c=self.cancel) pm.formLayout(form, edit=True, attachForm=[(StandinLayout, 'top', 5), (StandinLayout, 'bottom', 5), (StandinLayout, 'right', 5), (StandinLayout, 'left', 5)]) pm.setUITemplate("DefaultTemplate", popTemplate=True)
def loftCurveToolUi(): winName = 'Loft_Curve_Tool_UI' winTitle = 'Loft Curve Tool' winWH = [500, 230] if pm.window(winName, q=1, ex=1): pm.deleteUI(winName) pm.window(winName, t=winTitle, tlb=1, s=0) mainCmn = pm.columnLayout('mainCmn') explaiCmn = pm.columnLayout('explaiCmn', cat=['left', 145], rs=10) explainTxt = pm.text(l=u'\nSelection Curves', h=30, fn='boldLabelFont') pm.separator(st='none', w=winWH[0], h=10) pm.setParent('..') optRowCmn = pm.rowColumnLayout('optRowCmn', nc=2, cw=[(1, winWH[0] * .5 - 10), (2, winWH[0] * .5 - 10)]) geomCb = pm.checkBoxGrp('geomCb', ncb=1, l='Geometry ', v1=1) sizeIntFd = pm.floatFieldGrp('sizeIntFd', nf=1, l='Size ', v1=2) pm.setParent('..') norDirCmn = pm.columnLayout('norDirCmn') pm.separator(st='none', w=winWH[0], h=10) norDirCbGrp = pm.checkBoxGrp('norDirCbGrp', ncb=3, l='NormalDirection ', labelArray3=['X', 'Y', 'Z'], v2=1) pm.separator(st='none', w=winWH[0], h=10) pm.setParent('..') textLabelWh = winWH[0] - (winWH[0] * .718) nameRowCmn = pm.rowColumnLayout('nameRowCmn', nc=2, cw=[(1, textLabelWh), (2, winWH[0] * .65)]) pm.text(l='Name ', h=30) NmTxtFid = pm.textField('NmTxtFid', tx='', h=30) pm.setParent('..') applyCmn = pm.columnLayout('applyCmn', cat=['left', 40], rs=10) pm.separator(st='none', w=winWH[0], h=10) applyBtn = pm.button('applyBtn', l='Create', w=winWH[0] - 75, h=30, c=progressLoading) pm.setParent('..') pm.setParent('..') pm.window(winName, e=1, wh=winWH) pm.showWindow(winName)
def getModuleInstance(self): cName = pm.textFieldGrp(self.cNameT,q = 1,text = 1) side = pm.textFieldGrp(self.sideT,q = 1,text = 1) cntSizeV = pm.floatFieldGrp(self.cntSize,q = 1,value1 = 1) self.__pointerClass = Hierarchy(side,size = cntSizeV,characterName = cName) return self.__pointerClass
def dimConnections(element): print "DimConnections" if element['name'] in ['motionblur']: value = pm.checkBoxGrp( element['name'], query = True, v1 = True) print element['uielement'] valueInv = value #groups = mantraGlobalsAttributes.mantraGlobalsAttributes #if el['name'] in ['xftimesamples', 'geotimesamples', 'motionfactor', 'mbtype']: if value: print "enabling ctrls" else: print "disabling ctrls" pm.intFieldGrp('xftimesamples', edit = True, enable = valueInv) pm.intFieldGrp('geotimesamples', edit = True, enable = valueInv) pm.floatFieldGrp('motionfactor', edit = True, enable = valueInv) pm.attrEnumOptionMenu('mbtype', edit = True, enable = valueInv) pm.checkBoxGrp('imagemotionblur', edit = True, enable = valueInv)
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 setValue(self, value): if value == "stdingfilename": self.fileName = pm.textFieldButtonGrp("stdingfilename", query=True, text=True) if value == "stdinshowpoints": self.showPoints = pm.checkBoxGrp("stdinshowpoints", query=True, value1=True) if value == "stdinptdensity": self.density = pm.floatFieldGrp("stdinptdensity", query=True, value1=True) if value == "stdinptsize": self.pointSize = pm.intFieldGrp("stdinptsize", query=True, value1=True)
def create(self, stationary_count, offset_count): ''' Create the fgshooter window. ''' if pm.window(self.window_name, exists=True): pm.deleteUI(self.window_name) pm.window(self.window_name, title=self.window_title) main_form = pm.formLayout(numberOfDivisions=2) self.column = pm.columnLayout(adjustableColumn=True) # Render Camera self.render_camera_field = pm.checkBoxGrp(label="Include Render Camera", value1=self.render_camera, changeCommand=self.updateRenderCamera) # Stationary Cameras pm.separator(height=20, style="in") pm.rowLayout(numberOfColumns=3, columnWidth3=(140, 80, 80), columnAlign=(1, 'right'), columnAttach3=("right", "both", "both")) pm.text("Stationary Cameras") self.stationary_field = pm.intField(value=stationary_count) pm.button(label="Update", height=22, command=self.update) pm.setParent('..') self.stationary = [] i = 0 while i < stationary_count: self.stationary.append(pm.floatFieldGrp(value1=self.stationary_frames[i], label="frame")) i += 1 # Offset Cameras pm.separator(height=20, style="in") pm.rowLayout(numberOfColumns=3, columnWidth3=(140, 80, 80), columnAlign=(1, 'right'), columnAttach3=("right", "both", "both")) pm.text("Offset Cameras") self.offset_field = pm.intField(value=offset_count) pm.button(label="Update", height=22, command=self.update) pm.setParent('..') self.offset = [] i = 0 while i < offset_count: self.offset.append(pm.intFieldGrp(value1=self.offset_frames[i], label="frame offset")) i += 1 pm.setParent('..') # remove/apply buttons self.remove_button = pm.button(label="Remove All", height=30, command=self.remove) self.apply_button = pm.button(label="Apply / Refresh", height=30, command=self.apply) pm.formLayout(main_form, edit=True, attachForm=[(self.column, "top", 2),(self.column, "left", 2),(self.column, "right", 2), (self.remove_button, "bottom", 2), (self.remove_button, "left", 2), (self.apply_button, "bottom", 2), (self.apply_button, "right", 2)], attachControl=(self.remove_button, "right", 1, self.apply_button), attachPosition=[ (self.remove_button, "right", 0, 1), (self.apply_button, "left", 1, 1)] ) pm.setParent('..') pm.showWindow()
def window(self): win = pm.window(title='Frustum Selection', width=400, s=True, resizeToFitChildren=True) pm.columnLayout(adj=True) radio = pm.radioButtonGrp(nrb=3, l1='Use Time Slider', l2='Start/End', l3='Current Time', sl=1) frameRange = pm.intFieldGrp(nf=2, l='Frame Range: Start', cw1=100, v1=1001, el='End', v2=1100, en=False) radio.onCommand2(pm.Callback(frameRange.setEnable, True)) radio.offCommand2(pm.Callback(frameRange.setEnable, False)) screen_size = pm.intFieldGrp(nf=2, l='Screen Size', cw1=100, v1=2048, el='Height', v2=858) offset = pm.floatFieldGrp(nf=1, l='Selection Offset', cw1=100, el='%', v1=0) invert = pm.checkBoxGrp(ncb=1, l='Invert Selection', cw1=100, v1=0) auto = pm.checkBoxGrp(ncb=1, l='Auto Get Camera', cw1=100, v1=1) pm.text( label= 'Help: it is possible to select multiple cameras.\nfilmTranslate attribute on camera is NOT in effect on selecting, use filmOffset instead.\nPositive offset shrink selection while negative expanding.', align='left', fn='boldLabelFont', recomputeSize=True, wordWrap=True) #autoFunc, widthFunc, heightFunc, modeFunc, offsetFunc, invertFunc, startFunc, endFunc): pm.button(l='Select', command=pm.Callback(self.getObjectInFrustumShell, auto.getValue1, screen_size.getValue1, screen_size.getValue2, radio.getSelect, offset.getValue1, invert.getValue1, frameRange.getValue1, frameRange.getValue2)) pm.button(l='Tag', command=pm.Callback(self.tagMasters)) pm.button(l='Delete All Tags', command=pm.Callback(self.deleteAllTags)) pm.separator(style='in', h=10) pm.button(label='Close', command=pm.Callback(pm.deleteUI, win.name())) pm.showWindow(win.name())
def __init__(self): self.title = "Mantra Standin" self.fileName = "" self.density = .3 self.pointSize = 1 self.showPoints = False self.boundingBox = [-.5, -.5, -.5, .5, .5, .5] pm.setUITemplate("DefaultTemplate", pushTemplate=True) self.height = 500 with pm.frameLayout(collapsable=False, labelVisible=False) as frame: pm.textFieldButtonGrp("stdingfilename", label="GeoFileName", text="", buttonLabel="Select", bc=pm.Callback(self.selectGeoFile), cc=pm.Callback(self.setValue, "stdingfilename")) #string $b = `symbolButton -image "navButtonBrowse.xpm" browser`; with pm.frameLayout(collapsable=False, label="Points"): pm.checkBoxGrp("stdinshowpoints", label="Show Points", value1=False, cc=pm.Callback(self.setValue, "stdinshowpoints")) pm.floatFieldGrp("stdinptdensity", label="PointDensity", value1=0.3, cc=pm.Callback(self.setValue, "stdinptdensity")) pm.intFieldGrp("stdinptsize", label="PointSize", value1=1, cc=pm.Callback(self.setValue, "stdinptsize")) with pm.rowLayout(nc=2): pm.button(label="Create Standin", c=pm.Callback(self.createStandin)) pm.button(label="Cancel", c=pm.Callback(self.delete)) self.show()
def addUIElement(uiType, attribute, uiLabel, callback, renderGlobalsNodeName): ui = None if uiType == 'bool': ui = pm.checkBoxGrp(label=uiLabel) if callback is not None: pm.checkBoxGrp(ui, edit=True, cc=callback) if uiType == 'int': ui = pm.intFieldGrp(label=uiLabel, numberOfFields=1) if callback is not None: pm.intFieldGrp(ui, edit=True, cc=callback) if uiType == 'float': ui = pm.floatFieldGrp(label=uiLabel, numberOfFields=1) if callback is not None: pm.floatFieldGrp(ui, edit=True, cc=callback) if uiType == 'enum': ui = pm.attrEnumOptionMenuGrp(label=uiLabel, at=attribute, ei=getEnumList(attribute)) # attrEnumOptionGrp has no cc callback, so I create a script job if callback is not None: attribute = pm.Attribute(renderGlobalsNodeName + "." + attribute) pm.scriptJob(attributeChange=[attribute, callback], parent=ui) if uiType == 'color': ui = pm.attrColorSliderGrp(label=uiLabel, at=attribute) if uiType == 'string': ui = pm.textFieldGrp(label=uiLabel) if callback is not None: pm.textFieldGrp(ui, edit=True, cc=callback) if uiType == 'vector': ui = pm.floatFieldGrp(label=uiLabel, nf=3) if callback is not None: pm.floatFieldGrp(ui, edit=True, cc=callback) return ui
def uiCreate(self): self.uiClose() self.window = pm.window( WIN_NAME, title=SCRIPT_NAME, maximizeButton=False ) with self.window: with pm.formLayout() as ui_LAY_mainForm: with pm.scrollLayout(childResizable=True) as ui_LAY_mainScroll: with pm.frameLayout( label='Parameters', collapsable=True, marginHeight=3, borderStyle='etchedIn', borderVisible=True, collapse=False ): with pm.columnLayout(adjustableColumn=True, columnOffset=('both', 2)): self.ui_FLTFLDGRP_xPos = pm.floatFieldGrp(numberOfFields=1, label='+X', precision=6) self.ui_FLTFLDGRP_xNeg = pm.floatFieldGrp(numberOfFields=1, label='-X', precision=6) self.ui_FLTFLDGRP_yPos = pm.floatFieldGrp(numberOfFields=1, label='+Y', precision=6) self.ui_FLTFLDGRP_yNeg = pm.floatFieldGrp(numberOfFields=1, label='-Y', precision=6) self.ui_FLTFLDGRP_zPos = pm.floatFieldGrp(numberOfFields=1, label='+Z', precision=6) self.ui_FLTFLDGRP_zNeg = pm.floatFieldGrp(numberOfFields=1, label='-Z', precision=6) pm.separator(style='none', height=5) self.ui_BTN_create = pm.button( label='Create', height=MAIN_BUTTONS_HEIGHT, command=self.ui_on_BTN_create_clicked ) self.ui_BTN_close = pm.button( label='Close', height=MAIN_BUTTONS_HEIGHT, command=self.uiClose ) ui_LAY_mainForm.attachForm(ui_LAY_mainScroll, 'top', 2) ui_LAY_mainForm.attachForm(ui_LAY_mainScroll, 'left', 2) ui_LAY_mainForm.attachForm(ui_LAY_mainScroll, 'right', 2) ui_LAY_mainForm.attachControl(ui_LAY_mainScroll, 'bottom', 2, self.ui_BTN_create) ui_LAY_mainForm.attachNone(self.ui_BTN_create, 'top') ui_LAY_mainForm.attachForm(self.ui_BTN_create, 'left', 2) ui_LAY_mainForm.attachPosition(self.ui_BTN_create, 'right', 2, 50) ui_LAY_mainForm.attachForm(self.ui_BTN_create, 'bottom', 2) ui_LAY_mainForm.attachNone(self.ui_BTN_close, 'top') ui_LAY_mainForm.attachPosition(self.ui_BTN_close, 'left', 2, 50) ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'right', 2) ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'bottom', 2) self.setupInitialValues()
def callback_timerangeSelect(*args): #print args opt = args[0] pm.floatFieldGrp( 'timeRange_FFG', e=True, en=False ) if opt==1: try: camera = pm.textField( 'camera_TFG', q=True, text=True ) pm.floatFieldGrp( 'timeRange_FFG', e=True, value1=camera.startFrame.get(), value2=camera.endFrame.get() ) except: pass elif opt==2: pm.floatFieldGrp( 'timeRange_FFG', e=True, value1=pm.playbackOptions( q=True, min=True ), value2=pm.playbackOptions( q=True, max=True ) ) elif opt==3: pm.floatFieldGrp( 'timeRange_FFG', e=True, en=True )
def __uiGrok(): """UI parser""" ui = {} ui['subdivs_mult'] = pm.floatFieldGrp('subdivs_mult_in', q=True, v=True)[0] #ui['mode_select'] = pm.radioButtonGrp( 'mode_sel_in', q=True, sl=True ) ui['dmc_min_subdivs'] = pm.intSliderGrp('min_subdivs_in', q=True, v=True) ui['dmc_max_subdivs'] = pm.intSliderGrp('max_subdivs_in', q=True, v=True) ui['dmc_threshold'] = pm.floatSliderGrp('thresh_val_in', q=True, v=True) ui['adaptive_amt'] = pm.floatSliderGrp('adapt_amt_in', q=True, v=True) ui['adaptive_min'] = pm.intSliderGrp('adapt_min_in', q=True, v=True) ui['subdivs'] = pm.intSliderGrp('subdivs_in', q=True, v=True) return ui
def LuxEnvironmentCreateTab(self, dummy = None): log.debug("LuxEnvironmentCreateTab()") self.createGlobalsNode() if self.rendererTabUiDict.has_key('environment'): self.rendererTabUiDict.pop('environment') parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "ENScrollLayout" envDict = {} self.rendererTabUiDict['environment'] = 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): envDict['pskSkyUse'] = pm.checkBoxGrp(label="Use physical Sky:", value1=True, cc=pm.Callback(self.uiCallback, tab="environment")) pm.connectControl(envDict['pskSkyUse'], self.renderGlobalsNodeName + ".usePhysicalSky", index=2) envDict['pskUsePhySun'] = pm.checkBoxGrp(label="Use Physical Sun:", value1=False, cc=pm.Callback(self.uiCallback, tab="environment")) pm.connectControl(envDict['pskUsePhySun'], self.renderGlobalsNodeName + ".physicalSun", index=2) envDict['pskPhySun'] = pm.textFieldGrp(label="Sun Object:", text="", editable=False) pm.separator() envDict['pskSunGain'] = pm.floatFieldGrp(label="Sun Gain:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskSunGain'], self.renderGlobalsNodeName + ".sunGain", index=2) envDict['pskTurb'] = pm.floatFieldGrp(label="Turbidity:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskTurb'], self.renderGlobalsNodeName + ".turbidity", index=2) envDict['pskSamples'] = pm.floatFieldGrp(label="Samples:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskSamples'], self.renderGlobalsNodeName + ".skySamples", index=2) envDict['pskRelSize'] = pm.floatFieldGrp(label="Sun Size:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskRelSize'], self.renderGlobalsNodeName + ".sunRelSize", 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) ]) pm.scriptJob(attributeChange=[self.renderGlobalsNode.physicalSun, pm.Callback(self.uiCallback, tab="environment")]) self.updateEnvironment()
def __init__(self,parent,mainUi): self.mainUi = mainUi self.__popuItems = [] pm.setParent(parent) self.mainL = pm.columnLayout(adj = 1) pm.separator(h = 10) #(self,baseName = 'arm',side = 'l',size = 1.5, self.name = pm.text(l = '**** Spine Module ****') self.baseNameT = pm.textFieldGrp(l = 'baseName : ',ad2 = 1,text = 'spine',cl2 = ['left','left']) self.sideT = pm.textFieldGrp(l = 'side :',ad2 = 1,text = 'm',cl2 = ['left','left']) self.cntAxisT = pm.textFieldGrp(l = 'ctrl Axis :',ad2 = 1,text = 'y',cl2 = ['left','left']) self.cntSizeBody = pm.floatFieldGrp(l = 'ctrl Size : ',cl2 = ['left','left'],ad2 = 1,numberOfFields = 1,value1 = 2) self.cntSizeIk = pm.floatFieldGrp(l = 'ik Size : ',cl2 = ['left','left'],ad2 = 1,numberOfFields = 1,value1 = 1.8) self.segment = pm.intFieldGrp(l = 'segment Number : ',cl2 = ['left','left'],ad2 = 1,numberOfFields = 1,value1 = 9) self.mainMetaNodeM = pm.optionMenu(l = 'mainMeta : ') metaUtils.metaSel() self.removeB = pm.button(l = 'remove',c = self.__removeInstance) pm.separator(h = 10) self.__pointerClass = None
def getData(self, *args): path = pm.textFieldButtonGrp(self.pathUI, query=True, text=True) prefix = pm.textFieldGrp(self.prefixUI, query=True, text=True) doProxy = pm.checkBoxGrp(self.createProxyUI, query=True, value1=True) percentage = pm.floatFieldGrp(self.percentageUI, query=True, value1=True) createStdin = pm.checkBoxGrp(self.createStdInUI, query=True, value1=True) oneFilePerMesh = pm.checkBoxGrp(self.oneFilePerMeshUI, query=True, value1=True) useTransform = pm.checkBoxGrp(self.doTransformUI, query=True, value1=True) pm.optionVar['mtap_binMeshExportPath'] = path pm.optionVar['mtap_binMeshExportPathPrefix'] = prefix pm.optionVar['mtap_binMeshCreateProxy'] = doProxy pm.optionVar['mtap_binMeshPercentage'] = percentage pm.optionVar['mtap_binMeshCreateStandin'] = createStdin pm.optionVar['mtap_binMeshOneFilePerMesh'] = oneFilePerMesh pm.optionVar['mtap_binMeshUseTransform'] = useTransform
def initUI(self): pm.setUITemplate("DefaultTemplate", pushTemplate=True) form = pm.formLayout() binMeshExportPath = pm.optionVar.get( 'mtap_binMeshExportPath', pm.workspace.path + "/geo/export.binarymesh") prefix = pm.optionVar.get('mtap_binMeshExportPathPrefix', "prefix") createProxy = pm.optionVar.get('mtap_binMeshCreateProxy', True) percentage = pm.optionVar.get('mtap_binMeshPercentage', 0.1) createStandin = pm.optionVar.get('mtap_binMeshCreateStandin', True) oneFilePerMesh = pm.optionVar.get('mtap_binMeshOneFilePerMesh', False) useTransform = pm.optionVar.get('mtap_binMeshUseTransform', False) with pm.columnLayout('StandinLayout') as StandinLayout: with pm.frameLayout('StandinLayout', label="Standin export options", collapsable=False): with pm.columnLayout('StandinColumnLayout'): self.pathUI = pm.textFieldButtonGrp( label="Standin directory", text=binMeshExportPath, buttonLabel="File", buttonCommand=self.fileBrowser) self.prefixUI = pm.textFieldGrp(label="Prefix", text=prefix) self.createProxyUI = pm.checkBoxGrp(label="Create proxy", value1=createProxy) self.percentageUI = pm.floatFieldGrp(label="Percentage", value1=percentage) self.createStdInUI = pm.checkBoxGrp(label="Create StandIn", value1=createStandin) self.oneFilePerMeshUI = pm.checkBoxGrp( label="One File Per Mesh", value1=oneFilePerMesh) self.doTransformUI = pm.checkBoxGrp(label="Use Transform", value1=useTransform) with pm.rowColumnLayout(numberOfColumns=2): pm.button(label="Create BinaryMesh", c=self.doit) pm.button(label="Cancel", c=self.cancel) pm.formLayout(form, edit=True, attachForm=[(StandinLayout, 'top', 5), (StandinLayout, 'bottom', 5), (StandinLayout, 'right', 5), (StandinLayout, 'left', 5)]) pm.setUITemplate("DefaultTemplate", popTemplate=True)
def AppleseedTranslatorCreateTab(self): log.debug("AppleseedTranslatorCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "TrScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "TrColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="Translator", collapsable=True, collapse=False): attr = pm.Attribute(self.renderGlobalsNodeName + ".translatorVerbosity") ui = pm.attrEnumOptionMenuGrp(label="Translator Verbosity", at=self.renderGlobalsNodeName + ".translatorVerbosity", ei=self.getEnumList(attr)) with pm.frameLayout(label="{0} export".format(self.rendererName), collapsable=True, collapse=False): ui = pm.checkBoxGrp(label="Export {0} Scene file:".format(self.rendererName), value1=False) pm.connectControl(ui, self.renderGlobalsNodeName + ".exportSceneFile", index=2) # xmlDict = {} # self.rendererTabUiDict['xml'] = xmlDict # defaultXMLPath = pm.workspace.path + "/" + pm.sceneName().basename().split(".")[0] + ".appleseed" # if not defaultXMLPath.dirname().exists(): # defaultXMLPath.dirname().makedirs() # with pm.rowLayout(nc=3): # xmlDict['xmlFileText'] = pm.text(label="Export to") # xmlDict['xmlFile'] = pm.textField(text=defaultXMLPath) # pm.symbolButton(image="navButtonBrowse.png", c=self.xmlFileBrowse) # pm.connectControl(xmlDict['xmlFile'], self.renderGlobalsNodeName + ".exportSceneFileName", index=2) with pm.frameLayout(label="Optimize Textures", collapsable=True, collapse=False): optiDict = {} ui = pm.checkBoxGrp(label="Use Optimized Textures:", value1=False) pm.connectControl(ui, self.renderGlobalsNodeName + ".useOptimizedTextures", index=2) with pm.rowLayout(nc=3): self.rendererTabUiDict['opti'] = optiDict pm.text(label="OptimizedTex Dir:") optiDict['optiField'] = pm.textField(text=self.renderGlobalsNode.optimizedTexturePath.get()) pm.symbolButton(image="navButtonBrowse.png", c=self.dirBrowse) pm.connectControl(optiDict['optiField'], self.renderGlobalsNodeName + ".optimizedTexturePath", index=2) with pm.frameLayout(label="Additional Settings", collapsable=True, collapse=False): ui = pm.floatFieldGrp(label="Scene scale:", value1=1.0, numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".sceneScale", index=2) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
def __init__(self,parent,mainUi): self.mainUi = mainUi pm.setParent(parent) self.mainL = pm.columnLayout(adj = 1) pm.separator(h = 10) #(self, baseName = 'main',side = 'm',size = 1,characterName = None): self.name = pm.text(l = '**** Main Module ****') self.cNameT = pm.textFieldGrp(l = 'characterName : ',ad2 = 1,text = 'test') self.sideT = pm.textFieldGrp(l = 'side :',ad2 = 1,text = 'm') self.cntSize = pm.floatFieldGrp(l = 'ctrl Size : ',cl2 = ['left','left'], ad2 = 1,numberOfFields = 1,value1 = 3) self.tempButton = pm.button(l = 'measure',c = self.__measure) self.removeB = pm.button(l = 'remove',c = self.__removeInstance) pm.separator(h = 10) self.__pointerClass = None
def MakeLocationField(locationAttribute, withButton=False, leftColumnWidth=__LEFT_COLUMN_WIDTH__, annotation=None): """ Creates & returns a UI component, linked to given LocationAttribute, which allows user to manually enter coordinate values, or select a Maya Locator within the scene to determine the location. :param locationAttribute: LocationAttribute instance. :param withButton: True = has button to show Maya Locator selection menu, False = button not available (input fields only). :param leftColumnWidth: float, width of label column. :param annotation: toolTip annotation, or None. """ if(not isinstance(locationAttribute, at.LocationAttribute)): raise TypeError("Attempt to make location field with wrong type (expected:%s, got: %s)" % (at.LocationAttribute, type(locationAttribute))) if(not withButton): rowLayout = MakeRowLayout(2, leftColumnWidth=leftColumnWidth, rightColumnWidth=__MIDDLE_COLUMN_WIDTH__ + __RIGHT_COLUMN_WIDTH__) else: rowLayout = MakeRowLayout(3, leftColumnWidth=leftColumnWidth, middleColumnWidth=__RIGHT_COLUMN_WIDTH__, rightColumnWidth=__FOURTH_COLUMN_WIDTH__, makeAdjustable=False) MakeText(locationAttribute.attributeLabel, annotation) locationField = pm.floatFieldGrp(numberOfFields=3, precision=3, columnWidth3=(__MIDDLE_COLUMN_WIDTH__, __MIDDLE_COLUMN_WIDTH__, __MIDDLE_COLUMN_WIDTH__), value1=locationAttribute.x, value2=locationAttribute.y, value3=locationAttribute.z) locationField.changeCommand(lambda *args: locationAttribute._setValue(locationField.getValue())) locationAttribute.updateUiCommand = (lambda *args: locationField.setValue((locationAttribute.x, locationAttribute.y, locationAttribute.z, 0.0))) locationAttribute.uiEnableMethod = locationField.setEnable if(annotation is not None): locationField.setAnnotation(annotation) elif(locationAttribute.annotation is not None): locationField.setAnnotation(locationAttribute.annotation) if(withButton): button = pm.button(label="...", annotation=("Select/clear locator for %s" % at.LocationAttribute.attributeLabel), width=__FOURTH_COLUMN_WIDTH__) button.setCommand(lambda *args: _MakeObjectSelectionList(locationAttribute)) SetAsChildLayout(rowLayout) return locationField
def AppleseedTranslatorCreateTab(self): self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "TrScrollLayout" uiDict = {} self.rendererTabUiDict['translator'] = uiDict 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): with pm.columnLayout(adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName='translatorVerbosity', uiType='enum', displayName='Verbosity:', default='0', uiDict=uiDict) with pm.frameLayout(label="appleseed Output", collapsable=True, collapse=False): with pm.columnLayout(adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName='exportMode', uiType='enum', displayName='Output Mode:', default='0', uiDict=uiDict, callback=self.AppleseedTranslatorUpdateTab) with pm.rowLayout(nc=3) as uiDict['outputFilenameLayout']: pm.text(label="Output Filename:") uiDict['fileNameField'] = pm.textField(text=self.renderGlobalsNode.exportSceneFileName.get()) pm.symbolButton(image="navButtonBrowse.png", c=self.outputFileBrowse) pm.connectControl(uiDict['fileNameField'], self.renderGlobalsNodeName + ".exportSceneFileName", index=2) with pm.frameLayout(label="Optimize Textures", collapsable=True, collapse=False): with pm.columnLayout(adjustableColumn=True, width=400): 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="Optimized Textures 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) ]) self.AppleseedTranslatorUpdateTab()
def IndigoTranslatorCreateTab(self): log.debug("IndigoTranslatorCreateTab()") 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="Indigo Scene File export", collapsable = True, collapse=False): ui = pm.checkBoxGrp(label="Export Indigo Scene file:", value1 = False) pm.connectControl(ui, self.renderGlobalsNodeName + ".exportSceneFile", index = 2 ) xmlDict = {} self.rendererTabUiDict['xml'] = xmlDict defaultXMLPath = pm.workspace.path + "/" + pm.sceneName().basename().split(".")[0] + ".igs" if not defaultXMLPath.dirname().exists(): defaultXMLPath.dirname().makedirs() with pm.rowLayout(nc=3): xmlDict['xmlFileText'] = pm.text(label = "Export to") xmlDict['xmlFile'] = pm.textField(text = defaultXMLPath) pm.symbolButton(image="navButtonBrowse.png", c=self.xmlFileBrowse) pm.connectControl(xmlDict['xmlFile'], self.renderGlobalsNodeName + ".exportSceneFileName", index = 2 ) with pm.frameLayout(label="Optimize Textures", collapsable = True, collapse=False): optiDict = {} ui = pm.checkBoxGrp(label="Use Optimized Textures:", value1 = False) 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 getUIData(self, *args): self.prefix = pm.textFieldGrp(self.nameFld, query=True, text=True) self.loc1 = pm.textFieldButtonGrp(self.loc1Fld, query=True, text=True) self.loc2 = pm.textFieldButtonGrp(self.loc2Fld, query=True, text=True) self.loc3 = pm.textFieldButtonGrp(self.loc3Fld, query=True, text=True) self.shoulder = pm.textFieldButtonGrp(self.upperTorsoFld, query=True, text=True) self.cog = pm.textFieldButtonGrp(self.lowerTorsoFld, query=True, text=True) self.world = pm.textFieldButtonGrp(self.worldFld, query=True, text=True) self.hand_cnt = pm.textFieldButtonGrp(self.handCntFld, query=True, text=True) self.aim = pm.radioButtonGrp(self.aimFld,q=True,sl=True) self.aimPolarity = pm.radioButtonGrp(self.aimPolarityFld,q=True,sl=True) self.up = pm.radioButtonGrp(self.upFld,q=True,sl=True) self.upPolarity = pm.radioButtonGrp(self.upPolarityFld,q=True,sl=True) self.normal = pm.radioButtonGrp(self.nrFld, query=True, sl=True) self.radius = pm.floatFieldGrp(self.rFld, query=True, value1=True) self.build = pm.radioButtonGrp(self.buildFld, query=True, sl=True)
def layerCreate(self, attribute): print "layerCreate attr", attribute pmAttr = pm.Attribute(attribute) self.thisNode = pmAttr.node() parent = pm.setParent(query=True) with pm.columnLayout(adjustableColumn=True, parent=parent): pm.button(label="Create New Layer") with pm.columnLayout(adjustableColumn=True): for i in range(pmAttr.numElements()): with pm.frameLayout(collapsable=False, label="Layer {0}".format(i)): with pm.columnLayout(adjustableColumn=True): nameCtrl = pm.textFieldGrp(label="Name") pm.connectControl(nameCtrl, pmAttr[i].layerName, index = 2) weightCtrl = pm.floatFieldGrp(label="Weight", value1=0.0) pm.connectControl(weightCtrl, pmAttr[i].layerWeight, index = 2) texCtrl = pm.attrColorSliderGrp(at=pmAttr[i].layerTexture, label="Texture"); shdCtrl = pm.attrColorSliderGrp(at = pmAttr[i].layerShader, label="Shader"); with pm.columnLayout(adjustableColumn=True): with pm.rowLayout(nc=3): pm.button(label="Up") pm.button(label="Delete") pm.button(label="Down")
def progressLoading(ev=None): crvs = pm.ls(sl=1) geom = pm.checkBoxGrp('geomCb', q=1, v1=1) size = pm.floatFieldGrp('sizeIntFd', q=1, v1=1) norDir = [ pm.checkBoxGrp('norDirCbGrp', q=1, v1=1), pm.checkBoxGrp('norDirCbGrp', q=1, v2=1), pm.checkBoxGrp('norDirCbGrp', q=1, v3=1) ] nm = pm.textField('NmTxtFid', q=1, tx=1) pm.progressWindow(pr=0, min=0, max=100) geols = [] for i, crv in enumerate(crvs): pm.progressWindow(e=1, pr=(100.0 / len(crvs)) * i, st=crv.name()) geo = CurveLoft(crv, geom, size, norDir, nm) if geom == 1: geo.rename('%s%s_geo' % (nm, (i + 1))) elif geom == 0: geo.rename('%s%s_sfc' % (nm, (i + 1))) geols.append(geo) if len(geols) >= 2: pm.group(geols) pm.progressWindow(endProgress=1)
def TheaTranslatorCreateTab(self): log.debug("TheaTranslatorCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query = True) pm.setUITemplate("attributeEditorTemplate", pushTemplate = True) scLo = self.rendererName + "TrScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness = 0): with pm.columnLayout(self.rendererName + "TrColumnLayout", adjustableColumn = True, width = 400): with pm.frameLayout(label="Translator", collapsable = True, collapse=False): attr = pm.Attribute(self.renderGlobalsNodeName + ".translatorVerbosity") ui = pm.attrEnumOptionMenuGrp(label = "Translator Verbosity", at=self.renderGlobalsNodeName + ".translatorVerbosity", ei = self.getEnumList(attr)) with pm.frameLayout(label="Thea XML export", collapsable = True, collapse=False): ui = pm.checkBoxGrp(label="Export scene XML file:", value1 = False) pm.connectControl(ui, self.renderGlobalsNodeName + ".exportXMLFile", index = 2 ) xmlDict = {} self.rendererTabUiDict['xml'] = xmlDict with pm.rowColumnLayout(nc=3, width = 120): pm.text(label="XMLFileName:", width = 60, align="right") defaultXMLPath = pm.workspace.path + "/" + pm.sceneName().basename().split(".")[0] + ".Thea" xmlDict['xmlFile'] = pm.textField(text = defaultXMLPath, width = 60) pm.symbolButton(image="navButtonBrowse.png", c=self.xmlFileBrowse) pm.connectControl(xmlDict['xmlFile'], self.renderGlobalsNodeName + ".exportXMLFileName", index = 2 ) with pm.frameLayout(label="Optimize Textures", collapsable = True, collapse=False): with pm.rowColumnLayout(nc=3, width = 120): optiDict = {} pm.text(label="OptimizedTex Dir:", width = 60, align="right") self.rendererTabUiDict['opti'] = optiDict pm.symbolButton(image="navButtonBrowse.png", c=self.dirBrowse) optiDict['optiField'] = pm.textField(text = self.renderGlobalsNode.optimizedTexturePath.get(), width = 60) pm.connectControl(optiDict['optiField'], self.renderGlobalsNodeName + ".optimizedTexturePath", index = 2 ) with pm.frameLayout(label="Additional Settings", collapsable = True, collapse=False): ui = pm.floatFieldGrp(label="Scene scale:", value1 = 1.0, numberOfFields = 1) pm.connectControl(ui, self.renderGlobalsNodeName + ".sceneScale", index = 2 ) pm.setUITemplate("attributeEditorTemplate", popTemplate = True) pm.formLayout(parentForm, edit = True, attachForm = [ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
def build(self, *args): ''' Call methods to build the joints on nurbs plane setup ''' _name = 'build' pymelLogger.info('Started: %s' % _name) # Validate user input name = pm.textFieldGrp(self.nameFld, q=1, text=1) num = pm.intFieldGrp(self.numFld, q=1, v=1)[0] rad = pm.floatFieldGrp(self.radFld, q=1, v=1)[0] axis = pm.radioButtonGrp(self.buildFld, q=1, sl=1) objs = pm.ls(sl=1) if not name: pymelLogger.error('No name entered by user. Must enter a name. Exiting.') return if num < 1 or num > 50: pymelLogger.error('%s is an invalid value for number of joints. Must be between 3 - 50. Exiting.' % num) return if rad < 0.009 or rad > 10: pymelLogger.error('%s is an invalid value for joint radius. Must be between 0.01 - 10. Exiting.' % rad) return if not objs: pymelLogger.error('No objects selected. Must select objects to build curve along. Exiting.') return # Call build methods crv1, crv2 = self._createCurves(objs=objs, axis=axis, num=num) plane = self._createPlane(name=name, crv1=crv1, crv2=crv2) follicles = self._createFollicles(name=name, plane=plane, num=num) self._createJoints(name=name, follicles=follicles, rad=rad) pm.delete(crv1, crv2) pymelLogger.info('Ended: %s' % _name) pymelLogger.info('Build successful!')
def ui(self): ''' Create UI ''' _name = 'ui' pymelLogger.info('Started: %s' % _name) winName = 'ms_jointsOnNurbsPlaneWin' if(pm.window(winName, exists=True)): pm.deleteUI(winName, window=True) win = pm.window(winName) with pm.formLayout() as form: self.nameFld = pm.textFieldGrp(l='Name') self.numFld = pm.intFieldGrp(l='Joints (3-50)', v1=3) self.radFld = pm.floatFieldGrp(l='Radius (0.01 - 10)', v1=0.5, pre=2) self.buildFld = pm.radioButtonGrp(l='Plane Curve Duplicate', labelArray3=['x', 'y', 'z'], nrb=3, sl=3) pm.text('Select objects to create plane along, then press "Build"') pm.button(l='>> Build <<', c=self.build) form.redistribute() pm.showWindow() pymelLogger.info('Ended: %s' % _name)
def uiCreate(self): self.uiClose() self.window = pm.window(WIN_NAME, title=SCRIPT_NAME, maximizeButton=False) with self.window: with pm.formLayout() as ui_LAY_mainForm: with pm.scrollLayout(childResizable=True) as ui_LAY_mainScroll: with pm.frameLayout(label='Parameters', collapsable=True, marginHeight=3, borderStyle='etchedIn', borderVisible=True, collapse=False): with pm.columnLayout(adjustableColumn=True, columnOffset=('both', 2)): self.ui_FLTFLDGRP_xPos = pm.floatFieldGrp( numberOfFields=1, label='+X', precision=6) self.ui_FLTFLDGRP_xNeg = pm.floatFieldGrp( numberOfFields=1, label='-X', precision=6) self.ui_FLTFLDGRP_yPos = pm.floatFieldGrp( numberOfFields=1, label='+Y', precision=6) self.ui_FLTFLDGRP_yNeg = pm.floatFieldGrp( numberOfFields=1, label='-Y', precision=6) self.ui_FLTFLDGRP_zPos = pm.floatFieldGrp( numberOfFields=1, label='+Z', precision=6) self.ui_FLTFLDGRP_zNeg = pm.floatFieldGrp( numberOfFields=1, label='-Z', precision=6) pm.separator(style='none', height=5) self.ui_BTN_create = pm.button( label='Create', height=MAIN_BUTTONS_HEIGHT, command=self.ui_on_BTN_create_clicked) self.ui_BTN_close = pm.button(label='Close', height=MAIN_BUTTONS_HEIGHT, command=self.uiClose) ui_LAY_mainForm.attachForm(ui_LAY_mainScroll, 'top', 2) ui_LAY_mainForm.attachForm(ui_LAY_mainScroll, 'left', 2) ui_LAY_mainForm.attachForm(ui_LAY_mainScroll, 'right', 2) ui_LAY_mainForm.attachControl(ui_LAY_mainScroll, 'bottom', 2, self.ui_BTN_create) ui_LAY_mainForm.attachNone(self.ui_BTN_create, 'top') ui_LAY_mainForm.attachForm(self.ui_BTN_create, 'left', 2) ui_LAY_mainForm.attachPosition(self.ui_BTN_create, 'right', 2, 50) ui_LAY_mainForm.attachForm(self.ui_BTN_create, 'bottom', 2) ui_LAY_mainForm.attachNone(self.ui_BTN_close, 'top') ui_LAY_mainForm.attachPosition(self.ui_BTN_close, 'left', 2, 50) ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'right', 2) ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'bottom', 2) self.setupInitialValues()
with pm.rowLayout(numberOfColumns = 5): pm.text(label = "Aim Axis") aimAxisCollection = pm.radioCollection() aimAxisXBtn = pm.radioButton(label = 'X', select = 1) aimAxisYBtn = pm.radioButton(label = 'Y') aimAxisZBtn = pm.radioButton(label = 'Z') aimAxisIsNegativeBox = pm.checkBox(label = "Is negative") with pm.rowLayout(numberOfColumns = 5): pm.text(label = "Up Axis") upAxisCollection = pm.radioCollection() upAxisXBtn = pm.radioButton(label = 'X') upAxisYBtn = pm.radioButton(label = 'Y', select = 1) upAxisZBtn = pm.radioButton(label = 'Z') upAxisIsNegativeBox = pm.checkBox(label = "Is negative") with pm.rowLayout(numberOfColumns = 4): worldUpAxisField = pm.floatFieldGrp(label = "World Up Axis",numberOfFields = 3, value1 = 0.00, value2 = 1.00, value3 = 0.00, precision = 2) setWorldUpXBtn = pm.button(label='X') setWorldUpYBtn = pm.button(label='Y') setWorldUpZBtn = pm.button(label='Z') with pm.columnLayout(columnWidth = 455, columnAttach = ('both', 5)): orientChildrenBox = pm.checkBox(label = "Orient children of selected joints", value = True) pm.text(label = "If joint has several children", height = 20, align = 'left') orientChildrenTowardsCollection = pm.radioCollection() pm.radioButton(label = "Orient Parent towards average of child positions", select = 1) pm.radioButton(label = "Orient Parent towards first child position") with pm.rowLayout(numberOfColumns = 1): orientJointsBtn = pm.button(label = "Orient Joints", width = 455) with pm.frameLayout(): pm.separator(width = 450) pm.text(label = "Add or Substract from Joint Orient")
def createWindow(self): print "lala" if self.bipedWindow: pm.deleteUI(self.bipedWindow) self.bipedWindow = pm.window(title='VZ BIPED RIG', iconName='bipedRig') self.tabs = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5) self.basicForm = pm.columnLayout(adj=True) pm.text(label='VZ BIPED RIG', fn='boldLabelFont') pm.text(label='BASIC OPTIONS', fn='plainLabelFont') self.characterNameTextField = pm.textFieldGrp(label='Character Name:', w=200, h=18, ed=True, tx='character', cw=[[1, 130], [2, 200]], cat=[(1, 'left', 5), (2, 'left', 0)]) pm.separator(hr=True, h=30, st='single') self.fingerNames = ['Thumb', 'Index', 'Middle', 'Ring', 'Pinky'] for i, fingerName in enumerate(self.fingerNames): pm.rowLayout(nc=3, cw=(1, 180)) self.handFingersInterface[fingerName] = {} self.handFingersInterface[fingerName]['checkBox'] = pm.checkBox(v=1, en=1, label=fingerName + ' Finger | Phalanx: ') self.handFingersInterface[fingerName]['radioBtn'] = pm.radioButtonGrp(labelArray2=['2', '3'], sl=2, ct2=['left', 'left'], co2=[0, -65], numberOfRadioButtons=2) pm.setParent('..') pm.radioButtonGrp(self.handFingersInterface['Thumb']['radioBtn'], e=True, sl=1) pm.separator(hr=True, h=30, st='single') for i, fingerName in enumerate(self.fingerNames): pm.rowLayout(nc=3, cw=(1, 180)) self.footFingersInterface[fingerName]={} self.footFingersInterface[fingerName]['checkBox'] = pm.checkBox(v=1, en=1, label=fingerName + ' Toe | Phalanx: ') self.footFingersInterface[fingerName]['radioBtn'] = pm.radioButtonGrp(labelArray2=['2', '3'], sl=1, ct2=['left', 'left'], co2=[0, -65], numberOfRadioButtons=2) pm.setParent('..') pm.separator(hr=True, h=30, st='single') pm.rowLayout(nc=3, cw=(1, 180)) self.hasArmRibbonsCheckbox = pm.checkBox(v=1, en=1, label='Arm Ribbons | Joints Number: ') self.armRibbonJointsIntField = pm.intField(w=62, h=18, ed=True, min=1, v=5) self.armRibbonFirstJointOffsetFloatField = pm.floatFieldGrp(l='First Joint Offset:', nf=1, v1=0.1, cat=[(1, 'left', 20), (2, 'left', -20)]) pm.setParent('..') pm.rowLayout(nc=3, cw=(1, 180)) self.hasLegRibbonsCheckbox = pm.checkBox(v=1, en=1, label='Leg Ribbons | Joints Number:') self.legRibbonJointsIntField = pm.intField(w=62, h=18, ed=True, min=1, v=5) self.legRibbonFirstJointOffsetFloatField = pm.floatFieldGrp(l='First Joint Offset:', nf=1, v1=0.1, cat=[(1, 'left', 20), (2, 'left', -20)]) pm.setParent('..') pm.separator(hr=True, h=30, st='single') pm.rowLayout(nc=2, cw=(1, 180)) pm.text(label=' Spine Joints') self.spineJointsIntField = pm.intField(w=62, h=18, ed=True, min=1, v=5) pm.setParent('..') pm.separator(hr=True, h=30, st='single') pm.rowLayout(nc=2, cw=(1, 180)) pm.text(l='Modules connection:', fn='plainLabelFont') self.modulesConnectionRadioButton = pm.radioButtonGrp(labelArray2=['Hierarchy', 'Constraint'], sl=1, ct2=['left', 'left'], numberOfRadioButtons=2) pm.setParent('..') pm.separator(hr=True, h=30, st='single') self.getFromSceneCheckbox = pm.checkBox(v=1, en=1, label='Get Guide From Scene') self.reapplySkinCheckbox = pm.checkBox(v=0, en=1, label='Reapply skin after rebuilding rig') pm.separator( h=30 ) self.createGuideButton = pm.button(w=263, h=20, l='Create guide', c=self.createGuideCallback) self.createGuideButton = pm.button(w=263, h=20, l='Save Ctrls', c=self.saveCntrlsCallback) self.createGuideButton = pm.button(w=263, h=20, l='Load Ctrls', c=self.loadCntrlsCallback) self.toggleGuideButton = pm.button(w=263, h=20, l='Toggle Guide Visibility', c=self.toggleGuidesVizCallback) self.createRigButton = pm.button(w=263, h=30, l='Create Rig', c=self.createRigCallback) pm.showWindow(self.bipedWindow)
def create(self): # Create default render globals node if needed. createGlobalNodes() parentForm = pm.setParent(query=True) pm.setUITemplate("renderGlobalsTemplate", pushTemplate=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) columnWidth = 400 with pm.scrollLayout("outputScrollLayout", horizontalScrollBarThickness=0): with pm.columnLayout("outputColumnLayout", adjustableColumn=True, width=columnWidth): with pm.frameLayout(label="AOVs", collapsable=True, collapse=False): with pm.columnLayout("outputColumnLayout", adjustableColumn=True, width=columnWidth): self._addControl(ui=pm.checkBoxGrp(label="Diffuse"), attrName="diffuseAOV") self._addControl(ui=pm.checkBoxGrp(label="Glossy"), attrName="glossyAOV") self._addControl(ui=pm.checkBoxGrp(label="Emission"), attrName="emissionAOV") self._addControl(ui=pm.checkBoxGrp(label="Direct Diffuse"), attrName="directDiffuseAOV") self._addControl(ui=pm.checkBoxGrp(label="Indirect Diffuse"), attrName="indirectDiffuseAOV") self._addControl(ui=pm.checkBoxGrp(label="Direct Glossy"), attrName="directGlossyAOV") self._addControl(ui=pm.checkBoxGrp(label="Indirect Glossy"), attrName="indirectGlossyAOV") self._addControl(ui=pm.checkBoxGrp(label="Albedo"), attrName="albedoAOV") self._addControl(ui=pm.checkBoxGrp(label="Normal"), attrName="normalAOV") self._addControl(ui=pm.checkBoxGrp(label="UV"), attrName="uvAOV") self._addControl(ui=pm.checkBoxGrp(label="Depth"), attrName="depthAOV") self._addControl(ui=pm.checkBoxGrp(label="NPR Shading"), attrName="nprShadingAOV") self._addControl(ui=pm.checkBoxGrp(label="NPR Contours"), attrName="nprContourAOV") with pm.frameLayout(label="Denoiser", collapsable=True, collapse=True): with pm.columnLayout("outputColumnLayout", adjustableColumn=True, width=columnWidth): self._addControl( ui=pm.attrEnumOptionMenuGrp( label="Denoiser", enumeratedItem=self._getAttributeMenuItems("denoiser")), attrName="denoiser") self._addControl( ui=pm.checkBoxGrp( label="Skip Already Denoised"), attrName="skipDenoised") self._addControl( ui=pm.checkBoxGrp( label="Random Pixel Order"), attrName="randomPixelOrder") enablePrefilter = mc.getAttr( "appleseedRenderGlobals.prefilterSpikes") self._addControl( ui=pm.checkBoxGrp( label="Prefilter Spikes", changeCommand=self.__prefilterChanged), attrName="prefilterSpikes") self._addControl( ui=pm.floatFieldGrp( label="Spike Thereshold", numberOfFields=1, enable=enablePrefilter), attrName="spikeThreshold") self._addControl( ui=pm.floatFieldGrp( label="Patch Distance", numberOfFields=1), attrName="patchDistance") self._addControl( ui=pm.intFieldGrp( label="Denoise Scales", numberOfFields=1), attrName="denoiseScales") with pm.frameLayout(label="Render Stamp", collapsable=True, collapse=True): with pm.columnLayout("outputColumnLayout", adjustableColumn=True, width=columnWidth): self._addControl(ui=pm.checkBoxGrp(label="Enable"), attrName="renderStamp") self._addControl( ui=pm.textFieldGrp( label='Render Stamp'), attrName="renderStampString") with pm.frameLayout(label="Logging", collapsable=True, collapse=True): with pm.columnLayout("outputColumnLayout", adjustableColumn=True, width=columnWidth): self._addControl( ui=pm.attrEnumOptionMenuGrp( label="Log Level", enumeratedItem=self._getAttributeMenuItems("logLevel")), attrName="logLevel") self._addControl( ui=pm.textFieldButtonGrp( label='Log Filename', buttonLabel='...', buttonCommand=self.__chooseLogFilename), attrName="logFilename") pm.setUITemplate("renderGlobalsTemplate", popTemplate=True) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout( parentForm, edit=True, attachForm=[ ("outputScrollLayout", "top", 0), ("outputScrollLayout", "bottom", 0), ("outputScrollLayout", "left", 0), ("outputScrollLayout", "right", 0)]) logger.debug("Created appleseed render global output tab") # Update the newly created tab. self.update()
def create(self): # Create default render globals node if needed. createGlobalNodes() parentForm = pm.setParent(query=True) pm.setUITemplate("renderGlobalsTemplate", pushTemplate=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) columnWidth = 400 with pm.scrollLayout("appleseedScrollLayout", horizontalScrollBarThickness=0): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): with pm.frameLayout(label="Sampling", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self._addControl( ui=pm.intFieldGrp( label="Render Passes", numberOfFields=1), attrName="passes") self._addControl( ui=pm.checkBoxGrp( label="Adaptive Sampling", changeCommand=self.__adaptiveSamplerChanged), attrName="adaptiveSampling") adaptiveSampling = mc.getAttr("appleseedRenderGlobals.adaptiveSampling") self._addControl( ui=pm.intFieldGrp( label="Min Samples", numberOfFields=1, enable=adaptiveSampling), attrName="minPixelSamples") self._addControl( ui=pm.intFieldGrp( label="Max Samples", numberOfFields=1), attrName="samples") self._addControl( ui=pm.intFieldGrp( label="Batch Sample Size", numberOfFields=1, enable=adaptiveSampling), attrName="batchSampleSize") self._addControl( ui=pm.floatFieldGrp( label="Noise Threshold", numberOfFields=1, enable=adaptiveSampling), attrName="sampleNoiseThreshold") self._addControl( ui=pm.attrEnumOptionMenuGrp( label="Pixel Filter", enumeratedItem=self._getAttributeMenuItems("pixelFilter")), attrName="pixelFilter") self._addControl( ui=pm.floatFieldGrp( label="Pixel Filter Size", numberOfFields=1), attrName="pixelFilterSize") self._addControl( ui=pm.intFieldGrp( label="Tile Size", numberOfFields=1), attrName="tileSize") with pm.frameLayout(label="Lighting", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self._addControl( ui=pm.attrEnumOptionMenuGrp( label="Lighting Engine", enumeratedItem=self._getAttributeMenuItems("lightingEngine")), attrName="lightingEngine") with pm.frameLayout(label="Path Tracing", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self._addControl( ui=pm.checkBoxGrp( label="Limit Bounces", changeCommand=self.__limitBouncesChanged), attrName="limitBounces") limitBounces = mc.getAttr( "appleseedRenderGlobals.limitBounces") self._addControl( ui=pm.intFieldGrp( label="Global Bounces", numberOfFields=1, enable=limitBounces), attrName="bounces") self._addControl( ui=pm.intFieldGrp( label="Diffuse Bounces", numberOfFields=1, enable=limitBounces), attrName="diffuseBounces") self._addControl( ui=pm.intFieldGrp( label="Glossy Bounces", numberOfFields=1, enable=limitBounces), attrName="glossyBounces") self._addControl( ui=pm.intFieldGrp( label="Specular Bounces", numberOfFields=1, enable=limitBounces), attrName="specularBounces") self._addControl( ui=pm.floatFieldGrp( label="Light Samples", numberOfFields=1), attrName="lightSamples") self._addControl( ui=pm.floatFieldGrp( label="Environment Samples", numberOfFields=1), attrName="envSamples") self._addControl( ui=pm.checkBoxGrp(label="Clamp Roughness"), attrName="clampRoughness") self._addControl( ui=pm.checkBoxGrp(label="Caustics"), attrName="caustics") self._addControl( ui=pm.floatFieldGrp( label="Max Ray Intensity", numberOfFields=1), attrName="maxRayIntensity") with pm.frameLayout(label="Scene", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self._addControl( ui=pm.attrEnumOptionMenuGrp( label="Override Shaders", enumeratedItem=self._getAttributeMenuItems("diagnostics")), attrName="diagnostics") self._addControl( ui=pm.floatFieldGrp( label="Scene Scale", numberOfFields=1), attrName="sceneScale") with pm.rowLayout("appleseedRowLayout", nc=3): pm.text("Environment Light") ui = pm.optionMenu( changeCommand=self.__environmentLightSelected) pm.menuItem(label="<none>") for envLight in g_environmentLightsList: pm.menuItem(parent=ui, label=envLight) # Set the currently selected environment light in the menu. connections = mc.listConnections( "appleseedRenderGlobals.envLight") if connections: node = connections[0] if mc.nodeType(node) == "transform": shapes = mc.listRelatives(node, shapes=True) assert shapes node = shapes[0] pm.optionMenu(ui, edit=True, value=node) else: pm.optionMenu(ui, edit=True, value="<none>") self._uis["envLight"] = ui logger.debug( "Created globals env light menu, name = %s" % ui) self._addControl( ui=pm.checkBoxGrp(label="Environment Visible"), attrName="bgLight") with pm.frameLayout(label="Motion Blur", collapsable=True, collapse=True): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self._addControl( ui=pm.checkBoxGrp( label="Motion Blur", changeCommand=self.__motionBlurChanged), attrName="motionBlur") enableMotionBlur = mc.getAttr( "appleseedRenderGlobals.motionBlur") self._addControl( ui=pm.intFieldGrp( label="Camera Samples", numberOfFields=1, enable=enableMotionBlur), attrName="mbCameraSamples") self._addControl( ui=pm.intFieldGrp( label="Transformation Samples", numberOfFields=1, enable=enableMotionBlur), attrName="mbTransformSamples") self._addControl( ui=pm.intFieldGrp( label="Deformation Samples", numberOfFields=1, enable=enableMotionBlur), attrName="mbDeformSamples") self._addControl( ui=pm.floatFieldGrp( label="Shutter Open", numberOfFields=1, enable=enableMotionBlur), attrName="shutterOpen") self._addControl( ui=pm.floatFieldGrp( label="Shutter Close", numberOfFields=1, enable=enableMotionBlur), attrName="shutterClose") with pm.frameLayout(label="System", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self._addControl( ui=pm.intFieldGrp( label="Threads", numberOfFields=1), attrName="threads") self._addControl( ui=pm.intFieldGrp( label="Texture Cache Size (MB)", numberOfFields=1), attrName="maxTexCacheSize") with pm.frameLayout(label="Experimental", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self._addControl( ui=pm.checkBoxGrp(label="Use Embree"), attrName="useEmbree") pm.setUITemplate("renderGlobalsTemplate", popTemplate=True) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout( parentForm, edit=True, attachForm=[ ("appleseedScrollLayout", "top", 0), ("appleseedScrollLayout", "bottom", 0), ("appleseedScrollLayout", "left", 0), ("appleseedScrollLayout", "right", 0)]) logger.debug("Created appleseed render global main tab") # Update the newly created tab. self.update()
def uiCreate(self): self.uiClose() self.window = pm.window( WIN_NAME, title=SCRIPT_NAME, maximizeButton=False ) with self.window: pm.setUITemplate('DefaultTemplate', pushTemplate=True) with pm.formLayout() as self.ui_LAY_mainForm: with pm.tabLayout(tabsVisible=False) as self.ui_TAB_top: pm.tabLayout(self.ui_TAB_top, e=True, height=1) with pm.formLayout() as self.ui_LAY_attachForm: with pm.tabLayout(tabsVisible=False, scrollable=True, innerMarginWidth=4) as self.ui_TAB_inner: with pm.columnLayout(adjustableColumn=True) as self.ui_LAY_mainColumn: with pm.frameLayout( label='Parameters', collapsable=True, collapse=False, marginHeight=3 ): with pm.columnLayout(adjustableColumn=True, columnOffset=('both', 2)): self.ui_FLTFLDGRP_xPos = pm.floatFieldGrp(numberOfFields=1, label='+X', precision=6) self.ui_FLTFLDGRP_xNeg = pm.floatFieldGrp(numberOfFields=1, label='-X', precision=6) self.ui_FLTFLDGRP_yPos = pm.floatFieldGrp(numberOfFields=1, label='+Y', precision=6) self.ui_FLTFLDGRP_yNeg = pm.floatFieldGrp(numberOfFields=1, label='-Y', precision=6) self.ui_FLTFLDGRP_zPos = pm.floatFieldGrp(numberOfFields=1, label='+Z', precision=6) self.ui_FLTFLDGRP_zNeg = pm.floatFieldGrp(numberOfFields=1, label='-Z', precision=6) self.ui_BTN_create = pm.button( label='Create', height=MAIN_BUTTONS_HEIGHT, command=self.ui_on_BTN_create_clicked ) self.ui_BTN_close = pm.button( label='Close', height=MAIN_BUTTONS_HEIGHT, command=self.uiClose ) pm.setUITemplate('DefaultTemplate', popTemplate=True) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'top', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'left', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'right', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'bottom', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'top', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'left', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'right', 0) self.ui_LAY_mainForm.attachControl(self.ui_TAB_top, 'bottom', 5, self.ui_BTN_close) self.ui_LAY_mainForm.attachNone(self.ui_BTN_create, 'top') self.ui_LAY_mainForm.attachForm(self.ui_BTN_create, 'left', 5) self.ui_LAY_mainForm.attachPosition(self.ui_BTN_create, 'right', 2, 50) self.ui_LAY_mainForm.attachForm(self.ui_BTN_create, 'bottom', 5) self.ui_LAY_mainForm.attachNone(self.ui_BTN_close, 'top') self.ui_LAY_mainForm.attachPosition(self.ui_BTN_close, 'left', 2, 50) self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'right', 5) self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'bottom', 5) self.setupInitialValues()
def createUi(self, node=None): log.debug("createUi for node %s" % str(node)) currentSegment = "" layoutList = [] for att in self.attList: if att.kategory != None and currentSegment != att.kategory: log.debug("kategory %s != %s" % (currentSegment, att.kategory)) katlist = att.kategory.split("|") diff = len(layoutList) - len(katlist) # neue liste ist kuerzer als alte, also solange dicht machen bis die laenge gleich ist log.debug("check diff %d" % diff) while diff > 0: layoutList.pop() pm.setParent("..") pm.setParent("..") diff = len(layoutList) - len(katlist) log.debug("new diff %d" % diff) # alte liste ist nun nicht laenger als neue liste # durchgehen und alles dichtmachen was nicht gleich ist for i in range(len(layoutList)): kat = katlist[i] ckat = layoutList[i] # wenn werte ungelich dann alles was noch kommt zumachen if kat != ckat: laylen = len(layoutList) for n in range(i, laylen): pm.setParent("..") pm.setParent("..") layoutList.pop(n) # nun sollte sichergestellt sein, dass layoutList nur noch elemente # enthaelt, die gleich sind, also kann man daran anknuepfen for i in range(len(layoutList), len(katlist)): log.debug("opening layout for katlist %s %d %s" % (str(katlist), i, katlist[i])) self.beginUISegment(katlist[i]) layoutList.append(katlist[i]) currentSegment = att.kategory if MAP_API_ATTR.has_key(att.type): log.debug("Adding element %s with displayName %s" % (att.attname, att.displayname)) attype, attypeval = MAP_API_ATTR[att.type] log.debug( "Adding attribute named %s type %s val %s default %s" % (att.attname, attype, attypeval, att.default)) if attypeval == 'bool': att.uiElement = pm.checkBoxGrp(att.attname, numberOfCheckBoxes=1, label1=att.displayname, cc=Callback( self.dimConnections, att)) att.uiDimFunction = pm.checkBoxGrp if node: pm.connectControl(att.uiElement, node + "." + att.attname, index=2) if attypeval == 'int': att.uiElement = pm.intFieldGrp(att.attname, numberOfFields=1, label=att.displayname, value1=att.default, cc=Callback( self.dimConnections, att)) att.uiDimFunction = pm.intFieldGrp if node: pm.connectControl(att.uiElement, node + "." + att.attname, index=2) if attypeval == 'long2': if node: att.uiDimFunction = pm.attrFieldGrp( attribute='%s' % (node + "." + att.attname), cc=Callback(self.dimConnections, att)) if attypeval == 'float': att.uiElement = pm.floatFieldGrp(att.attname, numberOfFields=1, label=att.displayname, value1=att.default, cc=Callback( self.dimConnections, att)) att.uiDimFunction = pm.floatFieldGrp if node: pm.connectControl(att.uiElement, node + "." + att.attname, index=2) if attypeval == 'float2': if node: att.uiDimFunction = pm.attrFieldGrp( attribute='%s' % (node + "." + att.attname), cc=Callback(self.dimConnections, att)) if attypeval == 'string': att.uiElement = pm.textFieldGrp(att.attname, label=att.displayname, text=att.default, cc=Callback( self.dimConnections, att)) pm.connectControl(att.uiElement, node + "." + att.attname, index=2) pm.textFieldGrp(att.uiElement, edit=True, text=att.default) if attypeval == 'enum': poplist = map(list, enumerate(att.values)) if node: nodeatt = node + "." + att.attname att.uiElement = pm.attrEnumOptionMenuGrp( att.attname, label=att.displayname, at=nodeatt, ei=poplist, vcc=Callback(self.dimConnections, att)) att.uiDimFunction = pm.attrEnumOptionMenuGrp else: att.uiElement = pm.attrEnumOptionMenuGrp( att.attname, label=att.displayname, ei=poplist, vcc=Callback(self.dimConnections, att)) att.uiDimFunction = pm.attrEnumOptionMenuGrp if attypeval == 'message': pass if len(layoutList) > 0: for i in range(len(layoutList)): pm.setParent("..") pm.setParent("..")
def fixMyRoot(*args): make_animRange() snapRoot() print 'Root has been fixed!' return '''UI code''' Win = pm.window(vis=1, title='Fix My Root', s=0, h=140, w=315) myLayout = pm.columnLayout(p=Win, adj=1) rowLay = pm.rowLayout(p=myLayout, nc=2, adj=1) pm.setParent(rowLay) timeInput = pm.floatFieldGrp(nf=2, l='Start & End Frame', cl3=['center', 'center', 'center'], adj=1) pm.setParent(myLayout) rowLay2 = pm.rowLayout(p=myLayout, nc=3, cl2=['center', 'center'], ad2=20) pm.setParent(myLayout) rootNameInput = pm.textFieldButtonGrp(adj=1, text="Click Root Control and Set", bl='Set', columnAlign=[1, 'center'], p=myLayout, bc=setRootVr) hipNameInput = pm.textFieldButtonGrp(adj=1, text="Click Pelvis Control and Set", bl='Set', columnAlign=[1, 'center'], p=myLayout,
def gui(self): if pm.window('transferAndOffsetUVsGUI', exists=True): pm.deleteUI('transferAndOffsetUVsGUI', window=True) window = pm.window('transferAndOffsetUVsGUI', title='transferAndOffsetUVs v%s' % __ver__, widthHeight=(200, 55)) baseLayout = pm.autoLayout() with baseLayout: optLayout = pm.autoLayout(orientation='horizontal') with optLayout: self.uvField = pm.intFieldGrp(l='UV', nf=2, cw3=[20, 25, 25], v1=6, v2=6) self.space = pm.floatFieldGrp(l='space', cw2=(30, 50), pre=3, v1=0.01) onc = partial(self.isOverlapEnabled, 1) ofc = partial(self.isOverlapEnabled, 0) self.useOverlap = pm.checkBoxGrp(l='overlap', v1=0, cw2=(40, 50), onCommand1=onc, offCommand1=ofc) self.shellCount = pm.intFieldGrp(l='max shell count', cw2=(80, 35), en=0, v1=4) modeLayout = pm.autoLayout(orientation='horizontal') with modeLayout: self.mode = pm.radioButtonGrp(la2=['U', 'V'], nrb=2, cw3=[30, 25, 25], l='mode', sl=1) self.dirc = pm.radioButtonGrp(la2=['+', '-'], nrb=2, cw3=[45, 25, 25], l='direction', sl=1) self.adjustCB = pm.checkBoxGrp(l='Adjust', v1=0, cw2=(35, 20)) self.fitCB = pm.checkBoxGrp(l='Fit', v1=0, cw2=(20, 20)) self.shuffleCB = pm.checkBoxGrp(l='Shuffle', v1=0, cw2=(40, 20)) modeLayout.attachNone(self.adjustCB, 'right') modeLayout.attachNone(self.fitCB, 'right') modeLayout.attachNone(self.shuffleCB, 'right') with pm.autoLayout(orientation='horizontal'): cmd = partial(self.calc) pm.button('calc', c=cmd) cmd = partial(self.doit) pm.button('run', c=cmd) optLayout.attachNone(self.uvField, 'right') optLayout.attachNone(self.space, 'right') optLayout.attachNone(self.useOverlap, 'right') optLayout.attachNone(self.shellCount, 'right') baseLayout.attachNone(optLayout, 'bottom') baseLayout.attachNone(modeLayout, 'bottom') pm.showWindow(window) window.setWidthHeight([380, 100])