コード例 #1
0
    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."
                )
コード例 #2
0
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:" )
コード例 #3
0
    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()
コード例 #4
0
    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()
コード例 #5
0
 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)
コード例 #6
0
ファイル: Selector.py プロジェクト: joetainment/mmmmtools
 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()
コード例 #7
0
ファイル: Selector.py プロジェクト: joetainment/mmmmtools
 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()
コード例 #8
0
 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)
コード例 #9
0
    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()
コード例 #10
0
    def __init__(self, parent=None, mmmm=None, parentWidget=None):
        self.parent = parent
        self.mmmm = mmmm
        self.widgets = {}

        self.annotationAboutInteraction = (
            "The settings should also auto apply when you change them,\n " +
            "but due to a Maya bug, you may occasionally have to apply manually,\n "
            + "with the button.")

        try:
            initialMultiplier = pm.melGlobals[
                'MmmmToolsModelerGridToolsMultiplier']
        except:
            initialMultiplier = 1.0
            pm.melGlobals.initVar('float',
                                  'MmmmToolsModelerGridToolsMultiplier')
            pm.melGlobals['MmmmToolsModelerGridToolsMultiplier'] = 1.0
        initialSpacing = ((pm.grid(query=True, spacing=True) /
                           pm.grid(query=True, divisions=True)) /
                          initialMultiplier)
        initialWholeSize = pm.grid(query=True, size=True) / initialMultiplier

        ## Use this as parent otherwise use something else
        if parentWidget == None:
            parentWidget = self.widgets['parentWidget'] = pm.Window(
                title="Grid Manager", width=100, height=200)
        else:
            self.widgets['parentWidget'] = parentWidget

        ## Make a shortcut for function that addWidgets
        aw = self.addWidget

        with parentWidget:
            with aw('col', pm.ColumnLayout()):
                aw(
                    'mayaOptionsButton',
                    pm.Button(label="Maya Grid Options...",
                              command=lambda x: pm.mel.eval("GridOptions;")))
                aw(
                    'resetButton',
                    pm.Button(label="Reset (To Maya Defaults)",
                              command=lambda x: self.resetToMayaDefault()))
                #aw('resetText', pm.Text(label='  '))
                aw(
                    'reset2Button',
                    pm.Button(label="Apply These Settings",
                              annotation=self.annotationAboutInteraction,
                              command=lambda x: MmmmToolsMod.Static.Grid.
                              reset_via_numbers(
                                  multiplier=self.getMultiplierFromUi(),
                                  spacing=self.getSpacingFromUi(),
                                  wholeSize=self.getWholeSizeFromUi(),
                                  setManip=True,
                              )))

                ## note the "with" doesn't work with rows,
                ## so we manually specify parents
                priorParent = self.widgets['col']

                row1 = self.widgets["row1"] = pm.rowLayout(numberOfColumns=2)
                aw('rowText1', pm.Text('Multiplier:', parent=row1))
                aw(
                    'multiplierFloatField',
                    pm.floatField(
                        value=initialMultiplier,
                        parent=row1,
                        annotation=
                        "This will mutiply with both spacing and whole size \n "
                        + "to determine the final amount used. \n \n" +
                        self.annotationAboutInteraction,
                        changeCommand=lambda x: self.onChangedField(),
                        enterCommand=lambda x: self.onChangedField(),
                    ))
                pm.setParent(priorParent)

                row2 = self.widgets["row2"] = pm.rowLayout(numberOfColumns=2)
                aw('rowText2', pm.Text('Spacing:', parent=row2))
                aw(
                    'spacingFloatField',
                    pm.floatField(
                        value=initialSpacing,
                        parent=row2,
                        annotation="This will control grid point spacing,\n " +
                        "and will multiply with multiplier\n " +
                        "to determine the final amount used. \n \n" +
                        self.annotationAboutInteraction,
                        changeCommand=lambda x: self.onChangedField(),
                        enterCommand=lambda x: self.onChangedField(),
                    ))
                pm.setParent(priorParent)

                row3 = self.widgets["row3"] = pm.rowLayout(numberOfColumns=2)
                aw('rowText3', pm.Text('Whole:', parent=row3))
                aw(
                    'wholeSizeFloatField',
                    pm.floatField(
                        value=initialWholeSize,
                        parent=row3,
                        annotation=
                        "This will control the extents of the whole grid,\n " +
                        "(width/height) and will multiply with multiplier \n "
                        + "to determine the final amount used. \n \n" +
                        "Note, Maya's grid width is like a radius, \n" +
                        "visible grid in Maya always looks twice as tall/wide, \n"
                        +
                        "since the 'size' setting in Maya is distance from grid center, \n"
                        + "that's how Maya is intended to work. \n \n" +
                        self.annotationAboutInteraction,
                        changeCommand=lambda x: self.onChangedField(),
                        enterCommand=lambda x: self.onChangedField(),
                    ))
                pm.setParent(priorParent)

                row4 = self.widgets["row4"] = pm.rowLayout(numberOfColumns=2)
                aw('rowText4',
                   pm.Text('Auto adjust discreet move:', parent=row4))
                aw('setManipCheckBox',
                   pm.CheckBox(value=True, label=' ', parent=row4))
                ## the checkbox has a built in label, but that shows on wrong side
                pm.setParent(priorParent)

                aw('spacerBlankText', pm.Text(label='  '))

                aw(
                    'snapButton',
                    pm.Button(label="Snap Selected Objs To Grid",
                              command=lambda x: MmmmToolsMod.Static.Grid.
                              putSelectedObjsOnGrid()))
                aw(
                    'snapButton',
                    pm.Button(label="Snap Selected Verts To Grid",
                              command=lambda x: MmmmToolsMod.Static.Grid.
                              snapVertsToGrid()))
                aw('snapText', pm.Text(label='  '))

                aw(
                    'growButton',
                    pm.Button(
                        label="Grow",
                        command=lambda x: self.growWithWarning(log=True)))
                aw(
                    'shrinkButton',
                    pm.Button(
                        label="Shrink",
                        command=lambda x: self.shrinkWithWarning(log=True)))

        # Show Window
        if type(parentWidget) == pm.core.windows.window:
            win = parentWidget
            pm.showWindow(win)
            win.setWidth(200)
            win.setHeight(300)
コード例 #11
0
    def __init__(self,parent=None,mmmm=None, parentWidget=None):
        self.parent = parent
        self.mmmm = mmmm
        self.widgets = { }
        
        self.annotationAboutInteraction = (
            "The settings should also auto apply when you change them,\n "+
            "but due to a Maya bug, you may occasionally have to apply manually,\n "+
            "with the button."
        )
        
        
        
        
        try:
            initialMultiplier = pm.melGlobals['MmmmToolsModelerGridToolsMultiplier']
        except:
            initialMultiplier = 1.0
            pm.melGlobals.initVar( 'float', 'MmmmToolsModelerGridToolsMultiplier' )
            pm.melGlobals['MmmmToolsModelerGridToolsMultiplier'] = 1.0
        initialSpacing =(
            (    pm.grid( query=True, spacing=True ) / pm.grid( query=True, divisions=True )    )
            /
            initialMultiplier
        )
        initialWholeSize = pm.grid( query=True, size=True ) / initialMultiplier
        
        ## Use this as parent otherwise use something else
        if parentWidget==None:
            parentWidget = self.widgets['parentWidget'] = pm.Window(
                title="Grid Manager", width=100,height=200
            )
        else:
            self.widgets['parentWidget'] = parentWidget
        
        ## Make a shortcut for function that addWidgets
        aw = self.addWidget
        
        with parentWidget:
          with aw( 'col', pm.ColumnLayout() ):
            aw('mayaOptionsButton',pm.Button(label="Maya Grid Options...",
                    command= lambda x: pm.mel.eval("GridOptions;")
                )
            )
            aw('resetButton', pm.Button(label="Reset (To Maya Defaults)",
                command= lambda x: self.resetToMayaDefault()  ) )
            #aw('resetText', pm.Text(label='  '))
            aw('reset2Button', pm.Button(
                    label="Apply These Settings",
                    annotation=self.annotationAboutInteraction,
                    command= lambda x: MmmmToolsMod.Static.Grid.reset_via_numbers(
                        multiplier=self.getMultiplierFromUi(),
                        spacing=self.getSpacingFromUi(),
                        wholeSize=self.getWholeSizeFromUi(),
                        setManip=True,
                    )
                )
            )
            
            
            ## note the "with" doesn't work with rows,
            ## so we manually specify parents
            priorParent=self.widgets['col']
            
            row1 = self.widgets["row1"] = pm.rowLayout( numberOfColumns=2 )
            aw( 'rowText1', pm.Text('Multiplier:', parent=row1)  )
            aw( 'multiplierFloatField', pm.floatField(value=initialMultiplier, parent=row1,
                    annotation="This will mutiply with both spacing and whole size \n " +
                        "to determine the final amount used. \n \n"+
                        self.annotationAboutInteraction,
                    changeCommand= lambda x: self.onChangedField(),
                    enterCommand= lambda x: self.onChangedField(),
                )
            )
            pm.setParent( priorParent )  
            
            row2 = self.widgets["row2"] = pm.rowLayout( numberOfColumns=2 )
            aw( 'rowText2', pm.Text('Spacing:', parent=row2)  )
            aw( 'spacingFloatField', pm.floatField(value=initialSpacing, parent=row2,
                    annotation="This will control grid point spacing,\n "+
                        "and will multiply with multiplier\n "+
                        "to determine the final amount used. \n \n"+
                        self.annotationAboutInteraction,
                    changeCommand= lambda x: self.onChangedField(),
                    enterCommand= lambda x: self.onChangedField(),
                )
            )
            pm.setParent( priorParent )  
            
            row3 = self.widgets["row3"] = pm.rowLayout( numberOfColumns=2 )            
            aw( 'rowText3', pm.Text('Whole:', parent=row3)  )
            aw( 'wholeSizeFloatField', pm.floatField(value=initialWholeSize, parent=row3,
                     annotation="This will control the extents of the whole grid,\n " +
                        "(width/height) and will multiply with multiplier \n "+
                        "to determine the final amount used. \n \n"+
                        "Note, Maya's grid width is like a radius, \n"+
                        "visible grid in Maya always looks twice as tall/wide, \n"+
                        "since the 'size' setting in Maya is distance from grid center, \n"+
                        "that's how Maya is intended to work. \n \n"+
                        self.annotationAboutInteraction,           
                    changeCommand= lambda x: self.onChangedField(),
                    enterCommand= lambda x: self.onChangedField(),
                )
            )
            pm.setParent( priorParent )
            
            row4 = self.widgets["row4"] = pm.rowLayout( numberOfColumns=2 )            
            aw( 'rowText4', pm.Text('Auto adjust discreet move:', parent=row4)  )
            aw( 'setManipCheckBox', pm.CheckBox(value=True, label=' ', parent=row4) )
                ## the checkbox has a built in label, but that shows on wrong side
            pm.setParent( priorParent )  
            
               
               
            aw('spacerBlankText', pm.Text(label='  '))

            aw('snapButton', pm.Button(label="Snap Selected Objs To Grid",
                command= lambda x: MmmmToolsMod.Static.Grid.putSelectedObjsOnGrid()  ) )
            aw('snapButton', pm.Button(label="Snap Selected Verts To Grid",
                command= lambda x: MmmmToolsMod.Static.Grid.snapVertsToGrid()  ) )
            aw('snapText', pm.Text(label='  '))
            
            aw('growButton', pm.Button(label="Grow",
                command= lambda x: self.growWithWarning(log=True)  ) )
            aw('shrinkButton', pm.Button(label="Shrink",
                command= lambda x: self.shrinkWithWarning(log=True)  ) )
            
                
        # Show Window
        if type( parentWidget ) == pm.core.windows.window:
            win = parentWidget
            pm.showWindow(win)
            win.setWidth(200)
            win.setHeight(300)