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 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 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 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 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 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, 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 __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 __update_rename_preview() : preview_left = pm.ColumnLayout( 'th_rename_preview_left' ) preview_right = pm.ColumnLayout( 'th_rename_preview_right' ) old = [] for item in preview_left.getChildArray() : old.append( pm.Text( item ).getLabel() ) new = __rename_list_from_textfields( *old ) preview_right.clear() for name in new : pm.text( label=name, align='left', p=preview_right )
def __update_rename_preview(): preview_left = pm.ColumnLayout('th_rename_preview_left') preview_right = pm.ColumnLayout('th_rename_preview_right') old = [] for item in preview_left.getChildArray(): old.append(pm.Text(item).getLabel()) new = __rename_list_from_textfields(*old) preview_right.clear() for name in new: pm.text(label=name, align='left', p=preview_right)
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 _createRObjGUI(self): pm.text( label='Geometry' ) pm.attrEnumOptionMenuGrp( l='Type', at=self.node.name() + '.'+CRRenderObject_Node._geoTypeAttr, ei=self._genEnumsFor(Geometry)) pm.button(label="Add", w=128, c=pm.Callback(self.addChildEnumCB, CRGeometry, self.geo, srcattr=CRRenderObject_Node._geoTypeAttr))
def _createShaderGUI(self): pm.text( label='Shader' ) pm.attrEnumOptionMenuGrp( l='Type', at=self.node.name() + '.'+CRRenderObject_Node._sdrTypeAttr, ei=self._genEnumsFor(Shader)) pm.button(label="Add", w=128, c=pm.Callback(self.addChildEnumCB, CRShader, self.shaders, srcattr=CRRenderObject_Node._sdrTypeAttr))
def _createDataGUI(self): pm.text( label='Data' ) pm.attrEnumOptionMenuGrp( l='Type', at=self.node.name() + '.'+CRSimulation_Node._dataTypeAttr, ei=(0, DataObject.getTypeName())) pm.button(label="Add", w=128, c=pm.Callback(self.addChildEnumCB, CRDataObject, self.datasrcs, srcattr=CRSimulation_Node._dataTypeAttr))
def _createRObjGUI(self): pm.text( label='RenderObject' ) pm.attrEnumOptionMenuGrp( l='Type', at=self.node.name() + '.'+CRSimulation_Node._robjTypeAttr, ei=self._genEnumsFor(RenderObject)) pm.button(label="Add", w=128, c=pm.Callback(self.addChildEnumCB, CRRenderObject, self.robjs, srcattr=CRSimulation_Node._robjTypeAttr))
def _genTypeGUI(self, attrname, typ, val): if pm.attributeQuery(attrname, node=self.obj.node, h=True): return pm.text(l='Attribute') if typ == cr_types.url: pm.attrControlGrp(attribute=self.obj.node.name()+'.'+attrname) pm.button(label="Find", w=128, c= pm.Callback(gui.setAttrFromFileDialog, self.obj.node, attrname)) else: pm.attrControlGrp(attribute=self.obj.node.name()+'.'+attrname) pm.button(label="Ignore", w=128, en=False)
def _createDataSourceGUI(self): pm.text( label='Data Source' ) pm.attrEnumOptionMenuGrp( l='Format', at=self.node.name() + '.'+CRDataObject_Node._dataSrcTypeAttr, ei=self._genEnumsFor(DataSource)) pm.button(label="Add DataSource", w=128, c=pm.Callback(self.addChildEnumCB, CRDataSource, self.datasrcs, srcattr=CRDataObject_Node._dataSrcTypeAttr))
def _createScriptGUI(self): pm.text( label='Script' ) pm.attrEnumOptionMenuGrp( l='Type', at=self.node.name() + '.'+CRObject_Node._scriptTypeAttr, ei=(0, Scriptable.getTypeName()), en=self.bScript) pm.button(label="Add", w=128, c=pm.Callback(self.addScriptGUI, prefix='script'), en=self.bScript)
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 __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)
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 __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 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): 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 __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 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 __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 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
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() ) )
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, 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 __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 __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 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 __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 __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 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 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
def _createImportGUI(self): pm.text( label='Import' ) pm.text( label='This imports the entire simulation' ) pm.button(label="Import", w=128, c=pm.Callback(self._import))
def generateParentConnGUI(self): pm.text(label='Parents') for obj, name in self.obj.parents.iteritems(): pm.text(label=name, align='left')
def generateChildConnGUI(self): pm.text(label='Children') for obj, name in self.obj.children.iteritems(): pm.text(label=name, align='left')
def __populate_preview_grids( list_left, list_right ) : list_left.clear() list_right.clear() for obj in pm.ls( sl=True ): pm.text( label=obj.name(), align='left', p=list_left ) pm.text( label=obj.name(), align='left', p=list_right )
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=None): self.parentRef = parentRef #print( 'parent is:') #print( self.parentRef ) self.win = pm.window("UV Xform Tools") with self.win: self.lay = pm.formLayout() with self.lay: labels_x = 0 self.move_label = pm.text("Move UVs 1 Space Over") x = 0 y = 0 self.lay.attachForm(self.move_label, "left", labels_x) self.lay.attachForm(self.move_label, "top", y) x_orig = 20 y_orig = 20 x = x_orig y = y_orig x_offset_step = 80 self.move_b1 = pm.button( label="move up", command=lambda x: self.parentRef.move_uvs(0, 1)) self.move_b2 = pm.button( label="move down", command=lambda x: self.parentRef.move_uvs(0, -1)) self.move_b3 = pm.button( label="move left", command=lambda x: self.parentRef.move_uvs(-1, 0)) self.move_b4 = pm.button( label="move right", command=lambda x: self.parentRef.move_uvs(1, 0)) self.lay.attachForm(self.move_b1, "left", x) self.lay.attachForm(self.move_b1, "top", y) x = x + x_offset_step self.lay.attachForm(self.move_b2, "left", x) self.lay.attachForm(self.move_b2, "top", y) x = x + x_offset_step self.lay.attachForm(self.move_b3, "left", x) self.lay.attachForm(self.move_b3, "top", y) x = x + x_offset_step self.lay.attachForm(self.move_b4, "left", x) self.lay.attachForm(self.move_b4, "top", y) x_orig = 20 y_orig = 100 x = x_orig y = y_orig offset_step_y = 25 self.scale_label = pm.text("Scale UVs") self.lay.attachForm(self.scale_label, "left", labels_x) self.lay.attachForm(self.scale_label, "top", y - 20) self.shrink_b0 = pm.button( label="0.5", command=lambda x: self.parentRef.scale_uvs(s=0.5)) self.shrink_b1 = pm.button( label="0.9", command=lambda x: self.parentRef.scale_uvs(s=0.9)) self.shrink_b2 = pm.button( label="0.99", command=lambda x: self.parentRef.scale_uvs(s=0.99)) self.shrink_b3 = pm.button( label="0.999", command=lambda x: self.parentRef.scale_uvs(s=0.999)) x_orig = 20 x = x_orig y = y_orig offset_step_y = 25 self.lay.attachForm(self.shrink_b0, "left", x) self.lay.attachForm(self.shrink_b0, "top", y) x = x + 0 y = y + offset_step_y self.lay.attachForm(self.shrink_b1, "left", x) self.lay.attachForm(self.shrink_b1, "top", y) x = x + 0 y = y + offset_step_y self.lay.attachForm(self.shrink_b2, "left", x) self.lay.attachForm(self.shrink_b2, "top", y) x = x + 0 y = y + offset_step_y self.lay.attachForm(self.shrink_b3, "left", x) self.lay.attachForm(self.shrink_b3, "top", y) self.grow_b0 = pm.button( label="2", command=lambda x: self.parentRef.scale_uvs(s=2)) self.grow_b1 = pm.button( label="1.1", command=lambda x: self.parentRef.scale_uvs(s=1.1)) self.grow_b2 = pm.button( label="1.01", command=lambda x: self.parentRef.scale_uvs(s=1.01)) self.grow_b3 = pm.button( label="1.001", command=lambda x: self.parentRef.scale_uvs(s=1.001)) x_orig = 80 x = x_orig y = y_orig offset_step_y = 25 self.lay.attachForm(self.grow_b0, "left", x) self.lay.attachForm(self.grow_b0, "top", y) x = x + 0 y = y + offset_step_y self.lay.attachForm(self.grow_b1, "left", x) self.lay.attachForm(self.grow_b1, "top", y) x = x + 0 y = y + offset_step_y self.lay.attachForm(self.grow_b2, "left", x) self.lay.attachForm(self.grow_b2, "top", y) x = x + 0 y = y + offset_step_y self.lay.attachForm(self.grow_b3, "left", x) self.lay.attachForm(self.grow_b3, "top", y)
# print '%s, has no childred' %(tran) deleteList.append(tran) if not deleteList: pma.delete(deleteList) return ctrl #################TUTORIAL windowNameTut = "Tutorial" if (pma.window(windowNameTut, exists=True)): pma.deleteUI(windowNameTut) windowTutorial = pma.window(windowNameTut, title=windowNameTut, width=400, height=300, backgroundColor=[0.2, 0.2, 0.2]) pma.columnLayout("testColumn", adjustableColumn=True) pma.text("intro", label="This tool is a super tool to make booleans wrote by Leonardo Iezzi. To make it works correctly, you need to have your base mesh already even if just a cube. With your base mesh selected just press one of the three buttons on the windows to subtract or add those primitives. If you want to use a custom mesh for the operation: select your base mesh then the custom one (it's important to pick your base mesh first) and then press the 'Use custom mesh' button. After you have done, select your base mesh and press 'Clean Up.'", wordWrap=True, height=100, backgroundColor=[0.2, 0.2, 0.2], align='left', parent="testColumn") # pma.text("first", label = "1- Select always your main mesh first",wordWrap= True, height = 40, backgroundColor = [0.2, 0.2, 0.2], align='left', parent = "testColumn") # pma.text("secondo", label = "2- In case you want to use a custom mesh: Select first your main mesh then the mesh you want to add or subtract",wordWrap= True, height = 40, backgroundColor = [0.2, 0.2, 0.2], align='left', parent = "testColumn") # pma.text("third", label = "3- Everythong should works",wordWrap= True, height = 40, backgroundColor = [0.2, 0.2, 0.2], align='left', parent = "testColumn") pma.separator(parent="testColumn", height=20) pma.button("goit", label="Got it", width=120, height=40, backgroundColor=[0.5, 0.5, 0.5], parent="testColumn", command="pma.deleteUI(windowNameTut)") pma.showWindow() ################################################################################################UI################################################# # pma.deleteUI(windowNameTut)
def __init__(self, parentRef=None): self.parentRef = parentRef #print( 'parent is:') #print( self.parentRef ) self.win = pm.window("UV Xform Tools") with self.win: self.lay = pm.formLayout() with self.lay: labels_x = 0 self.move_label = pm.text( "Move UVs 1 Space Over" ) x = 0 y = 0 self.lay.attachForm( self.move_label, "left",labels_x ) self.lay.attachForm( self.move_label, "top", y ) x_orig = 20 y_orig = 20 x = x_orig y = y_orig x_offset_step = 80 self.move_b1 = pm.button( label="move up", command=lambda x: self.parentRef.move_uvs(0,1) ) self.move_b2 = pm.button( label="move down", command=lambda x: self.parentRef.move_uvs(0,-1) ) self.move_b3 = pm.button( label="move left", command=lambda x: self.parentRef.move_uvs(-1,0) ) self.move_b4 = pm.button( label="move right", command=lambda x: self.parentRef.move_uvs(1,0) ) self.lay.attachForm( self.move_b1, "left",x ) self.lay.attachForm( self.move_b1, "top", y ) x=x+x_offset_step self.lay.attachForm( self.move_b2, "left",x ) self.lay.attachForm( self.move_b2, "top", y ) x=x+x_offset_step self.lay.attachForm( self.move_b3, "left",x ) self.lay.attachForm( self.move_b3, "top", y ) x=x+x_offset_step self.lay.attachForm( self.move_b4, "left",x ) self.lay.attachForm( self.move_b4, "top", y ) x_orig = 20 y_orig = 100 x = x_orig y = y_orig offset_step_y = 25 self.scale_label = pm.text( "Scale UVs" ) self.lay.attachForm( self.scale_label, "left",labels_x ) self.lay.attachForm( self.scale_label, "top", y - 20 ) self.shrink_b0 = pm.button( label="0.5", command=lambda x: self.parentRef.scale_uvs(s=0.5) ) self.shrink_b1 = pm.button( label="0.9", command=lambda x: self.parentRef.scale_uvs(s=0.9) ) self.shrink_b2 = pm.button( label="0.99", command=lambda x: self.parentRef.scale_uvs(s=0.99) ) self.shrink_b3 = pm.button( label="0.999", command=lambda x: self.parentRef.scale_uvs(s=0.999)) x_orig = 20 x = x_orig y = y_orig offset_step_y = 25 self.lay.attachForm( self.shrink_b0, "left",x ) self.lay.attachForm( self.shrink_b0, "top", y ) x=x+0 y=y+offset_step_y self.lay.attachForm( self.shrink_b1, "left", x ) self.lay.attachForm( self.shrink_b1, "top", y ) x=x+0 y=y+offset_step_y self.lay.attachForm( self.shrink_b2, "left", x ) self.lay.attachForm( self.shrink_b2, "top", y ) x=x+0 y=y+offset_step_y self.lay.attachForm( self.shrink_b3, "left", x ) self.lay.attachForm( self.shrink_b3, "top", y ) self.grow_b0 = pm.button( label="2", command=lambda x: self.parentRef.scale_uvs(s=2) ) self.grow_b1 = pm.button( label="1.1", command=lambda x: self.parentRef.scale_uvs(s=1.1) ) self.grow_b2 = pm.button( label="1.01", command=lambda x: self.parentRef.scale_uvs(s=1.01)) self.grow_b3 = pm.button( label="1.001", command=lambda x: self.parentRef.scale_uvs(s=1.001)) x_orig = 80 x = x_orig y = y_orig offset_step_y = 25 self.lay.attachForm( self.grow_b0, "left",x ) self.lay.attachForm( self.grow_b0, "top", y ) x=x+0 y=y+offset_step_y self.lay.attachForm( self.grow_b1, "left", x ) self.lay.attachForm( self.grow_b1, "top", y ) x=x+0 y=y+offset_step_y self.lay.attachForm( self.grow_b2, "left", x ) self.lay.attachForm( self.grow_b2, "top", y ) x=x+0 y=y+offset_step_y self.lay.attachForm( self.grow_b3, "left", x ) self.lay.attachForm( self.grow_b3, "top", y )
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 )
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 main_ui(self): WIN = "nodes_rename" if pm.window(WIN, query=True, exists=True): pm.deleteUI(WIN) pm.window(WIN, title="Rename Nodes", iconName="RNMND") main_col = pm.columnLayout(parent=WIN, adjustableColumn=True) row_col = pm.rowColumnLayout(parent=main_col, numberOfColumns=2) type_list_col = pm.columnLayout(parent=row_col) pm.text(label="Node Type List", parent=type_list_col) pm.separator(height=5, style="none") rename_col = pm.columnLayout(parent=row_col, adjustableColumn=True) self.node_lst = pm.textScrollList('Node_Type_List', numberOfRows=10, parent=type_list_col, height=235, width=150, allowMultiSelection=False) pm.separator(parent=rename_col, height=20, style="none") pm.text(label="Gets name from selected mesh", parent=rename_col) pm.separator(parent=rename_col, height=5, style="none") name_from_col = pm.rowColumnLayout(parent=rename_col, numberOfColumns=2, columnOffset=(2, "left", 11)) pm.text(label="Replace Text", parent=name_from_col) self.replace_txt = pm.textField(parent=name_from_col, text="_MSH") name_to_col = pm.rowColumnLayout(parent=rename_col, numberOfColumns=2, columnOffset=(2, "left", 5)) pm.text(label="Replace With", parent=name_to_col) self.replace_to_txt = pm.textField(parent=name_to_col) pm.button(label="Rename (Replace)", parent=rename_col, command=lambda x: self.rename_call(mode="replace")) pm.separator(parent=rename_col, height=20) pm.text(label="Rename nodes irrespective\n of mesh name", parent=rename_col) pm.separator(parent=rename_col, height=5, style="none") new_name_col = pm.rowColumnLayout(parent=rename_col, numberOfColumns=2, columnOffset=(2, "left", 5)) pm.text(label="Rename", parent=new_name_col) self.rename_txt = pm.textField(parent=new_name_col) pm.button(label="Rename (New)", parent=rename_col, command=lambda x: self.rename_call(mode="rename")) pm.separator(parent=rename_col, height=20) pm.button(label="Refresh node List", parent=rename_col, command=lambda x: self.refresh_node_list()) pm.separator(parent=rename_col, height=20) pm.showWindow(WIN) pm.window(WIN, edit=True, widthHeight=(330, 260)) return None
def copySDK_UI(): WINDOW = 'copySDK' if pm.window(WINDOW, query=True, exists=True): pm.deleteUI(WINDOW) pm.window(WINDOW, title="copySDK", iconName='SDKcpy', widthHeight=(210, 370)) # Layout column_1 = pm.columnLayout(adjustableColumn=True) textlabel = pm.text(label="UI for script downloaded from\ highend3d.com\nContact Email : [email protected]", align="center", wordWrap=True) pm.separator(height=20, style='in', parent=column_1) col2 = pm.columnLayout(width=200, adjustableColumn=False, parent=column_1) row_col_1 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=column_1, columnOffset=(2, 'left', 10)) pm.separator(height=20, style='in', parent=column_1) col3 = pm.columnLayout(width=200, adjustableColumn=False, parent=column_1) row_col_2 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=column_1, columnOffset=(2, 'left', 10)) row_col_3 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=column_1, columnOffset=(2, 'left', 10)) pm.separator(height=20, style='in', parent=column_1) row_col_4 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=column_1, columnOffset=(2, 'left', 10)) row_col_5 = pm.rowColumnLayout(numberOfRows=2, parent=row_col_4) column_2 = pm.columnLayout(adjustableColumn=False, width=200, columnOffset=["both", 50], parent=column_1) # Widgets cr_attr_chk_bx = pm.checkBox('Create attribute', parent=column_2, editable=False) mode_lbl = pm.text(label="mode", align="center", parent=col2, width=200) mode_radio = pm.radioCollection(parent=column_1) rb1 = pm.radioButton(label='driven', parent=row_col_1, select=True, onCommand=lambda x: pm.checkBox( cr_attr_chk_bx, edit=True, editable=False)) rb1 = pm.radioButton(label='driver', parent=row_col_1, select=False, onCommand=lambda x: pm.checkBox( cr_attr_chk_bx, edit=True, editable=True)) ctr_replace_lbl = pm.text(label="controller", align="center", parent=col3, width=200) search_lbl = pm.text(label="search", align="center", parent=row_col_2, width=100) replace_lbl = pm.text(label="replace", align="center", parent=row_col_2, width=100) search_str = pm.TextField(text='', parent=row_col_3) replace_str = pm.TextField(text='', parent=row_col_3) refresh_button = pm.button( label='Refresh', parent=row_col_5, command=lambda x: populate_attr(field_obj=attr_list)) attr_list = pm.textScrollList('Attr', numberOfRows=10, parent=row_col_5, height=150, width=100, allowMultiSelection=True) populate_attr(field_obj=attr_list) mirror_chk_bx = pm.checkBox('mirror', parent=row_col_4) apply_button = pm.button( label='Apply', parent=column_2, width=100, command=lambda x: sdk_call(mode_radio, attr_list, search_str, replace_str, mirror_chk_bx, cr_attr_chk_bx)) pm.showWindow(WINDOW) pm.window(WINDOW, edit=True, widthHeight=(210, 370)) return None
def __init__(self): self.winTitle = "Gad29Tools" #try: # pm.deleteUI( self.winTitle ) #except: # print( traceback.format_exc() ) if pm.window( self.winTitle, query=True, exists=True ): pm.deleteUI( self.winTitle ) self.win = pm.window( "Gad29Tools" ) #self.win = pm.window( "Gad29Tools" + '_' + str( datetime.datetime.today().strftime('y%Ym%md%dh%Hn%Ms%S') ) ) self.scroll = pm.scrollLayout(parent=self.win) self.col = pm.columnLayout(parent=self.scroll) with self.col: self.jointsSectionLabel = pm.text( "Joints:" ) self.autoOrientXKeepZBtn = pm.button( "auto orient x while keeping z", command = lambda x: self.autoOrientXKeepZForSelected() ) self.autoOrientTipJointsBtn = pm.button( "auto orient tip joints", command = lambda x: self.autoOrientTipJointsForSelected() ) self.autoOrientTipJointsBtn = pm.button( "fix joint complex xforms", command = lambda x: self.fixJointComplexXformsForSelected() ) self.checkJointsBtn = pm.button( "check joints (currently only rot and scale)", command = lambda x: self.checkJoints() ) self.ctrlSectionLabel = pm.text( "\n" + "Controls:" ) self.ctrlSizeFloatField = pm.floatField( value=8.0 ) self.makeAnimCtrlAndZeroBtn = pm.button( "Make Anim Ctrl And Zero (at size given above)", command = lambda x: self.makeAnimCtrlAndZero() ) self.clearSelectedCtrlsPosSlaveBtn = pm.button( "Clear Selected Ctrls Pos Slave", command = lambda x: self.clearSelectedCtrlsPosSlave() ) self.clearSelectedCtrlsRotSlaveBtn = pm.button( "Clear Selted Ctrls Rot Slave", command = lambda x: self.clearSelectedCtrlsRotSlave() ) self.constrainSlavesToSelectedBtn = pm.button( "Constrain Slaves To Selected", command = lambda x: self.constrainSlavesToSelected() ) self.parentingSectionLabel = pm.text( "\n" + "Parenting:" ) self.chainParentBtn = pm.button( "chain parent", command = lambda x: self.chainParent() ) self.chainParentWithZeroesBtn = pm.button( "chain parent with zeroes", command = lambda x: self.chainParentWithZeroes() ) self.parentWithZeroesBtn = pm.button( "parent with zeroes", command = lambda x: self.parentWithZeroes() ) #self.fromBtn = pm.button( "parent without compensation", # command = lambda x: self.parentWithoutCompensation() #) self.connectionsSectionLabel = pm.text( "\n" + "Connections:" ) self.fromBtn = pm.button( "from", command = lambda x: self.setFromAttrsViaChannelBoxAndSelection() ) self.toBtn = pm.button( "to (connect)", command = lambda x: self.connectToAttrsViaChannelBoxAndSelection() ) self.toBtn = pm.button( "to (drive)", command = lambda x: self.driveToAttrsViaChannelBoxAndSelectionOneToOne() ) self.linearizeBtn = pm.button( "linearize", command = lambda x: self.linearizeViaChannelBoxAndSelection() ) self.linearizeBtn = pm.button( "cycle", command = lambda x: self.cycleViaChannelBoxAndSelection() ) self.parentingSectionLabel = pm.text( "\n" + "Misc:" ) self.fromBtn = pm.button( "makeCamPlaneForDrawing", command = lambda x: self.makeCamPlaneForDrawing() ) self.checkForUnfoldNodesBtn = pm.button( "check for unfold nodes", command = lambda x: self.checkForUnfoldNodes() ) self.win.show()
def __populate_preview_grids(list_left, list_right): list_left.clear() list_right.clear() for obj in pm.ls(sl=True): pm.text(label=obj.name(), align='left', p=list_left) pm.text(label=obj.name(), align='left', p=list_right)