def _build_jerk_limits_tab(parent_layout): jerk_limits_tab = pm.rowColumnLayout('jerk_limits_tab', numberOfColumns=2) # Set up primary axis accel limits tab pm.columnLayout(adj=True, columnAttach=('both', 5)) pm.separator(height=5, style='none') # Input text field width for all axis limits cell_width = 163 for i in range(6): # Axis 1 Limit row pm.rowLayout(numberOfColumns=2, columnAttach=(1, 'left', 3), adjustableColumn=2, height=20) pm.text(label='Axis {}: '.format(i + 1), enable=False) set_focus_count = ((i + 1) % 6) + 1 # Axis 1 Min limit pm.textField("t_A{}Jerk".format(i + 1), font=FONT, pht='deg/sec' + u'\xb3', width=cell_width, changeCommand='import pymel.core as pm; ' \ 'import mimic_utils; ' \ 'pm.setFocus("t_A{}Jerk"); ' \ .format(set_focus_count)) pm.setParent('..') pm.setParent(parent_layout) return jerk_limits_tab
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 _build_ui_prefs_frame(parent_layout): pm.frameLayout(label="UI", collapsable=True) ui_prefs_column = pm.columnLayout(adj=True, columnAttach=('both', 5)) pm.separator(height=2, style='none') # Shader range row layout pm.rowLayout(numberOfColumns=3, adjustableColumn=2, columnAttach=(1, 'left', 0), columnWidth=[(1, 113), (2, 50), (3, 50)], height=20) pm.text(label='Shader range:') # Axis limit shader range float field pm.floatField("f_shaderRange", min=0, pre=0, value=20, changeCommand=mimic_utils.set_shader_range) # Set axis limit shader range button pm.button(label=' Set ', width=50, height=20, command=mimic_utils.set_shader_range) pm.setParent(ui_prefs_column) pm.separator(height=8, style='none') pm.setParent(parent_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) pm.button(label=' Add ', command=add_robot, 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 __init__(self, template): self.template = template self.win = "arnold_filter_list_win" if pm.window(self.win, exists=True): pm.deleteUI(self.win) pm.window(self.win, title="Add Light Filter", sizeable=False, resizeToFitChildren=True) #pm.windowPref(removeAll=True) pm.columnLayout(adjustableColumn=True, columnOffset=("both", 10), #columnAttach=('both',1), rowSpacing=10) self.scrollList = pm.textScrollList('alf_filter_list', nr=4, ams=False) pm.textScrollList(self.scrollList, e=True, doubleClickCommand=Callback(self.addFilterAndHide)) for label, nodeType in self.filters(): pm.textScrollList(self.scrollList, edit=True, append=label) pm.rowLayout(numberOfColumns=2, columnAlign2=("center", "center")) pm.button(width=100, label="Add", command=Callback(self.addFilterAndHide)) pm.button(width=100, label="Cancel", command=Callback(pm.deleteUI, self.win, window=True)) pm.setParent('..') pm.setParent('..') pm.showWindow(self.win)
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.") for type in deformerTypes: deformers = pm.ls(type=type) for node in deformers: frameLayout = pm.frameLayout( label=node.name(), collapsable = True) with frameLayout: with pm.rowLayout(numberOfColumns=2) : pm.button( l="Del", c=pm.Callback( self.deleteNode, node)) pm.attrFieldSliderGrp( label="iteration", min=1, max=100, attribute=node.it) with pm.rowLayout(numberOfColumns=2) : pm.attrControlGrp( label="rotation consistency", attribute= node.rc) pm.attrFieldSliderGrp( label="global rotation", min=-720, max=720, attribute=node.ir) with pm.rowLayout(numberOfColumns=3) : pm.attrControlGrp( label="blend mode", attribute= node.bm) pm.attrControlGrp( label="tet mode", attribute= node.tm) pm.attrControlGrp( label="area weight", attribute= node.aw) with pm.rowLayout(numberOfColumns=2) : pm.attrControlGrp( label="visualise energy", attribute= node.ve) pm.attrFieldSliderGrp( label="visualisation multiplier", min=0.001, max=1000, attribute=node.vmp) for j in range(node.blendMesh.numElements()): with pm.rowLayout(numberOfColumns=1) : pm.attrFieldSliderGrp(label=node.blendWeight[j].getAlias(), min=-1.0, max=2.0, attribute= node.blendWeight[j])
def createUI(): global m2uwin if m2uwin is not None: pm.deleteUI(m2uwin, window=True) v = m2u.getVersion() m2uwin = pm.window( title="m2u "+v+" (maya)", iconName='m2u', widthHeight=(150, 300) ) pm.columnLayout() pm.rowLayout(numberOfColumns = 2) pm.button( label='Connect', c=cbConnect ) pm.button( label='Setup Cameras', c=cbSetupCamera ) pm.setParent('..') pm.checkBox( label='Sync Camera', onc = cbSyncCamera, ofc = cbSyncCameraOff, v = False) pm.checkBox( label='Sync Objects', onc = cbSyncObjects, ofc = cbSyncObjectsOff, v = False) pm.checkBox( label='Sync Visibility', onc = cbSyncVisibility, ofc = cbSyncVisibilityOff, v = False) pm.separator() pm.button( label='Fetch Selected', c = cbFetchSelected) pm.button( label='Send Selected To Editor', c = cbSendSelectedToEd) #pm.button( label='Import Content Test', c = cbUDKImportContent) pm.setParent( '..' ) pm.showWindow( m2uwin )
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 uiOptions(self): with pm.tabLayout(tv=False, imw=5, imh=5 ) as layout: with pm.columnLayout(adj=1): self.navFieldGrp( 'navFieldGrp', label='Work Path : ', text=self.startPath.get(), optVar=self.startPath, fileMode='dir' ) pm.separator(style='in', h=8) with pm.rowLayout(nc=7): pm.text(l=' Work : ', al='right', w=140 ) pm.button(l='Create', c=partial( self.btnCmd, 'create'), w=50 ) pm.button(l='Reload', c=partial( self.btnCmd, 'reload'), w=50 ) pm.button(l='Replace', c=partial( self.btnCmd, 'replace'), w=50 ) pm.button(l='Import', c=partial( self.btnCmd, 'import'), w=50 ) pm.button(l='Remove', c=partial( self.btnCmd, 'remove'), w=50 ) with pm.rowLayout(nc=7): pm.text(l='',al='right', w=140 ) pm.button(l='Print Reference State', c=partial( self.btnCmd, 'state'), w=128 ) pm.separator(style='in', h=8) with pm.rowLayout(nc=7): pm.text(l='Maya Editor : ',al='right', w=140 ) pm.button(l='Reference Editor', c=pm.Callback( pm.mel.ReferenceEditor ), w=128 ) pm.button(l='Namespace Editor', c=pm.Callback( pm.mel.NamespaceEditor ), w=128 ) return layout
def role_mqsb_switch(status, *args): pm.rowLayout(srcAddr, e= 1, vis= 1 if status else 0) pm.rowLayout(disAddr, e= 1, vis= 0 if status else 1) pm.textField(tcHost_txt, e= 1, tx= '', ed= 1 if status else 0) pm.textField(tcPort_txt, e= 1, tx= '', ed= 1 if status else 0) pm.columnLayout(remap_Area, e= 1, en= 1 if status else 0) pm.columnLayout(exect_Area, e= 1, en= 1 if status else 0)
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 createUI(): global m2uwin if m2uwin is not None: pm.deleteUI(m2uwin, window=True) v = m2u.getVersion() m2uwin = pm.window(title="m2u " + v + " (maya)", iconName='m2u', widthHeight=(150, 300)) pm.columnLayout() pm.rowLayout(numberOfColumns=2) pm.button(label='Connect', c=cbConnect) pm.button(label='Setup Cameras', c=cbSetupCamera) pm.setParent('..') pm.checkBox(label='Sync Camera', onc=cbSyncCamera, ofc=cbSyncCameraOff, v=False) pm.checkBox(label='Sync Objects', onc=cbSyncObjects, ofc=cbSyncObjectsOff, v=False) pm.checkBox(label='Sync Visibility', onc=cbSyncVisibility, ofc=cbSyncVisibilityOff, v=False) pm.separator() pm.button(label='Fetch Selected', c=cbFetchSelected) pm.button(label='Send Selected To Editor', c=cbSendSelectedToEd) #pm.button( label='Import Content Test', c = cbUDKImportContent) pm.setParent('..') pm.showWindow(m2uwin)
def _makeArgRow(self, methodIndex, type, argName, direction, annotation=''): COL1_WIDTH = 260 COL2_WIDTH = 120 pm.rowLayout(nc=4, cw4=[COL1_WIDTH, COL2_WIDTH, 70, 150], **self.layout) label = str(type) pm.text(l=label, ann=annotation) pm.text(l=argName, ann=annotation) if direction == 'return': pm.text(l='(result)') else: direction_om = pm.optionMenu(l='', w=60, ann=annotation, cc=pm.CallbackWithArgs( MethodRow.setDirection, self, methodIndex, argName)) for unit in ['in', 'out']: pm.menuItem(l=unit) direction_om.setValue(direction) if self._isPotentialUnitType(type): om = pm.optionMenu(l='', ann=annotation, cc=pm.CallbackWithArgs(MethodRow.setUnitType, self, methodIndex, argName)) for unit in ['unitless', 'linear', 'angular', 'time']: pm.menuItem(l=unit) if argName == 'return': try: value = factories.apiClassOverrides[ self.apiClassName]['methods'][self.apiMethodName][ methodIndex]['returnInfo']['unitType'] except KeyError: pass else: try: value = factories.apiClassOverrides[ self.apiClassName]['methods'][self.apiMethodName][ methodIndex]['argInfo'][argName]['unitType'] except KeyError: pass try: om.setValue(value) except: pass else: pm.text(l='', ann=annotation) pm.setParent('..')
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 build_options_columns(name, options_dict, parent_tab_layout): """ Build a pair of columns to present UserOptions in the Mimic UI. :param name: Name of this column. :param options_dict: UserOptions as OrderedDict where the key is a string and where the value is a dictionary of checkbox parameters for the UI. :param parent_tab_layout: Parent tab layout in which columns will live. :return: """ # Create two options columns pm.rowLayout(name, numberOfColumns=1, adjustableColumn=1, columnAttach=(1, 'left', 3), columnWidth=[(1, 200)], ) # Rename the columns global _OPTS_COLUMN_NAME _OPTS_COLUMN_NAME = _OPTS_COLUMN_NAME.format(name) pm.columnLayout(_OPTS_COLUMN_NAME, parent=name, adj=True, width=200) for i, option in enumerate(options_dict): pm.checkBox(options_dict[option][__name], # cb_... label=option, # _checkbox_name_pretty value=options_dict[option][__value], enable=options_dict[option][__enable], visible=options_dict[option][__visible], parent=_OPTS_COLUMN_NAME) # Return to parent pm.setParent(parent_tab_layout)
def uiContents(): with pm.frameLayout(l='Color', cll=True, mw=3, mh=3 ): with pm.columnLayout(adj=True): with pm.rowLayout(nc=2): pm.text(label='Set Override Color : ', align='right', w=130) with pm.rowColumnLayout( nc=10 ): wh=18 for i in range(0,32): rgb = (0,0,0) if i == 0: rgb = (0.5,0.5,0.5) anno = 'Reset' pm.symbolButton( i=iconPath+'ui_colorNone.png', annotation=anno, w=wh, h=wh, c=pm.Callback( setColor.setColor, color=i ) ) else: rgb = pm.colorIndex( i, q=True ) anno = '- index : %d\n- RGB : %03.3f %03.3f %03.3f\n- name : %s'%(i, rgb[0], rgb[1], rgb[2], setColor.color_intToStr(i) ) pm.canvas( rgbValue = rgb, annotation = anno, w=wh, h=wh, pressCommand = pm.Callback( setColor.setColor, color=i ) ) #partial( self.setColor, i, True , self._toShape)) #partial( self.setColor, i, False, False)) pm.separator(h=8,style='in') with pm.rowLayout( nc=10 ): pm.text(label='Set Wire Frame Color : ', align='right', w=130) pm.button(label='Object Color Palette', c=pm.Callback( pm.mel.objectColorPalette ), w=180 ) # ====================================== # Buttons # ======================================
def __init_window__(self): self.window = pm.window(menuBar=False, widthHeight=[200, 100], title="PYMHUD by Daniel S�nchez Quir�s") self.columna = pm.columnLayout(adjustableColumn=True) # Name row self.row1 = pm.rowLayout(numberOfColumns=3, adjustableColumn=True, parent=self.columna) pm.text("Name:", al="left", parent=self.row1) self.nameQ = pm.textField(parent=self.row1) pm.checkBox( label="", parent=self.row1, offCommand=Callback(self.nameHud, False), onCommand=Callback(self.nameHud, True) ) # Scene row self.row2 = pm.rowLayout(numberOfColumns=3, adjustableColumn=True, parent=self.columna) pm.text("Scene Name:", al="left") self.sceneNameQ = pm.textField(parent=self.row2) pm.checkBox( label="", parent=self.row2, offCommand=Callback(self.sceneHud, False), onCommand=Callback(self.sceneHud, True), ) # Date row self.row3 = pm.rowLayout(numberOfColumns=3, adjustableColumn=True, parent=self.columna) pm.text("Date:", al="left") pm.checkBox( label="", parent=self.row3, offCommand=Callback(self.dateHud, False), onCommand=Callback(self.dateHud, True) ) # rame counter row self.row4 = pm.rowLayout(numberOfColumns=3, adjustableColumn=True, parent=self.columna) pm.text("Frame Counter:", al="left") pm.checkBox(label="", parent=self.row4, offCommand=Callback(self.frameHud), onCommand=Callback(self.frameHud)) pm.showWindow(self.window)
def createRamp( self, attr ): #Create the control fields pm.columnLayout( ) cmds.rowLayout(nc=2, cw2=(142,220)) pm.text("Shutter Curve"); pm.text(" "); pm.cmds.setParent('..') cmds.rowLayout("ShutterCurveRowLayout",nc=2, cw2=(142,220)) pm.columnLayout("ShutterCurveColumLayout") cmds.rowLayout("ShutterCurveValueLayout", nc=2, cw2=(60,45)) pm.text("Value"); valueField = pm.floatField("ShutterCurveValueField"); pm.cmds.setParent('..') pm.rowLayout("ShutterCurvePositionLayout", nc=2, cw2=(60,45)) pm.text("Position"); positionField = cmds.floatField("ShutterCurvePositionField"); pm.cmds.setParent('..') '''pm.rowLayout(nc=2, cw2=(60,65)) pm.text("Interpol."); pm.optionMenu(changeCommand=self.updateRamp ) pm.menuItem( label='None' ) pm.menuItem( label='Linear' ) pm.menuItem( label='Smooth' ) pm.menuItem( label='Spline' ) pm.cmds.setParent('..')''' pm.cmds.setParent('..') gradient = pm.gradientControlNoAttr("ShutterCurveGradientControl", w=200, h=100 ) pm.gradientControlNoAttr( gradient, edit=True, changeCommand=pm.Callback(self.syncAttribute,attr,gradient, valueField, positionField) ) #Initialize the curve with the values in the attribute curveString = "" attr = self.nodeAttr('aiShutterCurve') size = cmds.getAttr(attr, size=True) startX = 0 startY = 1 if size > 0: x = cmds.getAttr(attr+'[0].aiShutterCurveX') y = cmds.getAttr(attr+'[0].aiShutterCurveY') startX = x startY = y curveString += str(y) +"," + str(x) +",1" else: curveString += "1,0,1" for i in range(1,size): x = cmds.getAttr(attr+'['+str(i)+'].aiShutterCurveX') y = cmds.getAttr(attr+'['+str(i)+'].aiShutterCurveY') curveString += ","+str(y) +"," + str(x) +",1" cmds.gradientControlNoAttr( gradient, edit=True, asString=curveString) pm.floatField(valueField, edit=True, value=startY, changeCommand=pm.Callback(self.updateValue, attr, gradient, valueField, positionField)) pm.floatField(positionField, edit=True, value=startX, changeCommand=pm.Callback(self.updatePosition, attr, gradient, valueField, positionField))
def wnd_rowShapes(): global opt_shapeOptions, txt_shapeName, txt_shapeSuffix global opt_placementOption pm.frameLayout(label="Shape Maker", width=500, collapsable=True) pm.rowLayout(numberOfColumns=2, columnAlign=([1, "left"], [2, "right"]), width=450, columnWidth=([1, 200], [2, 250])) pm.text(label="Choose a shape") opt_shapeOptions = pm.optionMenu(width=100) pm.menuItem(label="Circle") pm.menuItem(label="Sphere") pm.menuItem(label="Square") pm.menuItem(label="Cube") pm.menuItem(label="2D Arrow") pm.menuItem(label="3D Arrow") pm.menuItem(label="Round Pointer") pm.menuItem(label="COG Circle") pm.menuItem(label="Compass") pm.setParent("..") pm.rowLayout(numberOfColumns=2, columnAlign=([1, "left"], [2, "right"]), width=450, columnWidth=([1, 200], [2, 250])) pm.text(label="Enter a name.\nLeave blank for default shape name.") txt_shapeName = pm.textField(placeholderText="shape") pm.setParent("..") pm.rowLayout(numberOfColumns=2, columnAlign=([1, "left"], [2, "right"]), width=450, columnWidth=([1, 200], [2, 250])) pm.text( label="Insert a suffix.\nLeave blank for default\n\"icon\" to be added" ) txt_shapeSuffix = pm.textField(placeholderText="icon") pm.setParent("..") pm.rowLayout(numberOfColumns=2, columnAlign=([1, "left"], [2, "right"]), width=450, columnWidth=([1, 200], [2, 250])) pm.text(label="Shape is placed on:") opt_placementOption = pm.optionMenu(width=150) pm.menuItem(label="Origin") pm.menuItem(label="Currently Selected Object") pm.setParent("..") pm.rowLayout(numberOfColumns=3, columnWidth=([1, 150], [2, 150])) pm.text(label="") pm.button(label="Create Shape", command=pm.Callback(createShape, opt_shapeOptions, txt_shapeName, txt_shapeSuffix, opt_placementOption)) pm.text(label="") pm.setParent("..") pm.setParent("..")
def makeLightExclusive(self, attr): lightName = attr.split(".")[0] pm.rowLayout(nc=2, cal=[2, 'left']) pm.text(label="") pm.exclusiveLightCheckBox('exclusiveButton', light=lightName, label="Illuminates By Default") pm.setParent('..')
def __init__(self): self.windows_name = 'cgru_afanasy_wnd' if pm.window(self.windows_name, exists=True): pm.deleteUI(self.windows_name) self.window = pm.window(self.windows_name, t='Afanasy') with pm.columnLayout(adj=True): labels_width = 90 with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='Start Frame') pm.intField( 'cgru_afanasy__start_frame', v=pm.optionVar.get('cgru_afanasy__start_frame_ov', 1) ) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='End Frame') pm.intField( 'cgru_afanasy__end_frame', v=pm.optionVar.get('cgru_afanasy__end_frame_ov', 1) ) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='Frame Per Task') pm.intField( 'cgru_afanasy__frames_per_task', v=pm.optionVar.get('cgru_afanasy__frames_per_task_ov', 1) ) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='By Frame') pm.intField( 'cgru_afanasy__by_frame', v=pm.optionVar.get('cgru_afanasy__by_frame_ov', 1) ) pm.checkBox('cgru_afanasy__paused', l='Start Paused', v=0) pm.checkBox( 'cgru_afanasy__separate_layers', l='Submit Render Layers as Separate Tasks', v=1 ) pm.button( l='LAUNCH', c=self.launch ) pm.checkBox( 'cgru_afanasy__close', l='Close After', v=1 ) pm.showWindow(self.window)
def wnd_row_default(): pm.frameLayout(collapsable=True, label="") pm.rowLayout(numberOfColumns=1) pm.text(label="blank") #More layout in here pm.setParent("..") pm.setParent("..")
def zFileSwitchRefreshNew(attr): # Is there a less dumb way to align the button sensibly? pm.rowLayout(nc=5, cl5=("center", "center", "center", "center", "center")) pm.text(label='') pm.button('refreshFileSwitch', label='Refresh') pm.text(label='') pm.text(label='') pm.text(label='') pm.setParent('..') zFileSwitchRefreshReplace(attr)
def MakeRowLayout(numColumns, leftColumnWidth=__LEFT_COLUMN_WIDTH__, middleColumnWidth=__MIDDLE_COLUMN_WIDTH__, rightColumnWidth=__RIGHT_COLUMN_WIDTH__, makeAdjustable=True): """ Creates & returns a PyMel row layout. :param numColumns: number of columns in the layout, min=1 max=4 (<1 or >4 will raise a ValueError). :param leftColumnWidth: float, width of left column. :param middleColumnWidth: float, width of middle column, ignored if numColumns = 1. :param rightColumnWidth: float, width of right column, ignored if numColumsn < 3. :param makeAdjustable: True = right-most column (up to 3rd) will have flexible width, False = all columns fixed. """ if(numColumns == 4): layout = pm.rowLayout(numberOfColumns=4, columnWidth4=(leftColumnWidth, middleColumnWidth, rightColumnWidth - __FOURTH_COLUMN_WIDTH__, __FOURTH_COLUMN_WIDTH__), columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0), (4, 'right', 10)]) if(makeAdjustable): layout.adjustableColumn(3) return layout if(numColumns == 3): layout = pm.rowLayout(numberOfColumns=3, columnWidth3=(leftColumnWidth, middleColumnWidth, rightColumnWidth), columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)]) if(makeAdjustable): layout.adjustableColumn(3) return layout elif(numColumns == 2): layout = pm.rowLayout(numberOfColumns=2, columnWidth2=(leftColumnWidth, rightColumnWidth), columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0)]) if(makeAdjustable): layout.adjustableColumn(2) return layout elif(numColumns == 1): layout = pm.rowLayout(numberOfColumns=1, columnAlign=(1, 'left'), columnAttach=(1, 'left', leftColumnWidth + 3)) if(makeAdjustable): layout.adjustableColumn(1) return layout else: raise ValueError
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 mainBody(self, path, mayaFalse): try: if pm.rowLayout(self.masterRow, exists=True, query=True): print 'yes' pm.deleteUI(self.masterRow, layout=True) except: print 'doesnt exist yet' print(os.listdir(path)) self.fileList = [ i for i in os.listdir(path) if os.path.isfile(os.path.join(path, i)) ] self.masterRow = pm.rowLayout(width=600, nc=5, parent=self.masterCol) spacerCol = pm.columnLayout(width=25, parent=self.masterRow) col = pm.columnLayout(width=600, parent=self.masterRow) mainBox = pm.scrollLayout(horizontalScrollBarThickness=16, verticalScrollBarThickness=16, parent=col, width=500, height=600) self.radColle = pm.radioCollection() self.path = path #creating entry for each file for i in self.fileList: if '.ma' in i[-3:]: row1 = pm.rowLayout(i, nc=5, width=450, parent=mainBox) pm.image(image=str(path + '/' + i).rstrip('.ma') + '.png', height=100, width=100) column1 = pm.columnLayout(parent=row1) #writing a partial for command radioButtonChange = partial(self.fillSceneName, i) pm.radioButton(i, label=i, parent=column1, onCommand=radioButtonChange, annotation=path) radioSpacer = pm.rowLayout(nc=2) pm.text(label='', width=16, align='left', parent=radioSpacer, enable=False) pm.text('SER export', label=u'comment コメント', width=150, height=20, align='left', parent=radioSpacer, enable=False)
def scriptUI(): windowID = 'WeapCon' if pm.window(windowID, exists=True): pm.deleteUI(windowID) pm.windowPref('WeapCon', remove=True) #creating window pm.window(windowID, title=u'SER 武器コンストレイン | 2018/02/28', widthHeight=(600, 100)) #buttons for first row constrFrame = pm.frameLayout(annotation='annotation test', label=u'武器コンストレイン', labelIndent=5, width=590, marginHeight=5) pm.rowLayout('row1', nc=5, width=400) conSetup = pm.button( 'constraintSetup', label=u'コンストレイン インストール', width=300, height=30, backgroundColor=(0.6, 0.6, 0.6), parent='row1', command='SERTools_001.constraintSwitch.createConstr()') bake = pm.button('motionBake', label=u'ベーク', width=300, height=30, backgroundColor=(0.6, 0.6, 0.6), parent='row1', command='SERTools_001.constraintSwitch.bakeLoc()') ''' #buttons for 2nd row pm.rowLayout( 'row2', nc = 2, parent = 'columnLayout01' ) bodySliderGrp = pm.intSliderGrp(field = True, label = u'全身ポーズ', minValue = 0, maxValue = upperLimit - 1, value = 0, adj = 3, columnWidth3 = [100,50,200], width = 525, dragCommand = setPose) pm.rowLayout( 'row3', nc = 2, parent = 'columnLayout01', width = 590, height = 50) pm.columnLayout( 'col_1', width = 100, parent = 'row3')#spacer pm.columnLayout( 'col_2', width = 390, parent = 'row3') resetButton = pm.button( 'resetButton', label = u'T ポーズに', width = 390, height = 20, backgroundColor = ( 0.6, 0.6, 0.6), parent = 'col_2', command = resetChar ) pm.rowLayout( 'row4', nc = 2, parent = 'columnLayout01', width = 590, height = 50) pm.columnLayout( 'col_3', width = 100, parent = 'row4')#spacer pm.columnLayout( 'col_4', width = 390, parent = 'row4') resetButton_ctrlRig = pm.button( 'ctrlRigReset', label = u'Control Rig T pose', width = 390, height = 20, backgroundColor = ( 0.6, 0.6, 0.6), parent = 'col_4', command = resetCharTPose ) ''' pm.showWindow() pm.window(windowID, edit=True, widthHeight=(600, 100))
def __init__(self): with pm.frameLayout(l='Transform:', cll=True, cl=False, bs='out'): with pm.columnLayout(): with pm.gridLayout(nc=5): pm.iconTextButton(image1='pbUV/tRot90CCW.png', c=lambda *args: self.rotate(angle=90, dir='ccw'), commandRepeatable=True) pm.iconTextButton(image1='pbUV/tRotCCW.png', c=lambda *args: self.rotate(dir='ccw'), commandRepeatable=True) pm.iconTextButton(image1='pbUV/tTranslateUp.png', c=lambda *args: self.move(v=1), commandRepeatable=True) pm.iconTextButton(image1='pbUV/tRotCW.png', c=lambda *args: self.rotate(dir='cw')) pm.iconTextButton(image1='pbUV/tRot90CW.png', c=lambda *args: self.rotate(angle=90, dir='cw'), commandRepeatable=True) flipuv = pm.iconTextButton(image1='pbUV/tFlipUV.png', c=lambda *args: self.flip(axis='u'), commandRepeatable=True) pm.popupMenu(button=3, p=flipuv, pmc=lambda *args: self.flip(axis='v')) pm.iconTextButton(image1='pbUV/tTranslateLeft.png', c=lambda *args: self.move(u=-1), commandRepeatable=True) pm.iconTextButton(image1='pbUV/tTranslateDown.png', c=lambda *args: self.move(v=-1), commandRepeatable=True) pm.iconTextButton(image1='pbUV/tTranslateRight.png', c=lambda *args: self.move(u=1), commandRepeatable=True) pm.iconTextButton(image1='pbUV/tRot180CCW.png', c=lambda *args: self.rotate(angle=180, dir='ccw'), commandRepeatable=True) with pm.rowColumnLayout(nc=4): self.manipValue = pm.floatField(v=1.0) pm.iconTextButton(image1='pbUV/tScaleU.png', c=lambda *args: self.scale(axis='u'), commandRepeatable=True) pm.iconTextButton(image1='pbUV/tScaleV.png', c=lambda *args: self.scale(axis='v'), commandRepeatable=True) pm.iconTextButton(image1='pbUV/tScaleUV.png', c=lambda *args: self.scale(), commandRepeatable=True) pm.separator(st='in', width=160, height=8) with pm.rowLayout(nc=2): pm.button(l='Orient Edge', c=self.orient_edge) pm.button(l='Orient Bounds', c=self.orient_bounds) pm.separator(st='in', width=160, height=8) with pm.columnLayout(cal='left'): pm.text(l='Pivot:') self.pivType = pm.radioButtonGrp(nrb=2, labelArray2=['Selection', 'Custom'], cw2=[64, 64], cc=self._piv_change, sl=1) with pm.rowLayout(nc=3, en=False) as self.pivPos: pm.text('POS:') self.pivU = pm.floatField() self.pivV = pm.floatField() self.sampleSel = pm.button(l='Sample Selection', height=18, en=False, c=self.sample_sel_cmd)
def placeHighLight(*args): ### UI setup global UI_name UI_name = [ 'txtBtn_light', 'txtBtn_camera', 'txtBtn_object', 'txtBtn_HLitPoint', 'btn_placeHLit', 'chk_interaction' ] if pm.window( 'winPlaceHLit', exists=True ): pm.deleteUI( 'winPlaceHLit', window=True ) ui_layout['window'] = pm.window( 'winPlaceHLit', title='Place Highlight', sizeable=False, h=100, w=250 ) ui_layout['mainLayout'] = pm.columnLayout( columnAlign='left', columnAttach=['left', 0] ) #// get active camera activeViewCamera = getActiveCam() '''loc_light_probe = pm.createNode('locator', name='light_probe') pm.lockNode(loc_light_probe, lock=False)''' #// sub layout #// sub1 ui_layout['ui_sub1'] = pm.rowLayout(nc=2, cw=[(1, 210), (2, 40)], p=ui_layout['mainLayout'] ) pm.textFieldButtonGrp( UI_name[0], label='Light: ', text='', buttonLabel='Pick',editable=False, buttonCommand='pickLit()', cw=[(1,50), (2,120), (3,40)], p=ui_layout['ui_sub1'] ) pm.button( 'btn_sel_light' ,label='Sel', command=pm.Callback( doSelItem, UI_name[0] ), p=ui_layout['ui_sub1'] ) #// sub2 ui_layout['ui_sub2'] = pm.rowLayout(nc=2, cw=[(1, 210), (2, 40)], p=ui_layout['mainLayout'] ) pm.textFieldButtonGrp( UI_name[1], label='Camera: ', text=activeViewCamera, buttonLabel='Pick', editable=False, buttonCommand='pickCam()', cw=[(1,50), (2,120), (3,40)], p=ui_layout['ui_sub2'] ) pm.button( 'btn_sel_camera' ,label='Sel', command=pm.Callback( doSelItem, UI_name[1] ), p=ui_layout['ui_sub2'] ) #// sub3 ui_layout['ui_sub3'] = pm.rowLayout(nc=2, cw=[(1, 210), (2, 40)], p=ui_layout['mainLayout'] ) pm.textFieldButtonGrp( UI_name[2], label='Object: ', text='', buttonLabel='Pick', editable=False, buttonCommand='pickTgtObj()', cw=[(1,50), (2,120), (3,40)], p=ui_layout['ui_sub3'] ) pm.button( 'btn_sel_obj' ,label='Sel', command=pm.Callback( doSelItem, UI_name[2] ), p=ui_layout['ui_sub3'] ) #// sub4 ui_layout['ui_sub4'] = pm.rowLayout(nc=2, cw=[(1, 210), (2, 40)], p=ui_layout['mainLayout'] ) pm.textFieldButtonGrp( UI_name[3], label='Point: ', text='', buttonLabel='Pick', editable=False, buttonCommand='pickHLitPt()', cw=[(1,50), (2,120), (3,40)], p=ui_layout['ui_sub4'] ) pm.button( 'btn_sel_point' ,label='Sel', command=pm.Callback( doSelItem, UI_name[3] ), p=ui_layout['ui_sub4'] ) #// sub5 ui_layout['ui_sub5'] = pm.rowLayout(nc=2, cw=[(1, 70), (2, 50)], p=ui_layout['mainLayout'] ) pm.button( UI_name[4] ,label='Place Light!', command='doPlaceHLight()', p=ui_layout['ui_sub5'] ) pm.checkBox( UI_name[5], label='interactive mode', onCommand=pm.Callback( doInteractionON ), offCommand=pm.Callback( doInteractionOFF ), p=ui_layout['ui_sub5'] ) pm.showWindow( ui_layout['window'] ) pm.spaceLocator( name='light_probe' ) pm.lockNode( 'light_probe', lock=True ) pm.textFieldButtonGrp( 'txtBtn_HLitPoint', edit=True, text='light_probe' ) #// clean make live and scriptJob after exit script pm.scriptJob( uiDeleted=[ ui_layout['window'], pm.Callback( flushScript ) ] )
def _buildupWindow(self): if isinstance(self._window, _pmCore.uitypes.Window) and self._window.exists(self._window.name()): _pmCore.deleteUI(self._window, window=True) self._window = _pmCore.window(title=self._winTitle) _pmCore.rowLayout(numberOfColumns=2, columnWidth2=[200, 100]) self._textScrollList = _pmCore.textScrollList(height=100) for category in _Database.getCategoryList(): _pmCore.textScrollList(self._textScrollList, edit=True, append=category) _pmCore.columnLayout() _pmCore.button(label='Add', width=100, height=30, command=self._addClicked) _pmCore.button(label='Rename', width=100, height=30, command=self._renameClicked) _pmCore.button(label='Delete', width=100, height=30, command=self._deleteClicked)
def uiContents(): with pm.frameLayout(l='Surfacing', cll=True, mw=3, mh=3 ): with pm.columnLayout( adj=True ): with pm.rowLayout(nc=10): pm.text(l='Assign Initial Shading Group : ', w= labelWidth, align='right') pm.button( l='Assign', w= 160, c=pm.Callback( btn_assignInitialShader )) with pm.rowLayout(nc=10): pm.text(l='File Texture Manager : ', w= labelWidth, align='right') pm.button( l='Open UI..', w= 160, c=pm.Callback( btn_fileTextureManager )) pm.button(l='d', w=20, c=pm.Callback( pm.launch, web="http://www.creativecrash.com/maya/script/filetexturemanager") ) pm.button(l='t', w=20, c=pm.Callback( pm.launch, web="https://www.youtube.com/watch?v=3bSkVoo6glU") )
def create_mimic_window(window_name): # If the window already exists, delete the window if pm.window("mimic_win", exists=True): pm.deleteUI("mimic_win", window=True) # Initialize window and Layout mimic_version = general_utils.get_mimic_version() mimic_win = pm.window( "mimic_win", width=245, title='MIMIC {}'.format(mimic_version)) # + ' <dev 4.8.19>')) pm.rowLayout(numberOfColumns=3, adjustableColumn=2) return mimic_win
def __init__(self, par): ToolsUI.__init__(self, par) with pm.columnLayout() as self.layout: with pm.rowLayout(nc=4): pm.floatField('uvEntryFieldU', precision=3, ed=True, width=46, ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kEnterValueTotransformInUAnnot'), cc=lambda *args: pm.mel.textureWindowUVEntryCommand(1)) pm.floatField('uvEntryFieldV', precision=3, ed=True, width=46, ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kEnterValueTotransformInVAnnot'), cc=lambda *args: pm.mel.textureWindowEntryCommand(0)) pm.iconTextButton(image1='uv_update.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kRefreshUVValuesAnnot'), c=self.uv_update, commandRepeatable=True) pm.iconTextCheckBox('uvEntryTransformModeButton', image1='uvEntryToggle.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kUVTransformationEntryAnnot'), value=pm.melGlobals['gUVEntryTransformMode'], onc=lambda *args: pm.mel.uvEntryTransformModeCommand(), ofc=lambda *args: pm.mel.uvEntryTransformModeCommand()) with pm.rowLayout(nc=6): copyuv = pm.iconTextButton('copyUVButton', image1='copyUV.png', ann=pm.mel.getRunTimeCommandAnnotation('PolygonCopy'), c=lambda *args: pm.mel.PolygonCopy()) pm.popupMenu('copyUVButtonPopup', button=3, p=copyuv, pmc=lambda *args: pm.mel.PolygonCopyOptions()) pasteuv = pm.iconTextButton('pasteUVButton', image1='pasteUV.png', ann=pm.mel.getRunTimeCommandAnnotation('PolygonPaste'), c=lambda *args: pm.mel.PolygonPaste()) pm.popupMenu('pasteUVButtonPopup', button=3, p=pasteuv, pmc=lambda *args: pm.mel.PolygonPasteOptions()) pm.iconTextButton('pasteUButton', image1='pasteUDisabled.png', en=False, ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kPasteUValueAnnot'), c=lambda *args: pm.mel.textureWindowCreateToolBar_uvPaste(1, 0)) pm.iconTextButton('pasteVButton', image1='pasteVDisabled.png', en=False, ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kPasteVValueAnnot'), c=lambda *args: pm.mel.textureWindowCreateToolBar_uvPaste(0, 1)) pm.iconTextCheckBox(image1='copyUVMode.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kToggleCopyPasteAnnot'), onc=lambda *args: pm.mel.textureWindowCreateToolBar_copyPasteMode(1), ofc=lambda *args: pm.mel.textureWindowCreateToolBar_copyPasteMode(0)) pm.iconTextButton(image1='cycleUVs.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kCycleUVsCounterClockwiseAnnot'), c=lambda *args: pm.mel.polyRotateUVsByVertex(), commandRepeatable=True)
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 _buildPrefUi(self): # delete previous UI if pmc.window(self.uiPrefName, exists=True): pmc.deleteUI(self.uiPrefName, window=True) # create UI self.uiPref['win'] = pmc.window(self.uiPrefName, title=self.uiPrefTitle, menuBar=True, width=300, height=200, sizeable=False) self.uiPref['mainLay'] = pmc.columnLayout() self.uiPref['titleTxt'] = pmc.text(label='Preferences', backgroundColor=[0,0,0], enableBackground=True, height=20, width=200) self.uiPref['optLay'] = pmc.rowLayout(numberOfColumns=2, columnWidth2=(125, 75)) self.uiPref['optTxt'] = pmc.text(label='Format filter') self.uiPref['chkLay'] = pmc.columnLayout() v=False if '.obj' in self.filtersList: v=True self.uiPref['objChb'] = pmc.checkBox(label='Obj', value=v) v=False if '.ma' in self.filtersList: v=True self.uiPref['maChb'] = pmc.checkBox(label='Ma', value=v) v=False if '.mb' in self.filtersList: v=True self.uiPref['mbChb'] = pmc.checkBox(label='Mb', value=v) v=False if '.fbx' in self.filtersList: v=True self.uiPref['fbxChb'] = pmc.checkBox(label='Fbx', value=v) pmc.setParent('..') pmc.setParent('..') pmc.rowLayout(numberOfColumns=2, columnWidth2=(100, 100)) self.uiPref['cancelBtn'] = pmc.button(label='Cancel', height=30, width=95) self.uiPref['saveBtn'] = pmc.button(label='Save', height=30, width=95) # command self.uiPref['cancelBtn'].setCommand(pmc.Callback(self._deletePrefUi)) self.uiPref['saveBtn'].setCommand(pmc.Callback(self._getNewFilter)) # show main ui pmc.showWindow(self.uiPref['win'])
def customLightFiltersNew(self, attr): pm.rowLayout(numberOfColumns=3, adjustableColumn=2, rowAttach=(1, "top", 0), columnWidth=[(1, 140), (2, 180)]) pm.text(label="") pm.columnLayout(adjustableColumn=True, columnAttach=("both", 0), rowSpacing=5) uiName = '%s_aiFilter' % (self.nodeType()) self.scrollList = pm.textScrollList( uiName, height=150, ams=False, sc=self.lightFilterListChanged, dcc=self.updateCustomLightFiltersNew) pm.rowLayout(numberOfColumns=2, columnWidth2=(80, 80), columnAttach2=("both", "both"), columnAlign2=("center", "center"), columnOffset2=(2, 2)) pm.button('lf_add_button', label="Add", c=Callback(self.addLightFilterWin)) pm.button('lf_remove_button', label="Disconnect", c=Callback(self.removeLightFilter)) # implicit end of row layout pm.setParent('..') # back to column layout pm.setParent('..') # back to row layout pm.columnLayout(adjustableColumn=True, columnAttach=("both", 0), rowSpacing=5) pm.symbolButton('lf_move_up_button', image='arrowUp.xpm', c=Callback(self.moveLightFilterUp)) pm.symbolButton('lf_move_down_button', image='arrowDown.xpm', c=Callback(self.moveLightFilterDown)) pm.setParent('..') pm.setParent('..') self.addOptionMenuGrp = pm.optionMenuGrp( 'lf_add_menu', label='Add', changeCommand=self.addLightFilterCB) self.addOptionMenu = self.addOptionMenuGrp + '|OptionMenu' self.lightFiltersUpdateList() self.updateAddMenu()
def __init__(self): if pmel.window('LightLinks', q=1, ex=1): pmel.deleteUI('LightLinks') cmds.window('LightLinks', w=365, h=305, s=0) pmel.columnLayout('column') pmel.formLayout(p='column') pmel.rowLayout(nc=4) pmel.button(l='添加', w=85, h=25, c=partial(add_sel_lights, 0)) pmel.button(l='移除', w=85, h=25, c=partial(del_lights, 0)) pmel.button(l='移除所有', w=85, h=25, c=partial(del_all_lights, 0)) pmel.button(l='刷新', w=85, h=25, c=partial(refresh_lights, 0)) pmel.formLayout(p='column') pmel.rowLayout(nc=4) pmel.textScrollList('light_list', ams=True, w=260, h=200, da=1) pmel.text(l="", w=5) pmel.button(l='补光', w=70.5, h=25, c=partial(light_links, "fast_link", 0), bgc=(0.6, 0.5, 0)) pmel.formLayout(p='column') pmel.rowLayout(nc=4) pmel.button(l='断开所有', w=85, h=25, c=partial(light_links, "global_break", 0)) pmel.button(l='链接所有', w=85, h=25, c=partial(light_links, "global_make", 0)) pmel.button(l='断开选择', w=85, h=25, c=partial(light_links, "local_break", 0)) pmel.button(l='链接选择', w=85, h=25, c=partial(light_links, "local_make", 0)) pmel.formLayout(p='column') pmel.rowLayout(nc=4) pmel.button(l='查看列表里的灯光', w=172.5, h=25, c=partial(check_sel_lights, 0)) pmel.button(l='检查选择的灯光链接', w=172.5, h=25, bgc=(0.3, 0.35, 0), c=partial(check_light_links, 0)) pmel.formLayout('text_form', p='column') pmel.columnLayout(p='text_form', bgc=(0.15, 0.2, 0), w=347, h=20) pmel.text('warming:If you selected lights in scene,do first', p='text_form', h=20) pmel.showWindow('LightLinks')
def createAttributesButtons(self, attr): # print "ObjectSetTemplate Create Buttons %r for %r" % (self.nodeName, attr) # print "ObjectSetTemplate Created Buttons %r for %r" % (self.nodeName, attr) pm.setUITemplate('attributeEditorTemplate', pushTemplate=True) pm.rowLayout(numberOfColumns=3, columnWidth3=(140, 80, 80), columnAttach3=("both", "both", "both"), columnAlign3=("center", "center", "center"), columnOffset3=(2, 2, 2)) pm.text(label="") pm.button('attr_add_button', label="Add", c=lambda *args: AttributeListWindow(self, mode='add')) pm.button('attr_remove_button', label="Remove", c=lambda *args: AttributeListWindow(self, mode='remove')) # pm.button('attr_remove_button', label="Remove", c=Callback(self.removeAttrWin)) pm.setUITemplate('attributeEditorTemplate', popTemplate=True)
def ContrlUI(): if pm.window( u'MeshPreviewUI',q=1,exists=1): pm.deleteUI(u'MeshPreviewUI') pm.window(u'MeshPreviewUI',t=u'Mesh预览--渲染细分Tool v1.0') pm.columnLayout(cal='left') pm.rowLayout(nc=2) pm.intSliderGrp( 'intDis',field=True, label='Display Ctrl',ann=u'物体的显示精度控制',cw=[(1,80),(2,50),(3,100)],cal=[(1,'left'),(2,'left'),(3,'left')], minValue=0, maxValue=7, fieldMinValue=0, fieldMaxValue=7, value=2 ) pm.setParent('..') pm.rowLayout(nc=2) pm.intSliderGrp( 'intRen',field=True, label='Render Ctrl',ann=u'物体的渲染精度控制',cw=[(1,80),(2,50),(3,100)],cal=[(1,'left'),(2,'left'),(3,'left')], minValue=0, maxValue=7, fieldMinValue=0, fieldMaxValue=7, value=2,en=0 ) pm.checkBox('checkMod', l=u'关联预览',ann=u'渲染精度与显示精度关联',v=1,cc=lambda *args:changelink()) pm.setParent('..') pm.rowLayout( nc=3,cw=[(1,75),(2,75),(3,75)]) pm.button(l=u'按1',w=74,bgc=[0.4,0.2,0.2],ann=u'就是按1啦!!!',c=lambda *args:run(0,0)) pm.button(l=u'按2',w=74,bgc=[0.2,0.2,0.4],ann=u'就是按2啦!!!',c=lambda *args:run(0,1)) pm.button(l=u'按3',w=74,bgc=[0.2,0.4,0.2],ann=u'就是按3啦!!!',c=lambda *args:run(0,2)) pm.setParent('..') pm.rowLayout( nc=3,cw=[(1,75),(2,75),(3,75)]) pm.button(l=u'所有按1',w=74,bgc=[0.4,0.2,0.2],ann=u'就是所有按1啦!!!',c=lambda *args:run(1,0)) pm.button(l=u'所有按2',w=74,bgc=[0.2,0.2,0.4],ann=u'就是所有按2啦!!!',c=lambda *args:run(1,1)) pm.button(l=u'所有按3',w=74,bgc=[0.2,0.4,0.2],ann=u'就是所有按3啦!!!',c=lambda *args:run(1,2)) pm.setParent('..') pm.text('designed by jiaguobao',ann=u'作者就是我') pm.showWindow(u'MeshPreviewUI') pm.window( u'MeshPreviewUI',e=1,w=320,h=120,sizeable=False)
def ui(): if pm.window(win, q=True, exists=True ): pm.deleteUI(win) with pm.window(win, wh=[300,600], t=title): with pm.frameLayout( lv=False, cll=False, mw=1, mh=1): with pm.columnLayout(adj=True): with pm.tabLayout(tv=False): with pm.frameLayout(lv=False, cll=False, mw=2, mh=2, bv=False): with pm.rowLayout(nc=3, adj=2): pm.image( image = shelfIcon ) pm.text(l=' %s'%title, fn='boldLabelFont', align='left') pm.image( image = alfredIcon ) pm.separator( h=8, style='in') with pm.frameLayout(lv=False, cll=False, mw=0, mh=0, bv=False): with pm.frameLayout(lv=False, cll=False, mw=3, mh=3, bv=False): # Scene ----------------------- with pm.frameLayout(l='Scene', cll=True, mw=3, mh=3 ): with pm.columnLayout(adj=True): with pm.rowLayout( nc=10 ): pm.text(label='Reference Editor 2 : ', align='right', w=150) pm.button(label='Open UI...', w=180, en=False ) with pm.rowLayout( nc=10 ): pm.text(label='File Traveler : ', align='right', w=150) pm.button(label='Open UI...', w=180, en=False ) # Camera ----------------------- with pm.frameLayout(l='Camera', cll=True, mw=3, mh=3 ): with pm.columnLayout(adj=True): with pm.rowLayout( nc=10 ): pm.text(label='Create Camera : ', align='right', w=150) with pm.columnLayout(): pm.button(label='Create Turntable Camera', w=180, en=False ) pm.button(label='Create Frustum Camera', w=180, en=False ) pm.button(label='Create Stereo Camera', w=180, en=False ) with pm.rowLayout( nc=10 ): pm.text(label='Set Camera Playback Range : ', align='right', w=150) pm.button(label='set', c=pm.Callback( sm.setCamPlaybackRange ), w=180 ) with pm.rowLayout( nc=10 ): pm.text(label='HUD : ', align='right', w=150) pm.button(label='Scene Name HUD', w=180, en=False ) with pm.rowLayout( nc=10 ): pm.text(label='Export Camera : ', align='right', w=150) pm.button(label='for After Effect...', w=180, en=False ) # Asset ----------------------- with pm.frameLayout(l='Asset', cll=True, mw=3, mh=3 ): with pm.columnLayout(adj=True): with pm.rowLayout( nc=10 ): pm.text(label='Toggle Display CharacterGeo : ', align='right', w=150) pm.button(label='( preview / render )', c=pm.Callback( sm.toggleDisplayCharacterGeo ), w=180 )
def createBrowser(self): win = pm.window(w=200) form = pm.formLayout(numberOfDivisions=100) col2 = pm.columnLayout(p=form, adjustableColumn=True) allowedAreas = ['right', 'left'] pm.dockControl(label='BROWSER', w=200, area='left', content=win, allowedArea=allowedAreas) self.projectSelectWidget = ProjectSelectWidget() self.projectSelectWidget.createProjectSelect(col2) pm.rowLayout(nc=3, adj=1) self.typeOpt = pm.optionMenuGrp(label='Item Type', changeCommand=self.changeTypeCallback, cat=[[1,'left',5],[2,'left',-80]]) types = ['asset', 'shot', 'model', 'uvs', 'texture', 'blendShape', 'rig', 'layout', 'animation', 'shotFinalizing', 'lightining', 'render'] for assetType in types: pm.menuItem(label=assetType) pm.symbolButton(image=r'D:/JOBS/PIPELINE/pipeExemple/scenes/icons/small.png', c=lambda x, y=2: self.changeViewCallback(y)) pm.symbolButton(image=r'D:/JOBS/PIPELINE/pipeExemple/scenes/icons/big.png', c=lambda x, y=1: self.changeViewCallback(y)) pane = pm.paneLayout(p=form, configuration='top3', ps=[(1, 20, 80), (2, 80, 80), (3, 100, 20)], shp = 0) self.folderTreeWidget = FolderTreeWidget('asset') self.folderTreeWidget.createFolderTree(pane) self.folderTreeWidget.getFolderTree() self.itemListWidget = ItemListWidget() self.itemListWidget.createList(pane) self.itemListWidget.refreshList(path=[], task='asset') self.infoWidget = InfoWidget() self.infoWidget.createInfo(pane) self.folderTreeWidget.itemListWidget = self.itemListWidget self.folderTreeWidget.itemListWidget.type = 'asset' self.folderTreeWidget.itemListWidget.task = 'asset' self.projectSelectWidget.folderTreeWidget = self.folderTreeWidget self.projectSelectWidget.itemListWidget = self.itemListWidget self.itemListWidget.infoWidget = self.infoWidget pm.formLayout(form, edit=True, attachForm=[(pane, 'left', 5), (pane, 'bottom', 5), (pane, 'right', 5), (col2, 'top', 5), (col2, 'left', 5), (col2, 'right', 5)], attachControl=[(pane, 'top', 5, col2)], attachPosition=[], attachNone=() ) pm.showWindow()
def uiContents(): with pm.frameLayout(l='Alembic', cll=True, mw=3, mh=3, bs='etchedIn'): with pm.columnLayout(adj=True): with pm.rowLayout(nc=10): pm.text(l='Alembic Tools : ', w=labelWidth, align='right') pm.button(l='Open UI..', c=pm.Callback( btn_alembicTools ), 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='Composit', cll=True, mw=3, mh=3, bs='etchedIn'): with pm.columnLayout(adj=True): with pm.rowLayout(nc=10): pm.text(l='Export To AfterEffects : ', w=labelWidth, align='right') pm.button(l='Open UI..', c=pm.Callback( btn_exportAE ), w=160)
def createCommonAttr(self,node,deformerType): with pm.rowLayout(numberOfColumns=len(self.probes[node])+2) : pm.button( l="Delete deformer", c=pm.Callback( self.deleteNode, node)) pm.button( l="Add selection to probes", c=pm.Callback( self.addSelectedProbe, node, deformerType) ) for j in range(len(self.probes[node])): pm.button( l=self.probes[node][j].name(), c=pm.Callback( self.deleteProbe, node, j) ) with pm.rowLayout(numberOfColumns=2) : pm.attrControlGrp( label="blend mode", attribute= node.bm) # pm.attrControlGrp( label="world mode", attribute= node.worldMode) pm.attrControlGrp( label="rotation consistency", attribute= node.rc) with pm.rowLayout(numberOfColumns=4) : pm.attrControlGrp( label="Weight mode", attribute= node.wtm) pm.attrFieldSliderGrp(label="effect radius", min=0.001, max=20.0, attribute=node.er) pm.attrControlGrp( label="normalise weight", attribute= node.nw) pm.attrControlGrp( label="normExponent", attribute=node.ne)
def rigMakeUI(): windowID = 'rigUI' if pm.window(windowID, exists=True): pm.deleteUI(windowID) pm.windowPref('WeapCon', remove=True) #creating window pm.window(windowID, title='SER Rig | 2018/03/01', widthHeight=(600, 100)) #buttons for first row rigFrame = pm.frameLayout(label=u'リグツール', labelIndent=5, width=590, marginHeight=5) pm.rowLayout('row1', nc=5, width=400) conSetup = pm.button('controllerSetup', label=u'リグを作る', width=300, height=30, backgroundColor=(0.6, 0.6, 0.6), parent='row1', command='createContr()') constrainSetup = pm.button('constraintSetup', label=u'2', width=300, height=30, backgroundColor=(0.6, 0.6, 0.6), parent='row1', command='reverseConstraint()') ''' #buttons for 2nd row pm.rowLayout( 'row2', nc = 2, parent = 'columnLayout01' ) bodySliderGrp = pm.intSliderGrp(field = True, label = u'全身ポーズ', minValue = 0, maxValue = upperLimit - 1, value = 0, adj = 3, columnWidth3 = [100,50,200], width = 525, dragCommand = setPose) pm.rowLayout( 'row3', nc = 2, parent = 'columnLayout01', width = 590, height = 50) pm.columnLayout( 'col_1', width = 100, parent = 'row3')#spacer pm.columnLayout( 'col_2', width = 390, parent = 'row3') resetButton = pm.button( 'resetButton', label = u'T ポーズに', width = 390, height = 20, backgroundColor = ( 0.6, 0.6, 0.6), parent = 'col_2', command = resetChar ) pm.rowLayout( 'row4', nc = 2, parent = 'columnLayout01', width = 590, height = 50) pm.columnLayout( 'col_3', width = 100, parent = 'row4')#spacer pm.columnLayout( 'col_4', width = 390, parent = 'row4') resetButton_ctrlRig = pm.button( 'ctrlRigReset', label = u'Control Rig T pose', width = 390, height = 20, backgroundColor = ( 0.6, 0.6, 0.6), parent = 'col_4', command = resetCharTPose ) ''' pm.showWindow() pm.window(windowID, edit=True, widthHeight=(600, 100))
def buildMainUI(self): """create main UI""" # window creation windowName = 'SkinSaveLoad' title = 'Skin Save and Load' if (pmc.window(windowName, exists=True)): pmc.deleteUI(windowName) self.mainUI['window'] = pmc.window(windowName, title=title, width=self.mainSize[0], height=self.mainSize[1], resizeToFitChildren=False, sizeable=False, retain=True ) self.mainUI['layMain'] = pmc.columnLayout( width=self.mainSize[0], height=self.mainSize[1] ) self.mainUI['layInfo'] = pmc.columnLayout( width=self.mainSize[0], height=20, enableBackground=True, backgroundColor=[0.1,0.1,0.1] ) self.mainUI['txtInfo'] = pmc.text( label='Save And Copy Skin Cluster Data', align='center', width=self.mainSize[0], height=20 ) pmc.setParent( '..' ) pmc.separator( height=10, style='none' ) self.mainUI['layChoice'] = pmc.rowLayout( numberOfColumns=2, columnWidth2=(25, (self.mainSize[0])-25), height=30 ) self.mainUI['btnChoice'] = pmc.button( label='>', annotation='Select an empty Group', width=20 ) self.mainUI['txtChoice'] = pmc.textField( text='SWC_saveLoad_grp', editable=False, width=(self.mainSize[0])-40 ) pmc.setParent( '..' ) self.mainUI['layTop'] = pmc.rowLayout( numberOfColumns=2, columnWidth2=(self.mainSize[0]/2-2, self.mainSize[0]/2-2), height=40 ) self.mainUI['btnSave'] = pmc.button( label='Save', annotation='Save SkinCluster Weight on object selected', width=self.mainSize[0]/2-3 ) self.mainUI['btnLoad'] = pmc.button( label='Load', annotation='Load SkinCluster Weight on object selected', width=self.mainSize[0]/2-3 ) pmc.setParent( '..' ) pmc.rowLayout( numberOfColumns=2, columnWidth2=(self.mainSize[0]/2-5, self.mainSize[0]/2-5), annotation='Delete previous skin cluster if founded', height=20 ) pmc.text( label='', align='center', width=self.nameSize[0]/2 ) self.mainUI['chbSkin'] = pmc.checkBox( label='Del Skin', value=True, width=self.mainSize[0]/2-5 ) pmc.setParent( '..' ) pmc.separator( height=10, style='none' ) self.mainUI['layBtm'] = pmc.frameLayout( label='SWC Tools', borderVisible=True, collapsable=True, collapse=False, width=self.mainSize[0], marginWidth=10 ) pmc.separator( height=5, style='none' ) self.mainUI['btnChange'] = pmc.button( label='Change SWC name ...', annotation='To properly rename a SWC object', width=self.mainSize[0]-20 ) self.mainUI['btnBone'] = pmc.button( label='Assign bones influences ...', annotation='To re attribut the influence of bones into others', width=self.mainSize[0]-20 ) pmc.separator( height=5, style='none' ) pmc.setParent( '..' ) # add command self.mainUI['btnChoice'].setCommand(pmc.Callback( self.__selectGrp__ )) self.mainUI['btnSave'].setCommand(pmc.Callback( self.__callSWCSave__ )) self.mainUI['btnLoad'].setCommand(pmc.Callback( self.__callSWCLoad__ )) self.mainUI['btnChange'].setCommand(pmc.Callback( self.changeNameUI )) self.mainUI['btnBone'].setCommand(pmc.Callback( self.assignBonesUI )) # show window self.mainUI['window'].show()
def _build_tool_setup_frame(parent_layout): controllers_frame = pm.frameLayout(label="Tool Setup", collapsable=True) controllers_column = pm.columnLayout(adj=True, columnAttach=('both', 5)) pm.separator(height=5, style='none') pm.rowLayout(numberOfColumns=3, adjustableColumn=1, columnAttach=(1, 'left', 0), columnWidth=[(1, 90), (2, 60), (3, 60)], height=20) pm.text('Tool controller:', align='left') pm.button(label='Attach', width=58, height=20, command=mimic_utils.attach_tool_controller, annotation='Attaches selected tool controller to the ' \ 'selected robot') pm.button(label='Detach', width=58, height=20, command=mimic_utils.detach_tool_controller, annotation='Detaches tool controller from robot') pm.setParent('..') pm.separator(height=3, style='none') pm.rowLayout(numberOfColumns=3, adjustableColumn=1, columnAttach=(1, 'left', 0), columnWidth=[(1, 90), (2, 60), (3, 60)], height=20) pm.text('Tool model:', align='left') pm.button(label='Attach', width=58, height=20, command=mimic_utils.attach_tool_model, annotation='Attaches selected tool model to the ' \ 'selected robot') pm.button(label='Detach', width=58, height=20, command=mimic_utils.detach_tool_model, annotation='Detaches selected tool model from its ' \ 'parent robot') pm.setParent('..') pm.separator(height=8, style='none') pm.setParent(parent_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." ) 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_createButtonTextFieldRowLayout(self): return pm.rowLayout( numberOfColumns=2, adjustableColumn=2, columnWidth=(1, BUTTON_WIDTH), columnAttach=(1, 'both', 2) )
def ParaUI(self): # setting basic UI height and width winWidth = 500 winHeight = 100 # checking for duplicate windows windowID = 'ParaScale' if pm.window(windowID, exists=True): pm.deleteUI(windowID) # re-adjusting UI if UI is not correct try: if pm.windowPref(windowID, q=True, height=True) != winHeight or pm.windowPref( windowID, q=True, width=True) != winWidth: pm.windowPref(windowID, remove=True) except: pass pm.window(windowID, title=u'Parallel scale | Ver 2018 / 06 / 22', widthHeight=(winWidth, winHeight)) masterFrame = pm.frameLayout(label=u'PARALLEL Scaling', labelIndent=5, marginHeight=5, nch=5) row1 = pm.rowLayout('row1', nc=5, width=600, parent=masterFrame) pm.text(label=u'キャラ名:', width=80, align='right') self.charalist = pm.optionMenu('listofchara', parent=row1) for i in self.nameList: pm.menuItem(label=i, parent=self.charalist) pm.text('', width=10, parent=row1) pm.button(label=u'スケール', parent=row1, command=self.scaleChara) pm.showWindow()
def test_nested(self): with ui.ColumnLayout() as cl: self.assertEqual(pm.currentParent(), cl) with pm.rowLayout() as rl: self.assertEqual(pm.currentParent(), rl) self.assertEqual(pm.currentParent(), cl) self.assertEqual(pm.currentParent(), self.win)
def __init__(self): version = "1.0" if pm.window('ms_copyAnimWin', exists=True): pm.deleteUI('ms_copyAnimWin', window=True) self.window = pm.window( 'ms_copyAnimWin', title="Copy Animation v%s" % version, iconName='ms_copyAnimWin') #, widthHeight=(200,100) ) with pm.columnLayout(adj=1): self.mainLO = pm.columnLayout(adjustableColumn=True) removeList = ['shared', 'UI'] self.namespaces = pm.namespaceInfo(lon=1) for each in removeList: self.namespaces.remove(each) with pm.rowLayout(nc=2): self.srcFld = pm.optionMenu(label='Source Namespace') for each in self.namespaces: pm.menuItem(label=each) self.tgtFld = pm.optionMenu(label='Target Namespace') for each in self.namespaces: pm.menuItem(label=each) pm.button(l='Copy animation', c=self.copyAnim) pm.showWindow(self.window)
def buildUI(self): pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) self.passesParent = pm.setParent(query=True) frameLayout = None with pm.frameLayout(label="Passes", collapsable=False, parent=self.parent) as frameLayout: with pm.columnLayout(adj=True): with pm.rowLayout(adj=True, nc=2, cw=((1, 200), (2, 200)), h=350): with pm.frameLayout(label="Existing Passes", collapsable=False, h=350): self.availableAOVsListUI = pm.textScrollList( doubleClickCommand=self.AOVdoubleClicked) pm.textScrollList(self.availableAOVsListUI, edit=True, append=self.getAOVs()) with pm.frameLayout(label="Active Passes", collapsable=False, h=350): self.activeAOVsListUI = pm.textScrollList( selectCommand=self.exsistingAOVclicked, doubleClickCommand=self.exsistingAOVdoubleClicked) self.updateExistingAOVList() pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.scriptJob(event=("NameChanged", self.nameChangedCallback), parent=frameLayout)
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 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 _add_header_image(self, parent_layout): """ """ # Creat rowLayout to hold out header image. This is done to get the proper #logo alignment and response to window size adjustments pm.rowLayout(height=50, backgroundColor=[0.2, 0.2, 0.2], numberOfColumns=2, adjustableColumn=1, columnAlign=(2, 'right'), columnAttach=[(2, 'right', 5)], rowAttach=[(2, 'top', 15)]) pm.text('') pm.image(image=self.__LOGO_NAME) pm.setParent(parent_layout)
def attrBoolControlGrp(*args, **kwargs): attribute = kwargs.pop('attribute', kwargs.pop('a', None)) assert attribute is not None, "You must passed an attribute" changeCommand = kwargs.pop('changeCommand', kwargs.pop('cc', None)) if changeCommand: def cc(newVal): pm.setAttr(attribute, newVal) changeCommand(newVal) else: cc = lambda newVal: pm.setAttr(attribute, newVal) if kwargs.pop('edit', kwargs.pop('e', False)): ctrl = args[0] pm.checkBox(ctrl, edit=True, value=pm.getAttr(attribute), changeCommand=cc) pm.scriptJob(parent=ctrl, replacePrevious=True, attributeChange=[ attribute, lambda: pm.checkBox( ctrl, edit=True, value=pm.getAttr(attribute)) ]) elif kwargs.pop('query', kwargs.pop('q', False)): # query pass else: # create labelText = kwargs.pop('label', None) if not labelText: labelText = pm.mel.interToUI(attribute.split('.')[-1]) ctrl = args[0] pm.rowLayout(numberOfColumns=1, columnWidth1=285, columnAttach1='right') pm.checkBox(ctrl, label=labelText, value=pm.getAttr(attribute), changeCommand=cc) pm.setParent('..') pm.scriptJob(parent=ctrl, attributeChange=[ attribute, lambda: pm.checkBox( ctrl, edit=True, value=pm.getAttr(attribute)) ]) return ctrl
def gui(): global windowPersistence, shapeWindow global snapToLocale, curveName global suffixEnable, suffixLabel, suffixName shapeWindow = pm.window(title='Shape Window') pm.columnLayout() button_width = 100 pm.rowColumnLayout(nc=4) pm.button(label='Create Circle', width=button_width, command=pm.Callback(makeShape, 'circle')) pm.button(label='Create Square', width=button_width, command=pm.Callback(makeShape, 'square')) pm.button(label='Create Cube', width=button_width, command=pm.Callback(makeShape, 'cube')) pm.button(label='Create 2D Arrow', width=button_width, command=pm.Callback(makeShape, 'arrow2d')) pm.button(label='Create 3D Arrow', width=button_width, command=pm.Callback(makeShape, 'arrow3d')) pm.button(label='Create COG Circle', width=button_width, command=pm.Callback(makeShape, 'cog')) pm.button(label='Create Compass', width=button_width, command=pm.Callback(makeShape, 'compass')) pm.setParent('..') pm.text(label='Enter a name. Leave blank for default.') curveName = pm.textField(placeholderText='shape') suffixEnable = pm.checkBox(label='Insert suffix on creation?', value=True, changeCommand=toggleSuffix) pm.rowLayout(nc=2) suffixLabel = pm.text(label='Suffix for curve after creation:', enable=True) suffixName = pm.textField(text='_icon', enable=True) pm.setParent('..') windowPersistence = pm.checkBox(label='Window Closes Automatically', value=isNotPersistent, changeCommand=togglePersistence) snapToLocale = pm.checkBox(label='Place at origin', value=sendToOrigin, changeCommand=togglePlacement) pm.showWindow(shapeWindow)