Пример #1
0
 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)        
Пример #2
0
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)
Пример #3
0
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 )
Пример #4
0
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
Пример #5
0
 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 )
Пример #6
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)
Пример #7
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)
    def tread_create_ui(self):
        self.WINDOW = 'Loop_Motion_Path'
        if pm.window(self.WINDOW, query=True, exists=True):
            pm.deleteUI(self.WINDOW)
        pm.window(self.WINDOW,
                  title="Loop Motion Path",
                  iconName='TR',
                  widthHeight=(200, 220))
        column_1 = pm.columnLayout(adjustableColumn=True)
        pm.separator(height=20, style='none', parent=column_1)
        self.tread_name = pm.TextField(text='Setup_Name', parent=column_1)
        pm.separator(height=20, style='none', parent=column_1)
        # get parent name
        row_col_1 = pm.rowColumnLayout(numberOfColumns=2,
                                       columnWidth=(1, 150),
                                       parent=column_1,
                                       columnOffset=(2, 'left', 10))
        self.curve_name = pm.TextField(text='PathCurve', parent=row_col_1)
        pm.button(label='<<',
                  parent=row_col_1,
                  command=lambda x: self.set_path_name())

        chk_bx_col = pm.rowColumnLayout(parent=column_1,
                                        numberOfColumns=2,
                                        columnWidth=(1, 20))
        pm.text("", parent=chk_bx_col)
        self.dup_crv_chk_bx = pm.checkBox("Duplicate Curve",
                                          parent=chk_bx_col,
                                          value=True)
        pm.separator(height=20, style='in', parent=column_1)
        self.jnt_type_lbl = pm.text(label="object placement type",
                                    align="left",
                                    parent=column_1)
        pm.separator(height=5, style='none', parent=column_1)
        self.jnt_typ_radio = pm.radioCollection(parent=column_1)

        row_layout = pm.rowLayout(numberOfColumns=2,
                                  height=20,
                                  parent=column_1)
        sel_chk_bx_col = pm.rowColumnLayout(parent=column_1,
                                            numberOfColumns=2,
                                            columnWidth=(1, 20))

        info_chk_bx_col = pm.ColumnLayout(parent=column_1)
        self.chk_bx_info = pm.text("", parent=info_chk_bx_col, enable=False)
        pm.text("", parent=sel_chk_bx_col)
        self.sel_obj_chk_bx = pm.checkBox("Use Selection On Curve",
                                          parent=sel_chk_bx_col,
                                          value=False,
                                          enable=False)
        self.divisions = pm.TextField(text='1', parent=column_1)

        pm.radioButton(
            label='uniform',
            parent=row_layout,
            select=True,
            onCommand=lambda x: self.ui_set_selection_enable(flag="uniform"))
        pm.radioButton(
            label='selection',
            parent=row_layout,
            onCommand=lambda x: self.ui_set_selection_enable(flag="selection"))

        pm.separator(height=20, style='none', parent=column_1)
        pm.text("Input sample object (default joint)", parent=column_1)

        sample_row_col = pm.rowColumnLayout(numberOfColumns=2,
                                            columnWidth=(1, 150),
                                            parent=column_1,
                                            columnOffset=(2, 'left', 10))
        self.sample_name = pm.text(label="", parent=sample_row_col)
        pm.button(label='<<',
                  parent=sample_row_col,
                  command=lambda x: self.set_sample_object())
        pm.separator(height=20, style='none', parent=column_1)
        pm.button(label='Create',
                  parent=column_1,
                  command=lambda x: self.setup_motion_path())
        pm.showWindow(self.WINDOW)
        pm.window(self.WINDOW, edit=True, widthHeight=(200, 320))
        return None
Пример #9
0
    def showUI(self):
        """
        this is teh function that creates the ui:
        in the future it will likely change to a Qt GUI
        """
        testWindow = 'HS_Normal_Tool'

        if pm.window(testWindow, exists=True):
            pm.deleteUI(testWindow)

        pm.window(testWindow, sizeable=False)

        pm.rowColumnLayout('normal_Column',
                           numberOfColumns=1,
                           columnWidth=(1, 300),
                           columnAttach=(1, 'left', 5))

        pm.rowLayout('flatRow', parent='normal_Column', numberOfColumns=2)

        pm.button(label='Flat Surface',
                  parent='flatRow',
                  width=100,
                  command=self.btn_connected_flat)

        self.objCheck = pm.checkBox(label='Object Selection',
                                    parent='flatRow',
                                    value=True)

        self.float1 = pm.floatSliderGrp(label='min_tolerance',
                                        parent='normal_Column',
                                        columnAlign=(1, 'left'),
                                        columnWidth=(1, 80),
                                        field=True)
        self.float2 = pm.floatSliderGrp(label='max_tolerance',
                                        parent='normal_Column',
                                        columnAlign=(1, 'left'),
                                        columnWidth=(1, 80),
                                        field=True)

        pm.separator(parent='normal_Column', height=20)

        pm.rowLayout('curveRow', parent='normal_Column', numberOfColumns=2)

        pm.button(label='Curved Surface',
                  parent='curveRow',
                  width=100,
                  command=self.btn_hs_tube)

        self.tubeCheck = pm.checkBox(label='Edge Ring',
                                     parent='curveRow',
                                     value=True)

        pm.separator(parent='normal_Column', height=20)

        pm.button(label='Unlock Selected vtx Normals',
                  parent='normal_Column',
                  command=self.unlockVtxN)

        pm.separator(parent='normal_Column', height=20)

        pm.checkBox(label='Toggle vtx Normals',
                    parent='normal_Column',
                    onCommand=self.btn_show_vtx_normals,
                    offCommand=self.btn_hide_vts_normals)

        self.float3 = pm.floatSliderGrp(
            label='vtx Length',
            parent='normal_Column',
            columnWidth=(1, 55),
            field=True,
            dragCommand=self.vtx_normal_length,
        )

        pm.floatSliderGrp(
            self.float3,
            label='vtx Length',
            edit=True,
            columnWidth=(2, 42),
        )

        pm.separator(parent='normal_Column', height=20)

        pm.rowLayout('blinnRow',
                     parent='normal_Column',
                     numberOfColumns=2,
                     columnWidth=(2, 200))

        pm.button(label='Create Blinn',
                  parent='blinnRow',
                  width=100,
                  command=self.btn_create_blinn)

        self.blinnCol = pm.colorSliderGrp(label='',
                                          parent='blinnRow',
                                          width=190,
                                          columnWidth=(1, 1),
                                          dragCommand=self.edit_blinn)

        pm.showWindow(testWindow)

        pm.window(testWindow, edit=True, widthHeight=(300, 265))
Пример #10
0
    def __init__(self, parentRef=None):
        self.parentRef = parentRef
        self.buttons = []
        self.layoutsR = []
        self.window = pm.window(sizeable=False,
                                title="Vertex Aligner",
                                titleBar=True,
                                resizeToFitChildren=True)
        with self.window:
            self.layoutC = pm.columnLayout()
            with self.layoutC:
                row = pm.rowLayout(numberOfColumns=3)
                self.layoutsR.append(row)
                with row:
                    btn_xMax = pm.button(
                        label=' To X Maximum',
                        command=lambda xc: self.Align_Vertices("x", "max"),
                        width=100)
                    btn_xMid = pm.button(
                        label=' To X Middle',
                        command=lambda xc: self.Align_Vertices("x", "mid"),
                        width=100)
                    btn_xMin = pm.button(
                        label=' To X Minimum',
                        command=lambda xc: self.Align_Vertices("x", "min"),
                        width=100)
                    self.buttons.append(btn_xMax)
                    self.buttons.append(btn_xMid)
                    self.buttons.append(btn_xMin)

                row = pm.rowLayout(numberOfColumns=3)
                self.layoutsR.append(row)
                with row:
                    btn_yMax = pm.button(
                        label=' To Y Maximum',
                        command=lambda xc: self.Align_Vertices("y", "max"),
                        width=100)
                    btn_yMid = pm.button(
                        label=' To Y Middle',
                        command=lambda xc: self.Align_Vertices("y", "mid"),
                        width=100)
                    btn_yMin = pm.button(
                        label=' To Y Minimum',
                        command=lambda xc: self.Align_Vertices("y", "min"),
                        width=100)
                    self.buttons.append(btn_yMax)
                    self.buttons.append(btn_yMid)
                    self.buttons.append(btn_yMin)

                row = pm.rowLayout(numberOfColumns=3)
                self.layoutsR.append(row)
                with row:
                    btn_zMax = pm.button(
                        label=' To Z Maximum',
                        command=lambda xc: self.Align_Vertices("z", "max"),
                        width=100)
                    btn_zMid = pm.button(
                        label=' To Z Middle',
                        command=lambda xc: self.Align_Vertices("z", "mid"),
                        width=100)
                    btn_zMin = pm.button(
                        label=' To Z Minimum',
                        command=lambda xc: self.Align_Vertices("z", "min"),
                        width=100)
                    self.buttons.append(btn_zMax)
                    self.buttons.append(btn_zMid)
                    self.buttons.append(btn_zMin)

        # Show Window
        pm.showWindow(self.window)
        self.window.setWidth(300)
        self.window.setHeight(300)