def updateRamp( self, attr ):
        name = self.nodeName
        translator = cmds.getAttr(self.nodeAttr('aiTranslator'))

        uiParent = pm.setParent( q = True )
        controls = pm.columnLayout( uiParent, q=True, ca=True )
        
        curveString = ""
        attr = self.nodeAttr('aiShutterCurve')
        size = cmds.getAttr(attr, size=True)
        if size > 0:
            x = cmds.getAttr(attr+'[0].aiShutterCurveX')
            y = cmds.getAttr(attr+'[0].aiShutterCurveY')
            curveString += str(y) +"," + str(x) +",1"
        else:
            curveString += "1,0,1"
        for i in range(1,size):
            x = cmds.getAttr(attr+'['+str(i)+'].aiShutterCurveX')
            y = cmds.getAttr(attr+'['+str(i)+'].aiShutterCurveY')
            curveString += ","+str(y) +"," + str(x) +",1"
            
        valuesSplit = curveString.split(",")
        
        if controls:
            for c in controls:
                control = c +"|ShutterCurveRowLayout|ShutterCurveGradientControl"
                valueField = c +"|ShutterCurveRowLayout|ShutterCurveColumLayout|ShutterCurveValueLayout|ShutterCurveValueField"
                positionField = c +"|ShutterCurveRowLayout|ShutterCurveColumLayout|ShutterCurvePositionLayout|ShutterCurvePositionField"
                cmds.gradientControlNoAttr( control, edit=True, asString=curveString)
                current = cmds.gradientControlNoAttr( control, query=True, currentKey=True) 
                
                pm.floatField(valueField, edit=True, value=float(valuesSplit[current*3]))
                pm.floatField(positionField, edit=True, value=float(valuesSplit[current*3+1]))
Beispiel #2
0
def _build_ui_prefs_frame(parent_layout):
    pm.frameLayout(label="UI", collapsable=True)
    ui_prefs_column = pm.columnLayout(adj=True, columnAttach=('both', 5))

    pm.separator(height=2, style='none')

    # Shader range row layout
    pm.rowLayout(numberOfColumns=3,
                 adjustableColumn=2,
                 columnAttach=(1, 'left', 0),
                 columnWidth=[(1, 113), (2, 50), (3, 50)],
                 height=20)

    pm.text(label='Shader range:')

    # Axis limit shader range float field
    pm.floatField("f_shaderRange",
                  min=0,
                  pre=0,
                  value=20,
                  changeCommand=mimic_utils.set_shader_range)

    # Set axis limit shader range button
    pm.button(label=' Set ',
              width=50,
              height=20,
              command=mimic_utils.set_shader_range)

    pm.setParent(ui_prefs_column)
    pm.separator(height=8, style='none')
    pm.setParent(parent_layout)
Beispiel #3
0
    def randPlacement(self, objectList, *args):

        input_randomizeRadius = pm.intField(self.widgets['randomizeRadius'],
                                            q=True,
                                            v=True)

        max = input_randomizeRadius

        min = input_randomizeRadius * -1

        # loop through
        for object in objectList:

            # spread
            randomNumberX = rand.randint(min, max)
            randomNumberZ = rand.randint(min, max)

            randomRotate = rand.randint(0, 360)

            randomScale = rand.uniform(
                (pm.floatField(
                    self.widgets['randomizeScaleMIN'], q=True, v=True)),
                (pm.floatField(
                    self.widgets['randomizeScaleMAX'], q=True, v=True)))

            pm.setAttr(object + '.tx', randomNumberX)
            pm.setAttr(object + '.tz', randomNumberZ)

            pm.setAttr(object + '.ry', randomRotate)

            pm.setAttr(object + '.sx', randomScale)
            pm.setAttr(object + '.sy', randomScale)
            pm.setAttr(object + '.sz', randomScale)
def applyCallback( pNoiseOption, pMaxValueField, pMinValueField, *pArgs ):
    
    NoiseOptionState = pm.optionMenu( pNoiseOption, query=True, value=True )
    MaxValue = pm.floatField( pMaxValueField, query=True, value=True )
    MinValue = pm.floatField( pMinValueField, query=True, value=True )
    
    GenerateVertexColor( NoiseOptionState, MaxValue, MinValue )   
def createUI( SWindowTitle, pApplyCallback ):
    
    windowID = 'vcgnWindowID'
    
    # If Window is Already Open, Delete it and Open a New One
    if pm.window( windowID, exists=True ):
        pm.deleteUI( windowID )
        
    # Init Window
    pm.window( windowID, title=SWindowTitle, sizeable=False, resizeToFitChildren=True )
        
    pm.rowColumnLayout( numberOfColumns=3, columnWidth=[ (1, 75), (2, 75), (3,75) ], columnOffset=[ (1,'right', 3) ])
        
    pm.text( label='Min Value:' )
        
    # Minimum Value Field, Default = 0.0, min = 0.0, max = 1.0, invisible slider step = 0.01
    MinValueField = pm.floatField( value=0.0, minValue=0.0, maxValue=1.0, step=0.01, annotation="This is the Minimum Value, It Can't Go below 0.0 or above 1.0" )
    pm.separator( h=10, style='none' )
        
    pm.text( label='Max Value:' )
        
    # Maximum Value Field, Default = 1.0, min = 0.0, max = 1.0, invisible slider step = 0.01
    MaxValueField = pm.floatField( value=1.0, minValue=0.0, maxValue=1.0, step=0.01, annotation="This is the Maximum Value, It Can't Go below 0.0 or above 1.0" )
    pm.separator( h=10, style='none' )
    
    # Formatting
    pm.separator( h=10, style='none' )     
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
        
    pm.text( label='Noise Type:' )
    
    # Noise Options - Enabled in 2.0    
    NoiseOption = pm.optionMenu( 'NoiseFunctions', enable=True, annotation="Select Alternate Distributions and Generation Functions Here" )
    pm.menuItem( label='Simple', parent='NoiseFunctions', annotation="A Simple Psuedo Random Noise Function that generates Random Values Between Min and Max" )
    pm.menuItem( label='Perlin', parent='NoiseFunctions', annotation="Try Moving the Object Around for More Variety with Perlin Noise" )
    pm.menuItem( label='3D Weighted', parent='NoiseFunctions', annotation="This Function Uses a Mixed Up Vertex List Randomly Adjust the Appearance of a Psuedo Random Number Generation" )
    pm.menuItem( label='Triangular', parent='NoiseFunctions', annotation="This Function Uses a Psuedo Random Number Generator with a Triangular Distribution" )
    pm.menuItem( label='Gamma', parent='NoiseFunctions', annotation="This Function Uses the Gamma Distribution, Does Not Work Well with Low Min Values, Suggestion Minimum 0.1" )
    pm.separator( h=10, style='none' )
    
    # Formatting
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
    
    # Buttons 
    pm.separator( h=10, style='none' )   
    pm.button( label='Apply', command=functools.partial(pApplyCallback,
                                                        NoiseOption,
                                                        MaxValueField,
                                                        MinValueField) )
        
    def cancelCallback( *Args ):
        if pm.window( windowID, exists=True ):
            pm.deleteUI( windowID )
        
    pm.button( label='Cancel', command=cancelCallback )
        
    pm.showWindow()       
Beispiel #6
0
def ui_export_selection(exec_button):
    """create ui window for export to abc and guerilla
    """
    if pmc.window('exportabc', exists=True):
        pmc.deleteUI('exportabc')
    pmc.window('exportabc', menuBar=True, width=200, height=50)
    pmc.columnLayout()
    pmc.radioCollection('framemode')
    pmc.radioButton('currentframe', label='Current frame')
    pmc.radioButton('timeslider', label='Time Slider')
    pmc.radioButton('startend', label='Start / End')
    pmc.separator()
    pmc.text(label='Start frame')
    pmc.intField('start')
    pmc.text(label='End frame')
    pmc.intField('end')
    pmc.separator()
    pmc.checkBox('preroll', label='Pre roll')
    pmc.intField('prerollstart')
    pmc.text(label='Step')
    pmc.floatField('step', value=1.0)
    pmc.separator()
    pmc.checkBox('guerilla', label='Send to Guerilla')
    pmc.separator()
    pmc.button('export', label='Export', width=250, c=exec_button)
    pmc.showWindow()
 def createRamp( self, attr ):
     #Create the control fields
     pm.columnLayout( )
     
     cmds.rowLayout(nc=2, cw2=(142,220))
     pm.text("Shutter Curve");
     pm.text(" ");
     pm.cmds.setParent('..')
     
     cmds.rowLayout("ShutterCurveRowLayout",nc=2, cw2=(142,220))
     
     pm.columnLayout("ShutterCurveColumLayout")
     cmds.rowLayout("ShutterCurveValueLayout", nc=2, cw2=(60,45))
     pm.text("Value");
     valueField = pm.floatField("ShutterCurveValueField");
     pm.cmds.setParent('..')
     
     pm.rowLayout("ShutterCurvePositionLayout", nc=2, cw2=(60,45))
     pm.text("Position");
     
     positionField = cmds.floatField("ShutterCurvePositionField");
     pm.cmds.setParent('..')
     
     '''pm.rowLayout(nc=2, cw2=(60,65))
     pm.text("Interpol.");
     pm.optionMenu(changeCommand=self.updateRamp )
     pm.menuItem( label='None' )
     pm.menuItem( label='Linear' )
     pm.menuItem( label='Smooth' )
     pm.menuItem( label='Spline' )
     pm.cmds.setParent('..')'''
     pm.cmds.setParent('..')
     
     gradient = pm.gradientControlNoAttr("ShutterCurveGradientControl", w=200, h=100 )
     pm.gradientControlNoAttr( gradient, edit=True, changeCommand=pm.Callback(self.syncAttribute,attr,gradient, valueField, positionField) )
     
     #Initialize the curve with the values in the attribute
     curveString = ""
     attr = self.nodeAttr('aiShutterCurve')
     size = cmds.getAttr(attr, size=True)
     startX = 0
     startY = 1
     if size > 0:
         x = cmds.getAttr(attr+'[0].aiShutterCurveX')
         y = cmds.getAttr(attr+'[0].aiShutterCurveY')
         startX = x
         startY = y
         curveString += str(y) +"," + str(x) +",1"
     else:
         curveString += "1,0,1"
     for i in range(1,size):
         x = cmds.getAttr(attr+'['+str(i)+'].aiShutterCurveX')
         y = cmds.getAttr(attr+'['+str(i)+'].aiShutterCurveY')
         curveString += ","+str(y) +"," + str(x) +",1"
         
     cmds.gradientControlNoAttr( gradient, edit=True, asString=curveString) 
     
     pm.floatField(valueField, edit=True, value=startY, changeCommand=pm.Callback(self.updateValue, attr, gradient, valueField, positionField))
     pm.floatField(positionField, edit=True, value=startX, changeCommand=pm.Callback(self.updatePosition, attr, gradient, valueField, positionField))
Beispiel #8
0
def setFrameRangeEnd(value):
    pymel.floatField(
        'MayaWindow|toolBar5|MainPlaybackRangeLayout|formLayout10|floatField4',
        edit=True,
        value=value)
    mel.eval(
        'setMaxPlayback MayaWindow|toolBar5|MainPlaybackRangeLayout|formLayout10|floatField4;'
    )
def createUI( SWindowTitle, pApplyCallback ):
    
    windowID = 'vcgnWindowID'
    
    # If Window is Already Open, Delete it and Open a New One
    if pm.window( windowID, exists=True ):
        pm.deleteUI( windowID )
        
    # Init Window
    pm.window( windowID, title=SWindowTitle, sizeable=False, resizeToFitChildren=True )
        
    pm.rowColumnLayout( numberOfColumns=3, columnWidth=[ (1, 75), (2, 75), (3,75) ], columnOffset=[ (1,'right', 3) ])
        
    pm.text( label='Min Value:' )
        
    # Minimum Value Field, Default = 0.0, min = 0.0, max = 1.0, invisible slider step = 0.01
    MinValueField = pm.floatField( value=0.0, minValue=0.0, maxValue=1.0, step=0.01 )
    pm.separator( h=10, style='none' )
        
    pm.text( label='Max Value:' )
        
    # Maximum Value Field, Default = 1.0, min = 0.0, max = 1.0, invisible slider step = 0.01
    MaxValueField = pm.floatField( value=1.0, minValue=0.0, maxValue=1.0, step=0.01 )
    pm.separator( h=10, style='none' )
    
    # Formatting
    pm.separator( h=10, style='none' )     
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
        
    pm.text( label='Noise Type:' )
    
    # Noise Options - Disabled For Version 1.0 Will Be Enabled in 2.0    
    NoiseOption = pm.optionMenu( 'NoiseFunctions', enable=False )
    pm.menuItem( label='Simple', parent='NoiseFunctions' )
    pm.menuItem( label='Perlin', parent='NoiseFunctions' )
    pm.menuItem( label='OpenSimplex', parent='NoiseFunctions' )
    pm.separator( h=10, style='none' )
    
    # Formatting
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
    
    # Buttons 
    pm.separator( h=10, style='none' )   
    pm.button( label='Apply', command=functools.partial(pApplyCallback,
                                                        NoiseOption,
                                                        MaxValueField,
                                                        MinValueField) )
        
    def cancelCallback( *Args ):
        if pm.window( windowID, exists=True ):
            pm.deleteUI( windowID )
        
    pm.button( label='Cancel', command=cancelCallback )
        
    pm.showWindow()       
 def refresh():
     State._slideParams['start'] = pm.intField(State._wnd.startField, query=True, value=True)
     State._slideParams['end'] = pm.intField(State._wnd.endField, query=True, value=True)
     State._slideParams['X'] = pm.floatField(State._wnd.xSlideField, query=True, value=True)
     State._slideParams['Y'] = pm.floatField(State._wnd.ySlideField, query=True, value=True)
     State._slideParams['Z'] = pm.floatField(State._wnd.zSlideField, query=True, value=True)
     
     pm.iconTextScrollList(State._wnd.selectedObjectsList, edit=True, removeAll=True)
     pm.iconTextScrollList(State._wnd.selectedObjectsList, edit=True, append=list(State._selectedObjects))
Beispiel #11
0
    def duplicateAlongPath(self, *args):
        '''
        ------------------------------------------

            position along curve

        ------------------------------------------
        '''
        inputX = pm.intField(self.widgets['numberOfDuplicates'],
                             q=True,
                             v=True)
        GOD_object = pm.ls(sl=True)[0]
        curve = pm.textFieldButtonGrp(self.widgets['curvePath'],
                                      q=True,
                                      tx=True)
        pathLength = pm.arclen(curve, ch=False)
        randomON = pm.checkBox(self.widgets['RandomPathDistance'],
                               q=True,
                               v=True)
        n = 0

        pathIncrement = 1.0 / inputX

        for increment in range(inputX):

            object = pm.duplicate(GOD_object, rc=True)
            objGroup = pm.group(object)
            motionPath = pm.pathAnimation(objGroup,
                                          fm=True,
                                          f=True,
                                          fa='x',
                                          ua='y',
                                          wut='scene',
                                          c=curve)
            pm.delete(pm.listConnections(motionPath + '.uValue'))
            value = rand.uniform(n, (n + pathIncrement))
            if randomON == True:
                pm.setAttr(motionPath + '.uValue', value)
                randomRotate = rand.randint(0, 360)

                randomScale = rand.uniform(
                    (pm.floatField(self.widgets['randomizeScaleMINPath'],
                                   q=True,
                                   v=True)),
                    (pm.floatField(self.widgets['randomizeScaleMAXPath'],
                                   q=True,
                                   v=True)))
                print object
                pm.setAttr(object[0] + '.ry', randomRotate)
                pm.setAttr(object[0] + '.sx', randomScale)
                pm.setAttr(object[0] + '.sy', randomScale)
                pm.setAttr(object[0] + '.sz', randomScale)
            else:
                pm.setAttr(motionPath + '.uValue', n)
            n = n + pathIncrement
            pm.parent(objGroup, 'ROOT_enviroment_01')
Beispiel #12
0
 def setDrivenVal(self,*args):
     """
      When the changeMenu is triggered for the Driven attribute option menu, set the value to
      the new attribute.
     """
     obj = pm.textFieldGrp(self.drivenField, q=True, text=True)
     attr = pm.optionMenu(self.drivenAttField, q=True, v=True)
     val = pm.getAttr('%s.%s' % (obj, attr) )
     
     pm.floatField(self.drivenValueField, e=True, v=float(val))
Beispiel #13
0
    def __init__(self):
        with pm.frameLayout(l='Transform:', cll=True, cl=False, bs='out'):
            with pm.columnLayout():
                with pm.gridLayout(nc=5):
                    pm.iconTextButton(image1='pbUV/tRot90CCW.png', c=lambda *args: self.rotate(angle=90, dir='ccw'),
                                      commandRepeatable=True)
                    pm.iconTextButton(image1='pbUV/tRotCCW.png', c=lambda *args: self.rotate(dir='ccw'),
                                      commandRepeatable=True)
                    pm.iconTextButton(image1='pbUV/tTranslateUp.png', c=lambda *args: self.move(v=1),
                                      commandRepeatable=True)
                    pm.iconTextButton(image1='pbUV/tRotCW.png', c=lambda *args: self.rotate(dir='cw'))
                    pm.iconTextButton(image1='pbUV/tRot90CW.png', c=lambda *args: self.rotate(angle=90, dir='cw'),
                                      commandRepeatable=True)

                    flipuv = pm.iconTextButton(image1='pbUV/tFlipUV.png', c=lambda *args: self.flip(axis='u'),
                                               commandRepeatable=True)
                    pm.popupMenu(button=3, p=flipuv, pmc=lambda *args: self.flip(axis='v'))
                    pm.iconTextButton(image1='pbUV/tTranslateLeft.png', c=lambda *args: self.move(u=-1),
                                      commandRepeatable=True)
                    pm.iconTextButton(image1='pbUV/tTranslateDown.png', c=lambda *args: self.move(v=-1),
                                      commandRepeatable=True)
                    pm.iconTextButton(image1='pbUV/tTranslateRight.png', c=lambda *args: self.move(u=1),
                                      commandRepeatable=True)
                    pm.iconTextButton(image1='pbUV/tRot180CCW.png', c=lambda *args: self.rotate(angle=180, dir='ccw'),
                                      commandRepeatable=True)

                with pm.rowColumnLayout(nc=4):
                    self.manipValue = pm.floatField(v=1.0)
                    pm.iconTextButton(image1='pbUV/tScaleU.png', c=lambda *args: self.scale(axis='u'),
                                      commandRepeatable=True)
                    pm.iconTextButton(image1='pbUV/tScaleV.png', c=lambda *args: self.scale(axis='v'),
                                      commandRepeatable=True)
                    pm.iconTextButton(image1='pbUV/tScaleUV.png', c=lambda *args: self.scale(),
                                      commandRepeatable=True)

                pm.separator(st='in', width=160, height=8)

                with pm.rowLayout(nc=2):
                    pm.button(l='Orient Edge', c=self.orient_edge)
                    pm.button(l='Orient Bounds', c=self.orient_bounds)

                pm.separator(st='in', width=160, height=8)

                with pm.columnLayout(cal='left'):
                    pm.text(l='Pivot:')
                    self.pivType = pm.radioButtonGrp(nrb=2, labelArray2=['Selection', 'Custom'], cw2=[64, 64],
                                                     cc=self._piv_change, sl=1)
                    with pm.rowLayout(nc=3, en=False) as self.pivPos:
                        pm.text('POS:')
                        self.pivU = pm.floatField()
                        self.pivV = pm.floatField()
                    self.sampleSel = pm.button(l='Sample Selection', height=18, en=False, c=self.sample_sel_cmd)
 def initialiseLayout(self):
     """ define the layout of the ui,
         also find every module under the TOOL_FOLDER, create a button for each module found"""
     
     #=======================================================================
     #DEFINE LAYOUT
     #=======================================================================
     self.widgets["toplevel_column"] = pm.columnLayout(adj=True)
     
     # ASSET LAYOUT
     pm.setParent(self.widgets["toplevel_column"])
     pm.frameLayout(label='Asset', collapsable=False, labelVisible=False)
     h = pm.horizontalLayout(ratios=[1,5])
     pm.text("Search :")
     self.widgets['assets_searchFilter_textField'] = pm.textField(cc=self.refresh_asset_textScroll)
     h.redistribute()
     pm.setParent("..")
     self.widgets['assets_textScroll'] = pm.textScrollList(ams=True, h=200, selectCommand=self.select_asset_callback)
     
     # IMAGE LAYOUT
     pm.setParent(self.widgets["toplevel_column"])
     pm.frameLayout(label='Image', collapsable=True, labelVisible=True)
     pm.scrollLayout(h=130)
     pm.popupMenu()        
     pm.menuItem(label='Open Thumbnail Directory', c=self.thumbnail_directory_open_callback)
     self.widgets['thumbnails_brower'] = pm.horizontalLayout()
     self.widgets['thumbnails_brower'].redistribute()
     
     #
     pm.setParent(self.widgets["toplevel_column"])
     pm.frameLayout(label='Settings', collapsable=True, labelVisible=True)
     pm.rowColumnLayout(numberOfColumns=4)
     pm.text(label='Zoom', w=100)
     self.widgets['zoom_field'] = pm.floatField(minValue=1, value=1, precision=2, w=100)
     pm.separator(style='none')
     pm.separator(style='none')
     pm.text(label='Width', w=100)
     self.widgets['width_field'] = pm.intField(value=100, w=100)
     pm.text(label='Height', w=100)
     self.widgets['height_field'] = pm.intField(value=100, w=100)
     pm.text(label='Offset W', w=100)
     self.widgets['shiftWidth_field'] = pm.floatField( value=0, precision=2, w=100)
     pm.text(label='Offset H', w=100)
     self.widgets['shiftHeight_field'] = pm.floatField( value=0, precision=2, w=100)
     
     
     #
     pm.setParent(self.widgets["toplevel_column"])
     pm.button(label='Generate Thumbnails', c=self.generate_thumbnail)
     
     #INITIAL
     self.refresh_asset_textScroll()
Beispiel #15
0
def timeSliderScrub():
    rangeMin = int(pymel.floatField('MayaWindow|toolBar5|MainPlaybackRangeLayout|formLayout10|floatField3', query=True, value=True))
    rangeMax = int(pymel.floatField('MayaWindow|toolBar5|MainPlaybackRangeLayout|formLayout10|floatField4', query=True, value=True))
    currentTime = pymel.currentTime(query=True)

    def sliderCmd(scrubWidget, values):
        time = values[0]
        cmds.currentTime(time)

    scrubSlider = createScrubSlider(sliderRange=(rangeMin, rangeMax), changeCommand=sliderCmd,
                                    defaultValues=[currentTime,], visible=False)

    return scrubSlider
Beispiel #16
0
    def __init__(self, par):
        ToolsUI.__init__(self, par)
        with pm.columnLayout() as self.layout:
            with pm.rowLayout(nc=4):
                pm.floatField('uvEntryFieldU', precision=3, ed=True, width=46,
                              ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kEnterValueTotransformInUAnnot'),
                              cc=lambda *args: pm.mel.textureWindowUVEntryCommand(1))

                pm.floatField('uvEntryFieldV', precision=3, ed=True, width=46,
                              ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kEnterValueTotransformInVAnnot'),
                              cc=lambda *args: pm.mel.textureWindowEntryCommand(0))

                pm.iconTextButton(image1='uv_update.png',
                                  ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kRefreshUVValuesAnnot'),
                                  c=self.uv_update,
                                  commandRepeatable=True)

                pm.iconTextCheckBox('uvEntryTransformModeButton', image1='uvEntryToggle.png',
                                    ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kUVTransformationEntryAnnot'),
                                    value=pm.melGlobals['gUVEntryTransformMode'],
                                    onc=lambda *args: pm.mel.uvEntryTransformModeCommand(),
                                    ofc=lambda *args: pm.mel.uvEntryTransformModeCommand())

            with pm.rowLayout(nc=6):
                copyuv = pm.iconTextButton('copyUVButton', image1='copyUV.png',
                                           ann=pm.mel.getRunTimeCommandAnnotation('PolygonCopy'),
                                           c=lambda *args: pm.mel.PolygonCopy())
                pm.popupMenu('copyUVButtonPopup', button=3, p=copyuv, pmc=lambda *args: pm.mel.PolygonCopyOptions())

                pasteuv = pm.iconTextButton('pasteUVButton', image1='pasteUV.png',
                                            ann=pm.mel.getRunTimeCommandAnnotation('PolygonPaste'),
                                            c=lambda *args: pm.mel.PolygonPaste())
                pm.popupMenu('pasteUVButtonPopup', button=3, p=pasteuv, pmc=lambda *args: pm.mel.PolygonPasteOptions())

                pm.iconTextButton('pasteUButton', image1='pasteUDisabled.png', en=False,
                                  ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kPasteUValueAnnot'),
                                  c=lambda *args: pm.mel.textureWindowCreateToolBar_uvPaste(1, 0))

                pm.iconTextButton('pasteVButton', image1='pasteVDisabled.png', en=False,
                                  ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kPasteVValueAnnot'),
                                  c=lambda *args: pm.mel.textureWindowCreateToolBar_uvPaste(0, 1))

                pm.iconTextCheckBox(image1='copyUVMode.png',
                                    ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kToggleCopyPasteAnnot'),
                                    onc=lambda *args: pm.mel.textureWindowCreateToolBar_copyPasteMode(1),
                                    ofc=lambda *args: pm.mel.textureWindowCreateToolBar_copyPasteMode(0))

                pm.iconTextButton(image1='cycleUVs.png',
                                  ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kCycleUVsCounterClockwiseAnnot'),
                                  c=lambda *args: pm.mel.polyRotateUVsByVertex(),
                                  commandRepeatable=True)
Beispiel #17
0
    def __init__(self):
        self._window    = pm.window(title='Vibrate', widthHeight=VibrateWindow._size, sizeable=False, maximizeButton=False)
        self._wrapper   = pm.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, VibrateWindow._size[0]), (2, VibrateWindow._size[0])], height=VibrateWindow._size[1])
        self._form      = pm.formLayout(parent=self._wrapper, height=470)
        self._execBtn   = pm.button(label='Set Vibration', parent=self._wrapper, command=State.setVibration)
        self._clearBtn  = pm.button(label='Clear Vibration', parent=self._wrapper, command=State.clearVibration)
        self._tabs      = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5)
        self._subform   = pm.formLayout(self._form, edit=True, attachForm=((self._tabs, 'top', 0), (self._tabs, 'left', 0), (self._tabs, 'bottom', 0), (self._tabs, 'right', 0)))

        self._tabObjects = pm.rowColumnLayout(numberOfColumns=1)
        pm.button(label='Add selected from scene', command=State.addSelectedObjectsFromScene)
        pm.button(label='Remove selected in scene', command=State.removeSelectedObjectInScene)
        pm.button(label='Remove selected in list', command=State.removeSelectedObjectsInList)
        pm.button(label='Remove all', command=State.removeAllObjects)
        self.selectedObjectsList = pm.iconTextScrollList(allowMultiSelection=True, height=(VibrateWindow._size[1] - 150))
        pm.setParent('..')

        self._tabVibration = pm.rowColumnLayout(numberOfColumns=1)

        pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)])
        pm.text(label='Start frame:')
        self.startField = pm.intField(minValue=-999999, maxValue=999999, step=1, value=0)
        pm.setParent('..')
        
        pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)])
        pm.text(label='End frame:')
        self.endField = pm.intField(minValue=-999999, maxValue=999999, step=1, value=1)
        pm.setParent('..')
        
        pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)])
        pm.text(label='X Force:')
        self.xForceField = pm.floatField(minValue=0.0, maxValue=999999.9, step=0.1, value=1.0)
        pm.setParent('..')
        
        pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)])
        pm.text(label='Y Force:')
        self.yForceField = pm.floatField(minValue=0.0, maxValue=999999.9, step=0.1, value=1.0)
        pm.setParent('..')
        
        pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)])
        pm.text(label='Z Force:')
        self.zForceField = pm.floatField(minValue=0.0, maxValue=999999.9, step=0.1, value=1.0)
        pm.setParent('..')
        
        pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)])
        pm.text(label='Speed:')
        self.speedField = pm.floatField(minValue=0.0, maxValue=999999.9, step=0.2, value=1.0)
        pm.setParent('..')
        
        pm.tabLayout(self._tabs, edit=True, tabLabel=((self._tabObjects, 'Objects'), (self._tabVibration, 'Vibration')))
Beispiel #18
0
    def targetSelected(self):
        sel = selected()
        targetIndex = self.targets.getSelectIndexedItem()
        if not targetIndex:
            return

        i = targetIndex[0] - 1

        targets = space.getTargetInfo(sel[0])
        targetConstraints = space._targetInfoConstraints[:]

        self.clearMultiTarget()
        if targets[i].type in [
                space.Mode.MULTI_PARENT, space.Mode.MULTI_ORIENT
        ]:

            with rowColumnLayout(nc=2, p=self.multiUI):
                state = space.serializeSpaces(sel[0])[i]

                weights = targetConstraints[i].getWeightAliasList()

                for t_i, (target, val) in enumerate(
                        zip(state['targets'], state['extra'])):
                    text(l=target[0])  # target is a pair, name and cardpath
                    f = floatField(v=val, min=0, max=1)
                    connectControl(f, weights[t_i])
Beispiel #19
0
 def create(self):
     '''
     # this creates the float field
     '''
     current_time = pm.keyframe( '%s' % (self.node) , query=True, index= (self.index, self.index), valueChange= True )[0]
     self.int_field = pm.floatField(value= float(current_time), annotation= 'change the value for the keyframe',
                             changeCommand= pm.Callback(self.change_value))
Beispiel #20
0
 def create(self):
     current_time = pm.keyframe('%s' % (self.node),
                                query=True,
                                index=(self.index, self.index),
                                valueChange=True)[0]
     self.int_field = pm.floatField(value=float(current_time),
                                    changeCommand=pm.Callback(
                                        self.change_value))
Beispiel #21
0
    def build_all_rig(self):
        self.namespace_name = pm.textField(self.namespace_txt, q=True, text=True)
        self.spine_num = pm.floatField(self.spine_float, q=True, v=True)
        self.neck_num = pm.floatField(self.neck_float, q=True, v=True)

        if self.namespace_name != '':
            pm.namespace( add=self.namespace_name)
        else:
            pass

        self.Rig = adb_build_autoRig.autoRig()
        self.Rig.build_legs()
        self.Rig.build_arms()
        self.Rig.build_spine(int(self.spine_num))

        pm.PyNode('x__guide_autoRig__grp__').v.set(0)
        sys.stdout.write('Auto rig is build \n')
def cam_set_cam_attrs(cameraListDropdown, *args, **kwargs):
  ''' '''
  camera = cameraListDropdown.getValue()
  focalLength = pm.floatField(prefix+'_floatField_focal_length', query=True, value=True)
  nearClip = pm.floatField(prefix+'_floatField_near_clip_plane', query=True, value=True)
  farClip = pm.floatField(prefix+'_floatField_far_clip_plane', query=True, value=True)
  overscan = pm.floatField(prefix+'_floatField_overscan', query=True, value=True)
  bkgdColor = pm.colorSliderGrp(prefix+'_colorSliderGrp_background_color', query=True, rgb=True )
  topColor = pm.colorSliderGrp(prefix+'_colorSliderGrp_gradient_top', query=True, rgb=True )
  bottomColor = pm.colorSliderGrp(prefix+'_colorSliderGrp_gradient_bottom', query=True, rgb=True )
  
  pm.setAttr(camera+'.focalLength', focalLength)
  pm.setAttr(camera+'.nearClipPlane', nearClip)
  pm.setAttr(camera+'.farClipPlane', farClip)
  pm.setAttr(camera+'.overscan', overscan)
  pm.displayRGBColor('background', bkgdColor[0], bkgdColor[1], bkgdColor[2])
  pm.displayRGBColor('backgroundTop', topColor[0], topColor[1], topColor[2])
  pm.displayRGBColor('backgroundBottom', bottomColor[0], bottomColor[1], bottomColor[2])
def lcCameraToolsUI(dockable=False, *args, **kwargs):
  ''' '''
  ci = 0 #color index iterator
  windowName = 'lcCameraTools'
  shelfCommand = 'import lct.src.lcCameraTools.lcCameraTools as lcCam\nreload(lcCam)\nlcCam.lcCameraToolsUI()'
  icon = basePath+'lcCameraTools.png'
  winWidth  = 204
  winHeight = 209
  
  mainWindow = lcWindow(windowName=windowName, width=winWidth, height=winHeight, icon=icon, shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True)
  mainWindow.create()
  pm.menu(l='Options', helpMenu=True)
  pm.menuItem(l='Reset Gradient Colors', command=lambda *args: cam_set_default_colors() )

  #
  pm.columnLayout(prefix+'_columLayout_main')
  
  #
  pm.rowColumnLayout(nc=2, cw=([1,50], [2,150]) )
  pm.text(l='Edit:', al='right')
  cameraListDropdown = pm.optionMenu(prefix+'_optionMenu_camera_list', bgc=colorWheel.getColorRGB(ci), w=150, h=25 )
  ci+=1
  cameraListDropdown.changeCommand(lambda *args: cam_get_cam_attrs(cameraListDropdown) )
  pm.setParent(prefix+'_columLayout_main')
  
  #  
  pm.rowColumnLayout(nc=2, cw=([1,125], [2,75]) )
  pm.text(l='Focal Length:', al='right')
  pm.floatField(prefix+'_floatField_focal_length', min=0.0, v=0.0, pre=1, w=75, changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown), receiveFocusCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
  pm.text(l='Near Clip Plane:', al='right')
  pm.floatField(prefix+'_floatField_near_clip_plane', min=0.0, v=0.0, pre=4, w=75, changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown), receiveFocusCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
  pm.text(l='Far Clip Plane:', al='right')
  pm.floatField(prefix+'_floatField_far_clip_plane', min=0.0, v=0.0, pre=0, w=75, changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown), receiveFocusCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
  pm.text(l='Overscan:', al='right')
  pm.floatField(prefix+'_floatField_overscan', min=0.0, v=0.0, pre=3, w=75, changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown), receiveFocusCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
  pm.text(l='Background Color:', al='right')
  pm.colorSliderGrp(prefix+'_colorSliderGrp_background_color', cw1=50, rgb=(0.0,0.0,0.0), changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
  pm.text(l='Gradient Top:', al='right')
  pm.colorSliderGrp(prefix+'_colorSliderGrp_gradient_top', cw1=50, rgb=(0.54,0.62,0.70), changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
  pm.text(l='Gradient Bottom:', al='right')
  pm.colorSliderGrp(prefix+'_colorSliderGrp_gradient_bottom', cw1=50, rgb=(0.1,0.1,0.1), changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) )
  pm.setParent(prefix+'_columLayout_main')
  
  #
  pm.rowColumnLayout(nc=2, cw=([1,175], [2,25]) )
  pm.button(prefix+'_button_toggle_bkgd', l='Toggle Background', bgc=colorWheel.getColorRGB(ci), w=200, h=25, annotation='Toggle between flat color and gradient background', command=lambda *args: camera.toggleBackground() )
  ci+=1
  pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'addToShelf.png', highlightImage=iconBasePath+'addToShelf_over.png', annotation='Add to Shelf', command=lambda *args: shelf.makeShelfButton('Toggle Camera Background', 'from lct.src.core.lcUtility import Camera as camera\ncamera.toggleBackground()', iconBasePath+'toggleBackground.png', "Toggle Camera's Viewport Background") )

  #
  mainWindow.show()
  
  cam_populate_camera_list(cameraListDropdown)  
  cam_get_cam_attrs(cameraListDropdown)
Beispiel #24
0
def build_spring(*args):
    dist = pm.floatField("distance", q=True, v=True)
    hostName = pm.textField("hostUI", q=True, text=True)
    try:
        hostUI = pm.PyNode(hostName)
    except TypeError:
        hostUI = False
    invertX = pm.checkBox("invertX", q=True, v=True)

    postSpring(dist, hostUI, hostUI, invertX)
Beispiel #25
0
    def __init__(self, opts):
        self.opts = opts
        with pm.frameLayout(l='Texel Density:', cll=True, cl=False, bs='out'):
            with pm.columnLayout(width=162):
                with pm.rowLayout(nc=2):
                    pm.text(l='Pixels Per Unit:')
                    self.texelDensity = pm.floatField(v=1)

                with pm.rowColumnLayout(nc=2):
                    pm.button(l='Set Density', c=self.set_density)
                    pm.button(l='Sample Density', c=self.sample_density)
Beispiel #26
0
def spring_UI(*args):
    """Creates the post tool UI"""

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

    window = pm.window("mGear_spring_window",
                       title="mGear post Spring",
                       w=350,
                       h=200,
                       mxb=False,
                       sizeable=False)

    pm.rowColumnLayout(numberOfColumns=2,
                       columnAttach=(1, 'right', 0),
                       columnWidth=[(1, 100), (2, 250)])

    pm.text("spring Distance: ")
    pm.floatField("distance",
                  annotation="distane in X local for the spring  position",
                  w=50,
                  value=5)
    pm.text(label="Invert X to -X: ")
    pm.checkBox("invertX", label=" Invert X direction to -X ")
    pm.text(label="UI Host: ")
    pm.textField("hostUI")

    pm.separator(h=10)
    pm.button(label="Spring Me bro!!", w=150, h=50, command=build_spring)
    pm.separator(h=10)

    pm.separator(h=10)
    pm.separator(h=10)
    pm.text(label="Instructions: Select controls in order from root to tip",
            align="left")
    pm.separator(h=10)
    pm.separator(h=10)
    pm.separator(h=10)
    pm.button(label="Baker", w=50, h=50, command=bake_spring)

    pm.showWindow(window)
    def updateRamp(self, attr):
        name = self.nodeName
        translator = cmds.getAttr(self.nodeAttr('aiTranslator'))

        uiParent = pm.setParent(q=True)
        controls = pm.columnLayout(uiParent, q=True, ca=True)

        curveString = ""
        attr = self.nodeAttr('aiShutterCurve')
        size = cmds.getAttr(attr, size=True)
        if size > 0:
            x = cmds.getAttr(attr + '[0].aiShutterCurveX')
            y = cmds.getAttr(attr + '[0].aiShutterCurveY')
            curveString += str(y) + "," + str(x) + ",1"
        else:
            curveString += "1,0,1"
        for i in range(1, size):
            x = cmds.getAttr(attr + '[' + str(i) + '].aiShutterCurveX')
            y = cmds.getAttr(attr + '[' + str(i) + '].aiShutterCurveY')
            curveString += "," + str(y) + "," + str(x) + ",1"

        valuesSplit = curveString.split(",")

        if controls:
            for c in controls:
                control = c + "|ShutterCurveRowLayout|ShutterCurveGradientControl"
                valueField = c + "|ShutterCurveRowLayout|ShutterCurveColumLayout|ShutterCurveValueLayout|ShutterCurveValueField"
                positionField = c + "|ShutterCurveRowLayout|ShutterCurveColumLayout|ShutterCurvePositionLayout|ShutterCurvePositionField"
                cmds.gradientControlNoAttr(control,
                                           edit=True,
                                           asString=curveString)
                current = cmds.gradientControlNoAttr(control,
                                                     query=True,
                                                     currentKey=True)

                pm.floatField(valueField,
                              edit=True,
                              value=float(valuesSplit[current * 3]))
                pm.floatField(positionField,
                              edit=True,
                              value=float(valuesSplit[current * 3 + 1]))
 def updatePosition(self, attr, control, valueField, positionField):
     value = pm.floatField(positionField, query=True, value=True)
     
     values = cmds.gradientControlNoAttr( control, query=True, asString=True) 
     valuesSplit = values.split(',')
         
     current = cmds.gradientControlNoAttr( control, query=True, currentKey=True) 
     
     valuesSplit[current*3+1] = str(value)
     values = ",".join(valuesSplit)
     
     pm.gradientControlNoAttr( control, edit=True, asString=values)
     self.syncAttribute(attr, control, valueField, positionField)
Beispiel #29
0
	def execRemap(*args):
		remapType = pm.optionMenu(match_mnu, q= 1, v= 1)
		tirm = tirm_mqsb.isChecked()
		sel_src = not hSrc_mqsb.isChecked()
		sel_dis = not hTrg_mqsb.isChecked()
		scale = pm.floatField(scale_flt, q= 1, v= 1)
		mirror = [None, 'X', 'Z', 'Y'][pm.radioButtonGrp('mirror_radioBtnGrp' , q= 1, sl= 1) - 1]
		if maya_mqsb.isChecked():
			if _setConn:
				mr.remoteRemap(beam, remapType, tirm, sel_src, sel_dis, scale, mirror)
		else:
			dis = [str(i) for i in pm.textScrollList(trg_sls, q= 1, ai= 1)]
			mr.localRemap(dis, remapType, tirm, sel_src, sel_dis, scale, mirror)
Beispiel #30
0
    def preset(self, num):

        # Overwite textField values with pre-set values based on user's choice
        #     Args:
        #     num(int): Determines which set of values to use

        t_axiom = ''
        t_rule1 = ''
        t_rule2 = ''
        t_itr = 0
        t_angle = 0

        if num == 1:
            t_axiom = 'F'
            t_rule1 = 'F=FF-[-F+F+F]+[+F-F-F]'
            t_itr = 4
            t_angle = 22
            self.is_flat = False
        elif num == 2:
            t_axiom = 'FX'
            t_rule1 = 'F=FF-[-F+F]+[+F-F]'
            t_rule2 = 'X=FF+[+F]+[-F]'
            t_itr = 4
            t_angle = 25
            self.is_flat = False
        elif num == 3:
            t_axiom = 'X'
            t_rule1 = 'X=F-[[X]+X]+F[+FX]-X'
            t_rule2 = 'F=FF'
            t_itr = 4
            t_angle = 25
            self.is_flat = False

        pm.textField('AxiomField', tx=t_axiom, edit=True)
        pm.textField('RuleField1', tx=t_rule1, edit=True)
        pm.textField('RuleField2', tx=t_rule2, edit=True)
        pm.intField('IterationsField', v=t_itr, edit=True)
        pm.floatField('AngleField', v=t_angle, edit=True)
Beispiel #31
0
    def Folli(self):
        if pm.checkBox(
                self.folli_ctrl,
                q=True,
                v=True,
        ) == False:
            radius = pm.floatField(self.radius, q=True, value=True)
            countV = int(pm.floatField(self.folli, q=True, value=True))

            [
                adbFolli.Folli(1, countV, radius=radius, sub=x)
                for x in pm.selected()
            ]

        else:
            radius = pm.floatField(self.radius, q=True, value=True)
            countV = int(pm.floatField(self.folli, q=True, value=True))

            folli = [
                adbFolli.Folli(1, countV, radius=radius, sub=x)
                for x in pm.selected()
            ]
            [x.addControls() for x in folli]
Beispiel #32
0
    def load():
        objIn = State._openLoadFile('objects')
        State._selectedObjects = pickle.load(objIn)
        objIn.close()

        matIn = State._openLoadFile('materials')
        State._selectedMaterials = pickle.load(matIn)
        matIn.close()

        patIn = State._openLoadFile('pattern')
        patList = pickle.load(patIn)
        patIn.close()

        State._wnd.setSelectedPattern(patList.pop())

        patList = patList.pop() + [patList.pop(),]

        for v in [State._wnd.rK, State._wnd.rS, State._wnd.rM, State._wnd.rL, State._wnd.rB, State._wnd.rA]:
            pm.floatField(v, edit=True, value=patList.pop())

        pm.intField(State._wnd.rN, edit=True, value=patList.pop())
        
        State.refresh()
        State._wnd.randomAlgoChanged(None)
Beispiel #33
0
    def load():
        objIn = State._openLoadFile('objects')
        State._selectedObjects = pickle.load(objIn)
        objIn.close()

        vibIn = State._openLoadFile('vibration')
        State._vibrationParams = pickle.load(vibIn)
        vibIn.close()
        
        pm.intField(State._wnd.startField, edit=True, value=State._vibrationParams['start'])
        pm.intField(State._wnd.endField, edit=True, value=State._vibrationParams['end'])
        pm.floatField(State._wnd.xForceField, edit=True, value=State._vibrationParams['X'])
        pm.floatField(State._wnd.yForceField, edit=True, value=State._vibrationParams['Y'])
        pm.floatField(State._wnd.zForceField, edit=True, value=State._vibrationParams['Z'])
        pm.floatField(State._wnd.speedField, edit=True, value=State._vibrationParams['speed'])

        State.refresh()
    def updatePosition(self, attr, control, valueField, positionField):
        value = pm.floatField(positionField, query=True, value=True)

        values = cmds.gradientControlNoAttr(control, query=True, asString=True)
        valuesSplit = values.split(',')

        current = cmds.gradientControlNoAttr(control,
                                             query=True,
                                             currentKey=True)

        valuesSplit[current * 3 + 1] = str(value)
        values = ",".join(valuesSplit)

        pm.gradientControlNoAttr(control, edit=True, asString=values)
        self.syncAttribute(attr, control, valueField, positionField)
Beispiel #35
0
def crearRing():
    cantidad = pm.textFieldGrp(cant, q=True, text=True)
    radio = pm.textFieldGrp(rad, q=True, text=True)
    p1 = pm.floatField(ffp1, q=True, value=True)
    p2 = pm.floatField(ffp2, q=True, value=True)
    p3 = pm.floatField(ffp3, q=True, value=True)
    r1 = pm.floatField(ffr1, q=True, value=True)
    r2 = pm.floatField(ffr2, q=True, value=True)
    r3 = pm.floatField(ffr3, q=True, value=True)
    cbV = pm.checkBox(cb, q=True, value=True)
    cbC = pm.checkBox(cb2, q=True, value=True)
    EXP = pm.floatField(ffrEXP, q=True, value=True)
    INT = pm.floatField(ffrINT, q=True, value=True)
    print(int(cantidad), int(radio), p1, p2, p3, r1, r2, r3, cbV, cbC, EXP,
          INT)

    ringLight(int(radio), int(cantidad), (p1, p2, p3), (r1, r2, r3), cbV, cbC,
              EXP, INT)
Beispiel #36
0
    def get_variables(self):

        # Obtain user input and store them in variables to use later

        self.iterations = pm.intField('IterationsField', q=True, v=True)
        self.angle = pm.floatField('AngleField', q=True, v=True)
        self.axiom = pm.textField('AxiomField', q=True, tx=True)

        # Get all rules from user input

        self.rules = []
        for i in range(1, self.number_of_rules + 1):
            temp = pm.textField('RuleField{0}'.format(i), q=True, tx=True)
            if temp:
                self.rules.append(temp)

        self.check_input(self.iterations, self.axiom, self.rules)
Beispiel #37
0
def createUI( SWindowTitle, pApplyCallback ):
    
    windowID = 'texdenWindowID'
    
    # If Window is Already Open, Delete it and Open a New One
    if pm.window( windowID, exists=True ):
        pm.deleteUI( windowID )
    
    # Init Window
    pm.window( windowID, title=SWindowTitle, sizeable=False, resizeToFitChildren=True )
    
    pm.rowColumnLayout( numberOfColumns=3, columnWidth=[ (1, 95), (2, 75), (3, 75) ], columnOffset=[ (1, 'right', 3) ])
    
    pm.text( label='Texels Per Unit' )
    
    # Field for Desired Texel Density, Default = 1.0, min = 0.0, invisible slider step 1.0
    DensityField = pm.floatField( value=1.0, minValue=0.0, step=1.0, annotation="This is the Desired Texel Density" )
    pm.separator( h=10, style='none' )
    
    pm.text( label='Texture Resolution' )
    
    # Field for Texture Resolution, Default 1
    ResolutionField = pm.intField( value=1, minValue=1, step=1, annotation="This is Texture Resolution" )
    pm.separator(h=10, style='none' )
    
    # Formatting
    pm.separator( h=10, style='none' )     
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
    
    pm.separator( h=10, style='none' )   
    pm.button( label='Apply', command=functools.partial(pApplyCallback,
                                                        DensityField,
                                                        ResolutionField) )
    
        
    def cancelCallback( *Args ):
        if pm.window( windowID, exists=True ):
            pm.deleteUI( windowID )
        
    pm.button( label='Cancel', command=cancelCallback )
    
    pm.showWindow()
    def load():
        objIn = State._openLoadFile('objects')
        State._selectedObjects = pickle.load(objIn)
        objIn.close()

        vibIn = State._openLoadFile('slide')
        State._slideParams = pickle.load(vibIn)
        vibIn.close()
        
        pm.intField(State._wnd.startField, edit=True, value=State._slideParams['start'])
        pm.intField(State._wnd.endField, edit=True, value=State._slideParams['end'])
        pm.floatField(State._wnd.xSpeedField, edit=True, value=State._slideParams['X'])
        pm.floatField(State._wnd.ySpeedField, edit=True, value=State._slideParams['Y'])
        pm.floatField(State._wnd.zSpeedField, edit=True, value=State._slideParams['Z'])

        State.refresh()
Beispiel #39
0
    def make_ui(self):
        window_title = 'L-System'
        window_name = 'lSystem'
        width = 300
        height = 445
        default_radius = 2
        radius_min = 0
        raduis_max = 10

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

        self.window = pm.window(
            window_name,
            title=window_title,
            widthHeight=(width, height),
            mnb=False,
            mxb=False,
            rtf=True,
            sizeable=False,
        )

        pm.columnLayout()

        pm.text(l='L-System Generator',
                w=300,
                h=30,
                bgc=(.7, .7, .7),
                fn='boldLabelFont')
        pm.text(l='', h=5)

        pm.frameLayout(l='Input Rules')
        pm.rowLayout(nc=2, cw2=(50, 245), ct2=('both', 'both'))
        pm.text('AxiomText', l='Axiom:', h=30)
        pm.textField('AxiomField', h=30)
        pm.setParent('..')

        pm.rowLayout(nc=2, cw2=(50, 245), ct2=('both', 'both'))
        pm.text('RuleText1', l='Rule 1:', h=30)
        pm.textField('RuleField1', h=30)
        pm.setParent('..')

        pm.rowLayout(nc=2, cw2=(50, 245), ct2=('both', 'both'))
        pm.text('RuleText2', l='Rule 2:', h=30)
        pm.textField('RuleField2', h=30)
        pm.setParent('..')

        pm.rowLayout(nc=2, cw2=(50, 245), ct2=('both', 'both'))
        pm.text('RuleText3', l='Rule 3:', h=30)
        pm.textField('RuleField3', h=30)
        pm.setParent('..')

        pm.rowLayout(nc=2, cw2=(50, 245), ct2=('both', 'both'))
        pm.text('RuleText4', l='Rule 4:', h=30)
        pm.textField('RuleField4', h=30)
        pm.setParent('..')

        pm.rowLayout(nc=2, cw2=(60, 100), ct2=('both', 'both'))
        pm.text('Iterations', l='Iterations', h=20)
        pm.intField('IterationsField', h=20)
        pm.setParent('..')

        pm.rowLayout(nc=2, cw2=(60, 100), ct2=('both', 'both'))
        pm.text('Angle', l='Angle', h=20)
        pm.floatField('AngleField', h=20)
        pm.setParent('..')

        pm.text(l='', h=5)

        # Finish frame layout for input rules

        pm.setParent('..')

        pm.frameLayout(l='Predefined Trees')
        pm.text(l='', h=5)
        pm.radioButtonGrp(la3=['Shape 1', 'Shape 2', 'Shape 3'],
                          nrb=3,
                          on1=pm.Callback(self.preset, 1),
                          on2=pm.Callback(self.preset, 2),
                          on3=pm.Callback(self.preset, 3))
        pm.text(l='', h=5)
        pm.setParent('..')

        pm.frameLayout(l='Select')
        pm.rowLayout(nc=3, ct3=('both', 'both', 'both'))
        pm.button(l='Create', w=97, h=30, c=pm.Callback(self.draw))
        pm.button(l='Combine', w=97, h=30, c=pm.Callback(self.combine))
        pm.button(l='Delete', w=97, h=30, c=pm.Callback(self.delete_all))
        pm.setParent('..')

        # Finish frame layout for select

        pm.setParent('..')

        self.window.show()
        self.window.setWidthHeight((width, height))
Beispiel #40
0
def applyCallback( pDensityField, pResolutionField, *pArgs ):
    
    FDensityValue = pm.floatField( pDensityField, query=True, value=True )
    IResolutionValue = pm.intField( pResolutionField, query=True, value=True )
    
    setTexelDensity( FDensityValue, IResolutionValue )
Beispiel #41
0
    def uiCreate(self):

        self.onCloseClicked()

        self.window = pm.window(
            WIN_NAME,
            title='PyMel Window',
            maximizeButton=False
        )

        with self.window:
            with pm.formLayout() as uiLAY_mainForm:
                with pm.scrollLayout('uiLAY_mainScroll', childResizable=True) as self.uiLAY_mainScroll:
                    with pm.columnLayout(adjustableColumn=True):

                        with self.uiCreateFrame('uiLAY_frameCheckBoxes', 'Check Boxes (PMCheckBox)') as self.uiLAY_frameCheckBoxes:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=140, style='none')
                                    self.uiCHK_test1 = pm.checkBox('uiCHK_test1', label='test1')
                                    self.uiCHK_test2 = pm.checkBox('uiCHK_test2', label='test2')

                        with self.uiCreateFrame('uiLAY_frameCheckBoxGroups', 'Check Box Groups (PMCheckBoxGrp#)') as self.uiLAY_frameCheckBoxGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiCHKGRP_test1 = pm.checkBoxGrp(
                                    'uiCHKGRP_test1',
                                    numberOfCheckBoxes=1,
                                    label='PMCheckBoxGrp1',
                                    label1='test1'
                                )
                                self.uiCHKGRP_test2 = pm.checkBoxGrp(
                                    'uiCHKGRP_test2',
                                    numberOfCheckBoxes=2,
                                    label='PMCheckBoxGrp2',
                                    labelArray2=('test1', 'test2')
                                )
                                self.uiCHKGRP_test3 = pm.checkBoxGrp(
                                    'uiCHKGRP_test3',
                                    numberOfCheckBoxes=3,
                                    label='PMCheckBoxGrp3',
                                    labelArray3=('test1', 'test2', 'test3')
                                )
                                self.uiCHKGRP_test4 = pm.checkBoxGrp(
                                    'uiCHKGRP_test4',
                                    numberOfCheckBoxes=4,
                                    label='PMCheckBoxGrp4',
                                    labelArray4=('test1', 'test2', 'test3', 'test4')
                                )

                        with self.uiCreateFrame('uiLAY_frameColorSliders', 'Color Slider Groups (PMColorSliderGrp)') as self.uiLAY_frameColorSliders:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiCLRGRP_test1 = pm.colorSliderGrp(
                                    'uiCLRGRP_test1',
                                    label='test1'
                                )
                                self.uiCLRGRP_test2 = pm.colorSliderGrp(
                                    'uiCLRGRP_test2',
                                    label='test2'
                                )

                        with self.uiCreateFrame('uiLAY_frameFloatFields', 'Float Fields (PMFloatField)') as self.uiLAY_frameFloatFields:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=140, style='none')
                                    self.uiFLF_test1 = pm.floatField('uiFLF_test1')
                                    self.uiFLF_test2 = pm.floatField('uiFLF_test2')

                        with self.uiCreateFrame('uiLAY_frameFloatFieldGroups', 'Float Field Groups (PMFloatFieldGrp#)') as self.uiLAY_frameFloatFieldGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiFLFGRP_test1 = pm.floatFieldGrp(
                                    'uiFLFGRP_test1',
                                    numberOfFields=1,
                                    label='PMFloatFieldGrp1'
                                )
                                self.uiFLFGRP_test2 = pm.floatFieldGrp(
                                    'uiFLFGRP_test2',
                                    numberOfFields=2,
                                    label='PMFloatFieldGrp2'
                                )
                                self.uiFLFGRP_test3 = pm.floatFieldGrp(
                                    'uiFLFGRP_test3',
                                    numberOfFields=3,
                                    label='PMFloatFieldGrp3'
                                )
                                self.uiFLFGRP_test4 = pm.floatFieldGrp(
                                    'uiFLFGRP_test4',
                                    numberOfFields=4,
                                    label='PMFloatFieldGrp4'
                                )

                        with self.uiCreateFrame('uiLAY_frameFloatScrollBars', 'Float Scroll Bars (PMFloatScrollBar)') as self.uiLAY_frameFloatScrollBars:
                            with pm.columnLayout(adjustableColumn=True):
                                pm.separator(style='none', height=2)
                                self.uiFLSCRL_test1 = pm.floatScrollBar('uiFLSCRL_test1')
                                self.uiFLSCRL_test2 = pm.floatScrollBar('uiFLSCRL_test2')

                        with self.uiCreateFrame('uiLAY_frameFloatSliders', 'Float Sliders (PMFloatSlider)') as self.uiLAY_frameFloatSliders:
                            with pm.columnLayout(adjustableColumn=True):
                                pm.separator(style='none', height=2)
                                self.uiFLTSLD_test1 = pm.floatSlider('uiFLTSLD_test1')
                                self.uiFLTSLD_test2 = pm.floatSlider('uiFLTSLD_test2')

                        with self.uiCreateFrame('uiLAY_frameFloatSliderGroups', 'Float Slider Groups (PMFloatSliderGrp)') as self.uiLAY_frameFloatSliderGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiFLSGRP_test1 = pm.floatSliderGrp(
                                    'uiFLSGRP_test1',
                                    label='test1',
                                    field=True
                                )
                                self.uiFLSGRP_test2 = pm.floatSliderGrp(
                                    'uiFLSGRP_test2',
                                    label='test2',
                                    field=True
                                )

                        with self.uiCreateFrame('uiLAY_frameIconTextCheckBoxes', 'Icon Text Check Boxes (PMIconTextCheckBox)') as self.uiLAY_frameIconTextCheckBoxes:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiITCHK_test1 = pm.iconTextCheckBox(
                                        'uiITCHK_test1',
                                        style='iconAndTextHorizontal',
                                        label='cube',
                                        image1='cube'
                                    )
                                    self.uiITCHK_test2 = pm.iconTextCheckBox(
                                        'uiITCHK_test2',
                                        style='iconAndTextHorizontal',
                                        label='cone',
                                        image1='cone'
                                    )

                        with self.uiCreateFrame('uiLAY_frameIconTextRadioButtons', 'Icon Text Radio Buttons (PMIconTextRadioButton)') as self.uiLAY_frameIconTextRadioButtons:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=4):
                                    pm.separator(style='none', width=140)
                                    pm.iconTextRadioCollection()
                                    self.uiITRAD_test1 = pm.iconTextRadioButton(
                                        'uiITRAD_test1',
                                        style='iconAndTextHorizontal',
                                        label='cube',
                                        image1='cube'
                                    )
                                    self.uiITRAD_test2 = pm.iconTextRadioButton(
                                        'uiITRAD_test2',
                                        style='iconAndTextHorizontal',
                                        label='cone',
                                        image1='cone'
                                    )
                                    self.uiITRAD_test3 = pm.iconTextRadioButton(
                                        'uiITRAD_test3',
                                        style='iconAndTextHorizontal',
                                        label='torus',
                                        image1='torus'
                                    )

                        with self.uiCreateFrame('uiLAY_frameIconTextScrollLists', 'Icon Text Scroll Lists (PMIconTextScrollList)') as self.uiLAY_frameIconTextScrollLists:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiITSLST_test1 = pm.iconTextScrollList(
                                        'uiITSLST_test1',
                                        allowMultiSelection=True,
                                        append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
                                    )
                                    self.uiITSLST_test2 = pm.iconTextScrollList(
                                        'uiITSLST_test2',
                                        allowMultiSelection=True,
                                        append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
                                    )

                        with self.uiCreateFrame('uiLAY_frameIntFields', 'Int Fields (PMIntField)') as self.uiLAY_frameIntFields:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=140, style='none')
                                    self.uiINF_test1 = pm.intField('uiINF_test1')
                                    self.uiINF_test2 = pm.intField('uiINF_test2')

                        with self.uiCreateFrame('uiLAY_frameIntFieldGroups', 'Int Field Groups (PMIntFieldGrp#)') as self.uiLAY_frameIntFieldGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiINFGRP_test1 = pm.intFieldGrp(
                                    'uiINFGRP_test1',
                                    numberOfFields=1,
                                    label='PMIntFieldGrp1'
                                )
                                self.uiINFGRP_test2 = pm.intFieldGrp(
                                    'uiINFGRP_test2',
                                    numberOfFields=2,
                                    label='PMIntFieldGrp2'
                                )
                                self.uiINFGRP_test3 = pm.intFieldGrp(
                                    'uiINFGRP_test3',
                                    numberOfFields=3,
                                    label='PMIntFieldGrp3'
                                )
                                self.uiINFGRP_test4 = pm.intFieldGrp(
                                    'uiINFGRP_test4',
                                    numberOfFields=4,
                                    label='PMIntFieldGrp4'
                                )

                        with self.uiCreateFrame('uiLAY_frameIntScrollBars', 'Int Scroll Bars (PMIntScrollBar)') as self.uiLAY_frameIntScrollBars:
                            with pm.columnLayout(adjustableColumn=True):
                                pm.separator(style='none', height=2)
                                self.uiINSCRL_test1 = pm.intScrollBar('uiINSCRL_test1')
                                self.uiINSCRL_test2 = pm.intScrollBar('uiINSCRL_test2')

                        with self.uiCreateFrame('uiLAY_frameIntSliders', 'Int Sliders (PMIntSlider)') as self.uiLAY_frameIntSliders:
                            with pm.columnLayout(adjustableColumn=True):
                                pm.separator(style='none', height=2)
                                self.uiINTSLD_test1 = pm.intSlider('uiINTSLD_test1')
                                self.uiINTSLD_test2 = pm.intSlider('uiINTSLD_test2')

                        with self.uiCreateFrame('uiLAY_frameIntSliderGroups', 'Int Slider Groups (PMIntSliderGrp)') as self.uiLAY_frameIntSliderGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiINSGRP_test1 = pm.intSliderGrp(
                                    'uiINSGRP_test1',
                                    label='test1',
                                    field=True
                                )
                                self.uiINSGRP_test2 = pm.intSliderGrp(
                                    'uiINSGRP_test2',
                                    label='test2',
                                    field=True
                                )

                        with self.uiCreateFrame('uiLAY_frameOptionMenus', 'Option Menus (PMOptionMenu)') as self.uiLAY_frameOptionMenus:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=110, style='none')
                                    self.uiOPTMNU_test1 = pm.optionMenu('uiOPTMNU_test1', label='test1')
                                    pm.menuItem(label='one')
                                    pm.menuItem(label='two')
                                    pm.menuItem(label='three')
                                    self.uiOPTMNU_test2 = pm.optionMenu('uiOPTMNU_test2', label='test2')
                                    pm.menuItem(label='four')
                                    pm.menuItem(label='five')
                                    pm.menuItem(label='six')

                        with self.uiCreateFrame('uiLAY_frameOptionMenuGroups', 'Option Menus Groups (PMOptionMenuGrp)') as self.uiLAY_frameOptionMenuGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiOPMGRP_test1 = pm.optionMenuGrp('uiOPMGRP_test1', label='test1', extraLabel='extraLabel')
                                pm.menuItem(label='one')
                                pm.menuItem(label='two')
                                pm.menuItem(label='three')
                                self.uiOPMGRP_test2 = pm.optionMenuGrp('uiOPMGRP_test2', label='test2', extraLabel='extraLabel')
                                pm.menuItem(label='four')
                                pm.menuItem(label='five')
                                pm.menuItem(label='six')

                        with self.uiCreateFrame('uiLAY_frameRadioButtons', 'Radio Buttons (PMRadioButton)') as self.uiLAY_frameRadioButtons:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=4):
                                    pm.separator(style='none', width=140)
                                    pm.radioCollection()
                                    self.uiRAD_test1 = pm.radioButton('uiRAD_test1', label='test1')
                                    self.uiRAD_test2 = pm.radioButton('uiRAD_test2', label='test2')
                                    self.uiRAD_test3 = pm.radioButton('uiRAD_test3', label='test3')

                        with self.uiCreateFrame('uiLAY_frameRadioButtonGroups', 'Radio Button Groups (PMRadioButtonGrp#)') as self.uiLAY_frameRadioButtonGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiRADGRP_test1 = pm.radioButtonGrp(
                                    'uiRADGRP_test1',
                                    numberOfRadioButtons=1,
                                    label='PMRadioButtonGrp1',
                                    label1='test1'
                                )
                                self.uiRADGRP_test2 = pm.radioButtonGrp(
                                    'uiRADGRP_test2',
                                    numberOfRadioButtons=2,
                                    label='PMRadioButtonGrp2',
                                    labelArray2=('test1', 'test2')
                                )
                                self.uiRADGRP_test3 = pm.radioButtonGrp(
                                    'uiRADGRP_test3',
                                    numberOfRadioButtons=3,
                                    label='PMRadioButtonGrp3',
                                    labelArray3=('test1', 'test2', 'test3')
                                )
                                self.uiRADGRP_test4 = pm.radioButtonGrp(
                                    'uiRADGRP_test4',
                                    numberOfRadioButtons=4,
                                    label='PMRadioButtonGrp4',
                                    labelArray4=('test1', 'test2', 'test3', 'test4')
                                )

                        with self.uiCreateFrame('uiLAY_frameSymbolCheckBoxes', 'Symbol Check Boxes (PMSymbolCheckBox)') as self.uiLAY_frameSymbolCheckBoxes:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiSYMCHK_test1 = pm.symbolCheckBox(
                                        'uiSYMCHK_test1',
                                        image='polyCube'
                                    )
                                    self.uiSYMCHK_test2 = pm.symbolCheckBox(
                                        'uiSYMCHK_test2',
                                        image='polyCone'
                                    )

                        with self.uiCreateFrame('uiLAY_frameScriptTables', 'Script Tables (PMScriptTable)') as self.uiLAY_frameScriptTables:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiSCRTBL_test1 = pm.scriptTable(
                                        'uiSCRTBL_test1',
                                        selectionMode=3,
                                        rows=4,
                                        columns=2
                                    )
                                    self.uiSCRTBL_test2 = pm.scriptTable(
                                        'uiSCRTBL_test2',
                                        selectionMode=3,
                                        rows=4,
                                        columns=2
                                    )

                        with self.uiCreateFrame('uiLAY_frameScrollField', 'Scroll Field (PMScrollField)') as self.uiLAY_frameScrollField:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiSCRFLD_test1 = pm.scrollField(
                                        'uiSCRFLD_test1',
                                        wordWrap=True
                                    )
                                    self.uiSCRFLD_test2 = pm.scrollField(
                                        'uiSCRFLD_test2',
                                        wordWrap=True
                                    )

                        with self.uiCreateFrame('uiLAY_frameShelfTabLayout', 'Shelf Tab Layout (PMShelfTabLayout)') as self.uiLAY_frameShelfTabLayout:
                            with pm.columnLayout(adjustableColumn=True):
                                with pm.shelfTabLayout('uiSHLTAB_test1') as self.uiSHLTAB_test1:
                                    with pm.shelfLayout('test1'):
                                        pass
                                    with pm.shelfLayout('test2'):
                                        pass
                                    with pm.shelfLayout('test3'):
                                        pass
                                with pm.shelfTabLayout('uiSHLTAB_test2') as self.uiSHLTAB_test2:
                                    with pm.shelfLayout('test4'):
                                        pass
                                    with pm.shelfLayout('test5'):
                                        pass
                                    with pm.shelfLayout('test6'):
                                        pass

                        with self.uiCreateFrame('uiLAY_frameTabLayout', 'Tab Layout (PMTabLayout)') as self.uiLAY_frameTabLayout:
                            with pm.columnLayout(adjustableColumn=True):
                                with pm.tabLayout('uiTAB_test1') as self.uiTAB_test1:

                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow1:
                                        pass
                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow2:
                                        pass
                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow3:
                                        pass

                                pm.tabLayout(
                                    self.uiTAB_test1,
                                    edit=True,
                                    tabLabel=((uiLAY_tabRow1, 'test1'), (uiLAY_tabRow2, 'test2'), (uiLAY_tabRow3, 'test3'),)
                                )

                                with pm.tabLayout('uiTAB_test2') as self.uiTAB_test2:

                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow4:
                                        pass
                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow5:
                                        pass
                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow6:
                                        pass

                                pm.tabLayout(
                                    self.uiTAB_test2,
                                    edit=True,
                                    tabLabel=((uiLAY_tabRow4, 'test4'), (uiLAY_tabRow5, 'test5'), (uiLAY_tabRow6, 'test6'),)
                                )

                        with self.uiCreateFrame('uiLAY_frameTextFields', 'Text Fields (PMTextField)') as self.uiLAY_frameTextFields:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=140, style='none')
                                    self.uiTXT_test1 = pm.textField('uiTXT_test1')
                                    self.uiTXT_test2 = pm.textField('uiTXT_test2')

                        with self.uiCreateFrame('uiLAY_frameTextFieldButtonGroups', 'Text Field Button Groups (PMTextFieldButtonGrp)') as self.uiLAY_frameTextFieldButtonGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiTXBTGR_test1 = pm.textFieldButtonGrp(
                                    'uiTXBTGR_test1',
                                    label='test1',
                                    buttonLabel='button1'
                                )
                                self.uiTXBTGR_test2 = pm.textFieldButtonGrp(
                                    'uiTXBTGR_test2',
                                    label='test2',
                                    buttonLabel='button2'
                                )

                        with self.uiCreateFrame('uiLAY_frameTextFieldGroups', 'Text Field Groups (PMTextFieldGrp)') as self.uiLAY_frameTextFieldGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiTXTGRP_test1 = pm.textFieldGrp(
                                    'uiTXTGRP_test1',
                                    label='test1'
                                )
                                self.uiTXTGRP_test2 = pm.textFieldGrp(
                                    'uiTXTGRP_test2',
                                    label='test2'
                                )

                        with self.uiCreateFrame('uiLAY_frameTextScrollLists', 'Text Scroll Lists (PMTextScrollList)') as self.uiLAY_frameTextScrollLists:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiTXTLST_test1 = pm.textScrollList(
                                        'uiTXTLST_test1',
                                        allowMultiSelection=True,
                                        append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
                                    )
                                    self.uiTXTLST_test2 = pm.textScrollList(
                                        'uiTXTLST_test2',
                                        allowMultiSelection=True,
                                        append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
                                    )

                self.uiBTN_savePrefs = pm.button(
                    label='Save Prefs',
                    height=MAIN_BUTTONS_HEIGHT,
                    command=self.onSavePrefsClicked
                )

                self.uiBTN_loadPrefs = pm.button(
                    label='Load Prefs',
                    height=MAIN_BUTTONS_HEIGHT,
                    command=self.onLoadPrefsClicked
                )

                self.uiBTN_resetPrefs = pm.button(
                    label='Reset Prefs',
                    height=MAIN_BUTTONS_HEIGHT,
                    command=self.onResetPrefsClicked
                )

                uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'top', 2)
                uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'left', 2)
                uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'right', 2)
                uiLAY_mainForm.attachControl(self.uiLAY_mainScroll, 'bottom', 2, self.uiBTN_savePrefs)

                uiLAY_mainForm.attachNone(self.uiBTN_savePrefs, 'top')
                uiLAY_mainForm.attachForm(self.uiBTN_savePrefs, 'left', 2)
                uiLAY_mainForm.attachPosition(self.uiBTN_savePrefs, 'right', 2, 33)
                uiLAY_mainForm.attachForm(self.uiBTN_savePrefs, 'bottom', 2)

                uiLAY_mainForm.attachNone(self.uiBTN_loadPrefs, 'top')
                uiLAY_mainForm.attachPosition(self.uiBTN_loadPrefs, 'left', 2, 33)
                uiLAY_mainForm.attachPosition(self.uiBTN_loadPrefs, 'right', 2, 66)
                uiLAY_mainForm.attachForm(self.uiBTN_loadPrefs, 'bottom', 2)

                uiLAY_mainForm.attachNone(self.uiBTN_resetPrefs, 'top')
                uiLAY_mainForm.attachPosition(self.uiBTN_resetPrefs, 'left', 2, 66)
                uiLAY_mainForm.attachForm(self.uiBTN_resetPrefs, 'right', 2)
                uiLAY_mainForm.attachForm(self.uiBTN_resetPrefs, 'bottom', 2)

        self.window.setTitle(self.window.__class__)
Beispiel #42
0
def makeSpringUI():
    global springButtonID
    global dynHairMagicFrameID
    global dynSpringMagicFrameID
    global dynHairMagicRadioID
    global dynSpringMagicRadioID
    #global progressControlID
    if pm.window('makeSpringWin',ex=True):
        pm.deleteUI('makeSpringWin',window=True)
        pm.windowPref('makeSpringWin',remove=True)
    pm.window('makeSpringWin',menuBar=True,t="Spring Magic Maya %s" % version)
    pm.menu(tearOff=False,l="Edit")
    pm.menuItem(l="Reset Settings",ann="Reset all",c=lambda *arg:makeSpringUI())
    pm.scrollLayout('scrollLayout')
    pm.frameLayout(lv=False)
    pm.columnLayout(adjustableColumn=1)
    pm.rowColumnLayout(numberOfColumns=3,columnWidth=[(1,90),(2,90),(3,90)])
    pm.text(label="Pick Method: ")
    dynPickMethodID = pm.radioCollection()
    pm.radioButton(label="Hierachy",select=True,onc=lambda *arg:changeMethodVal(1))
    pm.radioButton(label="Selection",onc=lambda *arg:changeMethodVal(0))
    pm.text(label="Spring Method: ")
    dynSpringMethodID = pm.radioCollection()
    dynHairMagicRadioID= pm.radioButton(label="Hair Magic",select=True,onc=lambda *arg:changeSpringMethodVal(1))
    dynSpringMagicRadioID= pm.radioButton(label="Spring Magic",onc=lambda *arg:changeSpringMethodVal(0))
    pm.setParent('..')
    pm.separator(style='in')
    pm.rowColumnLayout(numberOfColumns=6,columnWidth=[(1,90),(2,60),(3,55),(4,45),(5,30),(6,45)],bgc=(0.5,0.5,0.5))
    pm.text(label="Key Range: ")
    dynkeyRange = pm.radioCollection()
    pm.radioButton(label="Active",select=True,onc=lambda *arg:changeTRangeVal(1))
    pm.radioButton(label="From: ",onc=lambda *arg:changeTRangeVal(0))
    pm.intField(value=startFrame,cc=changeSFVal)
    pm.text(label="To: ")
    pm.intField(value=endFrame,cc=changeEFVal)
    pm.setParent('..')
    pm.separator(style='out')
    pm.setParent('..')
    dynHairMagicFrameID=pm.frameLayout(label='Hair Magic',borderStyle='in')
    pm.rowColumnLayout(numberOfColumns=2,columnWidth=[(1,90),(2,180)])
    pm.text(label="Hair Damping: ",align='right')
    pm.floatField(min=0.0, max=1, value=dampValue, step=0.1, cc=changeDaVal)
    pm.text(label="Hair Stiffness: ",align='right')
    pm.floatField(min=0.0, max=1, value=stiffValue, step=0.1, cc=changeStiffVal)
    pm.setParent('..')
    pm.rowColumnLayout(numberOfColumns=4,columnWidth=[(1,90),(2,60),(3,60),(4,85)])
    pm.text(label="Hair Stiffness : ",align='right')
    dynJointFalloffID = pm.radioCollection()
    pm.radioButton(label="Normal",select=True,onc=lambda *arg:changeFVal(0))
    pm.radioButton(label="Quick",onc=lambda *arg:changeFVal(1))
    pm.radioButton(label="Slow",onc=lambda *arg:changeFVal(2))
    pm.text(label="Hair Detail : ",align='right')
    dynJointDetailID = pm.radioCollection()
    pm.radioButton(label="Low",onc=lambda *arg:changeDVal(0))
    pm.radioButton(label="Medium",select=True,onc=lambda *arg:changeDVal(1))
    pm.radioButton(label="High",onc=lambda *arg:changeDVal(2))
    pm.setParent('..')
    pm.setParent('..')
    dynSpringMagicFrameID=pm.frameLayout(label='Spring Magic',borderStyle='in',vis=False)
    pm.rowColumnLayout(numberOfColumns=3,columnWidth=[(1,120),(2,140),(3,60)])
    pm.rowColumnLayout(numberOfColumns=2,columnWidth=[(1,60),(2,60)])
    pm.text(label="Spring : ",align='right')
    pm.floatField(minValue=0, maxValue=1, value=0.3,editable=True,cc=changeSprVal)
    pm.setParent('..')
    pm.rowColumnLayout(numberOfColumns=2,columnWidth=[(1,60),(2,60)])
    pm.text(label="Twist : ",align='right')
    pm.floatField(minValue=0, maxValue=1, value=0.3,editable=True,cc=changeTwsVal)
    pm.setParent('..')
    pm.checkBox(label="Loop",cc=changeLoopVal)
    pm.setParent('..')
    pm.setParent('..')
    pm.separator(style='in')
    pm.rowColumnLayout(numberOfColumns=3,columnWidth=[(1,112),(2,112),(3,112)])
    springButtonID= pm.button(label="Do",c="springIt(springMethod); pm.deleteUI('makeSpringWin',window=True)")
    pm.button(label= "Apply",c='springIt(springMethod)')
    pm.button(label= "Clear",c='clearAnim()')
    pm.setParent('..')
    #progressControlID=pm.textField(tx="...",ed=False,bgc=(0,.5,0.15),fn='boldLabelFont',h=20)
    pm.showWindow()
Beispiel #43
0
def gui():
    global objList, myScrollField
    global obj01Field, obj02Field, obj03Field, obj04Field, geoField, uSlider, vSlider
    global xRotateFieldMax, yRotateFieldMax, zRotateFieldMax, xTranslateFieldMax, yTranslateFieldMax, zTranslateFieldMax, xScaleFieldMax, yScaleFieldMax, zScaleFieldMax
    global xRotateFieldMin, yRotateFieldMin, zRotateFieldMin, xTranslateFieldMin, yTranslateFieldMin, zTranslateFieldMin, xScaleFieldMin, yScaleFieldMin, zScaleFieldMin
    objList = []
    if (pm.window(win, ex=True)):
        pm.deleteUI(win)

    if (pm.windowPref(win, ex=True)):
        pm.windowPref(win, remove=True)

    myWin = pm.window(win,
                      title='fsaDuplicator',
                      sizeable=False,
                      mnb=True,
                      width=280,
                      backgroundColor=[.5, .5, .5])

    main = pm.rowColumnLayout()
    pm.text(label='surface')

    pm.separator(style='in', height=15)
    geoField = pm.textFieldButtonGrp(text='surface',
                                     buttonLabel='<<<',
                                     bc=loadGeo,
                                     ed=0,
                                     width=280)
    pm.separator(style='in', height=15)
    pm.text(label='objects')
    '''
    obj01Field = pm.textFieldButtonGrp( text = 'obj01' , buttonLabel = '<<<' , bc = loadObj01 , ed = 0 , width = 280 )
    obj02Field = pm.textFieldButtonGrp( text = 'obj02' , buttonLabel = '<<<' , bc = loadObj02 , ed = 0 , width = 280 )
    obj03Field = pm.textFieldButtonGrp( text = 'obj03' , buttonLabel = '<<<' , bc = loadObj03 , ed = 0 , width = 280 )
    obj04Field = pm.textFieldButtonGrp( text = 'obj04' , buttonLabel = '<<<' , bc = loadObj04 , ed = 0 , width = 280 )
    '''
    pm.button(label='add objects', command=addobj)
    myScrollField = pm.scrollField(w=280, height=50, wordWrap=True)

    pm.separator(style='in', height=15)
    pm.text(label='u density')
    uSlider = pm.intSliderGrp(min=1, max=100, field=True, width=280)
    pm.text(label='v density')
    vSlider = pm.intSliderGrp(min=1, max=100, field=True, width=280)
    pm.separator(style='in', height=15)
    pm.text(label='randomize transforms')

    rows = pm.rowColumnLayout(numberOfColumns=6,
                              columnWidth=[[1, 43], [2, 50], [3, 43], [4, 50],
                                           [5, 43], [6, 50]])

    # creating 'separators'
    pm.text(label='')
    pm.text(label='')
    pm.text(label='')
    pm.text(label='')
    pm.text(label='')
    pm.text(label='')

    pm.text(label='sxMin')
    xScaleFieldMin = pm.floatField(min=-100, max=100, value=1, width=50)
    pm.text(label='syMin')
    yScaleFieldMin = pm.floatField(min=-100, max=100, value=1, width=50)
    pm.text(label='szMin')
    zScaleFieldMin = pm.floatField(min=-100, max=100, value=1, width=50)

    pm.text(label='sxMax')
    xScaleFieldMax = pm.floatField(min=-100, max=100, value=1, width=50)
    pm.text(label='syMax')
    yScaleFieldMax = pm.floatField(min=-100, max=100, value=1, width=50)
    pm.text(label='szMax')
    zScaleFieldMax = pm.floatField(min=-100, max=100, value=1, width=50)

    # creating 'separators'
    pm.text(label='')
    pm.text(label='')
    pm.text(label='')
    pm.text(label='')
    pm.text(label='')
    pm.text(label='')

    pm.text(label='rxMin')
    xRotateFieldMin = pm.floatField(min=-360, max=360, width=50)
    pm.text(label='ryMin')
    yRotateFieldMin = pm.floatField(min=-360, max=360, width=50)
    pm.text(label='rzMin')
    zRotateFieldMin = pm.floatField(min=-360, max=360, width=50)

    pm.text(label='rxMax')
    xRotateFieldMax = pm.floatField(min=-360, max=360, width=50)
    pm.text(label='ryMax')
    yRotateFieldMax = pm.floatField(min=-360, max=360, width=50)
    pm.text(label='rzMax')
    zRotateFieldMax = pm.floatField(min=-360, max=360, width=50)

    # creating 'separators'
    pm.text(label='')
    pm.text(label='')
    pm.text(label='')
    pm.text(label='')
    pm.text(label='')
    pm.text(label='')

    pm.setParent(rows)
    pm.text(label='txMin')
    xTranslateFieldMin = pm.floatField(min=-100, max=100, width=50)
    pm.text(label='tyMin')
    yTranslateFieldMin = pm.floatField(min=-100, max=100, width=50)
    pm.text(label='tzMin')
    zTranslateFieldMin = pm.floatField(min=-100, max=100, width=50)

    pm.text(label='txMax')
    xTranslateFieldMax = pm.floatField(min=-100, max=100, width=50)
    pm.text(label='tyMax')
    yTranslateFieldMax = pm.floatField(min=-100, max=100, width=50)
    pm.text(label='tzMax')
    zTranslateFieldMax = pm.floatField(min=-100, max=100, width=50)

    pm.setParent(main)
    pm.separator(style='in', height=15)

    pm.button(label='replicate', command=replicateFunction)

    myWin.show()
Beispiel #44
0
def getFrameRangeEnd():
    return pymel.floatField(
        'MayaWindow|toolBar5|MainPlaybackRangeLayout|formLayout10|floatField4',
        query=True,
        value=True)
Beispiel #45
0
 def getFloatValue(self, param):
     return pm.floatField(param, query=True, value=True)
Beispiel #46
0
    def buildUI(self, card):

        uiFieldKwargs = self.getUIFieldKwargs(card)

        if self.type == self.BOOL:
            field = checkBox(l='', **uiFieldKwargs)  # noqa e741
            checkBox(field, e=True, cc=pdil.alt.Callback(self.setParam, field))

        elif self.type == self.INT:
            field = intField(**uiFieldKwargs)
            intField(field, e=True, cc=pdil.alt.Callback(self.setParam, field))

        elif self.type == self.FLOAT:
            field = floatField(**uiFieldKwargs)
            floatField(field,
                       e=True,
                       cc=pdil.alt.Callback(self.setParam, field))

        elif self.type == self.ENUM:
            field = optionMenu(l='')  # noqa e741
            optionMenu(field,
                       e=True,
                       cc=pdil.alt.Callback(self.setParam, field))

            for i, choice in enumerate(self.enum, 1):
                menuItem(l=choice)  # noqa e741
                if self.enum[choice] == uiFieldKwargs['text']:
                    optionMenu(field, e=True, sl=i)

        elif self.type == self.STR:
            # &&& Possibly super gross, if the field is "name", use the first joint...
            if 'text' not in uiFieldKwargs and self.kwargName == 'name':
                uiFieldKwargs['text'] = pdil.shortName(card.joints[0])
                #default = card.n
                #getDefaultIkName(card) # &&& MAKE THIS so I can use the same logic when building the card.

            field = textField(**uiFieldKwargs)
            textField(field,
                      e=True,
                      cc=pdil.alt.Callback(self.setParam, field))
            setattr(field, 'getValue',
                    field.getText)  # Hack to allow ducktyping.

        elif self.type == self.NODE_0:

            def setExtraNode(extraNode):
                card.extraNode[0] = extraNode

                temp = ParamInfo.toDict(card.rigParams)
                temp[self.kwargName] = 'NODE_0'
                card.rigParams = ParamInfo.toStr(temp)

                return True

            def clearExtraNode(extraNode):
                card.extraNode[0] = None
                temp = ParamInfo.toDict(card.rigParams)
                del temp[self.kwargName]
                card.rigParams = ParamInfo.toStr(temp)

                return True

            util.GetNextSelected(
                setExtraNode,
                clearExtraNode,
                l='',  # noqa e741
                tx=pdil.shortName(card.extraNode[0])
                if card.extraNode[0] else '',
                cw=[(1, 1), (2, 100), (3, 20)])
 def create(self):
     current_time = pm.keyframe( '%s' % (self.node) , query=True, index= (self.index, self.index), valueChange= True )[0]
     self.int_field = pm.floatField(value= float(current_time), changeCommand= pm.Callback(self.change_value))
Beispiel #48
0
def lcObj_offsetMultiple(mode='select', files=None, offset=[0,0,0], *args, **kwargs):
    '''
    select multiple external .obj files and offset them in worldspace
    '''
    # Select ###########################
    if mode=='select':
        path = pm.textField(prefix+'_textField_export_path', query=True, text=True)
        filter = "Wavefront Obj (*.obj)"
        files = pm.fileDialog2(ds=1, caption="Choose one or more Obj's to offset", dir=path, fileFilter=filter, fileMode=4)
        if files:
            lcObj_offsetMultiple(mode='window', files=files)
        else:
            lcUtility.Utility.lc_print("You didn't select anything . . .")

    # Window ###########################
    windowName = 'lcObj_offset_window'

    if mode=='window':
        if pm.control(windowName, exists = True):
            pm.deleteUI(windowName)

        w=200
        h=85
        offsetWindow = pm.window(windowName, t="lcObjTools - Obj Offset", widthHeight=[w+2,h], rtf=False, mnb=False, mxb=False, s=False, toolbox=True)
        pm.columnLayout()
        pm.text(l='Enter Obj Offset', w=w, h=25, al='center', font='boldLabelFont')
        a=(w/3)*0.2
        b=(w/3)-a
        pm.rowColumnLayout(nc=6, cw=([1,a], [2,b], [3,a], [4,b], [5,a], [6,b]) )
        pm.text(l='X', w=a, al='center', font='boldLabelFont')
        pm.floatField('o_x', w=b, v=0.0)
        pm.text(l='Y', w=a, al='center', font='boldLabelFont')
        pm.floatField('o_y', w=b, v=0.0)
        pm.text(l='Z', w=a, al='center', font='boldLabelFont')
        pm.floatField('o_z', w=b, v=0.0)
        pm.setParent('..')
        pm.separator(style='none', h=5)
        b=100
        a=(w-b)/2
        pm.rowColumnLayout(nc=3, cw=([1,a], [2,b], [3,a]) )
        pm.text(l='')
        pm.button(l='Offset', w=b, command=lambda *args: lcObj_offsetMultiple(mode='execute', files=files, offset=[pm.floatField('o_x',q=True,v=True), pm.floatField('o_y',q=True,v=True), pm.floatField('o_z',q=True,v=True)]) )
        pm.text(l='')

        offsetWindow.show()
        pm.window(offsetWindow, edit=True, wh=[w+2,h])

    # Execute ###########################
    if mode=='execute':
        i = 1
        for f in files:
            fileName, fileExtension = os.path.splitext(f)
            outputFile = '{}_Offset{}'.format(fileName, fileExtension)
            obj = lcGeometry.Obj(f, True, '[{} of {}]'.format(i, len(files)) )
            obj.edit_verts(offset)
            obj.write(outputFile)
            obj.flush()

            i=i+1
        if pm.control(windowName, exists = True):
            pm.deleteUI(windowName)
Beispiel #49
0
 def _createFloatRandParam(name):
     pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 50), (2, 200)])
     pm.text(label=name + ':')
     field = pm.floatField(name, minValue=-999999.9, maxValue=999999.9, step=0.05, enable=False)
     pm.setParent('..')
     return field
def win(*args):
    
    win='bsCorrectiveWindow'
    
    if pm.window(win, q=True, exists=True):
        pm.deleteUI(win)
        if pm.window(win, q=True, exists=True):
            pm.deleteUI(win)
    
    win=pm.window(win, t='Corrective Blendshape Model Helper', sizeable=False, rtf=True)
    
    mainLwt = pm.columnLayout(w=350)
    
    #Sculpt Frame
    pm.frameLayout('Sculpt', bgc=[0,0,0], bs='out', w=350)
    pm.text('To start, simply select the base mesh you wish to sculpt.\nPress "Start Sculpt". Once done, press "Extract Shape"')
    
    pm.rowColumnLayout(nc=2, cw=[(1,175), (2,170)])
    pm.separator(h=3, st='none')
    pm.separator(h=3, st='none')
    
    pm.button('Start Sculpt', c=na_bsCorrectiveSculpt.cbsStart)
    pm.button('Extract Shape', c=na_bsCorrectiveSculpt.cbsTrans)
    pm.separator(st='none', h=10)
    
    #Utilities Frame
    pm.frameLayout('Other Utilities', bgc=[0,0,0], p=mainLwt, cll=True, cl=True, bs='in', w=350)
    colLwt = pm.columnLayout(rs=5, adj=True)
    
    #Clear Tweaks Sub-frame
    pm.frameLayout('Clear Tweaks', p=colLwt, cll=True, cl=True)
    pm.separator(h=2, st='none')
    pm.button('Run', c=na_bsCorrectiveSculpt.clearTweaks)
    pm.separator(st='none')
    
    
    #Mirror Shape Sub-frame
    mirFrmLwt = pm.frameLayout('Mirror Shape', p=colLwt, cll=True, cl=True)
    pm.separator(h=2, st='none')
    mirRcLwt = pm.rowColumnLayout(nc=2, cw=[(1,170), (2,170)], cs=(2,10))
    
    pm.columnLayout(rs=1, adj=True, p=mirRcLwt)
    pm.text('Target', al='center')
    pm.rowColumnLayout(nc=2, cw=[(1,25), (2,140)])
    mirTargBtn = pm.button(l=' + ')
    mirTargTf = pm.textField()
    mirTargBtn.setCommand(partial(populateFromSel, mirTargTf))
    
    pm.columnLayout(rs=1, adj=True, p=mirRcLwt)
    pm.text('Base', al='center')
    pm.rowColumnLayout(nc=2, cw=[(1,25), (2,130)])
    mirBaseBtn = pm.button(l=' + ')
    mirBaseTf = pm.textField()
    mirBaseBtn.setCommand(partial(populateFromSel, mirBaseTf))
    
    pm.button('Run', p=mirFrmLwt, c=partial(mirrorRun, mirTargTf, mirBaseTf))
    pm.separator(st='none', p=mirFrmLwt)
    
    #Hook Up Sub-frame
    huFrmLwt = pm.frameLayout('Hook Up Shapes', p=colLwt, cll=True, cl=True)
    pm.separator(h=2, st='none')
    pm.text('To use this tool, fill out the lower section, \nselect the mesh you wish to add as a target, then run\n')
    huRcLwt = pm.rowColumnLayout(nc=2, cw=[(1,170), (2,160)], cs=(2,10))
    
    huCol1 = pm.columnLayout(rs=1, adj=True, p=huRcLwt)
    pm.text('Base', al='center')
    pm.rowColumnLayout(nc=2, cw=[(1,20), (2,145)])
    huBaseBtn = pm.button(l=' + ')
    huBaseTf = pm.textField()
    
    pm.setParent(huCol1)
    pm.separator(h=10, st='none')
    pm.text('Driver', al='center')
    pm.rowColumnLayout(nc=2, cw=[(1,20), (2,145)])
    huDriverBtn = pm.button(l=' + ')
    huDriverTf = pm.textField()
    huDriverBtn.setCommand(partial(populateFromSel, huDriverTf))
    
    huCol2 = pm.columnLayout(rs=1, adj=True, p=huRcLwt)
    pm.text('Blendshape Deformer', al='center')
    bsOpt = pm.optionMenu(l='')
    pm.menuItem(l='<Create New>')
    
    huBaseTf.changeCommand(partial(populateBsMen, huBaseTf.getText(), bsOpt))
    huBaseTf.enterCommand(partial(populateBsMen, huBaseTf.getText(), bsOpt))
    huBaseBtn.setCommand(partial(populateFromSel, huBaseTf, bsOpt))
    
    pm.setParent(huCol2)
    pm.separator(h=15, st='none')
    pm.text('     Attribute (RMB for Options)', al='center')
    pm.rowColumnLayout(nc=2, cw=[(1,20), (2,135)])
    pm.text(l='.   ')
    huAttrTf = pm.textField()
    attrPop = pm.popupMenu(button=3)
    pm.menuItem('Enter Driver First')
    attrPop.postMenuCommand(partial(populateAttrMen, huDriverTf, attrPop, huAttrTf))
    
    
    pm.setParent(huFrmLwt)
    pm.separator()
    pm.text('Key Info')
    
    kiRcLwt = pm.rowColumnLayout(nc=2, cw=[(1,165), (2,165)], cs=(2,10))
    
    pm.columnLayout(rs=1, adj=True, p=kiRcLwt)
    pm.text('Driver value for weight=0:', al='center')
    pm.rowColumnLayout(nc=2, cw=[(1,25), (2,137)])
    kiZeroBtn = pm.button(l=' > ')
    kiZeroFf = pm.floatField(v=0)
    kiZeroBtn.setCommand(partial(floatFieldFromDriver, huDriverTf, huAttrTf, kiZeroFf))
    
    pm.columnLayout(rs=1, adj=True, p=kiRcLwt)
    pm.text('Driver value for weight=1:', al='center')
    pm.rowColumnLayout(nc=2, cw=[(1,25), (2,130)])
    kiOneBtn = pm.button(l=' > ')
    kiOneFf = pm.floatField(v=90)
    kiOneBtn.setCommand(partial(floatFieldFromDriver, huDriverTf, huAttrTf, kiOneFf))
    
    pm.setParent(kiRcLwt)
    pm.separator(h=7, st='none');pm.separator(h=7, st='none')
    kiZeroTan = pm.optionMenu()
    pm.menuItem(l='spline');pm.menuItem(l='linear');pm.menuItem(l='clamped');pm.menuItem(l='stepped');
    pm.menuItem(l='flat');pm.menuItem(l='plateau');pm.menuItem(l='auto')
    kiOneTan = pm.optionMenu()
    pm.menuItem(l='spline');pm.menuItem(l='linear');pm.menuItem(l='clamped');pm.menuItem(l='stepped');
    pm.menuItem(l='flat');pm.menuItem(l='plateau');pm.menuItem(l='auto')
    pm.separator(h=7, st='none');pm.separator(h=7, st='none')
    priCb = pm.checkBox('Pre Infinity')
    poiCb = pm.checkBox('Post Infinity')
    
    pm.button(l='Run', p=huFrmLwt, c=partial(hookupRun, huBaseTf, bsOpt, huDriverTf, huAttrTf, kiZeroFf, 
                                             kiOneFf, kiZeroTan, kiOneTan, priCb, poiCb))
    pm.separator(st='none', p=mirFrmLwt)
    
    #Info Sub-frame
    pm.frameLayout('Information', p=colLwt, cll=True, cl=True)
    pm.separator(st='none')
    pm.button('About', w=340, c=aboutWin)
    pm.separator(st='none')
    
    pm.showWindow(win)

ControlsForm = pm.formLayout( 'ControlsForm',p='Controls')

ToolsForm = pm.formLayout('ToolkitForm',p='Tools')
SkinForm = pm.formLayout('SkinForm',p='Skin')
MiscForm = pm.formLayout('MiscForm',p='Misc')

GlobalName = pm.textField('Globalfield', w = 270 , h=25 ,pht = 'Name for Ctrls or Attrs',p = 'ControlsForm',bgc = [(.17),(.18),(.19)])

BaseCtlBtn = pm.iconTextButton('ControlBase',style='iconAndTextHorizontal', image1='polyColorSetEditor.png', label='Control Class',p = 'ControlsForm',w=130,h=40, bgc = [(.3),(.5),(.5)])
BaseCtlShapeBtn = pm.iconTextButton('ControlShape',style='iconAndTextHorizontal', image1='fluidCreate3D.png', label='Control Shape',p = 'ControlsForm',w=130,h=40,  bgc = [(.3),(.5),(.5)])
Border01Btn = pm.button('Border01',l = '',p = 'ControlsForm',w= 260,h = 60,en=0)

CtrlSizeText = pm.iconTextButton('Sizetxt',style='iconAndTextHorizontal',image1='StandinShelf.png',l = 'SHAPE SIZE',p = 'ControlsForm',w = 105,h=40, bgc = [(.2),(.3),(.3)],en = 1)
intensityTxtFld = pm.floatField('intenTxf',min = .10,p = 'ControlsForm',v=.10,w= 45,h =40,bgc = [(.17),(.18),(.19)] )
plusBtn = pm.symbolButton('plusBtn',p = 'ControlsForm',i = 'UVTBAdd.png',w = 40,h=40,ebg =1 , bgc = [(.2),(.3),(.3)],en = 1)
minusBtn = pm.symbolButton('minusBtn',p = 'ControlsForm',i = 'UVTBRemove.png',w = 40,h=40,ebg =1 , bgc = [(.2),(.3),(.3)],en = 1)


attrsBtn = pm.button('atrBtn',l= 'Attributes',p = 'ControlsForm',w = 270,h=19, bgc = [(.2),(.2),(.2)],hlc = [(.9),(.2),(.2)],en =1)



lockatBtn = pm.symbolButton('lockatrBtn',p = 'ControlsForm',i = 'Lock_ON.png',w = 63,h=25,ebg =1 , bgc = [(.3),(.2),(.2)],en = 1)
unlockatBtn = pm.symbolButton('unlockatrBtn',p = 'ControlsForm',i = 'Lock_OFF.png',w = 63,h=25,ebg =1 , bgc = [(.3),(.2),(.2)],en = 1)
keyableBtn = pm.symbolButton('keyableAtBtn',p = 'ControlsForm',i = 'keyIntoclip.png',w = 63,h=25,ebg =1 , bgc = [(.3),(.2),(.2)],en = 1)
hideBtn = pm.symbolButton('hideAtBtn',p = 'ControlsForm',i = 'RS_visible.png',w = 63,h=25,ebg =1 , bgc = [(.3),(.2),(.2)],en = 1)

OnOffAttr = pm.button('OnOff',l= 'Off/On',p = 'ControlsForm',w = 63,h=19, bgc = [(.2),(.2),(.2)],hlc = [(.9),(.2),(.2)],en =1)
ZeroOneAttr = pm.button('ZeroOneAtr',l= '0.0-1.0',p = 'ControlsForm',w = 63,h=19, bgc = [(.2),(.2),(.2)],hlc = [(.9),(.2),(.2)],en =1)
    def __init__(self):

        ui_labelWidth = 140
        ui_inputWidth = 240

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

        with pm.window(
            WIN_NAME,
            title=WIN_TITLE,
            maximizeButton=False,
            menuBar=True,
            menuBarVisible=True
        ) as self.window:

            pm.setUITemplate('DefaultTemplate', pushTemplate=True)

            pm.menu(label='Edit', tearOff=False)
            pm.menuItem(label='Reset Settings', command=self.ui_resetSettings)
            pm.menu(label='Help', tearOff=False)
            pm.menuItem(label='Help on ' + WIN_TITLE, command=self.ui_showHelp)

            with pm.formLayout() as self.ui_LAY_mainForm:

                with pm.tabLayout(tabsVisible=False) as self.ui_TAB_top:
                    pm.tabLayout(self.ui_TAB_top, e=True, height=1)

                    with pm.formLayout() as self.ui_LAY_attachForm:

                        with pm.tabLayout(tabsVisible=False, scrollable=True, innerMarginWidth=4) as self.ui_TAB_inner:

                            with pm.columnLayout(adjustableColumn=True) as self.ui_LAY_mainColumn:

                                with pm.frameLayout(
                                    label='Control Panel',
                                    collapsable=True,
                                    collapse=False,
                                    marginHeight=3
                                ) as self.ui_LAY_frameControlPanel:

                                    with pm.rowColumnLayout(
                                        numberOfColumns=12,
                                        columnSpacing=([3, 2], [4, 2], [5, 2], [6, 2]),
                                        rowSpacing=[1, 5],
                                        #            Label       X       Y         Z       XYZ      Mag     Sep      Reset     Bias      Sep       Min       Max
                                        columnWidth=[(1, 60), (2, 20), (3, 20), (4, 20), (5, 80), (6, 60), (7, 20), (8, 20), (9, 120), (10, 20), (11, 60), (12, 60)]
                                    ) as self.ui_LAY_mainRowColumn:

                                        # ----- Header Row -----

                                        pm.text(label='')
                                        pm.text(label='')
                                        pm.text(label='')
                                        pm.text(label='')
                                        pm.text(label='')
                                        pm.text(label='Magnitude', )
                                        pm.text(label='')
                                        pm.text(label='')
                                        pm.text(label='Bias', )
                                        pm.text(label='')
                                        pm.text(label='Min', )
                                        pm.text(label='Max', )

                                        # ----- Translate Row -----

                                        pm.text(label='Translate ', align='right')
                                        pm.button(label='X', command=pm.Callback(self.randomizeTranslate, ['tx']))
                                        pm.button(label='Y', command=pm.Callback(self.randomizeTranslate, ['ty']))
                                        pm.button(label='Z', command=pm.Callback(self.randomizeTranslate, ['tz']))
                                        pm.button(label='XYZ', command=pm.Callback(self.randomizeTranslate, ['tx', 'ty', 'tz']))
                                        self.ui_FLTFLD_translateMagnitude = pm.floatField('ui_FLTFLD_translateMagnitude',
                                                                                          changeCommand=self.ui_refresh,
                                                                                          value=10)
                                        pm.text(label='')
                                        self.ui_BTN_translateBiasReset = pm.button(label='0')
                                        pm.setUITemplate('DefaultTemplate', popTemplate=True)  # strange slider group visual with default template
                                        self.ui_INTSLGRP_translateBias = pm.intSliderGrp(
                                            'ui_INTSLGRP_translateBias',
                                            columnWidth=[1, 30],
                                            field=True,
                                            minValue=-100,
                                            maxValue=100,
                                            fieldMinValue=-100,
                                            fieldMaxValue=100,
                                            value=0,
                                            step=1,
                                            fieldStep=1,
                                            sliderStep=1,
                                            changeCommand=self.ui_refresh,
                                            dragCommand=self.ui_refresh
                                        )
                                        pm.setUITemplate('DefaultTemplate', pushTemplate=True)
                                        pm.button(self.ui_BTN_translateBiasReset, edit=True,
                                                  command=pm.Callback(self.ui_resetBias, self.ui_INTSLGRP_translateBias))
                                        pm.text(label='=')
                                        self.ui_FLTFLD_translateMin = pm.floatField(enable=False, value=-5)
                                        self.ui_FLTFLD_translateMax = pm.floatField(enable=False, value=95)

                                        # ----- Rotate Row -----

                                        pm.text(label='Rotate ', align='right')
                                        pm.button(label='X', command=pm.Callback(self.randomizeRotate, ['rx']))
                                        pm.button(label='Y', command=pm.Callback(self.randomizeRotate, ['ry']))
                                        pm.button(label='Z', command=pm.Callback(self.randomizeRotate, ['rz']))
                                        pm.button(label='XYZ', command=pm.Callback(self.randomizeRotate, ['rx', 'ry', 'rz']))
                                        self.ui_FLTFLD_rotateMagnitude = pm.floatField('ui_FLTFLD_rotateMagnitude',
                                                                                       changeCommand=self.ui_refresh, value=90)
                                        pm.text(label='')
                                        self.ui_BTN_rotateBiasReset = pm.button(label='0')
                                        pm.setUITemplate('DefaultTemplate', popTemplate=True)  # strange slider group visual with default template
                                        self.ui_INTSLGRP_rotateBias = pm.intSliderGrp(
                                            'ui_INTSLGRP_rotateBias',
                                            columnWidth=[1, 30],
                                            field=True,
                                            minValue=-100,
                                            maxValue=100,
                                            fieldMinValue=-100,
                                            fieldMaxValue=100,
                                            value=0,
                                            step=1,
                                            fieldStep=1,
                                            sliderStep=1,
                                            changeCommand=self.ui_refresh,
                                            dragCommand=self.ui_refresh
                                        )
                                        pm.setUITemplate('DefaultTemplate', pushTemplate=True)
                                        pm.button(self.ui_BTN_rotateBiasReset, edit=True,
                                                  command=pm.Callback(self.ui_resetBias, self.ui_INTSLGRP_rotateBias))
                                        pm.text(label='=')
                                        self.ui_FLTFLD_rotateMin = pm.floatField(enable=False, value=-5)
                                        self.ui_FLTFLD_rotateMax = pm.floatField(enable=False, value=95)

                                        # ----- Scale Row -----

                                        pm.text(label='Scale ', align='right')
                                        pm.button(label='X', command=pm.Callback(self.randomizeScale, ['sx']))
                                        pm.button(label='Y', command=pm.Callback(self.randomizeScale, ['sy']))
                                        pm.button(label='Z', command=pm.Callback(self.randomizeScale, ['sz']))

                                        pm.flowLayout(columnSpacing=2)
                                        pm.button(label='XYZ', command=pm.Callback(self.randomizeScale, ['sx', 'sy', 'sz']))
                                        pm.button(label='Uniform', command=pm.Callback(self.randomizeScale, ['uniform']))
                                        pm.setParent('..')

                                        self.ui_FLTFLD_scaleMagnitude = pm.floatField('ui_FLTFLD_scaleMagnitude',
                                                                                      changeCommand=self.ui_refresh, value=2)
                                        pm.text(label='')
                                        self.ui_BTN_scaleBiasReset = pm.button(label='0')
                                        pm.setUITemplate('DefaultTemplate', popTemplate=True)  # strange slider group visual with default template
                                        self.ui_INTSLGRP_scaleBias = pm.intSliderGrp(
                                            'ui_INTSLGRP_scaleBias',
                                            columnWidth=[1, 30],
                                            field=True,
                                            minValue=-100,
                                            maxValue=100,
                                            fieldMinValue=-100,
                                            fieldMaxValue=100,
                                            value=0,
                                            step=1,
                                            fieldStep=1,
                                            sliderStep=1,
                                            changeCommand=self.ui_refresh,
                                            dragCommand=self.ui_refresh
                                        )
                                        pm.setUITemplate('DefaultTemplate', pushTemplate=True)
                                        pm.button(self.ui_BTN_scaleBiasReset, edit=True,
                                                  command=pm.Callback(self.ui_resetBias, self.ui_INTSLGRP_scaleBias))
                                        pm.text(label='=')
                                        self.ui_FLTFLD_scaleMin = pm.floatField(enable=False, value=-5)
                                        self.ui_FLTFLD_scaleMax = pm.floatField(enable=False, value=95)

                                with pm.frameLayout(
                                        label='Seed Control',
                                        collapsable=True,
                                        collapse=False,
                                        marginHeight=3
                                ) as self.ui_LAY_frameSeedControl:

                                    with pm.columnLayout(adjustableColumn=False):

                                        with pm.rowLayout(
                                                numberOfColumns=2,
                                                columnWidth2=[ui_labelWidth, ui_inputWidth],
                                                columnAttach=[1, 'right', 5]
                                        ):
                                            pm.text(label='Use Seed')
                                            self.ui_CHK_useSeed = pm.checkBox(
                                                'ui_CHK_useSeed',
                                                value=True,
                                                label='',
                                                changeCommand=self.ui_refresh
                                            )

                                        with pm.rowLayout(
                                                numberOfColumns=2,
                                                columnWidth2=[ui_labelWidth, ui_inputWidth],
                                                columnAttach=[1, 'right', 5]
                                        ):
                                            pm.text(label='Seed')

                                            pm.setUITemplate('DefaultTemplate', popTemplate=True)  # strange slider group visual with default template
                                            self.ui_INTSLGRP_seedValue = pm.intSliderGrp(
                                                'ui_INTSLGRP_seedValue',
                                                field=True,
                                                minValue=1,
                                                maxValue=10000,
                                                fieldMinValue=1,
                                                fieldMaxValue=10000,
                                                value=1234,
                                                step=1,
                                                fieldStep=1,
                                                sliderStep=1
                                            )
                                            pm.setUITemplate('DefaultTemplate', pushTemplate=True)

                # pm.setParent(self.ui_mainForm)

                self.ui_BTN_close = pm.button(
                    label='Close',
                    command=self.ui_close
                )

        pm.setUITemplate('DefaultTemplate', popTemplate=True)

        self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'top', 0)
        self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'left', 0)
        self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'right', 0)
        self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'bottom', 0)

        self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'top', 0)
        self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'left', 0)
        self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'right', 0)
        self.ui_LAY_mainForm.attachControl(self.ui_TAB_top, 'bottom', 5, self.ui_BTN_close)

        self.ui_LAY_mainForm.attachNone(self.ui_BTN_close, 'top')
        self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'left', 5)
        self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'bottom', 5)
        self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'right', 5)

        self.prefSaver = prefsaver.PrefSaver(serializers.SerializerOptVar(OPT_VAR_NAME))
        self.ui_initSettings()
        self.ui_loadSettings()

        self.window.show()
        pm.refresh()
Beispiel #53
0
def ui_main():

	windowName = 'msAnimRemap'
	dockWidth = 250

	beam = pA.PointA()
	mark = pB.PointB()

	if pm.dockControl(windowName, q= 1, ex= 1):
		pm.dockControl(windowName, e= 1, vis= 0)
		pm.deleteUI(windowName, lay= 1)

	main_window = pm.window()
	mainForm = pm.formLayout(p= main_window)
	copypasteField = pm.cmdScrollFieldExecuter(vis= 0, p= mainForm)

	bannerArea = pm.columnLayout(adj= 1)
	bannerTxt = pm.text(l= 'AniRemap', w= dockWidth)
	QBannerTxt = mqt.convert(bannerTxt)
	QBannerTxt.setStyleSheet('QObject {font: bold 42px; color: #222222;}')
	pm.setParent('..')

	versioArea = pm.columnLayout(adj= 1)
	versioTxt = pm.text(l= 'v'+mAniRemap.__version__)
	QVersioTxt = mqt.convert(versioTxt)
	QVersioTxt.setStyleSheet('QObject {font: bold 10px; color: #777777;}')
	pm.setParent('..')
	
	sep______1 = pm.separator(st= 'in', w= dockWidth - 8)

	panelTxt_1 = pm.text(l= 'Transfer Settings', al= 'left')
	QpanelTxt_1 = mqt.convert(panelTxt_1)
	QpanelTxt_1.setStyleSheet('QObject {font: 12px; color: #777777;}')

	trans_Area = pm.columnLayout(adj= 1, rs= 2)

	role_group = pm.columnLayout(adj= 1, rs= 2)
	pm.text('Role', al= 'left')
	cmC = pm.columnLayout()
	role_mqsb = mqsb.SwitchBox(onl= 'Source', ofl= 'Target', w= dockWidth - 42, h= 28, v= True, \
		p= cmC, ofbg= [148, 106, 68], onbg= [72, 120, 138])
	pm.setParent('..')
	pm.setParent('..')

	pm.rowLayout(nc= 2, adj= 1, cal= [1, 'right'])

	maya_group = pm.columnLayout(adj= 1, rs= 2)
	pm.text('Maya', al= 'left')
	cmA= pm.columnLayout()
	maya_mqsb = mqsb.SwitchBox(onl= 'Cross', ofl= 'Alone', w= (dockWidth-46)/2, h= 20, v= True, p= cmA)
	pm.setParent('..')
	pm.setParent('..')

	mode_group = pm.columnLayout(adj= 1, rs= 2)
	pm.text('Mode', al= 'left')
	cmB = pm.columnLayout()
	mode_mqsb = mqsb.SwitchBox(onl= 'LAN', ofl= 'Local', w= (dockWidth-46)/2, h= 20, p= cmB)
	pm.setParent('..')
	pm.setParent('..')

	pm.setParent('..')

	pm.setParent('..')
	
	sep______2 = pm.separator(st= 'in', w= dockWidth - 8)

	targetLabel = 'Target Settings' if True else 'Target Info'
	panelTxt_2 = pm.text(l= targetLabel, al= 'left')
	QpanelTxt_2 = mqt.convert(panelTxt_2)
	QpanelTxt_2.setStyleSheet('QObject {font: 12px; color: #777777;}')

	targe_Area = pm.columnLayout(adj= 1, rs= 5)
	
	targetAlone = pm.columnLayout(adj= 1, rs= 5, vis= 0)
	trg_sls = pm.textScrollList(w= 180, h= 50)
	pm.rowLayout(nc= 3, adj= 1, cal= [1, 'right'])
	svt_btn = pm.button(l= 'Save Target', bgc= [0.40, 0.37, 0.31])
	adt_btn = pm.button(l= '+', w= 20)
	rmt_btn = pm.button(l= '-', w= 20)
	pm.setParent('..')
	pm.setParent('..')

	targetCross = pm.columnLayout(adj= 1, rs= 5)
	pm.rowLayout(nc= 2, adj= 1, cal= [1, 'right'])
	tcHost_lbe = pm.text('Host : ', en= 0)
	tcHost_txt = pm.textField(w= 140, en= 0)
	pm.setParent('..')
	pm.rowLayout(nc= 2, adj= 1, cal= [1, 'right'])
	pm.text('Port : ')
	tcPort_txt = pm.textField(w= 140)
	pm.setParent('..')
	srcAddr = pm.rowLayout(nc= 2, adj= 1, cal= [1, 'right'])
	ch_btn = pm.button(l= 'Connect', bgc= [0.40, 0.37, 0.31])
	ps_btn = pm.button(l= 'Paste', w= 50)
	pm.setParent('..')
	disAddr = pm.rowLayout(nc= 2, adj= 1, cal= [1, 'right'], vis= 0)
	op_btn = pm.button(l= 'Open', bgc= [0.40, 0.37, 0.31])
	cp_btn = pm.button(l= 'Copy', w= 50)
	pm.setParent('..')
	pm.setParent('..')

	pm.setParent('..')

	sep______3 = pm.separator(st= 'in', w= dockWidth - 8)

	panelTxt_3 = pm.text(l= 'Remap Settings', al= 'left')
	QpanelTxt_3 = mqt.convert(panelTxt_3)
	QpanelTxt_3.setStyleSheet('QObject {font: 12px; color: #777777;}')

	remap_Area = pm.columnLayout(adj= 1, rs= 5)
	
	pm.rowLayout(nc= 2, cal= [1, 'right'], h= 20)
	pm.text('Match : ', w= 45, al= 'right')
	match_mnu = pm.optionMenu(w= 120)
	pm.menuItem('name')
	pm.menuItem('order')
	pm.setParent('..')

	tirm_group = pm.rowLayout(nc= 2, adj= 2, cal= [1, 'right'], h= 20)
	pm.text('Time : ', w= 45, al= 'right')
	cmD = pm.columnLayout()
	tirm_mqsb = mqsb.SwitchBox(onl= 'Slider', ofl= 'Entire', w= 120, h= 18, v= False, \
		p= cmD, ofbg= [62, 58, 60], onbg= [88, 90, 95])
	pm.setParent('..')
	pm.setParent('..')

	hSrc_group = pm.rowLayout(nc= 2, adj= 2, cal= [1, 'right'], h= 20)
	pm.text('Source : ', w= 45, al= 'right')
	cmE = pm.columnLayout()
	hSrc_mqsb = mqsb.SwitchBox(onl= 'Hierachy', ofl= 'Selected', w= 120, h= 18, v= True, \
		p= cmE, ofbg= [62, 58, 60], onbg= [88, 90, 95])
	pm.setParent('..')
	pm.setParent('..')

	hTrg_group = pm.rowLayout(nc= 2, adj= 2, cal= [1, 'right'], h= 20)
	pm.text('Target : ', w= 45, al= 'right')
	cmF = pm.columnLayout()
	hTrg_mqsb = mqsb.SwitchBox(onl= 'Hierachy', ofl= 'Selected', w= 120, h= 18, v= True, \
		p= cmF, ofbg= [62, 58, 60], onbg= [88, 90, 95])
	pm.setParent('..')
	pm.setParent('..')

	pm.rowLayout(nc= 2, cal= [1, 'right'], h= 20)
	pm.text('Scale : ', w= 45, al= 'right')
	scale_flt = pm.floatField(v= 1, pre= 2, w= 120)
	pm.setParent('..')

	pm.rowLayout(nc= 2, adj= 2, cal= [1, 'right'], h= 20)
	pm.text('Mirror : ', w= 45, al= 'right', en= 1)
	pm.radioButtonGrp('mirror_radioBtnGrp', nrb= 4, la4= ['None', 'Y Z', 'Y X', 'X Z'], ad4= 1, \
		cw4= [50, 35, 35, 35], sl= 1, en= 1)
	pm.setParent('..')

	pm.setParent('..')
	
	sep______4 = pm.separator(st= 'in', w= dockWidth - 8)

	exect_Area = pm.columnLayout(adj= 1, rs= 5, h= 46)

	remap_btn = pm.button(l= 'Remap Animation Curves', w= dockWidth - 30, h= 40)
	pm.setParent('..')


	pm.formLayout(mainForm, e= 1, af= [(bannerArea, 'top', -6)])
	pm.formLayout(mainForm, e= 1, af= [(versioArea, 'top', 40), (versioArea, 'right', 50)])
	pm.formLayout(mainForm, e= 1, af= [(sep______1, 'top', 58)])
	pm.formLayout(mainForm, e= 1, af= [(panelTxt_1, 'top', 64)])
	pm.formLayout(mainForm, e= 1, af= [(trans_Area, 'top', 84), (trans_Area, 'left', 15)])
	pm.formLayout(mainForm, e= 1, af= [(sep______2, 'top', 182)])
	pm.formLayout(mainForm, e= 1, af= [(panelTxt_2, 'top', 188)])
	pm.formLayout(mainForm, e= 1, af= [(targe_Area, 'top', 210), (targe_Area, 'left', 31)])
	pm.formLayout(mainForm, e= 1, af= [(sep______3, 'top', 304)])
	pm.formLayout(mainForm, e= 1, af= [(panelTxt_3, 'top', 310)])
	pm.formLayout(mainForm, e= 1, af= [(remap_Area, 'top', 332), (remap_Area, 'left', 20)])
	pm.formLayout(mainForm, e= 1, af= [(sep______4, 'top', 488)])
	pm.formLayout(mainForm, e= 1, af= [(exect_Area, 'top', 496), (exect_Area, 'left', 10)])


	def maya_mqsb_switch(status, *args):
		pm.columnLayout(targetAlone, e= 1, vis= 0 if status else 1)
		pm.columnLayout(targetCross, e= 1, vis= 1 if status else 0)
		pm.columnLayout(mode_group, e= 1, en= 1 if status else 0)
		pm.columnLayout(role_group, e= 1, en= 1 if status else 0)
		if status:
			pm.columnLayout(remap_Area, e= 1, en= 1 if role_mqsb.isChecked() else 0)
			pm.columnLayout(exect_Area, e= 1, en= 1 if role_mqsb.isChecked() else 0)
		else:
			pm.columnLayout(remap_Area, e= 1, en= 1)
			pm.columnLayout(exect_Area, e= 1, en= 1)
	maya_mqsb.onCmd = partial(maya_mqsb_switch, 1)
	maya_mqsb.offCmd = partial(maya_mqsb_switch, 0)

	def mode_mqsb_switch(status, *args):
		pm.text(tcHost_lbe, e= 1, en= 1 if status else 0)
		pm.textField(tcHost_txt, e= 1, tx= '', en= 1 if status else 0)
		pm.textField(tcPort_txt, e= 1, tx= '')
	mode_mqsb.onCmd = partial(mode_mqsb_switch, 1)
	mode_mqsb.offCmd = partial(mode_mqsb_switch, 0)

	def role_mqsb_switch(status, *args):
		pm.rowLayout(srcAddr, e= 1, vis= 1 if status else 0)
		pm.rowLayout(disAddr, e= 1, vis= 0 if status else 1)
		pm.textField(tcHost_txt, e= 1, tx= '', ed= 1 if status else 0)
		pm.textField(tcPort_txt, e= 1, tx= '', ed= 1 if status else 0)
		pm.columnLayout(remap_Area, e= 1, en= 1 if status else 0)
		pm.columnLayout(exect_Area, e= 1, en= 1 if status else 0)
	role_mqsb.onCmd = partial(role_mqsb_switch, 1)
	role_mqsb.offCmd = partial(role_mqsb_switch, 0)

	def op_btn_openPort(*args):
		addr = ''
		mode = 'LAN' if mode_mqsb.isChecked() else 'local'
		port_on = mark._portStatus()[0]
		if port_on:
			for p in port_on:
				if mode == 'LAN' and port_on[p]['ipaddr'].split(':')[0]:
					addr = port_on[p]['ipaddr']
				if mode == 'local' and not port_on[p]['ipaddr'].split(':')[0]:
					addr = port_on[p]['ipaddr']
		if not addr:
			addr = mark.portOpen(mode, 'python')
		host = addr.split(':')[0]
		port = addr.split(':')[1]
		pm.textField(tcHost_txt, e= 1, tx= str(host))
		pm.textField(tcPort_txt, e= 1, tx= str(port))
	pm.button(op_btn, e= 1, c= op_btn_openPort)

	def copyAddr(*args):
		host = pm.textField(tcHost_txt, q= 1, tx= 1)
		port = pm.textField(tcPort_txt, q= 1, tx= 1)
		addr = host + ':' + port
		pm.cmdScrollFieldExecuter(copypasteField, e= 1, clr= 1)
		pm.cmdScrollFieldExecuter(copypasteField, e= 1, t= addr)
		pm.cmdScrollFieldExecuter(copypasteField, e= 1, sla= 1)
		pm.cmdScrollFieldExecuter(copypasteField, e= 1, cp= 1)
	pm.button(cp_btn, e= 1, c= copyAddr)

	def pasteAddr(*args):
		pm.cmdScrollFieldExecuter(copypasteField, e= 1, clr= 1)
		pm.cmdScrollFieldExecuter(copypasteField, e= 1, pst= 1)
		addr = pm.cmdScrollFieldExecuter(copypasteField, q= 1, t= 1)
		host = addr.split(':')[0] if ':' in addr else ''
		port = addr.split(':')[1] if ':' in addr else ''
		pm.textField(tcHost_txt, e= 1, tx= host)
		pm.textField(tcPort_txt, e= 1, tx= port)
	pm.button(ps_btn, e= 1, c= pasteAddr)

	def saveTarget(*args):
		pm.textScrollList(trg_sls, e= 1, ra= 1)
		pm.textScrollList(trg_sls, e= 1, append= [str(i.name()) for i in pm.ls(sl= 1)])
	pm.button(svt_btn, e= 1, c= saveTarget)

	def addTarget(*args):
		ai = pm.textScrollList(trg_sls, q= 1, ai= 1)
		ai.extend([str(i.name()) for i in pm.ls(sl= 1)])
		ai = list(set(ai))
		pm.textScrollList(trg_sls, e= 1, ra= 1)
		pm.textScrollList(trg_sls, e= 1, append= ai)
	pm.button(adt_btn, e= 1, c= addTarget)

	def rmvTarget(*args):
		sel = pm.textScrollList(trg_sls, q= 1, si= 1)
		pm.textScrollList(trg_sls, e= 1, ri= sel)
	pm.button(rmt_btn, e= 1, c= rmvTarget)

	def _setConn():
		mode = 'LAN' if mode_mqsb.isChecked() else 'local'
		host = pm.textField(tcHost_txt, q= 1, tx= 1)
		port = pm.textField(tcPort_txt, q= 1, tx= 1)
		if port and ((mode == 'LAN' and host) or mode == 'local'):
			beam.setCoord(int(port), host= host)
			return True

	def checkConn(*args):
		if _setConn():
			beam.cmdSend('cmds.warning("[AniRemap] Connection Test Success.")', silent= 1)
	pm.button(ch_btn, e= 1, c= checkConn)
	
	def execRemap(*args):
		remapType = pm.optionMenu(match_mnu, q= 1, v= 1)
		tirm = tirm_mqsb.isChecked()
		sel_src = not hSrc_mqsb.isChecked()
		sel_dis = not hTrg_mqsb.isChecked()
		scale = pm.floatField(scale_flt, q= 1, v= 1)
		mirror = [None, 'X', 'Z', 'Y'][pm.radioButtonGrp('mirror_radioBtnGrp' , q= 1, sl= 1) - 1]
		if maya_mqsb.isChecked():
			if _setConn:
				mr.remoteRemap(beam, remapType, tirm, sel_src, sel_dis, scale, mirror)
		else:
			dis = [str(i) for i in pm.textScrollList(trg_sls, q= 1, ai= 1)]
			mr.localRemap(dis, remapType, tirm, sel_src, sel_dis, scale, mirror)
	pm.button(remap_btn, e= 1, c= execRemap)

	def dockCloseCmd(*args):
		mark.portClose(0)
	pm.dockControl(windowName, area= 'right', content= main_window, allowedArea= ['right', 'left'], \
		vis= 1, s= 0, ret= 0, w= dockWidth, vcc= dockCloseCmd)
Beispiel #54
0
    def create(self, windowName, windowWidth, windowHeight):

        if pm.objExists('ROOT_enviroment_01'):
            self.rootObject = 'ROOT_enviroment_01'
        else:
            pm.group(n='ROOT_enviroment_01', em=True)
            pm.select(cl=True)
            self.rootObject = 'ROOT_enviroment_01'

        # delete window if it exsists
        if pm.window("window", exists=True):
            pm.deleteUI("window")

        #define window
        self.widgets['window'] = pm.window("window",
                                           t=windowName,
                                           w=windowWidth,
                                           h=windowHeight,
                                           menuBar=True,
                                           titleBarMenu=True,
                                           bgc=[0.18, 0.18, 0.18],
                                           maximizeButton=False)

        pm.menu(label='File', tearOff=True)
        pm.menuItem(label='Quit', c=partial(self.quit, "AutoRig_JT"))
        pm.menu(label='Help', helpMenu=True)
        pm.menuItem('Application..."', label='About Creator', c=self.about)
        pm.menuItem('Instructions', label='Instructions', c=self.instructions)

        self.widgets['mainLayout'] = pm.columnLayout(adj=True)

        pm.frameLayout('Import/Export tools', cll=True, bgc=[0.25, 0.25, 0.25])

        #pm.button(l='Browse >>>', c= self.fileBrowser,bgc=[0.1,0.1,0.1],h=50)

        pm.separator(h=15)
        FilePathText = pm.text('FilePathText',
                               l=self.FilePath,
                               bgc=[0.1, 0.1, 0.1],
                               h=50)
        pm.separator(h=15)
        projectsOptionMenu = pm.optionMenu("library_Menu",
                                           w=300,
                                           label="Choose a Folder:   ",
                                           cc=partial(self.populateObjects),
                                           bgc=[0.1, 0.1, 0.1])
        pm.separator(h=15)

        #create character option
        characterOptionMenu = pm.optionMenu("Contents_Menu",
                                            w=300,
                                            label="Choose a Object:",
                                            bgc=[0.1, 0.1, 0.1])

        self.populateFolders()
        self.populateObjects()
        pm.separator(h=15)
        CreateCharacterButton = pm.button(l="Build",
                                          w=300,
                                          h=50,
                                          c=self.build,
                                          bgc=[0.1, 0.1, 0.1])

        exportSelectionButton = pm.button(l="Export_Selection",
                                          w=300,
                                          h=50,
                                          c=self.ExportSelection,
                                          bgc=[0.1, 0.1, 0.1])
        pm.setParent(u=True)
        pm.separator(style='none', h=10)

        pm.frameLayout('Placement tools', cll=True, bgc=[0.25, 0.25, 0.25])

        pm.text(l='Randomize Placement:')
        pm.separator(style='none', h=10)

        pm.rowColumnLayout(nc=2)
        pm.text(l='                               number of instances here:')
        self.widgets['numberOfInstances'] = pm.intField('numberOfInstances',
                                                        v=5,
                                                        w=50,
                                                        bgc=[0.1, 0.1, 0.1])

        pm.text(l='                 randomize radius:')
        self.widgets['randomizeRadius'] = pm.intField('randomizeRadius',
                                                      v=5,
                                                      w=50,
                                                      bgc=[0.1, 0.1, 0.1])

        pm.text(l='                     randomize scale max:')
        self.widgets['randomizeScaleMAX'] = pm.floatField('randomizeScaleMAX',
                                                          v=1,
                                                          bgc=[0.1, 0.1, 0.1])

        pm.text(l='                     randomize scale min:')
        self.widgets['randomizeScaleMIN'] = pm.floatField('randomizeScaleMIN',
                                                          v=-1,
                                                          bgc=[0.1, 0.1, 0.1])

        pm.separator(style='none', h=10)
        pm.separator(style='none', h=10)
        pm.setParent(u=True)
        pm.button(l='Randomize', c=self.randomize)
        pm.separator(style='none', h=10)

        pm.text(l='Attach along path:')
        pm.separator(style='none', h=10)
        pm.rowColumnLayout(nc=2)

        pm.text(l='numberOfDuplicates:')
        self.widgets['numberOfDuplicates'] = pm.intField('numberOfDuplicates',
                                                         v=5,
                                                         w=50,
                                                         bgc=[0.1, 0.1, 0.1])
        pm.text(l='set curve to duplicate along:')
        self.widgets['curvePath'] = pm.textFieldButtonGrp('curvePath',
                                                          bl='<<<',
                                                          bc=self.addCurve)
        pm.text(l='Randomize:')
        self.widgets['RandomPathDistance'] = pm.checkBox(l='')
        pm.text(l='                     randomize scale max:')
        self.widgets['randomizeScaleMINPath'] = pm.floatField(
            'randomizeScaleMINPath', v=-1, bgc=[0.1, 0.1, 0.1])
        pm.text(l='                     randomize scale min:')
        self.widgets['randomizeScaleMAXPath'] = pm.floatField(
            'randomizeScaleMAXPath', v=1, bgc=[0.1, 0.1, 0.1])

        pm.setParent(u=True)
        pm.button(l='Attach to path', c=self.duplicateAlongPath)

        pm.rowColumnLayout(nc=2)
        pm.text(l='             set ground plane :')
        self.widgets['groundplaneTextField'] = pm.textFieldButtonGrp(
            'groundPlaneTextField', bl='<<<', bc=self.addGroundPlane)
        pm.setParent(u=True)
        pm.button(l='Snap to ground', c=self.snapToGround)

        pm.setParent(u=True)
        pm.separator(style='none', h=10)
        pm.frameLayout('Renaming tools', cll=True, bgc=[0.25, 0.25, 0.25])

        self.widgets["replaceOptions"] = pm.radioButtonGrp(
            numberOfRadioButtons=3,
            label='replace options:',
            labelArray3=['replace search', 'replace before', 'replace after'],
            sl=1)

        self.widgets["selectionOptions"] = pm.radioButtonGrp(
            numberOfRadioButtons=3,
            label='selection options:',
            labelArray3=['hierarchy', 'selected', 'all'],
            sl=2)

        self.widgets["rowLayout"] = pm.rowColumnLayout(numberOfColumns=2,
                                                       columnAttach=(1,
                                                                     'right',
                                                                     0),
                                                       columnWidth=[(1, 100),
                                                                    (2, 250)])

        pm.text(label='search for:')
        self.widgets["searchField"] = pm.textField()

        pm.text(label='replace for:')
        self.widgets["replaceField"] = pm.textField()

        pm.separator(h=20, style='none')
        pm.button(l='GO', c=self.GO)
        pm.separator(h=20, style='none')
        pm.separator(h=20, style='none')
        pm.separator(h=20, style='none')
        pm.button(l='Increment Chain', c=self.renameChain)

        # create window
        pm.showWindow(self.widgets['window'])
        pm.window(self.widgets['window'],
                  e=True,
                  w=windowWidth,
                  h=windowHeight,
                  s=False)
Beispiel #55
0
	def launch(self, *args, **kwargs):
		"""launch renderer command
		"""
		# do nothing if there is no window (called externally)
		if not pm.window('cgru_afanasy_wnd', ex= 1):
			return

		# get values
		separate_layers = pm.checkBox('af_separate', q=1, v=1)
		start_frame = int(pm.floatField('af_strFrmFfd', q=1, v=1))
		end_frame = int(pm.floatField('af_endFrmFfd', q=1, v=1))
		frames_per_task = pm.intField('af_frmPTask_F', q=1, v=1)
		by_frame = int(pm.floatField('af_stpFrmFfd', q=1, v=1))
		hosts_mask = pm.textField('af_hostMask_F', q=1, text=1)
		hosts_exclude = pm.textField('af_hostExcl_F', q=1, text=1)
		priority = pm.intField('af_priority_F', q=1, v=1)
		pause = pm.checkBox('af_paused', q=1, v=1)
		close = pm.checkBox('af_close', q=1, v=1)

		# check values
		if start_frame > end_frame:
			temp = end_frame
			end_frame = start_frame
			start_frame = temp

		frames_per_task = max(1, frames_per_task)
		by_frame = max(1, by_frame)

		# store field values
		pm.optionVar['af_separate_layer_ov'] = separate_layers
		pm.optionVar['af_frmPTask_F_ov'] = frames_per_task
		pm.optionVar['af_hostMask_F_ov'] = hosts_mask
		pm.optionVar['af_hostExcl_F_ov'] = hosts_exclude
		pm.optionVar['af_priority_F_ov'] = priority
		pm.optionVar['af_paused_ov'] = pause
		pm.optionVar['af_close_ov'] = close

		# get paths
		scene_name = pm.sceneName()
		datetime = '%s%s' % (
			time.strftime('%y%m%d-%H%M%S-'),
			str(time.time() - int(time.time()))[2:5]
		)

		filename = '%s.%s.mb' % (scene_name, datetime)

		project_path = pm.workspace(q=1, rootDirectory=1)

		# ############################################################################
		# maya images folder root, a default path for not separate_layers
		# changed by DavidPower
		outputs = pm.workspace(q= 1, rd= 1) + pm.workspace('images', q= 1, fre= 1)
		# ############################################################################

		job_name = os.path.basename(scene_name)

		logger.debug('%ss %se %sr' % (start_frame, end_frame, by_frame))
		logger.debug('scene        = %s' % scene_name)
		logger.debug('file         = %s' % filename)
		logger.debug('job_name     = %s' % job_name)
		logger.debug('project_path = %s' % project_path)
		logger.debug('outputs      = %s' % outputs)

		if pm.checkBox('af_close', q=1, v=1):
			pm.deleteUI('cgru_afanasy_wnd')

		cmd_buffer = [
			'"%(filename)s"',
			'%(start)s',
			'%(end)s',
			'-by %(by_frame)s',
			'-hostsmask "%(msk)s"',
			'-hostsexcl "%(exc)s"',
			'-fpt %(fpt)s',
			'-name "%(name)s"',
			'-priority %(prio)s',
			'-pwd "%(pwd)s"',
			'-proj "%(proj)s"',
			'-images "%(images)s"',
			'-deletescene'
		]

		kwargs = {
			'filename': filename,
			'start': start_frame,
			'end': end_frame,
			'by_frame': by_frame,
			'msk': hosts_mask,
			'exc': hosts_exclude,
			'fpt': frames_per_task,
			'name': job_name,
			'prio': priority,
			'pwd': project_path,
			'proj': project_path,
			'images': outputs
		}

		drg = pm.PyNode('defaultRenderGlobals')
		if drg.getAttr('currentRenderer') == 'mentalRay':
			cmd_buffer.append('-type maya_mental')

		if pause:
			cmd_buffer.append('-pause')

		#-----------------------------#
		currentRenderer = pm.PyNode('defaultRenderGlobals').getAttr('currentRenderer')
		sn = os.path.basename(cmds.file(q= 1, exn= 1)).split('.')[0]
		imgPrefix = pm.getAttr('vraySettings.fileNamePrefix') if currentRenderer == 'vray' else pm.getAttr('defaultRenderGlobals.imageFilePrefix')
		tmpPrefix = imgPrefix.replace('<Scene>', sn)
		if currentRenderer == 'vray':
			pm.setAttr('vraySettings.fileNamePrefix', tmpPrefix)
		else:
			pm.setAttr('defaultRenderGlobals.imageFilePrefix', tmpPrefix)
		#-----------------------------#

		# save file
		pm.saveAs(
			filename,
			force=1,
			type='mayaBinary'
		)

		#-----------------------------#
		if currentRenderer == 'vray':
			pm.setAttr('vraySettings.fileNamePrefix', imgPrefix)
		else:
			pm.setAttr('defaultRenderGlobals.imageFilePrefix', imgPrefix)
		#-----------------------------#

		# rename back to original name
		pm.renameFile(scene_name)

		cmdList = []

		# submit renders
		if separate_layers:
			# render each layer separately
			rlm = pm.PyNode('renderLayerManager')
			layers = [layer for layer in rlm.connections()
					  if layer.renderable.get()]

			for layer in layers:
				layer_name = layer.name()
				kwargs['name'] = '%s:%s' % (job_name, layer_name)

				# ############################################################################
				# update images path for each layers, and fix outputs if renderer is vray
				# changed by DavidPower
				kwargs['images'] = self.dpaf_outputsFix(layer)
				# ############################################################################

				kwargs['start'] = int(self.dpaf_getOverrideData('defaultRenderGlobals.startFrame', layer_name))
				kwargs['end'] = int(self.dpaf_getOverrideData('defaultRenderGlobals.endFrame', layer_name))
				kwargs['by_frame'] = int(self.dpaf_getOverrideData('defaultRenderGlobals.byFrameStep', layer_name))

				tmp_cmd_buffer = copy.copy(cmd_buffer)
				tmp_cmd_buffer.append(
					'-take %s' % layer.name()
				)

				# create one big command
				afjob_cmd = ' '.join([
					os.environ['CGRU_PYTHONEXE'],
					'"%s/python/afjob.py"' % os.environ['AF_ROOT'],
					'%s' % ' '.join(tmp_cmd_buffer) % kwargs
				])
				cmdList.append(afjob_cmd)

		else:
			# create one big command
			afjob_cmd = ' '.join([
				os.environ['CGRU_PYTHONEXE'],
				'%s/python/afjob.py' % os.environ['AF_ROOT'],
				'%s' % ' '.join(cmd_buffer) % kwargs
			])
			cmdList.append(afjob_cmd)

		# call each command separately
		for cmd in cmdList:
			print(cmdList)

			os.system(cmd)