def create( layout ) : container = pm.verticalLayout( p=layout ) top_layout = pm.columnLayout( p=container, adj=True ) # top_layout = pm.verticalLayout( bgc=(1,0,0), p=container ) bottom_layout = pm.scrollLayout( p=container, cr=True ) bottom_horiz = pm.horizontalLayout( p=bottom_layout ) left = pm.frameLayout( label='Old Name', mh=4, mw=4, p=bottom_horiz ) right = pm.frameLayout( label='New Name', mh=4, mw=4, p=bottom_horiz ) list_left = pm.columnLayout( 'th_rename_preview_left', p=left, rs=4 ) list_right = pm.columnLayout( 'th_rename_preview_right', p=right, rs=4 ) bottom_horiz.redistribute() # regex rename_frame = pm.frameLayout( label='Regex', mh=4, mw=4, p=top_layout ) rename_layout = pm.columnLayout( p=rename_frame, adj=True, rs=4 ) rename_search = pm.textField( 'th_rename_search', pht='Search', p=rename_layout, cc=lambda *args : __update_rename_preview() ) rename_replace = pm.textField( 'th_rename_replace', pht='Replace', p=rename_layout, cc=lambda *args : __update_rename_preview() ) rename_prefix = pm.textField( 'th_rename_prefix', pht='Prefix', p=rename_layout, cc=lambda *args : __update_rename_preview() ) rename_suffix = pm.textField( 'th_rename_suffix', pht='Suffix', p=rename_layout, cc=lambda *args : __update_rename_preview() ) renumber_layout = pm.rowLayout( p=rename_layout, nc=2, adj=True ) rename_from = pm.textField( 'th_rename_from', pht='Renumber From', p=renumber_layout, cc=lambda *args : __update_rename_preview() ) rename_by = pm.textField( 'th_rename_by', pht='Renumber By', p=renumber_layout, cc=lambda *args : __update_rename_preview() ) pm.button( label='Rename', p=rename_layout, c=lambda *args : __rename_from_ui() ) # setup a script job to update preview grids pm.scriptJob( p=container, e=( 'SelectionChanged', lambda *args : __populate_preview_grids( list_left, list_right ) ) ) __populate_preview_grids( list_left, list_right ) container.redistribute( 1, 3 )
def create(layout): container = pm.verticalLayout(p=layout) top_layout = pm.columnLayout(p=container, adj=True) # top_layout = pm.verticalLayout( bgc=(1,0,0), p=container ) bottom_layout = pm.scrollLayout(p=container, cr=True) bottom_horiz = pm.horizontalLayout(p=bottom_layout) left = pm.frameLayout(label='Old Name', mh=4, mw=4, p=bottom_horiz) right = pm.frameLayout(label='New Name', mh=4, mw=4, p=bottom_horiz) list_left = pm.columnLayout('th_rename_preview_left', p=left, rs=4) list_right = pm.columnLayout('th_rename_preview_right', p=right, rs=4) bottom_horiz.redistribute() # regex rename_frame = pm.frameLayout(label='Regex', mh=4, mw=4, p=top_layout) rename_layout = pm.columnLayout(p=rename_frame, adj=True, rs=4) rename_search = pm.textField('th_rename_search', pht='Search', p=rename_layout, cc=lambda *args: __update_rename_preview()) rename_replace = pm.textField('th_rename_replace', pht='Replace', p=rename_layout, cc=lambda *args: __update_rename_preview()) rename_prefix = pm.textField('th_rename_prefix', pht='Prefix', p=rename_layout, cc=lambda *args: __update_rename_preview()) rename_suffix = pm.textField('th_rename_suffix', pht='Suffix', p=rename_layout, cc=lambda *args: __update_rename_preview()) renumber_layout = pm.rowLayout(p=rename_layout, nc=2, adj=True) rename_from = pm.textField('th_rename_from', pht='Renumber From', p=renumber_layout, cc=lambda *args: __update_rename_preview()) rename_by = pm.textField('th_rename_by', pht='Renumber By', p=renumber_layout, cc=lambda *args: __update_rename_preview()) pm.button(label='Rename', p=rename_layout, c=lambda *args: __rename_from_ui()) # setup a script job to update preview grids pm.scriptJob( p=container, e=('SelectionChanged', lambda *args: __populate_preview_grids(list_left, list_right))) __populate_preview_grids(list_left, list_right) container.redistribute(1, 3)
def ckFidgetWin(): """ ckFidgetWin() description: creates interface for ckFidget tool. the list is built dynamically from the list of active fidgets on load, so the more fidgets you add. the longer the tool window will become. inputs: outputs: the main fidget window. CK - I should add some menus to this that have basic falloffs for common tasks, like cloth, sss, or lighting. """ if pm.mel.eval('window -ex "fidgetMainWin" ;'): pm.mel.eval('deleteUI "fidgetMainWin";' ) fidgetWin = pm.mel.eval('window -title "Carl Keifer attribute fidgeter" -width 150 fidgetMainWin;') pm.columnLayout( adjustableColumn=True ) pm.frameLayout( label = "Build Fidget", borderStyle='in', collapsable=True ) pm.rowLayout( numberOfColumns=5, columnWidth=(75,75) ) pm.button( label = 'Add Fidget', command = 'ckAddFidget()' ) pm.button( label = 'refresh UI', command = 'ckFidget()' ) pm.button( label = 'Save All', command = 'ckSavRstZerAll( "save" )') pm.button( label = 'Zero All', command = 'ckSavRstZerAll( "zero" )') pm.button( label = 'Restore All', command = 'ckSavRstZerAll( "restore" )') pm.setParent( '..' ) pm.setParent( '..' ) pm.frameLayout( label = "Master Fidget", borderStyle='in', collapsable=True ) pm.rowLayout( numberOfColumns=6, columnWidth=(75,75) ) pm.mel.eval( 'floatField -value $gckFidgetBump -min 0 -changeCommand "$gckFidgetBump = `floatField -q -v masterBump`" masterBump;' ) pm.button( label = '<', command = 'ckFidgetBumpAll("Down")') pm.button( label = '>', command = 'ckFidgetBumpAll("Up")') pm.radioButtonGrp( label='Bump by:', labelArray2=['0.0', '%'], numberOfRadioButtons=2, sl=1, on1= 'pm.setAttr("ckFidget_GRP.bumpBy", False)', on2= 'pm.setAttr("ckFidget_GRP.bumpBy", True)') pm.setParent( '..' ) pm.setParent( '..' ) pm.frameLayout( label = "Fidget Attributes", borderStyle='in', collapsable=True ) e = 0 # this iterates the list of fidgets we have ckList = ckGetList("ckFidget_GRP.ckFidgetList") for i in ckList: print "i, ",i pm.rowLayout( numberOfColumns=6, columnWidth=(75,75) ) pm.attrFieldSliderGrp( l=str(i), min=-10.0, max=10.0, at = i ) pm.button( label = '<', command = 'ckFidgetBump(\"'+i+'\", "Down")' ) pm.button( label = '>', command = 'ckFidgetBump( \"'+i+'\","Up")' ) pm.button( label = 'save', command = 'ckSavRst( \"'+i+'\", "save")') pm.button( label = 'zero', command = 'pm.setAttr( \"'+i+'\", 0)' ) pm.button( label = 'restore', command = 'ckSavRst( \"'+i+'\", "restore")') pm.setParent( '..' ) pm.setParent( '..' ) pm.setParent( '..' ) pm.showWindow(fidgetWin) # I should now connect the master fidget value to the fidget group
def manage_shape_ui(self): WINDOW = "add_control" chk_win = pm.window(WINDOW, query=True, exists=True) if chk_win: pm.deleteUI(WINDOW) pm.window(WINDOW, title="Manage_Shapes", iconName="MS") main_col = pm.columnLayout(parent=WINDOW, adjustableColumn=True) main_split_col = pm.rowColumnLayout(parent=main_col, numberOfColumns=2, columnOffset=(2, "left", 5)) cmd_col = pm.columnLayout(parent=main_split_col) pm.separator(parent=main_col, height=10) mel_cmd_col = pm.columnLayout(parent=cmd_col, columnOffset=("left", 10)) pm.text("\t\t\t\tShape Name", parent=mel_cmd_col) nm_txt = pm.textField(text="", parent=mel_cmd_col, width=300) pm.text("\t\t\t\tShape mel command", parent=mel_cmd_col) txt = pm.scrollField("", wordWrap=True, parent=mel_cmd_col, height=130, width=300) pm.separator(parent=main_col, height=10) add_btn_col = pm.columnLayout(parent=cmd_col, columnOffset=("left", 100)) pm.button("add", parent=add_btn_col, width=100, command=lambda x: self.add_ctr(cmd=txt.getText(), nm=nm_txt.getText())) list_col = pm.columnLayout(parent=main_split_col) pm.text("\t\tExisting Shapes", parent=list_col) self.shp_lst_bx = pm.textScrollList(parent=list_col, height=165, width=170) edit_btn_col = pm.rowColumnLayout(numberOfColumns=3, parent=list_col) pm.button("Delete", parent=edit_btn_col, width=82, command=lambda x: self.delete_selection()) pm.separator(parent=edit_btn_col, horizontal=False) pm.button("rename", parent=edit_btn_col, width=82, command=lambda x: self.rename_ui()) pm.showWindow(WINDOW) pm.window(WINDOW, edit=True, widthHeight=(500, 220)) return None
def createNew(self, floating=False): if self.mmmm == None: self.mmmm = MmmmToolsMod.Dynamic.GetInstance() mmmm = self.mmmm self.widgets = {} self.subs = {} ## Create Main Widgets win = self.widgets["win"] = pm.window() ## scroll = self.widgets["scroll"] = pm.scrollLayout(parent=win, horizontalScrollBarThickness=0) ## The dock must be created after the window's layout dock = self.widgets["dock"] = pm.dockControl( "MmmmTools Dock", floating=floating, area="left", content=win, allowedArea=["right", "left"] ) col = self.widgets["col"] = pm.columnLayout(parent=scroll) # self.mainFrame = MmmmMainDockableWindowSub( ) # self.mainFrame # self.mainFrame = # self.makeMainFrame( parentLayout=col ) modellerFrame = pm.frameLayout(label="Modeler", collapsable=True, parent=col, marginWidth=10) modellerCol = pm.columnLayout(parent=modellerFrame) f0 = pm.frameLayout(label="Modeler Actions", marginWidth=10, collapsable=True, parent=modellerCol) commander = self.mmmm.commander cmdEntries = commander.entries prefix = "Modeler/" for name, entry in cmdEntries.items(): if name.startswith(prefix): uiLabel = entry.get("uiLabel") if uiLabel == None: ## Trim modeler from name uiLabel = name[len(prefix) :] pm.button(label=uiLabel, parent=f0, command=commander.commandsMelNames[name]) f1 = pm.frameLayout(label="Grid Tools", marginWidth=10, collapsable=True, parent=modellerCol) mmmm.modeler.runGridTools(makeUi=True, parentWidget=f1) f2 = pm.frameLayout(label="Retopo Tools", marginWidth=10, collapsable=True, parent=modellerCol) mmmm.modeler.runRetoper(makeUi=True, parentWidget=f2) f3 = pm.frameLayout(label="Mirror Tools", marginWidth=10, collapsable=True, parent=modellerCol) mmmm.modeler.runMirrorer(makeUi=True, parentWidget=f3) pm.windowPref(win, width=500, height=500) win.setWidth(500) win.setHeight(800)
def __init__(self, parentRef, selection=False, multiplier=1.0): self.parentRef = parentRef self.buttons = [] self.window = pm.window(sizeable=False, title="Light Multiplier", titleBar=True) with self.window: self.layout = pm.columnLayout() with self.layout: ## Using Ui on the end of Widget names self.multiplierText = pm.text(label='Multiplier:', align='left') self.multiplierUi = pm.floatField(value=1.0) self.checkBoxUi = pm.checkBox( label='Affect Selected Lights Only') self.okUi = pm.button( label='Apply', parent=self.layout, command=lambda xc: self.parentRef.applyMultiplier( multiplier=self.multiplierUi.getValue(), selection=self.checkBoxUi.getValue(), ), width=300) pm.showWindow(self.window) self.window.setWidth(600) self.window.setHeight(400)
def run(self): self.win = pm.window( title="Mmmm Baker Tool" ) with self.win: self.col = pm.columnLayout() with self.col: self.spacers = [] self.xnormalPathTextLabel = pm.text("Path and filename of xNormal executable:") self.xnormalPathTextField = pm.textField( width = 500, text="C:/Program Files/S.Orgaz/xNormal 3.19.2/x64/xNormal.exe" ) self.spacers.append( pm.text(" ") ) self.modelsPathTextLabel = pm.text("Path where models are:") self.modelsPathTextField = pm.textField( width = 500, text="C:/Users/Public/mmmmBaker" ) self.modelsPathTextLabel2 = pm.text( "(Warning, if changed, requires custom xnormal settings xml which points to new path.)" ) self.spacers.append( pm.text(" ") ) self.highSuffixTextLabel = pm.text( 'High Suffix, on models for xnormals "high" model files, no extension' ) self.highSuffixTextField = pm.textField( width = 500, text="_hi" ) self.spacers.append( pm.text(" ") ) #self.highSuffixTextLabel = pm.text( "Suffix on files: (not extension)" ) #self.cageSuffixTextField = pm.textField( width = 500, text="_cage" ) self.xmlFilesTextLabel = pm.text( "Xml files to bake, comma separated list:" ) self.xmlFilesTextLabel2 = pm.text( "(xnormal settings files, should be in the same folder as models)" ) self.xmlFilesTextField = pm.textField( width = 500, text="xnormal_settings_for_mmmmbaker_example.xml,xnormal_settings_for_mmmmbaker_example2.xml" ) self.goButton = pm.button( label="Go! (Bake selected models) )", command=lambda x: self.go() )
def initUi(self): win = self.win = pm.window("Mmmm Mel To Python Converter") with win: col = self.col = pm.columnLayout(adjustableColumn=True) with col: labelMel = self.labelMel = pm.text("Mel:") tf01 = self.tf01 = pm.scrollField( wordWrap=True ) btnRunMel = self.btnRunMel = pm.button("Run Mel", command= lambda x: pm.mel.eval( self.tf01.getText() ) ) labelSpacer01 = self.labelSpacer01 = pm.text("\n") labelPython = self.labelPython = pm.text("Python:") tf02 = self.tf02 = pm.scrollField( editable=False, wordWrap=True ) btnRunPython = self.btnRunMel = pm.button("Run Python", command= lambda x: self.execPython( codeStr=self.tf02.getText() ) ) labelSpacer02 = self.labelSpacer02 = pm.text("\n") btnConvert = self.btnConvert = pm.button("Convert Mel To Python", command= lambda x: self.tf02.setText( self.convertFunc( self.tf01.getText() ) ) )
def insert_joints_UI(): WINDOW = 'InsertJoints' if pm.window(WINDOW, query=True, exists=True): pm.deleteUI(WINDOW) pm.window(WINDOW, title="Insert Joints", iconName='CS', widthHeight=(200, 70)) main_col = pm.columnLayout(adjustableColumn=True) pm.separator(height=5, style='none', parent=main_col) textip_col = pm.rowColumnLayout(numberOfColumns=2, parent=main_col, columnOffset=(1, "left", 5), columnSpacing=(2, 5)) pm.separator(height=5, style='none', parent=main_col) butn_col = pm.rowColumnLayout(numberOfColumns=3, parent=main_col, columnOffset=(2, "left", 65)) pm.text(label="number of joints", parent=textip_col) textip = pm.textField(text="", parent=textip_col) pm.text(label="", parent=butn_col) pm.button(label="Create", parent=butn_col, command=lambda x: call_fun(textip.getText())) pm.showWindow(WINDOW) pm.window(WINDOW, edit=True, widthHeight=(200, 70)) return None
def __init__(self, parentRef): self.parentRef = parentRef self.buttons = [] self.window = pm.window( sizeable = False, title = "Selector", titleBar=True) with self.window: self.layout = pm.columnLayout() with self.layout: self.labFace = pm.text( label='A Useful Tool For Making Selections.', align='left',parent = self.layout ) self.labFace = pm.text( label='Currently this tool only selects non quad faces.', align='left',parent = self.layout ) self.labFace3 = pm.text( label='More features will be added to this tool in the future.', align='left',parent = self.layout ) self.labFace4Blank = pm.text( label=' ', align='left',parent = self.layout ) self.labFace4Blank = pm.text( label=' ', align='left',parent = self.layout ) btn__find_non_quad_faces = pm.button ( label = 'Find-Quad Face Faces',parent = self.layout, command = lambda xc: self.parentRef.highlightNonQuads(),width = 300 ) self.buttons.append( btn__find_non_quad_faces ) self.labTriResult = pm.text( label='Number of Triangles Found:', align='left', parent = self.layout ) self.triFace = pm.intField(parent = self.layout, width = 40,value=0) self.labngonResult = pm.text( label='Number of n-Gons Found:', align='left', parent = self.layout ) self.ngonFace = pm.intField(parent = self.layout, width = 40,value=0) # Set the values? self.buttons.append( btn__find_non_quad_faces ) #pm.formLayout( form, edit=True,attachForm=[(self.labVtx,'top',10),(self.labVtx,'left',5),(self.layoutGrid,'top',30),(self.layoutGrid,'left',5),(self.labFace,'top',200),(self.labFace,'left',5),(btn_Face,'top',220),(btn_Face,'left',5),(self.labTriResult,'top',255),(self.labTriResult,'left',5),(self.triFace,'top',250),(self.triFace,'left',160),(self.ngonFace,'top',270),(self.ngonFace,'left',160),(self.labngonResult,'top',275),(self.labngonResult,'left',5)]) # Show Window pm.showWindow(self.window) self.window.setWidth(600) self.window.setHeight(400)
def initUi(self): win = self.win = pm.window("Mmmm Mel To Python Converter") with win: col = self.col = pm.columnLayout(adjustableColumn=True) with col: labelMel = self.labelMel = pm.text("Mel:") tf01 = self.tf01 = pm.scrollField(wordWrap=True) btnRunMel = self.btnRunMel = pm.button( "Run Mel", command=lambda x: pm.mel.eval(self.tf01.getText())) labelSpacer01 = self.labelSpacer01 = pm.text("\n") labelPython = self.labelPython = pm.text("Python:") tf02 = self.tf02 = pm.scrollField(editable=False, wordWrap=True) btnRunPython = self.btnRunMel = pm.button( "Run Python", command=lambda x: self.execPython(codeStr=self.tf02. getText())) labelSpacer02 = self.labelSpacer02 = pm.text("\n") btnConvert = self.btnConvert = pm.button( "Convert Mel To Python", command=lambda x: self.tf02.setText( self.convertFunc(self.tf01.getText()))) win.show()
def __init__(self, parent): self.parent = parent self.win = pm.window('Attribute Setter', resizeToFitChildren=True) with self.win: self.col = pm.columnLayout() with self.col: self.helpButton = pm.button( label="Show Help", command=lambda x: self.showHelp(), ) ## Text label that says "Attribute to change:" self.attributeLabel = pm.text( 'Attribute to change:' ) ## Text entry field, a place where the user will type in the attribute to change self.attributeField = pm.textField( width=600 ) ## Text label that says "New value for attribute:" self.valueLabel = pm.text( 'New value for attribute:' ) ## Text entry field, a place where the user will type the new value to set the attribute to self.valueField = pm.textField( width=600 ) self.go = pm.button( label="Set Attributes", command=lambda x: self.parent.setAttributes( attribute=self.attributeField.getText(), value=self.valueField.getText(), ) )
def showHelp(self): helpWindow = pm.window('Attribute Setter Help', resizeToFitChildren=True) with helpWindow: helpCol = pm.columnLayout() with helpCol: helpText = pm.text( helpString ) helpWindow.show()
def go(self): with self.win: self.col = pm.columnLayout() self.sourceText = pm.text("Attribute source") self.sourceField = pm.textField(width=300) self.text7 = pm.text(" ") self.targetText = pm.text("Attribute target") ## text that says attribute ## place to enter text for which attribute self.targetField = pm.textField(width=300) self.text5 = pm.text(" ") self.text6 = pm.text( "Multiplier (Only has affects resut if it is changed from the default 0.0 to another number.)" ) self.multField = pm.floatField(width=300) self.button = pm.button( "Connect the attribute of the source to all the targets \n (source is first selected)", command=lambda x: self.parent.connectAttributes( sourceAttrName=self.sourceField.getText(), targetAttrName=self.targetField.getText(), multiplier=self.multField.getValue(), ), ) ## text that says value ## place to enter the new value self.win.show()
def __init__(self, parentRef): self.parentRef = parentRef self.win = pm.window(title="Joint Orientation", width=250, height=180) self.col = pm.columnLayout() self.row1 = pm.rowColumnLayout(width=200, numberOfColumns=2) self.rotateXText = pm.text(label="X rotate:", parent=self.row1) self.rotateXField = pm.intField(parent=self.row1) self.rotateYText = pm.text(label="Y rotate:", parent=self.row1) self.rotateYField = pm.intField(parent=self.row1) self.rotateZText = pm.text(label="Z rotate:", parent=self.row1) self.rotateZField = pm.intField(parent=self.row1) self.button = pm.button( label="Rotate Joints", width=200, command=lambda x: parentRef.rotateJoint( self.rotateXField.getValue(), self.rotateYField.getValue(), self.rotateZField.getValue()), parent=self.col) self.button = pm.button(label="Rotate Joints Relative", width=200, command=lambda x: parentRef.rotateJoint( self.rotateXField.getValue(), self.rotateYField.getValue(), self.rotateZField.getValue(), rotateRelative=True), parent=self.col) self.win.show() self.win.setWidth(260) self.win.setHeight(210)
def go(self): with self.win: self.col = pm.columnLayout() self.sourceText = pm.text("Attribute source") self.sourceField = pm.textField(width=300) self.text7 = pm.text(" ") self.targetText = pm.text("Attribute target") ## text that says attribute ## place to enter text for which attribute self.targetField = pm.textField(width=300) self.text5 = pm.text(" ") self.text6 = pm.text( "Multiplier (Only has affects resut if it is changed from the default 0.0 to another number.)" ) self.multField = pm.floatField(width=300) self.button = pm.button( "Connect the attribute of the source to all the targets \n (source is first selected)", command=lambda x: self.parent.connectAttributes( sourceAttrName=self.sourceField.getText(), targetAttrName=self.targetField.getText(), multiplier=self.multField.getValue())) ## text that says value ## place to enter the new value self.win.show()
def __init__(self, parentRef=None, mmmmToolsRef=None): self.mmmmTools = mmmmToolsRef self.parentRef = parentRef self.scriptFileRunner = MmmmScriptFileRunner( parentRef=self, mmmmToolsRef=self.mmmmTools) self.scriptFileRunner.findScripts() self.win = pm.window("Script File Runner") self.ddMenuEntires = [] with self.win: self.col = pm.columnLayout() with self.col: self.textPath = pm.text("Path to scripts:") self.textFieldPath = pm.textField( text=self.scriptFileRunner.searchPath, width=400, changeCommand=lambda x: self.onTextPathChangeCommand()) self.btnRefresh = pm.button("Refresh Scripts", command=lambda x: self.buildMenu()) self.text = pm.text("Script File To Run:") self.ddMenu = pm.optionMenu(changeCommand=self.onDdMenuChange) self.buildMenu() ## self.textFieldScript = pm.textField( width=500 ) self.btnRunScript = pm.button( "Run Script", command=lambda x: self.scriptFileRunner.runScript( self.chosenScript)) self.win.show()
def makeUi( self ): self.win = pm.window(title="Mr Clean") self.win.show() with self.win: self.col = pm.columnLayout() with self.col: self.win.setWidth( 400 ) self.win.setHeight( 200 ) self.precisionText = pm.text( "Precision:\n Accuracy of face check, higher is more precise \n" + "but will allow smaller errors.\n" + "It's like the opposite of merge distance tolerance." ) self.precision = pm.intField( ) self.precision.setValue( 2 ) self.toleranceText = pm.text( "Tolerance" ) self.tolerance = pm.floatField( ) self.tolerance.setValue( 0.01 ) self.button = pm.button( "Mostly Safe Cleanup", command = lambda x: self.mrClean.mostlySafeCleanup( self.precision.getValue(), self.tolerance.getValue() ) ) self.warningText = pm.text( "Beware, backup your model first,\n" + "since this tool might delete more of\n" + "your model than you want it to. This\n" + "tool often helps with *very* broken\n" + "models, but it can potentially make\n" + "changes even where there aren't problems\n" + " on a model." )
def __init__(self, parentRef): self.parentRef = parentRef self.buttons = [] self.window = pm.window(sizeable=False, title="Selector", titleBar=True) with self.window: self.layout = pm.columnLayout() with self.layout: self.labFace = pm.text( label='A Useful Tool For Making Selections.', align='left', parent=self.layout) self.labFace = pm.text( label='Currently this tool only selects non quad faces.', align='left', parent=self.layout) self.labFace3 = pm.text( label= 'More features will be added to this tool in the future.', align='left', parent=self.layout) self.labFace4Blank = pm.text(label=' ', align='left', parent=self.layout) self.labFace4Blank = pm.text(label=' ', align='left', parent=self.layout) btn__find_non_quad_faces = pm.button( label='Find-Quad Face Faces', parent=self.layout, command=lambda xc: self.parentRef.highlightNonQuads(), width=300) self.buttons.append(btn__find_non_quad_faces) self.labTriResult = pm.text(label='Number of Triangles Found:', align='left', parent=self.layout) self.triFace = pm.intField(parent=self.layout, width=40, value=0) self.labngonResult = pm.text(label='Number of n-Gons Found:', align='left', parent=self.layout) self.ngonFace = pm.intField(parent=self.layout, width=40, value=0) # Set the values? self.buttons.append(btn__find_non_quad_faces) #pm.formLayout( form, edit=True,attachForm=[(self.labVtx,'top',10),(self.labVtx,'left',5),(self.layoutGrid,'top',30),(self.layoutGrid,'left',5),(self.labFace,'top',200),(self.labFace,'left',5),(btn_Face,'top',220),(btn_Face,'left',5),(self.labTriResult,'top',255),(self.labTriResult,'left',5),(self.triFace,'top',250),(self.triFace,'left',160),(self.ngonFace,'top',270),(self.ngonFace,'left',160),(self.labngonResult,'top',275),(self.labngonResult,'left',5)]) # Show Window pm.showWindow(self.window) self.window.setWidth(600) self.window.setHeight(400)
def hs_tube(self, edgering=True): """ used for correcting normals on the ends of a hard surface pipe. if edgering = True, than only one edge need be selected and it will select the ring automatically. """ if edgering: mm.eval('SelectEdgeRingSp;') oSel = pm.ls(sl=True, flatten=True) for obj in oSel: # determine weather or not the selection is a face if str(obj.split('.')[-1][0]) == 'f': # if it is, convert it to edges mm.eval('ConvertSelectionToContainedEdges;') break eSel = pm.ls(sl=True, flatten=True) # another good ol' progress bar progWind = pm.window(title='progress') pm.columnLayout() progressControl = pm.progressBar(maxValue=len(eSel), width=300) pm.showWindow(progWind) # for the selected edges run the hs_verts function for edges in eSel: pm.select(edges) mm.eval('ConvertSelectionToFaces;') angled_faces = pm.ls(sl=True, flatten=True) self.hs_verts(angled_faces[0], angled_faces[1]) ee = eSel.index(edges) pm.progressBar(progressControl, edit=True, progress=ee) pm.deleteUI(progWind) pm.selectType(edge=True)
def __init__(self, parentRef): self.parentRef = parentRef self.buttons = [] self.window = pm.window(sizeable=False, title="Retoper", titleBar=True) with self.window: self.layout = pm.columnLayout() with self.layout: self.lab1 = pm.Text( label='A "Retop" Tool For Creating New Topology.', align='left', parent=self.layout) self.lab2 = pm.Text( label='Please Note: This tool does not preserve', width=300, align='left', parent=self.layout) self.lab3 = pm.Text( label='construction history of edited objects.', width=300, align='left', parent=self.layout) btn__setReference = pm.Button( label='Set Reference Mesh', parent=self.layout, command=lambda xc: self.parentRef.setReference(), width=300) self.buttons.append(btn__setReference) btn__makeReferenceLive = pm.Button( label='Make Reference Live', parent=self.layout, command=lambda xc: self.parentRef.makeReferenceLive(), width=300) self.buttons.append(btn__makeReferenceLive) btn__makeReferenceNotLive = pm.Button( label='Make Reference Not Live', parent=self.layout, command=lambda xc: self.parentRef.makeReferenceNotLive(), width=300) self.buttons.append(btn__makeReferenceNotLive) btn__projectSelection = pm.Button( label='Project Selection To Surface', parent=self.layout, command=lambda xc: self.parentRef.projectSelection(), width=300) self.buttons.append(btn__projectSelection) # Show Window pm.showWindow(self.window) self.window.setWidth(600) self.window.setHeight(400)
def dock(mainWindow): """ Show dockable window args mainWindow : QtGui.QMainWindow return None """ mainWindow.setObjectName('sampleWindowObject') DOCK_NAME = "dock_name" from pymel import all as pm if pm.dockControl(DOCK_NAME, q=True, ex=1): pm.deleteUI(DOCK_NAME) if pm.window('dummyWindow', q=True, ex=1): pm.deleteUI('dummyWindow') # Create dummy window object to keep the layout pm.window('dummyWindow') pm.columnLayout() floatingLayout = pm.paneLayout( configuration='single', w=300) pm.setParent('..') # Create new dock pm.dockControl( DOCK_NAME, aa=['right', 'left'], a='right', fl=False, con=floatingLayout, label="Sample Dock", w=300) # Parent QMainWindow object to the layout pm.control('sampleWindowObject', e=True, parent=floatingLayout)
def __init__(self, parentRef=None, parentWidget=None): self.parentRef = parentRef self.buttons = [] self.layoutsR = [] self.widgets = {} if parentWidget==None: parentWidget = self.widgets['parentWidget'] = pm.window( sizeable = True, title = "Mirrorer", titleBar=True, resizeToFitChildren=True, ) else: self.widgets['parentWidget'] = parentWidget with parentWidget: self.layoutC = pm.columnLayout( ) with self.layoutC: row = pm.rowLayout( numberOfColumns=3 ) self.layoutsR.append( row ) with row: self.makeStartShapeUi = pm.button ( label = 'Make Starting Shape', command = lambda xc: self.parentRef.makeStartShape(),width = 200 ) row = pm.rowLayout( numberOfColumns=3 ) self.layoutsR.append( row ) with row: self.deleteNegativeSideUi = pm.button ( label = 'Delete Negative Side', command = lambda xc: self.parentRef.deleteNegativeSide(),width = 200 ) row = pm.rowLayout( numberOfColumns=3 ) self.layoutsR.append( row ) with row: self.mirrorSelectionUi = pm.button ( label = 'Mirror As Instance', command = lambda xc: self.parentRef.mirrorSelection(),width = 200 ) row = pm.rowLayout( numberOfColumns=3 ) self.layoutsR.append( row ) with row: self.mirrorSelectionUi = pm.button ( label = 'Flatten to zero on X axis', command = lambda xc: self.parentRef.flattenToXZero(),width = 200 ) row = pm.rowLayout( numberOfColumns=3 ) self.layoutsR.append( row ) with row: self.mirrorSelectionUi = pm.button ( label = 'Mirror Geometry (Baked/Frozen)', command = lambda xc: self.parentRef.mirrorGeometry( ),width = 200 ) # Show Window if type( parentWidget ) == pm.core.windows.window: win = parentWidget pm.showWindow(win) win.setWidth(300) win.setHeight(200)
def main_rearrange_ui(self): WIN = "rearrange_nodes" if pm.window(WIN, query=True, exists=True): pm.deleteUI(WIN) pm.window(WIN, title="Rearrange Nodes", iconName="ReArNd") main_col = pm.columnLayout(parent=WIN, adjustableColumn=True) list_ord_col = pm.rowColumnLayout(parent=main_col, numberOfColumns=3) ord_col_ch = pm.columnLayout(parent=list_ord_col, adjustableColumn=True) pm.separator(parent=list_ord_col, horizontal=False, width=10) list_col_ch = pm.columnLayout(parent=list_ord_col, adjustableColumn=True) self.ord_lst = pm.textScrollList('deformers_reorder', numberOfRows=10, parent=ord_col_ch, height=235, width=150, allowMultiSelection=False, enable=False) pm.separator(style="none", height=20, parent=list_col_ch) self.nd_typ_txt = pm.textField(parent=list_col_ch, width=150) pm.separator(style="none", height=10, parent=list_col_ch) pm.button(label="Get Selected Node Type", parent=list_col_ch, command=lambda x: self.show_type()) pm.separator(style="in", height=50, parent=list_col_ch) pm.button(label="Rearrange", height=130, parent=list_col_ch, backgroundColor=(0.561, 0.737, 0.561), command=lambda x: self.reorder_deformer_nodes()) pm.button(label="Edit Order List", parent=ord_col_ch, command=lambda x: self.reorder_edit_ui()) pm.showWindow(WIN) pm.window(WIN, edit=True, widthHeight=(320, 260)) return None
def __init__(self): self.simpleScripter = SimpleScripter() self.win = pm.window("Simple Scripter") with self.win: self.col = pm.columnLayout() with self.col: self.text = pm.text("Mel Script code to repeat:") self.textFieldScript = pm.textField(width=500, text=mel_command) self.btnOneToMany = pm.button( "Run as One To Many", command=lambda x: self.simpleScripter.oneToMany( self.textFieldScript.getText()))
def __init__(self, parentRef): self.parentRef = parentRef self.buttons = [] self.window = pm.window(sizeable=False, title="Retoper", titleBar=True) with self.window: self.layout = pm.columnLayout() with self.layout: self.lab1 = pm.Text(label='A "Retop" Tool For Creating New Topology.', align="left", parent=self.layout) self.lab2 = pm.Text( label="Please Note: This tool does not preserve", width=300, align="left", parent=self.layout ) self.lab3 = pm.Text( label="construction history of edited objects.", width=300, align="left", parent=self.layout ) btn__setReference = pm.Button( label="Set Reference Mesh", parent=self.layout, command=lambda xc: self.parentRef.setReference(), width=300, ) self.buttons.append(btn__setReference) btn__makeReferenceLive = pm.Button( label="Make Reference Live", parent=self.layout, command=lambda xc: self.parentRef.makeReferenceLive(), width=300, ) self.buttons.append(btn__makeReferenceLive) btn__makeReferenceNotLive = pm.Button( label="Make Reference Not Live", parent=self.layout, command=lambda xc: self.parentRef.makeReferenceNotLive(), width=300, ) self.buttons.append(btn__makeReferenceNotLive) btn__projectSelection = pm.Button( label="Project Selection To Surface", parent=self.layout, command=lambda xc: self.parentRef.projectSelection(), width=300, ) self.buttons.append(btn__projectSelection) # Show Window pm.showWindow(self.window) self.window.setWidth(600) self.window.setHeight(400)
def dock(mainWindow): """ Show dockable window args mainWindow : QtWidgets.QMainWindow return None """ mainWindow.setObjectName('sampleWindowObject') DOCK_NAME = "dock_name" from pymel import all as pm if pm.dockControl(DOCK_NAME, q=True, ex=1): pm.deleteUI(DOCK_NAME) if pm.window('dummyWindow', q=True, ex=1): pm.deleteUI('dummyWindow') # Create dummy window object to keep the layout pm.window('dummyWindow') pm.columnLayout() floatingLayout = pm.paneLayout(configuration='single', w=300) pm.setParent('..') # Create new dock pm.dockControl(DOCK_NAME, aa=['right', 'left'], a='right', fl=False, con=floatingLayout, label="Sample Dock", w=300) # Parent QMainWindow object to the layout pm.control('sampleWindowObject', e=True, parent=floatingLayout)
Utils = UtilsMod.Utils class ScripterEditorUi(object): def __init__(self,mmmmToolsRef=None,makeUi=True): widthForAll = 900 self.mmmmTools = mmmmToolsRef self.attrName = 'notes' ##'mmmmScriptStringAttr' self.activeScriptText = '' self.scriptModule = None self.node = None self.codeString = '' self.activeScriptLabelStartText = "Actice Script being Edited is: " self.win = pm.window("Scripter - Editor", width=widthForAll) initialUuid = str( uuid.uuid4() ).replace('-','_') with self.win: self.col = pm.columnLayout( width=600 ) with self.col: self.notice = pm.text( '''NOTICE: Script Objects Use Object Notes attributes, which don't exist when blank. \n You may have to add to them manually if you can't use "get from selection".''') pm.text( " ") pm.text( "Script prefix: (it is recommended this be left as the default)" ) self.scriptPrefixTextField = pm.textField( text="script__", width=widthForAll, ) pm.text( "Script name: (it is recommended that you use a unique and descriptive name)" ) self.scriptNameTextField = pm.textField( text=initialUuid, width=widthForAll, ) self.scriptGetButton = pm.button( label="Make the script, or get the script if it already exists. (Works using the above fields, prefix and name.)", command=lambda x: self.getScriptContents(), width=widthForAll, ) self.getScriptFromSelectionButton = pm.button( label="Get Script From Selection / Make new script if no script on selection \n Autofills above fields when it find a script.", command=lambda x: self.getScriptFromSelection(), width=widthForAll, ) pm.text( " " ) pm.text( " " ) ## different spaces used to keep unique names self.activeScriptText = pm.text( self.activeScriptLabelStartText ) pm.text( "Script contents: (Editing here will immediately edit the corresponding mmmmScriptStringAttr attribute on the object.)" ) self.scriptContentsScrollField = pm.scrollField( keyPressCommand = lambda x: self.setScriptContents(), changeCommand = lambda x: self.setScriptContents(), width=widthForAll, height=500,
def __init__(self): self.simpleScripter = SimpleScripter() self.win = pm.window("Simple Scripter") with self.win: self.col = pm.columnLayout() with self.col: self.text = pm.text( "Mel Script code to repeat:" ) self.textFieldScript = pm.textField( width=500, text=mel_command ) self.btnOneToMany = pm.button( "Run as One To Many", command = lambda x: self.simpleScripter.oneToMany( self.textFieldScript.getText() ) )
def ui(self): WINDOW = "jointSequence" if pm.window(WINDOW, query=True, exists=True): pm.deleteUI(WINDOW) pm.window(WINDOW, title="Continue Joints along loops", iconName="JNTS") main_col = pm.columnLayout(adjustableColumn=True) guide_col = pm.columnLayout(parent=main_col) info_txt = "INFO:"+\ "\nFrom selected edges as starting point and"+\ "\ndirection guide, every next edge loop is"+\ "\nobtained till it reaches the end or the"+\ "\nstaring selection edge or the selected end point" guide_txt = "GUIDE:\nSelect 2 edges, each from adjacent loops"+\ "\nfirst edge is the starting point"+\ "\nsecond edge to guide the direction"+\ "\nif third edge is selected, acts as end point" pm.text(guide_txt, align="left", parent=guide_col) pm.separator(parent=guide_col, height=5, style="in") pm.text(info_txt, align="left", parent=guide_col) pm.separator(parent=main_col, height=10) text_col = pm.rowColumnLayout(parent=main_col, numberOfColumns=2, columnOffset=(2, "left", 25)) pm.text("number of loops to\nskip inbetween", parent=text_col) self.skip_val = pm.textField(text="0", parent=text_col, width=50) check_col = pm.rowColumnLayout(numberOfColumns=2, parent=main_col, columnOffset=(2, "left", 120)) pm.text("", parent=check_col) self.skn_chk = pm.checkBox("skin", parent=check_col) pm.separator(parent=main_col, style="none", height=5) pm.button("create", parent=main_col, command=lambda x: self.run()) pm.showWindow(WINDOW) pm.window(WINDOW, edit=True, widthHeight=(220, 230)) return None
class MmmmShellThickenUi(object): def __init__(self, autorun=True ): self.shellThicken = MmmmShellThicken( ) if autorun==True: self.createUi() def createUi(self): self.win = pm.window(title="Mmmm Shell Thicken") with self.win: self.col = pm.columnLayout() with self.col: self.thicknessLabel = pm.text( "Thickness: " ) self.thicknessFloatField = pm.floatField( value=1.0, precision=9, width=200 ) self.divisionsLabel = pm.text( "Divisions: " ) self.divisionsIntField = pm.intField( value=1, width=200 ) self.mergeLabel = pm.text( "Distance (tolerance) for verts merge:" )
def test_ui(self): test_win = "log" if pm.window(test_win, query=True, exists=True): pm.deleteUI(test_win) pm.window(test_win, title="Rearrange Deformers", iconName="ReArDf") log_col = pm.columnLayout(parent=test_win, adjustableColumn=True) self.log_txt = pm.scrollField('log_list', parent=log_col, height=235, width=150, wordWrap=True) #self.reord_lst.append(self.file_ord_list) pm.showWindow(test_win) pm.window(test_win, edit=True, widthHeight=(300, 260)) return None
def __init__(self, mmmmTools=None, randomSelector=None): if randomSelector == None: self.randomSelector = RandomSelector() else: self.randomSelector = randomSelector self.win = pm.window("Random Selector") with self.win: self.col = pm.columnLayout() with self.col: self.ratioText = pm.text("Decimal number as ratio to select:") self.ratioFloat = pm.floatField() self.ratioFloat.setValue(0.5) self.selectButton = pm.button( "Select by Ratio", command=lambda x: self.randomSelector.go(self.ratioFloat.getValue()) ) self.win.show()
def create_atr_ui(self): self.ATTR_WINDOW = "Create_Attr" if pm.window(self.ATTR_WINDOW, query=True, exists=True): pm.deleteUI(self.ATTR_WINDOW) pm.window(self.ATTR_WINDOW, title="create attribute", iconName="CA", widthHeight=(250, 200)) attr_main_col = pm.columnLayout(adjustableColumn=True, parent=self.ATTR_WINDOW) attr_nm_col = pm.rowColumnLayout(parent=attr_main_col, numberOfColumns=2) pm.text(label="Enum Attribute Name : ", parent=attr_nm_col) self.attr_nm = pm.textField("", parent=attr_nm_col, width=120) pm.separator(parent=attr_main_col, style="in") attr_val_col = pm.rowColumnLayout(parent=attr_main_col, numberOfColumns=2, columnOffset=(1, "right", 5)) attr_val_ch_col = pm.rowColumnLayout(parent=attr_val_col, numberOfRows=2) attr_val_btn_ch_col = pm.rowColumnLayout(parent=attr_val_col, numberOfRows=2) pm.text(label="Enum Attribute values", parent=attr_val_ch_col) self.enum_val = pm.scrollField(parent=attr_val_ch_col, width=130, height=150) pm.text(label=" ", parent=attr_val_btn_ch_col) pm.button(label="Create Attr\non selected\ncontrol", parent=attr_val_btn_ch_col, height=150, width=100, command=lambda x: self.create_attr()) pm.showWindow(self.ATTR_WINDOW) pm.window(self.ATTR_WINDOW, edit=True, widthHeight=(250, 200)) return None
def __init__(self, mmmmTools=None, randomSelector=None): if randomSelector == None: self.randomSelector = RandomSelector() else: self.randomSelector = randomSelector self.win = pm.window('Random Selector') with self.win: self.col = pm.columnLayout() with self.col: self.ratioText = pm.text("Decimal number as ratio to select:") self.ratioFloat = pm.floatField() self.ratioFloat.setValue(0.5) self.selectButton = pm.button( "Select by Ratio", command=lambda x: self.randomSelector.go(self.ratioFloat. getValue())) self.win.show()
def object_creator_ui(): """This method creates user interface to input object details User Inputs: - Object name - Object ID Returns : None """ WINDOW = 'ObjectCreator' if pm.window(WINDOW, query=True, exists=True): pm.deleteUI(WINDOW) pm.window(WINDOW, title="Object creator", iconName='OC', widthHeight=(200, 250)) column_1 = pm.columnLayout(adjustableColumn=True) pm.Text(label="Enter Object Name", parent=column_1) object_name = pm.TextField(text='Object', parent=column_1) pm.separator(height=20, style='in', parent=column_1) pm.Text(label="Enter ID to start with", parent=column_1) object_id = pm.TextField(text='01', parent=column_1) pm.separator(height=20, style='in', parent=column_1) pm.button(label='Create Joint', command=lambda x: create_joint(object_name.getText(), object_id.getText()), parent=column_1) pm.separator(height=20, style='in', parent=column_1) pm.button(label='Create Locator', command=lambda x: create_locator(object_name.getText(), object_id.getText()), parent=column_1) pm.separator(height=20, style='in', parent=column_1) pm.button(label='Create Group', command=lambda x: create_group(object_name.getText(), object_id.getText()), parent=column_1) pm.showWindow(WINDOW) pm.window(WINDOW, edit=True, widthHeight=(200, 250)) return None
def lyr_swtch_ui(self): self.MAIN_WINDOW = "Layered_texture_switch" if pm.window(self.MAIN_WINDOW, query=True, exists=True): pm.deleteUI(self.MAIN_WINDOW) pm.window(self.MAIN_WINDOW, title="Layered Tex Switch", iconName="LTS", widthHeight=(150, 200)) main_col = pm.columnLayout(adjustableColumn=True, height=100, parent=self.MAIN_WINDOW) but_col = pm.rowColumnLayout(parent=main_col, numberOfColumns=2) self.create_attr_btn = pm.button( label="Create ENUM Attribute", parent=main_col, command=lambda x: self.create_atr_ui()) pm.separator(parent=main_col, style="in", height=10) pm.text(label="Enum Attribuite list", parent=main_col) pm.separator(parent=main_col, style="none", height=5) self.text_lst = pm.textScrollList(allowMultiSelection=False, parent=main_col, height=150) pm.separator(parent=main_col, style="none", height=5) but_col = pm.rowColumnLayout(parent=main_col, numberOfColumns=3) pm.button(label="Refresh List", parent=but_col, command=lambda x: self.populate_list()) pm.separator(parent=but_col, horizontal=False) pm.button(label="Create Switch", parent=but_col, command=lambda x: self.create_switching()) pm.showWindow(self.MAIN_WINDOW) pm.window(self.MAIN_WINDOW, edit=True, widthHeight=(150, 235)) return None
def __init__(self, parentRef, selection=False, multiplier=1.0): self.parentRef = parentRef self.buttons = [] self.window = pm.window( sizeable = False, title = "Light Multiplier", titleBar=True) with self.window: self.layout = pm.columnLayout() with self.layout: ## Using Ui on the end of Widget names self.multiplierText = pm.text( label='Multiplier:', align='left' ) self.multiplierUi = pm.floatField( value=1.0 ) self.checkBoxUi = pm.checkBox( label='Affect Selected Lights Only') self.okUi = pm.button ( label = 'Apply',parent = self.layout, command = lambda xc: self.parentRef.applyMultiplier( multiplier=self.multiplierUi.getValue(), selection=self.checkBoxUi.getValue(), ), width = 300 ) pm.showWindow(self.window) self.window.setWidth(600) self.window.setHeight(400)
def run(self): self.win = pm.window(title="Mmmm Baker Tool") with self.win: self.col = pm.columnLayout() with self.col: self.spacers = [] self.xnormalPathTextLabel = pm.text( "Path and filename of xNormal executable:") self.xnormalPathTextField = pm.textField( width=500, text= "C:/Program Files/S.Orgaz/xNormal 3.19.2/x64/xNormal.exe") self.spacers.append(pm.text(" ")) self.modelsPathTextLabel = pm.text("Path where models are:") self.modelsPathTextField = pm.textField( width=500, text="C:/Users/Public/mmmmBaker") self.modelsPathTextLabel2 = pm.text( "(Warning, if changed, requires custom xnormal settings xml which points to new path.)" ) self.spacers.append(pm.text(" ")) self.highSuffixTextLabel = pm.text( 'High Suffix, on models for xnormals "high" model files, no extension' ) self.highSuffixTextField = pm.textField(width=500, text="_hi") self.spacers.append(pm.text(" ")) #self.highSuffixTextLabel = pm.text( "Suffix on files: (not extension)" ) #self.cageSuffixTextField = pm.textField( width = 500, text="_cage" ) self.xmlFilesTextLabel = pm.text( "Xml files to bake, comma separated list:") self.xmlFilesTextLabel2 = pm.text( "(xnormal settings files, should be in the same folder as models)" ) self.xmlFilesTextField = pm.textField( width=500, text= "xnormal_settings_for_mmmmbaker_example.xml,xnormal_settings_for_mmmmbaker_example2.xml" ) self.goButton = pm.button( label="Go! (Bake selected models) )", command=lambda x: self.go())
def reorder_edit_ui(self): reorder_win = "Reorder_Deformer_List" if pm.window(reorder_win, query=True, exists=True): pm.deleteUI(reorder_win) pm.window(reorder_win, title="Rearrange Deformers", iconName="ReArDf") main_col = pm.columnLayout(parent=reorder_win, adjustableColumn=True) self.reord_lst = pm.scrollField('reorder_deformer_list', parent=main_col, height=235, width=150, text=self.populate_order_edit_list()) pm.button("Save order list", parent=main_col, command=lambda x: self.save_deformer_list()) pm.showWindow(reorder_win) pm.window(reorder_win, edit=True, widthHeight=(150, 260)) return None
def __init__(self, parentRef): self.parentRef = parentRef self.win = pm.window( title="Joint Orientation", width=250, height=180) self.col = pm.columnLayout() self.row1 = pm.rowColumnLayout( width = 200, numberOfColumns=2 ) self.rotateXText = pm.text( label="X rotate:", parent=self.row1 ) self.rotateXField = pm.intField( parent=self.row1 ) self.rotateYText = pm.text( label="Y rotate:", parent=self.row1 ) self.rotateYField = pm.intField( parent=self.row1 ) self.rotateZText = pm.text( label="Z rotate:", parent=self.row1 ) self.rotateZField = pm.intField( parent=self.row1 ) self.button = pm.button( label="Rotate Joints", width=200, command = lambda x: parentRef.rotateJoint( self.rotateXField.getValue() ,self.rotateYField.getValue() ,self.rotateZField.getValue() ), parent=self.col ) self.button = pm.button( label="Rotate Joints Relative", width=200, command = lambda x: parentRef.rotateJoint( self.rotateXField.getValue() ,self.rotateYField.getValue() ,self.rotateZField.getValue(), rotateRelative=True ), parent=self.col ) self.win.show() self.win.setWidth(260) self.win.setHeight(210)
def __init__(self): self.win=pm.window() with self.win: self.col = pm.columnLayout() with self.col: self.label1 = pm.text( "Attribute Group Name (To Be Added)" ) self.dropdown = pm.optionMenu( "menu", changeCommand = self.onDropDownChange ) with self.dropdown: for i,v in enumerate(addableAttrList): pm.menuItem( v ) self.attrNameField = pm.textField( ) self.addAttrButton = pm.button( "Add Attribtutes!", command = lambda x: self.addAttributeGroup( self.attrNameField.getText() ) ) self.win.show()
def __init__(self): self.window = pm.window( "Rename UI" ) self.window.show() with self.window: self.col = pm.columnLayout() with self.col: pm.text( "Prefix Field" ) self.prefixField = pm.textField( text="", width=300 ) pm.text( "Search Field" ) self.searchField = pm.textField( text="", width=300 ) pm.text( "Replace Field" ) self.replaceField = pm.textField( text="",width=300 ) pm.text( "Suffix Field" ) self.suffixField = pm.textField( text="",width=300 ) self.button = pm.button( "Rename Selected", command = lambda x: self.renameSelected() ) self.button.setBackgroundColor( [0,0.5,0] ) self.window.setWidth( 380 ) self.window.setHeight( 180 )
def uv_ratio_UI(self): UV_RATIO_WINDOW = "UVratio" if pm.window(UV_RATIO_WINDOW, query=True, exists=True): pm.deleteUI(UV_RATIO_WINDOW) pm.window(UV_RATIO_WINDOW, title="uv ratio", iconName="UVR") main_col = pm.columnLayout(adjustableColumn=True) self.ref_shell_btn = pm.button("set reference shell", height=40, parent=main_col, backgroundColor=(.863, 0.078, 0.235), command=lambda x: self.set_ref_shell()) pm.separator(parent=main_col, style="in", height=5) self.sel_shell_btn = pm.button("select assigned reference shell", parent=main_col, enable=False, command=lambda x: self.sel_ref_shell()) pm.separator(parent=main_col, style="in", height=10) self.assign_btn = pm.button("apply uv ratio on\n selected Shells", height=40, parent=main_col, enable=False, command=lambda x: self.rescale_uv()) #self.assign_btn.setEnable(False) pm.separator(parent=main_col, height=5, style="in") ch_bx_col = pm.rowColumnLayout(numberOfColumns=2, parent=main_col, columnOffset=(1, "left", 40)) pm.text("", parent=ch_bx_col) self.ch_bx = pm.checkBox(label="Object Selection", parent=ch_bx_col, enable=False) pm.text("Check above option to select mesh\ninstead of shell", parent=main_col) pm.showWindow(UV_RATIO_WINDOW) pm.window(UV_RATIO_WINDOW, edit=True, widthHeight=(200, 170)) return None
class ScriptFileRunnerUi(object): def __init__(self, parentRef=None, mmmmToolsRef=None): self.mmmmTools = mmmmToolsRef self.parentRef = parentRef self.scriptFileRunner = MmmmScriptFileRunner( parentRef = self, mmmmToolsRef=self.mmmmTools ) self.scriptFileRunner.findScripts() self.win = pm.window("Script File Runner") self.ddMenuEntires = [ ] with self.win: self.col = pm.columnLayout() with self.col: self.textPath = pm.text( "Path to scripts:" ) self.textFieldPath = pm.textField( text=self.scriptFileRunner.searchPath, width=400, changeCommand= lambda x : self.onTextPathChangeCommand() ) self.btnRefresh = pm.button( "Refresh Scripts", command = lambda x: self.buildMenu( )
def __init__(self, parentRef, parentWidget=None): self.parentRef = parentRef self.buttons = [] self.widgets = {} if parentWidget == None: parentWidget = self.widgets["parentWidget"] = pm.Window(sizeable=True, title="Retoper", titleBar=True) else: self.widgets["parentWidget"] = parentWidget with parentWidget: self.layout = pm.columnLayout() with self.layout: labelStr = 'A "Retop" Tool For Creating New Topology.' labelStr += "\n" labelStr += "Please Note: This tool does not preserve" labelStr += "\n" labelStr += "construction history of edited objects." self.lab1 = pm.Text(label=labelStr, align="left", parent=self.layout) ##self.lab2 = pm.Text( label='Please Note: This tool does not preserve', width=300, align='left',parent = self.layout ) ##self.lab3 = pm.Text( label='construction history of edited objects.', width=300, align='left',parent = self.layout ) btn__setReference = pm.Button( label="Set Reference Mesh", parent=self.layout, command=lambda xc: self.parentRef.setReference() ) self.buttons.append(btn__setReference) btn__selectReference = pm.Button( label="Select Reference", parent=self.layout, command=lambda xc: self.parentRef.selectReference() ) self.buttons.append(btn__selectReference) btn__makeReferenceLive = pm.Button( label="Make Reference Live", parent=self.layout, command=lambda xc: self.parentRef.makeReferenceLive(), ) self.buttons.append(btn__makeReferenceLive) btn__makeReferenceNotLive = pm.Button( label="Make Reference Not Live", parent=self.layout, command=lambda xc: self.parentRef.makeReferenceNotLive(), ) self.buttons.append(btn__makeReferenceNotLive) btn__makeReferenceHidden = pm.Button( label="Make Reference Hidden", parent=self.layout, command=lambda xc: self.parentRef.makeReferenceHidden(), ) self.buttons.append(btn__makeReferenceHidden) btn__makeReferenceVisible = pm.Button( label="Make Reference Visible", parent=self.layout, command=lambda xc: self.parentRef.makeReferenceVisible(), ) self.buttons.append(btn__makeReferenceVisible) btn__projectSelection = pm.Button( label="Project Selection To Surface", parent=self.layout, command=lambda xc: self.parentRef.projectSelection(), ) self.buttons.append(btn__projectSelection) ## put a button here for auto new material and transparency animation ## put a button here for auto ref layer ## put a button here for quad draw (a shortcut) ## put a button here to project along particular axis (essentially just scale first) # Show Window if type(parentWidget) == pm.core.windows.window: win = parentWidget pm.showWindow(win) win.setWidth(200) win.setHeight(300)
def makeFrame(parentLayout): # f = pm.frameLayout( label="test - - - - -", collapsable=True, parent=col ) frameOrWin = self.widgets["frameOrWin"] = parentLayout ##scroll = self.widgets['scroll'] = pm.scrollLayout( parent = frameOrWin ) col = self.widgets["col"] = pm.columnLayout(parent=frameOrWin)
def generateConnGUI(self): pm.columnLayout(nch=2) self.generateChildConnGUI() pm.separator() self.generateParentConnGUI()
def setupCmds(self): self.title = "MmmmQM" wids = self.widgets = Duck() win = wids.win = pm.window( title=self.title ) win.show() win.setWidth( 210 ) ## "with" puts the tabbed stuff in the window! with win: scr = wids.scr = pm.scrollLayout(verticalScrollBarAlwaysVisible=True) with scr: #lay = wids.lay = pm.formLayout() col = wids.col = pm.columnLayout() with col: n = {} ## we will collect all new widgets here! try: pm.text( "pop up windows" ) rowA = wids.rowA = pm.rowLayout( numberOfColumns=10 ) with rowA: self.makeAndAddButton( n, self.entries.a1 ) self.makeAndAddButton( n, self.entries.a2 ) self.makeAndAddButton( n, self.entries.a3 ) self.makeAndAddButton( n, self.entries.a4 ) except: print( traceback.format_exc() ) try: pm.text( "more..." ) rowB = wids.rowB = pm.rowLayout( numberOfColumns=10 ) with rowB: self.makeAndAddButton( n, self.entries.b1 ) self.makeAndAddButton( n, self.entries.b2 ) self.makeAndAddButton( n, self.entries.b3 ) self.makeAndAddButton( n, self.entries.b4 ) except: print( traceback.format_exc() ) try: rowC = wids.rowC = pm.rowLayout( numberOfColumns=10 ) with rowC: self.makeAndAddButton( n, self.entries.c1 ) self.makeAndAddButton( n, self.entries.c2 ) self.makeAndAddButton( n, self.entries.c3 ) self.makeAndAddButton( n, self.entries.c4 ) except: print( traceback.format_exc() ) try: rowD = wids.rowD = pm.rowLayout( numberOfColumns=10 ) with rowD: self.makeAndAddButton( n, self.entries.d1 ) self.makeAndAddButton( n, self.entries.d2 ) self.makeAndAddButton( n, self.entries.d3 ) self.makeAndAddButton( n, self.entries.d4 ) except: print( traceback.format_exc() ) for k in sorted( n.keys() ): v = n[k] k = k.lower().replace( " ", "_" ).replace(">","_") setattr( wids, k, v )
def __init__(self, parentRef, parentWidget=None, mmmm=None ): self.parentRef = parentRef self.buttons = [] self.widgets = {} self.mmmm = mmmm if parentWidget==None: parentWidget = self.widgets['parentWidget'] = pm.Window( sizeable = True, title = "Mmmm Hotkeys Manager", titleBar=True ) else: self.widgets['parentWidget'] = parentWidget with parentWidget: self.layout = pm.columnLayout() with self.layout: self.widgets['editorBtn'] = pm.button( "Maya Hotkey Editor Window...", annotation= "Open the Maya's default builtin hotkey editor window. " + " There is nothing MmmmTools specific about this, it's just a shortcut.", command='pm.mel.eval("HotkeyPreferencesWindow;")', ) self.widgets['infoText'] = pm.text("\nInstructions (read tooltip, hover here)\n", annotation = "Note that users should avoid editing the hotkey sets \n" + "starting with Mmmm. If you wish to modify them, \n" + "you should duplicate the Mmmm keyset you want to modify, \n" + "rename, so it does not start with Mmmm, and make change to your own copy. \n\n" + "Changing the Mmmm keySets themselves requires writing/altering python code. \n" + "Our recommendation is that for your own hotkeys, you make your own hotkey sets, \n" + "and switch to them as necessary. (See other button tooltips for more info.)" ) self.widgets['nextKeySetBtn'] = pm.button( "Next Hotkey Set", command = lambda x: self.parentRef.nextKeySet(), annotation="Go to the next keyset, in alphabetical order. \n\n " + "In case you want to add it to a shelf/button: \n" + "The mel command to do this is: MmmmCmds__Hotkeys__NextKeySet", ) self.widgets['prevKeySetBtn'] = pm.button( "Prev Hotkey Set", command = lambda x: self.parentRef.prevKeySet(), annotation="Go to the previous keyset, in alphabetical order. \n\n " + "In case you want to add it to a shelf/button: \n" + "The mel command to do this is: MmmmCmds__Hotkeys__PrevKeySet", ) #self.widgets['refreshListBtn'] = pm.button( "Refresh Hotkey Set Dropdown List" ) self.widgets['dropdownLabel'] = pm.text("\n Choose active hotkey set:", annotation="You may need to either click the refresh button, " +"or if that is unavailable, close and reopen this window, to refresh the list." ) self.widgets['dropdown'] = pm.optionMenu( "MmmmKeySetDropdownMenu", changeCommand = self.onDropDownChange, ) keySets = pm.hotkeySet( query=True, hotkeySetArray=True) keySets.sort() for keySet in keySets : pm.menuItem( keySet )