コード例 #1
0
ファイル: ui.py プロジェクト: kyuhoChoi/mayaTools
def ui():
    if pm.window(win, q=True, exists=True ): 
        pm.deleteUI(win)

    with pm.window(win, wh=[300,600], t=title):
        with pm.frameLayout( lv=False, cll=False, mw=1, mh=1):
            with pm.columnLayout(adj=True):
                with pm.tabLayout(tv=False):
                    with pm.frameLayout(lv=False, cll=False, mw=2, mh=2, bv=False):
                        with pm.rowLayout(nc=3, adj=2):
                            pm.image( image = shelfIcon )
                            pm.text(l=' %s'%title, fn='boldLabelFont', align='left')
                            pm.image( image = alfredIcon )

                pm.separator( h=8, style='in')
                
                with pm.frameLayout(lv=False, cll=False, mw=0, mh=0, bv=False):
                    with pm.frameLayout(lv=False, cll=False, mw=3, mh=3, bv=False):

    # Scene -----------------------
                        with pm.frameLayout(l='Scene', cll=True, mw=3, mh=3 ):
                            with pm.columnLayout(adj=True):

                                with pm.rowLayout( nc=10 ):
                                    pm.text(label='Reference Editor 2 : ', align='right', w=150)
                                    pm.button(label='Open UI...', w=180, en=False )   

                                with pm.rowLayout( nc=10 ):
                                    pm.text(label='File Traveler : ', align='right', w=150)
                                    pm.button(label='Open UI...', w=180, en=False ) 

    # Camera -----------------------
                        with pm.frameLayout(l='Camera', cll=True, mw=3, mh=3 ):
                            with pm.columnLayout(adj=True):

                                with pm.rowLayout( nc=10 ):
                                    pm.text(label='Create Camera : ', align='right', w=150)
                                    with pm.columnLayout():
                                        pm.button(label='Create Turntable Camera', w=180, en=False )
                                        pm.button(label='Create Frustum Camera', w=180, en=False )
                                        pm.button(label='Create Stereo Camera', w=180, en=False )   

                                with pm.rowLayout( nc=10 ):
                                    pm.text(label='Set Camera Playback Range : ', align='right', w=150)
                                    pm.button(label='set', c=pm.Callback( sm.setCamPlaybackRange ), w=180 )  
                                    
                                with pm.rowLayout( nc=10 ):
                                    pm.text(label='HUD : ', align='right', w=150)
                                    pm.button(label='Scene Name HUD', w=180, en=False )

                                with pm.rowLayout( nc=10 ):
                                    pm.text(label='Export Camera : ', align='right', w=150)
                                    pm.button(label='for After Effect...', w=180, en=False )
                                
    # Asset -----------------------
                        with pm.frameLayout(l='Asset', cll=True, mw=3, mh=3 ):
                            with pm.columnLayout(adj=True):
                                with pm.rowLayout( nc=10 ):
                                    pm.text(label='Toggle Display CharacterGeo : ', align='right', w=150)
                                    pm.button(label='( preview / render )', c=pm.Callback( sm.toggleDisplayCharacterGeo ), w=180 )
コード例 #2
0
ファイル: gui.py プロジェクト: bohdon/viewGui
    def register(self):
        """ Register the dock in maya """
        self.deleteViews()
        
        # Dock
        if pm.dockControl(self.dockName, ex=True):
            pm.deleteUI(self.dockName)

        # Window
        if pm.window(self.winName, ex=True):
            pm.deleteUI(self.winName)
        
        self._win = None
        self.applyMetrics()

        # For a dockControl, we've got to go create the ui this way
        # otherwise when we create the dockControl it doesn't see the main layout
        self._win = pm.window(self.winName, title=self.title)
        with pm.frameLayout('mainForm', lv=False, bv=False, p=self._win) as self._mainLayout:
            self.mainControl = self._mainLayout

            # Create the dockControl
            self._dockControl = pm.dockControl(self.winName+"Dock",
                con=self._win, aa=['left', 'right'], a=self.area, fl=int(self.floating), l=self.title,
                vcc=Callback(self.dockVisibleChanged), vis=False,
            )
            self._win = self._mainLayout
            self.showDefaultView()

        pm.scriptJob(uid=(self._win, Callback(self.winClosed)))
コード例 #3
0
def build():
    if pm.window('RemapWin', q = 1, ex = 1): pm.deleteUI('RemapWin')
    if pm.windowPref('RemapWin', q=1, ex = 1): pm.windowPref('RemapWin', r = True)
    with pm.window('RemapWin', title = 'RemapWin', wh = (150, 50), s = 0) as win:
        with pm.columnLayout(rs = 2, adj = 1):
            pm.button(l = u'创建色阶节点', c = run)
            pm.button(l = u'删除节点', c = deleteNodes)
コード例 #4
0
def gui():
    
    '''
    Main Interface
    '''
    win = "Layout"

    if pm.window(win, exists=True):
        pm.deleteUI(win, window=True)
    win = pm.window("Layout", w=300)
    main = pm.columnLayout()
    scroll = pm.scrollLayout(w=400, height=200)
    
    get_references()
    global asset_1, asset_2, asset_3
    asset_1 = Asset_Widget(scroll, 'trafficLight')
    asset_2 = Asset_Widget(scroll, 'mailBox1')
    asset_3 = Asset_Widget(scroll, 'mailBox2')
    
    '''
    asset_widget(scroll)
    asset_widget(scroll)
    asset_widget(scroll)
    asset_widget(scroll)
    '''
    
    win.show()
コード例 #5
0
ファイル: baker.py プロジェクト: creuter23/fs-tech-artist
def gui():
    '''
    # gui for the script
    '''
    win = 'rigid_body_win'
    if pm.window(win, exists= True):
        pm.deleteUI(win)
        
    if pm.windowPref(win, exists= True):
        pm.windowPref(win, remove= True)
    
    global obj_scroll_list, name_field, tab_layout
    
    my_win = pm.window(win, title= 'BAKE', toolbox= True, width= 300)
    tab_layout = pm.tabLayout()
    
    ui_creator = pm.columnLayout(adjustableColumn= False)
    name_field = pm.textFieldGrp(label = 'System Name', text= 'Name',
                                 columnWidth2= [145, 150])
    obj_scroll_list = pm.textScrollList(width= 300, height= 200,
                                    allowMultiSelection= True)
    pm.rowColumnLayout(nc=3, columnWidth= ([1,100], [2,100], [1,100]))
    pm.button(label= 'Load', command= pm.Callback(load_objects), width= 100)
    pm.button(label= '+', command= pm.Callback(add_objects), width= 100)
    pm.button(label= '-', command= pm.Callback(remove_objects), width= 100)
    
    pm.setParent('..')
    pm.button(label= 'Create Baking System', height= 50, width= 300,
              command= pm.Callback(create_baking_system))
    
    pm.tabLayout( tab_layout, edit=True, tabLabel=((ui_creator, 'Setup')))
    
    my_win.show()
コード例 #6
0
ファイル: SineRig_ui.py プロジェクト: Mauricio3000/MSH_Maya
 def __init__(self):
     winName = 'SineRigWin333'
     if pm.window(winName, exists=1):
         pm.deleteUI(winName,window=1)
     win = pm.window(winName, t='SineRig')
     
     pm.columnLayout(adj=1)
     pm.text('X Axis should be joint chain aim axis.')
     # Control
     self.cnt_fld = pm.textFieldButtonGrp(l='Control',bl='Load')
     pm.textFieldButtonGrp( self.cnt_fld, e=1, bc=lambda: pm.textFieldButtonGrp(self.cnt_fld,e=1,text=pm.ls(sl=1)[0]) )
     
     # Name
     self.name_fld = pm.textFieldGrp(l='Name')
     
     # Base jnt
     self.base_fld = pm.textFieldButtonGrp(l='Base Joint',bl='Load')
     pm.textFieldButtonGrp( self.base_fld, e=1, bc=lambda: pm.textFieldButtonGrp(self.base_fld,e=1,text=pm.ls(sl=1)[0]) ) 
     
     # Tip jnt
     self.tip_fld = pm.textFieldButtonGrp(l='Tip Joint',bl='Load')
     pm.textFieldButtonGrp( self.tip_fld, e=1, bc=lambda: pm.textFieldButtonGrp(self.tip_fld,e=1,text=pm.ls(sl=1)[0]) )        
     
     # Create button
     pm.button(l="Create",c=self.createRig)
     
     ##### Development Aide
     pm.textFieldButtonGrp(self.cnt_fld,e=1,text='TopFin_Base_ctrlA')
     pm.textFieldGrp(self.name_fld,e=1,text='Fin')
     pm.textFieldButtonGrp(self.base_fld,e=1,text='TopFinA_jnt_1')        
     pm.textFieldButtonGrp(self.tip_fld,e=1,text='TopFinA_jnt_12')        
     
     pm.showWindow(win)
コード例 #7
0
    def __init__(self):
        if pm.window('optionVarEditor', exists=True):
            pm.deleteUI('optionVarEditor')

        with pm.window(title='optionVarEditor', widthHeight=(502, 552), s=False) as window:
            with pm.columnLayout():
                with pm.rowColumnLayout(nc=2, cw=[(1, 250), (2, 250)]):
                    # List Column
                    with pm.columnLayout():
                        self.search = pm.textField(width=248, cc=self.refresh, ec=self.refresh)
                        self.scrollList = pm.textScrollList(height=500, width=250, selectCommand=self._select, ams=True)
                    # Attr Column
                    with pm.columnLayout():
                        pm.text(l='optionVar Name:')
                        self.name = pm.textField(tx='Name', ed=False, width=248)
                        pm.text(l='optionVar Value:')
                        self.value = pm.textField(tx='value', width=248)
                # Buttons
                with pm.rowColumnLayout(nc=3, cw=[(1, 166), (2, 166), (3, 166)]):
                    pm.button(label='Create', c=self._create)
                    pm.button(label='Edit', c=self._edit)
                    pm.button(label='Delete', c=self._delete)

        self.refresh()

        # Render Window
        window.show()
コード例 #8
0
ファイル: ms_armRig.py プロジェクト: Mauricio3000/MSH_Maya
    def helpWin(self,*args):
        """
         Display the help window
        """
        if(pm.window('msArmRigHelpWin',exists=True)):
            pm.deleteUI('msArmRigHelpWin',window=True)

        with pm.window('msArmRigHelpWin',title="Arm Rig Help",rtf=True) as mainWin:
            with pm.columnLayout():
                pm.text('   Locators should be placed for:')
                pm.text('               Shoulder')
                pm.text('               Elbow')
                pm.text('               Wrist')
                pm.text('\n')
                pm.text('   Upper Torso: Shoulder insertion. Clavicle or upper back joint.')
                pm.text('   Lower Torso: COG or something following the root.')
                pm.text('   World Mover: World mover control or equivalent.')
                pm.text('   (Used for space switch setup).')
                pm.text('\n')
                pm.text('   Switch Control: Place IK / FK switch on this control, usually the Hand control.')
                pm.text('   Switch control should be in place and zeroed.')
                pm.text('\n')
                pm.text('   Note: Locators should not be zeroed. They should have their world space')
                pm.text('   values in their translate attributes in the channel box.')        
                pm.text('\n')

                mainWin.show()
コード例 #9
0
    def __init__(self):
        title = 'pbRenderableCurve'
        version = 1.02

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

        with pm.window('pbRCurve', title='{0} | {1}'.format(title, version), s=False) as window:
            with pm.columnLayout():
                with pm.frameLayout(l='Selection:', cll=True, bs='out'):
                    with pm.columnLayout():
                        self.selField = pm.textFieldGrp(text='No Curves Selected', ed=False, l='Curve:', cw2=[72, 192])
                        with pm.rowLayout(nc=2):
                            self.bRenderable = pm.checkBox(l='Renderable', cc=self.bcRenderable)

                with pm.frameLayout(l='Mesh Settings:', cll=True, bs='out') as self.meshUI:
                    with pm.columnLayout():
                        with pm.rowLayout(nc=4):
                            self.useNormal = pm.checkBox(l='Use Normal', cc=self.bcUseNormal)
                            self.normalVector = [pm.intField(width=62, en=False, value=0, cc=self.setNormal),
                                                 pm.intField(width=62, en=False, value=1, cc=self.setNormal),
                                                 pm.intField(width=62, en=False, value=0, cc=self.setNormal)]
                        self.meshAttrs = [AttrSlider(maxValue=128, name='Thickness', obj=getCurves, type_='float', fmn=0.0001),
                                          AttrSlider(value=3, minValue=3, maxValue=64, name='Sides', obj=getCurves, fmn=3, fmx=100),
                                          AttrSlider(minValue=1, maxValue=32, name='Samples', obj=getCurves, fmn=1, fmx=128)]

                with pm.frameLayout('Shell Settings:', cll=True, bs='out') as self.shellUI:
                    with pm.columnLayout():
                        self.bShell = pm.checkBox(l='Enable Shell', cc=self.bcShell)
                        self.shellAttrs = [AttrSlider(value=1, minValue=-64, maxValue=64, name='ShellThickness', obj=getCurves, type_='float'),
                                           AttrSlider(value=1, minValue=1, maxValue=64, name='ShellDivisions', obj=getCurves, fmn=1, fmx=32)]

        window.show()
        pm.scriptJob(event=['SelectionChanged', self.refresh], protected=True, p=window)
        self.refresh()
コード例 #10
0
ファイル: lightTemplate.py プロジェクト: Quazo/breakingpoint
    def __init__(self, template):
        self.template = template
        self.win = "arnold_filter_list_win"
        if pm.window(self.win, exists=True):
            pm.deleteUI(self.win)
    
        pm.window(self.win, title="Add Light Filter",
                    sizeable=False,
                    resizeToFitChildren=True)
        #pm.windowPref(removeAll=True)
        pm.columnLayout(adjustableColumn=True,
                          columnOffset=("both", 10),
                          #columnAttach=('both',1),
                          rowSpacing=10)
    
        self.scrollList = pm.textScrollList('alf_filter_list', nr=4, ams=False)
        pm.textScrollList(self.scrollList,
                            e=True,
                            doubleClickCommand=Callback(self.addFilterAndHide))

        for label, nodeType in self.filters():
            pm.textScrollList(self.scrollList, edit=True, append=label)

        pm.rowLayout(numberOfColumns=2, columnAlign2=("center", "center"))
        pm.button(width=100, label="Add", command=Callback(self.addFilterAndHide))
        pm.button(width=100, label="Cancel", command=Callback(pm.deleteUI, self.win, window=True))
    
        pm.setParent('..')
        pm.setParent('..')

        pm.showWindow(self.win)
コード例 #11
0
ファイル: bdTrailUV.py プロジェクト: Mortaciunea/bdScripts
def createTrail():
    if pm.window('trailUI',ex=1):
        pm.deleteUI('trailUI')
    
    pm.window('trailUI')
    pm.columnLayout(adj=1)
    fsSample = pm.floatSliderGrp('sampleSlider', label='Sample by', cw=(1,70), adj=1, en=1,minValue=0.01, maxValue=100, fieldMinValue=0.01, fieldMaxValue=100,pre=2, field=1, v=1)
    pm.separator (height=4,style="in")
    startFrame = pm.playbackOptions(q=1,min=1)
    currentFrame = pm.currentTime(q=1)
    if currentFrame > startFrame:
        startFrame = currentFrame
    pm.intSliderGrp('startFrameSlider', label='Start frame', cw=(1,70), adj=1, en=1,minValue=0, maxValue=100, fieldMinValue=0, fieldMaxValue=10000, field=1, v=startFrame)
    pm.popupMenu(button=3,pmc = functools.partial(setTime,'start'))
    pm.intSliderGrp('endFrameSlider', label='End frame', cw=(1,70), adj=1, en=1,minValue=0, maxValue=100, fieldMinValue=0, fieldMaxValue=10000, field=1, v=startFrame+30)
    pm.popupMenu(button=3,pmc = functools.partial(setTime,'end'))
    pm.intSliderGrp('trailDivisions', label='Trail divisions', cw=(1,70), adj=1, en=1,minValue=1, maxValue=100, fieldMinValue=1, fieldMaxValue=10000, field=1, v=40)
    pm.separator (height=4,style="in")
    cbUvDistorted = pm.checkBox('cbUV',l='UV distorted',v=1)
    pm.separator (height=4,style="in")
    
    rowBtn = pm.rowColumnLayout(numberOfRows=1)
    pm.button(l='Create Trail',command=functools.partial(createTrailMesh))
    pm.button(l='Rebuil uvs',c=functools.partial(createTrailUv,''))
    pm.button(l='ELP !!!',c=openHelpPage)
    pm.showWindow('trailUI')
コード例 #12
0
ファイル: skin_swcUI.py プロジェクト: loichuss/maya
 def __renameBySearchUI__(self):
     """create UI to rename by search and replace methode"""
     # check if we have an object to work with
     if self.objSwc != None:
         # get selected item
         boneName = self.boneUI['tslBoneR'].getSelectItem()[-1]
         
         # window creation
         windowName = 'SkinSaveLoadBoneSearch'
         title      = 'Search and Replace Name'
         
         # creating the window
         if (pmc.window(windowName, exists = True)):
             pmc.deleteUI(windowName)
         
         self.boneSearchUI['window']    = pmc.window(windowName, title = title, width=self.boneSearchSize[0], height=self.boneSearchSize[1], resizeToFitChildren=False, sizeable=False, retain=True )
         self.boneSearchUI['layMain']   = pmc.columnLayout( width=self.boneSearchSize[0], height=self.boneSearchSize[1] )
         self.boneSearchUI['layChoice'] = pmc.rowLayout( numberOfColumns=4, columnWidth4=((self.boneSearchSize[0])/2-45, 10, (self.boneSearchSize[0])/2-45, 25), height=self.boneSearchSize[1] )
         self.boneSearchUI['txtSearch'] = pmc.textField( text=boneName, editable=True, width=(self.boneSearchSize[0])/2-45 )
         pmc.text( label=' > ', width=10 )
         self.boneSearchUI['txtReplace']= pmc.textField( text='', editable=True, width=(self.boneSearchSize[0])/2-45 )
         self.boneSearchUI['btnChoice'] = pmc.button( label='ok', annotation='Press it to rename the bones', width=25  )
         
         # add command
         self.boneSearchUI['btnChoice'].setCommand(pmc.Callback( self.__renameBySearch__ ))
         
         # show window
         self.boneSearchUI['window'].show()
         
         # replace properly the window at the middle of the father window
         self.boneSearchUI['window'].setTopLeftCorner([self.boneUI['window'].getTopEdge()+self.boneUI['window'].getHeight()/2-self.boneSearchSize[1]/2, self.boneUI['window'].getLeftEdge()+self.boneUI['window'].getWidth()/2-self.boneSearchSize[0]/2])
コード例 #13
0
ファイル: skin_swcUI.py プロジェクト: loichuss/maya
    def __renameManuallyBoneUI__(self):
        """create UI to rename one item"""
        # check if we have an object to work with
        if self.objSwc != None:
            # take the latest Item selected and select only this one
            boneIte  = self.boneUI['tslBoneR'].getSelectIndexedItem()
            if len(boneIte) > 1:
                self.boneUI['tslBoneR'].deselectAll()
                self.boneUI['tslBoneR'].setSelectIndexedItem(boneIte[-1])
            boneName = self.boneUI['tslBoneR'].getSelectItem()[-1]
            
            # window creation
            windowName = 'SkinSaveLoadBoneRename'
            title      = 'New Name'
            
            # creating the window
            if (pmc.window(windowName, exists = True)):
                pmc.deleteUI(windowName)
            
            self.boneRenameUI['window']    = pmc.window(windowName, title = title, width=self.boneRenameSize[0], height=self.boneRenameSize[1], resizeToFitChildren=False, sizeable=False )
            self.boneRenameUI['layMain']   = pmc.columnLayout( width=self.boneRenameSize[0], height=self.boneRenameSize[1] )
            self.boneRenameUI['layChoice'] = pmc.rowLayout( numberOfColumns=2, columnWidth2=((self.boneRenameSize[0])-40, 40), height=self.boneRenameSize[1] )
            self.boneRenameUI['txtChoice'] = pmc.textField( text=boneName, editable=True, width=(self.boneRenameSize[0])-45 )
            self.boneRenameUI['btnChoice'] = pmc.button( label='ok', annotation='Press it to rename the bones', width=37  )
            
            # add command
            self.boneRenameUI['btnChoice'].setCommand(pmc.Callback( self.__renameManuallyBone__, boneIte[-1] ))

            # show window
            self.boneRenameUI['window'].show()
            
            # replace properly the window at the middle of the father window
            self.boneRenameUI['window'].setTopLeftCorner([self.boneUI['window'].getTopEdge()+self.boneUI['window'].getHeight()/2-self.boneRenameSize[1]/2, self.boneUI['window'].getLeftEdge()+self.boneUI['window'].getWidth()/2-self.boneRenameSize[0]/2])
コード例 #14
0
ファイル: blueprint_ui.py プロジェクト: jeffhong21/scripts
    def __init__(self):

        self.moduleInstance = None

        self.UIwidgets = {}
        self.windowName = "createRigUI"
        self.windowTitle = "jhAutoRig Window"
        self.widthHeight = [475, 550]

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

        self.UIwidgets["window"] = pm.window(
            self.windowName,
            title=self.windowTitle,
            w=self.widthHeight[0],
            h=self.widthHeight[1],
            mxb=False,
            mnb=False,
            sizeable=False,
        )

        self.UIwidgets["ui_main_layout"] = pm.columnLayout(adj=True)

        self.initialize_modulesSettings()
        self.initialize_buildButton()

        pm.showWindow(self.windowName)

        self.createScriptJob()
コード例 #15
0
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()       
コード例 #16
0
def GUI():
    winName = 'squishy_ik_win'

    if pmc.window(winName, exists=1):
        pmc.deleteUI(winName)
    win = pmc.window(winName, t='Squishy IK')
    pmc.formLayout(numberOfDivisions=100)
    pmc.rowColumnLayout(nc=2, rs=[15, 15], columnOffset=(1, 'both', 5))
    pmc.text(l='1 - Create Placement Locators')
    pmc.button(l='Make Locators', c=pmc.Callback(makeAutoRigLocators))

    pmc.separator()
    pmc.separator()

    pmc.text(l='2 - Place locators where the spine begins and ends')
    pmc.button(l='Select Locators', c=pmc.Callback(selectAutoRigLocators))

    pmc.separator()
    pmc.separator()

    pmc.text(l='3 - With the locators place, go ahead and create the rig!')
    pmc.button(l='Create Squishy Spine', c=pmc.Callback(squishySplineIkCallback))

    pmc.separator()
    pmc.separator()

    pmc.text(l='4 - Select the joints to add to the skin cluster')
    pmc.button(l='Select Bind Joints', c=pmc.Callback(selectSquishyJointsCallback))

    win.show()
コード例 #17
0
 def __init__(self, debug=0):
     title="TransferBlendShapes"
     if(pm.windowPref(title, q=True, ex=True)):
         pm.windowPref(title, remove=True)
     if(pm.window(title, q=True, ex=True)):
         pm.deleteUI(title)
         
     self.win = pm.window(title, title="Transfer BlendShapes Tool")
     self.rowColumnLayoutA = pm.rowColumnLayout()
     self.intro = pm.text( label='complete the following steps in order' )
     self.frameLayoutA = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 1   Load Target Mesh', borderStyle='in' )
     self.columnlayoutA = pm.columnLayout()
     self.frameLayoutB = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 2   Import Mask', borderStyle='in' )
     self.columnlayoutA = pm.columnLayout()
     self.frameLayoutC = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True,  label='Step 3   Manipulate Match Mesh', borderStyle='in' )
     self.columnlayoutB = pm.columnLayout()
     self.frameLayoutD = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 4   Transfer Blends', borderStyle='in' )
     self.columnlayoutC = pm.columnLayout()
     #self.dockControl = pm.dockControl(label=title, area='right', content=title, allowedArea=['right', 'left'], sizeable=True)
     
     # fameA content
     self.names = {'Target':None}
     
     # Generating x number of fields based on dictionary keys of self.names
     for name in self.names:
         self.names[name] = pm.textFieldButtonGrp(cw = ((1, 76), (2, 176)), parent=self.frameLayoutA,
                                                  label = name, 
                                                  placeholderText = 'Enter Name Here   or   >>>> ',
                                                  buttonLabel = 'load selected', tcc= self.prepTargetMeshOn,
                                                  buttonCommand = pm.Callback(self.nameField_load, name))
     self.btn_prepTgt = pm.button(parent=self.frameLayoutA, enable=False, w=40, h=20, label="Prep Target", command=self.prepTargetMesh)
     self.fA_fillText = pm.text(parent=self.frameLayoutA, label='    ' )
         
     # fameB content
     self.importText = pm.text(parent=self.frameLayoutB, label='Import the desired facial mask' )
     self.manipulateText = pm.text(parent=self.frameLayoutB, label='Use the avalable controls to manipulate the mask' )
     self.fitText = pm.text(parent=self.frameLayoutB, label='Roughly fit the mask to the target mesh' )
     self.btn_trueHuman = pm.button(parent=self.frameLayoutB, enable=True, w=40, h=20, label="Human Anatomy", command=self.humanAnatomyImport)  
     self.btn_trueMuzzle = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Muzzle Anatomy", command=self.muzzleAnatomyImport)
     self.btn_toonHuman = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Human Toon", command=self.humanToonImport)  
     self.btn_toonMuzzle = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Muzzle Toon", command=self.muzzleToonImport)
     self.fB_fillText = pm.text(parent=self.frameLayoutB, label='    ' )
     
     # fameC content
     self.matchMeshText = pm.text(parent=self.frameLayoutC, label='activate match mesh and refine your geometry to better match the target' )
     self.btn_trueHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="Activate Match Mesh", command=self.matchMesh)
     self.btn_templateHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="template Target Mesh", command=self.tempTgt)
     self.btn_referenceHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="reference Target Mesh", command=self.refTgt)
     self.sldr_smooth = pm.intSliderGrp(parent=self.frameLayoutC, field=True, label='Match Mesh Divisions', minValue=-0, maxValue=4, fieldMinValue=-0, fieldMaxValue=4, value=0, cc=self.div_Slider_change)
     self.fC_fillText = pm.text(parent=self.frameLayoutC, label='    ' )
     
     # fameD content
     self.btn_go = pm.button(parent=self.frameLayoutD, enable=True, w=40, h=20, label="Transfer Shapes", command=self.execute)  
     self.btn_no = pm.button(parent=self.frameLayoutD, enable=True, w=40, h=20, label="NO DONT DO IT!", command=self.close)
     self.fE_fillText = pm.text(parent=self.frameLayoutD, label='    ' )
     self.win.show()
     if debug:
         test = ['mask_blendPipe_GEO', 'mask_hiRes_GEO']
         for name, test_val in zip(self.names, test):
             self.names[name].setText(test_val)
コード例 #18
0
ファイル: lights.py プロジェクト: creuter23/fs-tech-artist
 def __init__(self, path):
     
     self.path = path # the path to save the presets
     
     preset_win = 'preset_win'
     if pm.window(preset_win, exists= True):
         pm.deleteUI(preset_win)
         
     if pm.windowPref(preset_win, exists= True):
         pm.windowPref(preset_win, remove= True)
         
     temp_win = pm.window(preset_win, title= 'presets', width= 300,sizeable= False)
     
     pm.columnLayout(adjustableColumn= True)
     pm.text(label= '')
     
     pm.text(label= 'Preset Name')
     self.field = pm.textField()
     pm.text(label= '')
     pm.text(label= 'Description')
     pm.text(label= '')
     self.scroll = pm.scrollField(width= 300, wordWrap= True)
     pm.text(label= '')
     pm.button(label= 'Create Preset', command= pm.Callback(self.create_preset))
     pm.text(label= '')
     
     temp_win.show()
コード例 #19
0
def rh_dynamicJoint():
    #Create a variable for the window name
    winName = 'DynamicJoint'
    winTitle = 'rh_DynamicJoint_prototype_v0.23'
    #Delete the window if it exists
    if pm.window(winName, exists = True):
        pm.deleteUI(winName, window = True)
    #Build the main window
    pm.window(winName, title = winTitle, sizeable = True)
    #name field
    pm.textFieldGrp('NameTFG',label = 'Set up name:', text = 'Ribbon45hp', ed = True)
    pm.columnLayout(adjustableColumn = True)
    #side
    pm.radioButtonGrp('ColSel',nrb = 3,label = 'Side:',la3 = ['l','m','r'],sl = 1)    
    pm.columnLayout(adjustableColumn = True)
    #axis
    pm.radioButtonGrp('AxisSel',nrb = 3,label = 'Axis:',la3 = ['x','y','z'],sl = 1)    
    pm.columnLayout(adjustableColumn = True)
    #ccSize
    pm.floatSliderGrp('Cc_Size',label = 'Control Size:',f = True,min = 1,max = 10,fmn = 1,fmx = 100,v = 1)
    pm.columnLayout(adjustableColumn = True)
    #joint number
    pm.intSliderGrp('Joint_Num',label = 'Number Of Joints:',f = True,min = 4,max = 49,fmn = 1,fmx = 100,v = 4)
    pm.columnLayout(adjustableColumn = True)
    
    #inbound
    pm.button(label = 'Ready For Tasking', command = 'inbound()')
    pm.columnLayout(adjustableColumn = True)
    #bringTheRain
    pm.button(label = 'Target Acquire', command = 'bringTheRain()')
    pm.columnLayout(adjustableColumn = True)    
    
    #Show the window
    pm.showWindow(winName)
    pm.window(winName, edit = True, width = 378, height = 210)
コード例 #20
0
ファイル: aw_assimilator.py プロジェクト: creuter23/tools
    def __init__(self):
        """A GUI Class

        Args:
           args (None): Just in case...

        """
        self.name='aw_assimilator'
        self.width=200
        self.height=120
        self.title_blue_cl=[.1,.15,.2]
        self.close_red_cl=[0.5,0.2,0.2]
        self.go_green_cl=[.1,.4,.2]
        if pm.window(self.name, q=True, exists=True):
            pm.deleteUI(self.name)
        if pm.windowPref(self.name, ex=True):
            pm.windowPref(self.name, r=True)
        self.win = pm.window(self.name,widthHeight=(self.width, self.height),title=self.name)
        # Window creation 
        self.column_layout = pm.columnLayout(w=self.width)
        # Text Spacers!
        pm.text(l="\nSelect Source then Targets\n", fn='boldLabelFont', al='center', w=self.width, bgc=self.title_blue_cl)
        pm.text(l="", al='center')
        pm.text(l="Ready?", al='center', w=self.width)
        pm.text(l="", al='center', w=self.width)
        # Make a button and assign a command to it
        self.flow_layout=pm.flowLayout(w=self.width)
        pm.button('assimilateBtn',command=lambda *args: self.aw_assimilator(),label="Yes!", p=self.flow_layout, w=self.width/2, bgc=self.go_green_cl)
        pm.button('assimilateKillBtn',command=lambda *args: pm.deleteUI(self.name),label="Cancel", p=self.flow_layout, w=self.width/2-3, bgc=self.close_red_cl)
        self.win.show()
コード例 #21
0
ファイル: aw_windows.py プロジェクト: AndresMWeber/aw
 def __init__(self, title, widthHeight, tabs_names, frameLayoutPerTab, collapseStyle=0, descr=''):
     ### SETTING UP COLOR SCHEME ###
     colorScheme = col.ColorSwatches([col.ColorSwatch(47,52,64),
                                      col.ColorSwatch(63,86,102),
                                      col.ColorSwatch(234,96,69),
                                      col.ColorSwatch(245,229,192),
                                      col.ColorSwatch(248,202,77)])
     colorScheme.insertBetweens(3)
     self.col_fls=colorScheme.getColorList()
     
     self.close_red_cl=[0.5,0.2,0.2]
     self.title_blue_cl=[.1,.15,.2]
     self.go_green_cl=[.1,.4,.2]
     ### SETTING UP COLOR SCHEME ###
     if(pm.windowPref(title, q=True, ex=True)):
         pm.windowPref(title, remove=True)
     if(pm.window(title, q=True, ex=True)):
         pm.deleteUI(title)
     #self vars
     self.window = pm.window(title, wh=(widthHeight[0], widthHeight[1]), title=title)
     self.title=title
     self.wh = widthHeight
     self.tabs_names = tabs_names
     self.fl_perTab = frameLayoutPerTab
     self.collapseStyle=collapseStyle
     self.descr=descr
     #Defaults
     self.frameLayouts={}
     self.close_btn=''
     self.tabLayout=''
     self.docker=None
     
     self._createLayout()
     self.window.show()
コード例 #22
0
ファイル: ui_sample.py プロジェクト: kyuhoChoi/mayaTools
    def __init__(self):
        if pm.window(win, q=True, exists=True ): 
            pm.deleteUI(win)

        with pm.window(win, wh=[300,600], t=title):
            with pm.frameLayout( lv=False, cll=False, mw=1, mh=1):
                with pm.formLayout() as mainForm:

                    # 상단 
                    with pm.tabLayout(tv=False) as top:
                        with pm.frameLayout(lv=False, cll=False, mw=2, mh=2, bv=False):
                            with pm.rowLayout(nc=3, adj=2):
                                pm.image( image = shelf_icon )
                                pm.text(l='  %s'%title, fn='boldLabelFont', align='left')
                                pm.image( image = alfredIcon )
                   
                    #
                    # Contents start ===========================================================
                    # 중단
                    with pm.tabLayout(tv=False, scr=True, childResizable=True) as self.mid:
                        #with pm.columnLayout(adj=True):
                        with pm.frameLayout( lv=False, cll=False, mw=3, mh=3, bv=False):
                            uiContents()

                    #
                    # Contents end =============================================================
                    #
                    
                    # 하단
                    with pm.columnLayout(adj=True) as btm:
                        pm.helpLine()
       
            # 팝업메뉴
            # 왼쪽 마우스 클릭
            pm.popupMenu(button=1, p=top)
            pm.menuItem(l='Add To Shelf',  c=pm.Callback( self.addToShalf ) )

            # 오른쪽 마우스 클릭
            pm.popupMenu(button=3, p=top)
            pm.menuItem(l='Help', en=False )
           
            # 폼조정
            pm.formLayout( mainForm, e=True, 
                attachForm=[
                    (top, 'top', 3), 
                    (top, 'left', 3), 
                    (top, 'right', 3), 

                    (self.mid, 'left', 3), 
                    (self.mid, 'right', 3), 

                    (btm, 'left', 3), 
                    (btm, 'right', 3), 
                    (btm, 'bottom', 3),
                    ], 
                attachControl=[
                    (self.mid, 'top', 3, top), 
                    (self.mid, 'bottom', 0, btm)
                    ],
                )
コード例 #23
0
ファイル: ecSDKMirror.py プロジェクト: coxevan/tech_art_tools
    def __init__(self):
        self.window = 'sdkflip'
        self.title = 'ec Set Driven Key Utility'
        self.width_height = (312, 289)

        if py.window(self.window, exists=True):
            py.deleteUI(self.window)
        py.window(self.window, title=self.title, wh=self.width_height, sizeable=False)
        py.scrollLayout(horizontalScrollBarThickness=16, verticalScrollBarThickness=16)
        py.rowLayout("objRow", numberOfColumns=4, columnAlign2=("left", "right"), p="sdkflip")
        py.columnLayout("objCol", p="objRow")
        self.source_field = py.textField("sourceText", tx="Source Driver", p="objCol")
        py.columnLayout("objbutCol", p="objRow")
        py.button(label="<<", width=30, height=20, p="objbutCol", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_gui_fun, "sourcetxt"))
        py.columnLayout("tarCol", p="objRow")
        self.target_field = py.textField("targetText", tx="Target Driver", p="tarCol")
        py.columnLayout("tarbutCol", p="objRow")
        py.button(label="<<", width=30, height=20, p="tarbutCol", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_gui_fun, "targettxt"))
        py.frameLayout("scrollFrame", label="Driver Attributes", cll=False, borderStyle="etchedIn", p="sdkflip")
        py.rowLayout("scrollRow", p="scrollFrame")
        self.scroll_list = py.textScrollList("attrList", w=300, h=200, numberOfRows=8, allowMultiSelection=True, p="scrollRow")
        py.rowLayout("comRow", numberOfColumns=4, p="sdkflip")
        py.text("preText", l="Target Prefix", p="comRow")
        self.prefix_field = py.textField("prefixText", tx="rt", w=70, p="comRow")
        py.button(label="Mirror", width=80, height=30, p="comRow", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_sdk_flip, True))
        py.button(label="Copy", width=80, height=30, p="comRow", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_sdk_flip, False))

        py.showWindow(self.window)
コード例 #24
0
 def set_options(self, *arg):
     for opt in self.options:
         if opt == "sizes":
             value = []
             if self.dock_ui:
                 value.append(pmc.dockControl(self.dock_ui, q=True, w=True))
                 value.append(pmc.dockControl(self.dock_ui, q=True, h=True))
             else:
                 value.append(pmc.window(self.win, q=True, w=True))
                 value.append(pmc.window(self.win, q=True, h=True))
             
             value.extend(pmc.paneLayout(self.main_layout, q=True, paneSize=True))
             value.extend(pmc.paneLayout(self.script_layout, q=True, paneSize=True))
         
         elif opt == "dock":
             if self.dock_ui:
                 value = [self.dock[0]]
                 value.append(int(pmc.dockControl(self.dock_ui, q=True, floating=True)))
                 tmp = pmc.dockControl(self.dock_ui, q=True, area=True)
                 for obj_id, a in self.dock_areas.iteritems():
                     if a == tmp:
                         break
                 else:
                     obj_id = self.dock[2]
                 value.append(obj_id)
             else:
                 value = getattr(self, opt)
         else:
             value = getattr(self, opt)
         
         opt_name = self.get_option_name(opt)
         pmc.optionVar[opt_name] = value
     
     self.update_pys()
コード例 #25
0
def gui():
    '''
    creates the gui for the tool
    '''
    win = 'uvtools'
    if(pm.window(win, ex = True)):
        pm.deleteUI(win)
        
    if(pm.windowPref(win, ex = True)):
        pm.windowPref(win, remove = True)
        
        
    global scroll_list, dyn_uis
        
    myWin = pm.window(win, title='Anim UV Tool' , sizeable = True, mnb = True, width = 500, height = 400, backgroundColor= [.68,.68,.68])
    pm.scrollLayout(width= 500)
    pm.button(label= 'Creates Nodes', command= create_nodes, width= 500)
    
    row_layout = pm.rowColumnLayout(numberOfColumns= 3, columnWidth= [[1, 150], [2, 10], [3, 340]])
    pm.columnLayout(adjustableColumn= False, width=150)
    scroll_list = pm.textScrollList(width= 150, height= 200, selectCommand= pm.Callback(create_ui))
    pm.button(label= 'List Nodes', command= list_nodes, width= 148)
    pm.setParent(row_layout)
   
    pm.text(label= '')

    dyn_uis = pm.columnLayout(adjustableColumn= False, width= 340)
    
    # listing the nodes at start up
    list_nodes()
    
    myWin.show()
コード例 #26
0
def ui():
    columnWidth1st = 120

    if pm.window('AlembicMasterUI', q=True, exists=True) : pm.deleteUI('AlembicMasterUI')

    with pm.window('AlembicMasterUI',menuBar=True, s=True):
        with pm.columnLayout(adj=True):
            with pm.frameLayout( label='Export Alembic', mw=3, mh=3,cll=True, bs='etchedIn'):
                with pm.columnLayout(adj=True):
                    with pm.rowLayout(nc=3, adj=2):
                        pm.text(label='file :', w=columnWidth1st, align='right')
                        pm.textField('path_TFG', text="D:/")
                        pm.symbolButton( image='navButtonBrowse.png', c=pm.Callback( browseIt, 'path_TFG', 0, 'Alembic (*.abc)'  ) )
                        
                    with pm.rowLayout(nc=2, adj=2 ):
                        startFrame=pm.animation.playbackOptions(q=1, minTime=1)
                        EndFrame=pm.animation.playbackOptions(q=1, maxTime=1)
                        
                    with pm.rowLayout(nc=2, adj=2):
                        pm.text(l='',w=columnWidth1st)
                        pm.button(l='Export',bgc=(0.19,0.29,0.19),c=pm.Callback(exportScene))
                        
                    pm.radioButtonGrp( 'timeRange_RBG', label='Time range :', 
                        labelArray3=['Camera Setting','Time Slider', 'Start/End'], 
                        numberOfRadioButtons=3, 
                        select=1, 
                        cw = [1,columnWidth1st],
                        on1=pm.Callback( callback_timerangeSelect, 1), 
                        on2=pm.Callback( callback_timerangeSelect, 2),
                        on3=pm.Callback( callback_timerangeSelect, 3),
                        )
                        
                    pm.floatFieldGrp( 'timeRange_FFG', label='Start / End : ', value1=1, value2=24, numberOfFields=2, cw = [1,117], en=False)
            
            with pm.frameLayout( label='Rebuild Scene', mw=3, mh=3,cll=True, bs='etchedIn'):
                with pm.columnLayout(adj=True):
                    with pm.rowLayout(nc=2, adj=2):
                        pm.text(l='',w=columnWidth1st)
                        pm.button(l='New Scene', bgc=(0.24,0.49,0.24), c=pm.Callback(buildscene))
                    
            with pm.frameLayout( label='Import Alembic', mw=3, mh=3,cll=True, bs='etchedIn'):
                with pm.columnLayout(adj=True):
                    with pm.rowLayout(nc=3, adj=2):
                        pm.text(label='file :', w=columnWidth1st, align='right')
                        pm.textField('path_ABC2', text="D:/")
                        pm.symbolButton( image='navButtonBrowse.png', c=pm.Callback( browseIt, 'path_ABC2', 1, 'Alembic (*.abc)' ) )

                    with pm.rowLayout(nc=2, adj=2):
                        pm.text(l='',w=columnWidth1st)
                        pm.button(l='Import', bgc=(0.19,0.19,0.28), c=pm.Callback(importAbcFile))
                        
            with pm.frameLayout( label='Save Scene', mw=3, mh=3,cll=True, bs='etchedIn'):
                with pm.columnLayout(adj=True):
                    with pm.rowLayout(nc=3, adj=2):
                        pm.text(label='file :', w=columnWidth1st, align='right')
                        pm.textField('path_TFG2', text="D:/")
                        pm.symbolButton( image='navButtonBrowse.png', c=pm.Callback( browseIt, 'path_TFG2', 0 ) )
                    with pm.rowLayout(nc=2, adj=2):
                        pm.text(l='',w=columnWidth1st)
                        pm.button(l='Save Scene', w=64, bgc=(0.22,0.23,0.43), c=pm.Callback(saveScene))
コード例 #27
0
ファイル: gui.py プロジェクト: jenosavel/jhRigBuilder
    def __init__(self, *args, **kwargs):

        self.log           = logging.getLogger(self.__class__.__name__)
        self._refreshEvent = None

        if 'name' in kwargs:
            name = kwargs.pop('name')
        elif 'n' in kwargs:
            name = kwargs.pop('n')
        else:
            name = ''

        self._name = '{0}{1}'.format(self.__class__.__name__, name)

        if 'title' in kwargs:
            title = kwargs.pop('title')
        elif 't' in kwargs:
            title = kwargs.pop('t')
        else:
            title = ''

        kwargs['title'] = '{0} | {1}'.format(self.TITLE, title) if title else self.TITLE

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

        self._window = pm.window(self._name, *args, **kwargs)
コード例 #28
0
def ui_fixComponentShading(*args):
    ### UI setup
    global UI_name

    UI_name = [ 'chk_find', 'chk_fix', 'chk_layer', 'btn_run' ]

    if pm.window( 'fix_component_shading', exists=True ):
        pm.deleteUI( 'fix_component_shading', window=True )
        
    ui_layout['window'] = pm.window( 'fix_component_shading', title='Fix Component Shading', sizeable=False, h=200, w=200 )
    ui_layout['mainLayout'] = pm.columnLayout( columnAlign='left', columnAttach=['left', 0] )

    pm.checkBox( UI_name[0], label=' Find Component Shading Object', value=1, w=200, p=ui_layout['mainLayout'] )
    pm.checkBox( UI_name[1], label=' Fix Component Shading Object', w=200, p=ui_layout['mainLayout'] )
    pm.checkBox( UI_name[2], label=' Fix Ecah Render Layer', w=200, p=ui_layout['mainLayout'] )

    ui_layout['ui_sub1'] = pm.formLayout(p=ui_layout['mainLayout'] )
    btn = pm.button( UI_name[3] ,label=' Execute !', command=pm.Callback( doExecution ), w=100, p=ui_layout['ui_sub1'] )
    pm.formLayout( ui_layout['ui_sub1'], e=True, attachForm=[ (btn, 'left', 50 ) ] )
    
    pm.separator( h=8, w=200, style='single', p=ui_layout['mainLayout'] )
    
    ui_layout['ui_sub2'] = pm.columnLayout(p=ui_layout['mainLayout'] )
    pm.text(label=' --- This script will keep the material \n in the CURRENT render layer, so \n it better to run it in MASTER layer! --- ', bgc=[0.05, 0.05, 0.05], align='left', p=ui_layout['ui_sub2'] )
    
    pm.showWindow( ui_layout['window'] )
コード例 #29
0
ファイル: quiz.py プロジェクト: creuter23/fs-tech-artist
def gui():
    
    file_path = os.path.dirname(__file__)
    basename = os.path.basename(file_path)
    file_name = '%s.questions' % (basename)
    #print file_name, basename, file_path
    questions_file = os.path.join(file_path, file_name)
    #print questions_file
    f = open(questions_file, 'r')
    info = pickle.load(f)
    f.close()
    win = 'quiz_win'
    if pm.window(win, exists= True):
        pm.deleteUI(win)
        
    if pm.windowPref(win, exists= True):
        pm.windowPref(win, remove= True)
        
    global quiz
    my_win = pm.window(win, title= basename, toolbox= True,
                       width= 400, height= 600)
    
    pm.scrollLayout()
    
    quiz = Quiz(info)
    
    
    
    pm.button(label= 'Done', height= 35, command= pm.Callback(check))
    
    my_win.show()
コード例 #30
0
ファイル: exportABC.py プロジェクト: kiryha/AnimationDNA
def exportABCUI(*args):
    
    if pm.window('exportABC', q = 1, ex = 1):
        pm.deleteUI('exportABC')
    win = pm.window('exportABC', t= 'Export ANIMATION', rtf=True, w = 280 )
    with win:
        mainLayout = pm.columnLayout()              
        allLayout = pm.columnLayout(parent = mainLayout) 

        # Export <<  ALL ANIMATION  >>
        exportAll = pm.button(l = 'EXPORT ALL ANIMATION', w = 280, h= 50)
        exportAll.setCommand(pm.Callback (expAllABC, listChars,listCam,listAssets))
        pm.separator(h = 15)
        # Export <<  CAMERA  >> 
        exportCam = pm.button(l = 'EXPORT CAMERA', w = 280, h= 25) 
        exportCam.setCommand(pm.Callback (exportCamABC, listCam))
        pm.separator(h = 10)
        # Export <<  CHARACTERS  >>        
        charLayout = pm.rowColumnLayout(nc=2, parent = mainLayout) 
        if listChars:
           for char in listChars:
                exportChar = pm.button(l = char, w = 140, h= 25)
                exportChar.setCommand(pm.Callback (exportABC, char, 'CHR'))
        else:
            blank = pm.text(l = '     NO CHARACTERS IN SCENE' , h= 40)
        # Export <<  ALL CHARACTERS   >>
        charLayoutAll = pm.columnLayout( parent = mainLayout) 
        exportCharAll = pm.button(l = 'EXPORT ALL CHARACTERS', w = 280, h= 40)
        exportCharAll.setCommand(pm.Callback (expListABC, listChars, 'CHR'))
        # Export <<  ASSETS  >>
        pm.separator(h = 10) 
        assetLayout = pm.rowColumnLayout(nc= 2, parent = mainLayout) 
        if listAssets:
            for asset in listAssets:
                exportAss = pm.button(l = asset, w = 140, h= 25)
                exportAss.setCommand(pm.Callback (exportABC, asset, 'AST'))  
        else:
            a = pm.text(l = '     NO ASSETS IN SCENE', h= 20)               
        assetAllLayout = pm.columnLayout(parent = mainLayout) 
        # Export <<  ALL ASSETS  >>
        exportAssAll = pm.button(l = 'EXPORT ALL ASSETS', w = 280, h= 40)
        exportAssAll.setCommand(pm.Callback (expListABC, listAssets, 'AST'))
        pm.separator(h = 10)
        # Export <<  EDA  >>
        envLayout = pm.rowColumnLayout(nc = 2, parent = mainLayout) 
        if listAssetsEnv:
           for assetEnv in listAssetsEnv:
                exportEnv = pm.button(l = assetEnv, w = 140, h= 25)
                exportEnv.setCommand(pm.Callback (exportABC, assetEnv, 'EDA'))
                
        else:
            blank = pm.text(l = '     NO ANIM in ENVIRONMENT' , h= 40)
        envLayoutAll = pm.columnLayout( parent = mainLayout) # Export ALL EDA   
        exportEnvAll = pm.button(l = 'EXPORT ALL EDA', w = 280, h= 40)
        exportEnvAll.setCommand(pm.Callback (expListABC, listAssetsEnv, 'EDA' ))
        #pm.separator(h = 10)

        
    win.show()    
コード例 #31
0
ファイル: afanasy.py プロジェクト: ElonGame/anima
    def show(self):
        # some default values
        section_label_height = 30
        labels_width = 140

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

        self.window = pm.window(self.windows_name, t='Afanasy Job Submission')

        with pm.columnLayout(adj=True):

            pm.text(l='<h1><b>Job Parameters<b><h1>', h=section_label_height)
            with pm.rowLayout(nc=4,
                              adj=2,
                              cl4=['right', 'left', 'center', 'center'],
                              cw4=(labels_width, 40, 15, 15)):
                pm.text(l='<div align="right"><b>Start Frame</b></div>')
                start_time_int_field = pm.intField(
                    'cgru_afanasy__start_frame',
                    v=pm.optionVar.get('cgru_afanasy__start_frame_ov', 1)
                )
                pm.button(
                    l='<',
                    ann='Use minimum animation range',
                    c=functools.partial(
                        self.set_field_value,
                        start_time_int_field,
                        functools.partial(
                            pm.playbackOptions,
                            q=True,
                            min=True
                        )
                    )
                )
                pm.button(
                    l='<<',
                    ann='Use minimum playback range',
                    c=functools.partial(
                        self.set_field_value,
                        start_time_int_field,
                        functools.partial(
                            pm.playbackOptions,
                            q=True,
                            ast=True
                        )
                    )
                )

            with pm.rowLayout(nc=4, adj=2, cw4=(labels_width, 40, 15, 15)):
                pm.text(l='<b>End Frame</b>')
                end_time_int_field = pm.intField(
                    'cgru_afanasy__end_frame',
                    v=pm.optionVar.get('cgru_afanasy__end_frame_ov', 1)
                )
                pm.button(
                    l='<',
                    ann='Use maximum animation range',
                    c=functools.partial(
                        self.set_field_value,
                        end_time_int_field,
                        functools.partial(
                            pm.playbackOptions,
                            q=True,
                            max=True
                        )
                    )
                )
                pm.button(
                    l='<<',
                    ann='Use maximum playback range',
                    c=functools.partial(
                        self.set_field_value,
                        end_time_int_field,
                        functools.partial(
                            pm.playbackOptions,
                            q=True,
                            aet=True
                        )
                    )
                )

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Frame Per Task</b>')
                pm.intField(
                    'cgru_afanasy__frames_per_task',
                    v=pm.optionVar.get('cgru_afanasy__frames_per_task_ov', 1)
                )

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>By Frame</b>')
                pm.intField(
                    'cgru_afanasy__by_frame',
                    v=pm.optionVar.get('cgru_afanasy__by_frame_ov', 1)
                )

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Global Depend Mask</b>')
                pm.textField(
                    'cgru_afanasy__depend_mask_global',
                    text=pm.optionVar.get(
                        'cgru_afanasy__depend_mask_global_ov', ''
                    )
                )

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Host Mask</b>')
                pm.textField(
                    'cgru_afanasy__hosts_mask',
                    text=pm.optionVar.get('cgru_afanasy__hosts_mask_ov', '')
                )

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Host Exclude</b>')
                pm.textField(
                    'cgru_afanasy__hosts_exclude',
                    text=pm.optionVar.get('cgru_afanasy__hosts_exclude_ov', '')
                )

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Life Time (hours)</b>')
                pm.intField(
                    'cgru_afanasy__life_time',
                    v=pm.optionVar.get('cgru_afanasy__life_time_ov', 240)
                )

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Annotation</b>')
                pm.textField(
                    'cgru_afanasy__annotation',
                    text=pm.optionVar.get('cgru_afanasy__annotation_ov', '')
                )

            pm.separator()
            pm.text(l='<h1><b>Block Parameters<b><h1>', h=section_label_height)
            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Errors Avoid Host</b>')
                pm.intField(
                    'cgru_afanasy__errors_avoid_host',
                    v=pm.optionVar.get(
                        'cgru_afanasy__errors_avoid_host_ov',
                        3
                    ),
                    min=0,
                    max=127
                )

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Errors Retries</b>')
                pm.intField(
                    'cgru_afanasy__errors_retries',
                    v=pm.optionVar.get(
                        'cgru_afanasy__errors_retries_ov',
                        3
                    ),
                    min=0,
                    max=127
                )

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Errors Task Same Host</b>')
                pm.intField(
                    'cgru_afanasy__errors_task_same_host',
                    v=pm.optionVar.get(
                        'cgru_afanasy__errors_task_same_host_ov',
                        3
                    ),
                    min=0,
                    max=127
                )

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Errors Forgive Time</b>', ann='in seconds')
                pm.intField(
                    'cgru_afanasy__errors_forgive_time',
                    ann='in seconds',
                    v=pm.optionVar.get(
                        'cgru_afanasy__errors_errors_forgive_time_ov',
                        18000
                    ),
                    min=0
                )

            pm.separator()
            pm.text(l='<h1><b>Submission Details<b><h1>', h=section_label_height)
            with pm.rowLayout(nc=2, adj=2, cl2=('right', 'left'), cw2=(labels_width, 50)):
                pm.text(l='<b>Start Paused</b>', al='right')
                pm.checkBox('cgru_afanasy__paused', l='', v=0)

            pm.radioButtonGrp(
                'cgru_afanasy__separate_layers',
                numberOfRadioButtons=3,
                label='<b>Submit Render Layers<br>as Separate:</b>',
                labelArray3=[
                    'None',
                    'Block',
                    'Job'
                ],
                # adj=1,
                cw4=[labels_width, 50, 50, 50],
                sl=pm.optionVar.get('cgru_afanasy__separate_layers_ov', 2)
            )

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                ann = """This is a weird hack! When used in conjunction with
the <b>Skip Existence Frames<b> parameter of the maya render settings and the
Frames Per Task parameters is equal or greater than the number of frames in the
animation range, it allows the Maya scene to be loaded only once per farm
machine. But then to be able to use all farmers there should be at least the
same amount of Jobs that there are farm machines. So with this parameter it is
possible to submit the same job multiple times.. But it is a bad hack.

This system will be updated in Afanasy."""
                pm.text(l='<b>Submit Multiple Times</b>', ann=ann)
                pm.intField(
                    'cgru_afanasy__submit_multiple_times',
                    ann=ann,
                    v=pm.optionVar.get(
                        'cgru_afanasy__submit_multiple_times_ov',
                        1
                    )
                )

            with pm.rowLayout(nc=2, adj=2, cl2=('right', 'left'), cw2=(labels_width, 40)):
                pm.text(l='<b>Close After</b>', al='right')
                pm.checkBox(
                    'cgru_afanasy__close',
                    l='',
                    v=1
                )

            pm.button(
                l='SUBMIT',
                c=self.launch
            )


        pm.showWindow(self.window)
コード例 #32
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)
コード例 #33
0
def createUI():
    if pm.window(moduleWin, exists=True, q=True):
        pm.deleteUI(moduleWin)

    ModuleUI()
コード例 #34
0
ファイル: gui.py プロジェクト: milesckt/mgear
    def __init__(self):

        # Remove existing window
        if pm.window(GUIDE_UI_WINDOW_NAME, exists=True):
            print "deleting win"
            pm.deleteUI(GUIDE_UI_WINDOW_NAME)

        if pm.dockControl(GUIDE_DOCK_NAME, exists=True):
            print "deleting dock"
            pm.deleteUI(GUIDE_DOCK_NAME)

        panelWeight = 200
        scrollHight = 600

        # Create Window and main tab
        self.ui_window = pm.window(
            GUIDE_UI_WINDOW_NAME, width=panelWeight, title="Guide Tools",
            sizeable=True)
        self.ui_topLevelColumn = pm.columnLayout(
            adjustableColumn=True, columnAlign="center")

        #
        pm.columnLayout()
        pm.rowLayout(numberOfColumns=1, columnWidth=[(1, panelWeight)])
        pm.button(label="Settings", w=panelWeight, h=30,
                  bgc=[.042, .351, .615],
                  command=partial(self.inspectSettings))
        pm.setParent('..')
        pm.rowLayout(numberOfColumns=3, columnWidth=[
                     (1, (panelWeight / 3) - 1),
                     (2, (panelWeight / 3) - 1),
                     (3, (panelWeight / 3) - 1)])
        pm.button(label="Dupl.", w=(panelWeight / 3) - 1, h=23,
                  bgc=[.311, .635, 0], command=partial(self.duplicate, False))
        pm.button(label="Dupl. Sym", w=(panelWeight / 3) - 1, h=23,
                  bgc=[.465, .785, .159],
                  command=partial(self.duplicate, True))
        pm.button(label="Extr. Ctl", w=(panelWeight / 3) - 1, h=23,
                  bgc=[.835, .792, .042],
                  command=partial(self.extractControls))
        pm.setParent('..')
        pm.rowLayout(numberOfColumns=1, columnWidth=[(1, panelWeight)])
        pm.button(label="Build from selection", w=panelWeight, h=30,
                  bgc=[.912, .427, .176],
                  command=partial(self.buildFromSelection))
        pm.setParent('..')

        self.ui_tabs = pm.tabLayout(
            width=panelWeight, innerMarginWidth=5, innerMarginHeight=5)
        pm.tabLayout(self.ui_tabs, q=True, width=True)

        #
        self.ui_compColumn = pm.columnLayout(adj=True, rs=3)
        self.ui_compFrameLayout = pm.frameLayout(
            height=scrollHight, collapsable=False, borderVisible=False,
            labelVisible=False)
        self.ui_compList_Scroll = pm.scrollLayout(hst=0)
        self.ui_compList_column = pm.columnLayout(
            columnWidth=panelWeight, adj=True, rs=2)
        pm.separator()

        # List of components
        # doGrouping = 1 < len(shifter.COMPONENTS_DIRECTORIES.keys())
        compDir = shifter.getComponentDirectories()
        trackLoadComponent = []
        for path, comps in compDir.iteritems():

            pm.text(align="center", label=os.path.basename(path))
            pm.separator()
            for comp_name in comps:

                if comp_name in trackLoadComponent:
                    pm.displayWarning(
                        "Custom component name: %s, already in default "
                        "components. Names should be unique. This component is"
                        " not loaded" % comp_name)
                    continue
                else:
                    trackLoadComponent.append(comp_name)

                if not os.path.exists(os.path.join(path,
                                                   comp_name, "__init__.py")):
                    continue

                module = shifter.importComponentGuide(comp_name)

                reload(module)
                image = os.path.join(path, comp_name, "icon.jpg")

                buttonSize = 25
                textDesc = "Name: " + module.NAME + "\nType:: " + \
                           module.TYPE + "\n===========\nAuthor: " + \
                           module.AUTHOR + "\nWeb: " + module.URL + \
                           "\nEmail: " + module.EMAIL + \
                           "\n===========\nDescription:\n" + module.DESCRIPTION

                pm.rowLayout(numberOfColumns=2,
                             columnWidth=([1, buttonSize]),
                             adjustableColumn=2,
                             columnAttach=([1, "both", 0], [2, "both", 5]))
                pm.symbolButton(ann=textDesc,
                                width=buttonSize,
                                height=buttonSize,
                                bgc=[0, 0, 0],
                                ebg=False, i=image,
                                command=partial(self.drawComp, module.TYPE))
                pm.columnLayout(columnAlign="center")
                pm.text(align="center", width=panelWeight * .6,
                        label=module.TYPE, ann=textDesc, fn="plainLabelFont")

                pm.setParent(self.ui_compList_column)
                pm.separator()

        # Display the window
        pm.tabLayout(self.ui_tabs, edit=True,
                     tabLabelIndex=([1, "Components"]))
        allowedAreas = ['right', 'left']
        pm.dockControl(GUIDE_DOCK_NAME, area='right', content=self.ui_window,
                       allowedArea=allowedAreas, width=panelWeight, s=True)
コード例 #35
0
ファイル: ui.py プロジェクト: cgmafia/anima
    def init_ui(self):
        if core.window(self.window_name, q=True, ex=True):
            core.deleteUI(self.window_name, wnd=True)

        self.window = core.window(self.window_name,
                                  wh=(self.width, self.height),
                                  mnb=False,
                                  mxb=False,
                                  sizeable=False,
                                  title=self.window_title)

        #the layout
        main_formLayout = core.formLayout('main_formLayout',
                                          nd=100,
                                          parent=self.window)

        prog_columnLayout = core.columnLayout('prog_columnLayout',
                                              columnAttach=('both', 3),
                                              rowSpacing=10,
                                              columnWidth=265,
                                              parent=main_formLayout)

        top_rowLayout = core.rowLayout('top_rowLayout',
                                       numberOfColumns=2,
                                       columnWidth2=(85, 180),
                                       adjustableColumn=2,
                                       columnAlign=(1, 'right'),
                                       columnAttach=[(1, 'both', 0),
                                                     (2, 'both', 0)],
                                       parent=prog_columnLayout)

        topleft_columnLayout = core.columnLayout('topleft_columnLayout',
                                                 w=85,
                                                 columnAttach=('left', 5),
                                                 cal='left',
                                                 rowSpacing=17,
                                                 columnWidth=85,
                                                 parent=top_rowLayout)

        core.text(label='Scene Code', parent=topleft_columnLayout)
        core.text(label='File Version', parent=topleft_columnLayout)
        core.text(label='Handle Lenght', parent=topleft_columnLayout)
        core.text(label='Export', parent=topleft_columnLayout)
        core.text(label='Convert MOVs', parent=topleft_columnLayout)

        right_columnLayout = core.columnLayout('right_columnLayout',
                                               columnAttach=('left', 5),
                                               cal='left',
                                               rowSpacing=10,
                                               columnWidth=85,
                                               parent=top_rowLayout)

        Seqname_rowLayout = core.rowLayout('seqNameRow',
                                           numberOfColumns=3,
                                           columnWidth3=(40, 60, 55),
                                           columnAttach=[(1, 'both', 5),
                                                         (2, 'both', 10),
                                                         (3, 'both', 5)],
                                           parent=right_columnLayout)

        seq = core.textField(pht="SEQ", parent=Seqname_rowLayout)
        loc = core.textField(pht="LOC", parent=Seqname_rowLayout)
        script = core.textField(pht="Script", parent=Seqname_rowLayout)

        topRight_columnLayout = core.columnLayout('topRight_columnLayout',
                                                  w=170,
                                                  columnAttach=('both', 5),
                                                  rowSpacing=10,
                                                  columnWidth=160,
                                                  parent=right_columnLayout)

        current_version = self.mEnv.get_current_version()
        if current_version:
            version_number = current_version.version_number
        else:
            version_number = 1
        version_string = 'v%03d' % version_number

        version = core.textField(text=version_string)
        lenght_slider_grp = core.intSliderGrp(field=True,
                                              cw2=(30, 70),
                                              cc=self.set_handle,
                                              min=0,
                                              v=15,
                                              max=50)
        self.edl_checkBox = core.checkBox('EDL', value=True)
        self.mxf_checkBox = core.checkBox('to MXF', value=True)

        core.separator(h=20, parent=prog_columnLayout)

        bottom_columnLayout = core.columnLayout('bottom_rowLayout',
                                                w=260,
                                                columnAttach=('both', 5),
                                                rowSpacing=10,
                                                columnWidth=260,
                                                parent=prog_columnLayout)

        core.button(label='Export',
                    bgc=(0.1, 0.4, 0.1),
                    w=250,
                    parent=bottom_columnLayout,
                    c=self.export)
        core.button(label='Close Window',
                    command=self.close,
                    bgc=(0.3, 0.1, 0.1),
                    w=250,
                    parent=bottom_columnLayout)
コード例 #36
0
def lcTextureToolsUI(dockable=False, asChildLayout=False, *args, **kwargs):
    ''' '''
    global lct_cfg
    global prefix
    global height
    global defaultPath
    global defaultPrefix

    ci = 0  # color index iterator
    windowName = 'lcTextureTools'
    shelfCommand = 'import lct.src.{0}.{0} as {1}\nreload({1})\n{1}.{0}UI()'.format(windowName, prefix)
    commandString = 'import lct.src.{0}.{0} as {1}\nreload({1})\n{1}.{0}UI(asChildLayout=True)'.format(windowName,
                                                                                                       prefix)
    icon = os.path.join(basePath, 'lcTextureTools.png')
    winWidth = 205
    winHeight = height

    if pm.window(windowName, ex=True):
        pm.deleteUI(windowName)

    if not asChildLayout:
        lcUI.UI.lcToolbox_child_popout(prefix + '_columnLayout_main', windowName, height, commandString, iconPath,
                                       lct_cfg)
        mainWindow = lcUI.lcWindow(prefix=prefix, windowName=windowName, width=winWidth, height=winHeight, icon=icon,
                                   shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True)
        mainWindow.create()

    #
    pm.columnLayout(prefix + '_columnLayout_main')

    # RENAME TEXTURE NODES
    pm.text(l='- Rename File Texture Nodes -', font='boldLabelFont', al='center', w=200, h=20, bgc=colorWheel.darkgrey)
    pm.separator(style='none', h=3, w=200)

    pm.rowColumnLayout(nc=3, cw=([1, 40], [2, 110], [3, 50]))
    pm.textField(prefix + '_textField_prefix', placeholderText=defaultPrefix,
                 changeCommand=lambda *args: lct_cfg.set('lcTextureToolsPrefix',
                                                         pm.textField(prefix + '_textField_prefix', query=True,
                                                                      tx=True)),
                 receiveFocusCommand=lambda *args: lcTxT_rename_focus())
    pm.text(l="_'texture_file_name'")
    pm.button(prefix + '_button_rename', l='Rename', bgc=colorWheel.getColorRGB(ci),
              annotation='rename all file texture nodes', w=50,
              command=lambda *args: lcTxT_rename_textures(pm.textField(prefix + '_textField_prefix', q=True, tx=True)))
    ci += 1
    pm.setParent(prefix + '_columnLayout_main')
    pm.separator(style='in', h=8, w=200)

    # REPATH TEXTURE NODES
    pm.text(l='- Set new path for File Textures -', font='boldLabelFont', al='center', w=200, h=25,
            bgc=colorWheel.darkgrey)
    pm.separator(style='none', h=3, w=200)

    lcUI.UI.lc_browse_field_button(width=200, textFieldName=prefix + '_textField_new_path', lct_cfg=lct_cfg,
                                   configAttr='lcTextureToolsRepath', placeholderText=defaultPath,
                                   annotation='Choose a new texture directory')
    pm.setParent(prefix + '_columnLayout_main')

    #
    pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100]))
    pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Repath All', flat=False,
                      image=os.path.join(iconPath, 'repath.png'), bgc=colorWheel.getColorRGB(ci),
                      annotation='Repath all file texture nodes to exact path given',
                      command=lambda *args: lcTxT_repath_all())
    ci += 1
    pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Selected', flat=False,
                      image=os.path.join(iconPath, 'repath.png'), bgc=colorWheel.getColorRGB(ci),
                      annotation='Repath selected file texture nodes to exact path given',
                      command=lambda *args: lcTxT_repath_selected())
    ci += 1
    pm.setParent(prefix + '_columnLayout_main')
    #
    pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100]))
    pm.button(w=100, h=25, label='Intelli-All', bgc=colorWheel.getColorRGB(ci),
              annotation='Recursive search given path to repath all file texture nodes',
              command=lambda *args: lcTxT_intelligent_repath_all())
    ci += 1
    pm.button(w=100, h=25, label='Intelli-Selected', bgc=colorWheel.getColorRGB(ci),
              annotation='Recursive search given path to repath selected file texture nodes',
              command=lambda *args: lcTxT_intelligent_repath_selected())
    ci += 1
    pm.setParent(prefix + '_columnLayout_main')
    pm.separator(style='in', h=8, w=200)

    # REPATH SHADERS (dx11 only)
    pm.text(l='- Set new path for DX11 Shaders -', font='boldLabelFont', al='center', w=200, h=25,
            bgc=colorWheel.darkgrey)
    pm.separator(style='none', h=3, w=200)

    lcUI.UI.lc_browse_field_button(width=200, textFieldName=prefix + '_textField_new_shader_path', lct_cfg=lct_cfg,
                                   configAttr='lcTextureToolsShaderRepath', placeholderText=defaultPath,
                                   annotation='Choose a new shader directory')
    pm.setParent(prefix + '_columnLayout_main')

    #
    pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100]))
    pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Repath All', flat=False,
                      image=os.path.join(iconPath, 'shader_repath.png'), bgc=colorWheel.getColorRGB(ci),
                      annotation='Repath all dx11Shader nodes to exact path given',
                      command=lambda *args: lcTxT_shader_repath_all())
    ci += 1
    pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Selected', flat=False,
                      image=os.path.join(iconPath, 'shader_repath.png'), bgc=colorWheel.getColorRGB(ci),
                      annotation='Repath selected dx11Shader nodes to exact path given',
                      command=lambda *args: lcTxT_shader_repath_selected())
    ci += 1
    pm.setParent(prefix + '_columnLayout_main')
    pm.separator(style='in', h=8, w=200)

    # OPEN TEXTURES
    # a=170
    # b=200-a
    # pm.rowColumnLayout(nc=2, cw=([1,a], [2,b]))
    pm.text(l='- Open File Texture Nodes -', font='boldLabelFont', al='center', w=200, h=25, bgc=colorWheel.darkgrey)
    pm.separator(style='none', h=3, w=200)

    # pm.symbolButton(prefix+'_button_check_editors', visible=False, image=os.path.join(srcPath,'icons','hint.png'), annotation='Setup Image File Editors', command=lambda *args: lcTxT_update_maya_prefs(prefix+'_button_check_editors') )
    pm.setParent(prefix + '_columnLayout_main')
    pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100]))
    pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Open All', flat=False,
                      image=os.path.join(iconPath, 'open.png'), bgc=colorWheel.getColorRGB(ci),
                      annotation='Open all file texture nodes in default associated program',
                      command=lambda *args: lcTxT_open_textures('all'))
    ci += 1
    pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Selected', flat=False,
                      image=os.path.join(iconPath, 'open.png'), bgc=colorWheel.getColorRGB(ci),
                      annotation='Open selected file texture nodes in default associated program',
                      command=lambda *args: lcTxT_open_textures('selected'))
    ci += 1
    pm.separator(style='none', h=8, w=200)

    #
    if not asChildLayout:
        mainWindow.show()
        pm.window(mainWindow.mainWindow, edit=True, height=winHeight, width=winWidth)
    else:
        pm.setParent('..')
        pm.setParent('..')

    # edit menus
    optionsMenu, helpMenu = lcUI.UI.lcToolbox_child_menu_edit(asChildLayout, windowName)

    # restore interface selections
    pm.textField(prefix + '_textField_new_path', edit=True, text=lct_cfg.get('lcTextureToolsRepath'))
    pm.textField(prefix + '_textField_prefix', edit=True, text=lct_cfg.get('lcTextureToolsPrefix'))
    pm.textField(prefix + '_textField_new_shader_path', edit=True, text=lct_cfg.get('lcTextureToolsShaderRepath'))

    # run extra stuff
    pm.setFocus(prefix + '_button_rename')

    # validate export directory
    lcPath.Path.validatePathTextField(prefix + '_textField_new_path', lct_cfg, 'lcTextureToolsRepath', defaultPath)
    lcPath.Path.validatePathTextField(prefix + '_textField_new_shader_path', lct_cfg, 'lcTextureToolsShaderRepath',
                                      defaultPath)
コード例 #37
0
ファイル: rigging.py プロジェクト: ElonGame/anima
    def ui(self):
        """the ui
        """
        import functools
        width = 300
        height = 380

        if pm.window("skinTools_window", q=1, ex=1):
            pm.deleteUI("skinTools_window", window=1)

        self.window = pm.window("skinTools_window", w=width, h=height,
                                t="skinTools %s" % self.__version__)

        self.form_layout1 = pm.formLayout("skinTools_formLayout1", nd=100)
        with self.form_layout1:

            self.column_layout1 = \
                pm.columnLayout("skinTools_columnLayout1", adj=1, cal="center")
            with self.column_layout1:
                pm.button(
                    l="find skinCluster from selection",
                    c=self.find_skin_cluster_from_selection_button_proc
                )

                with pm.rowLayout("skinTools_skin_cluster_row_layout", nc=2):
                    pm.text(l="skinCluster: ")
                    self.skin_cluster_text = pm.text(l="")

                with pm.rowLayout("skinTools_mesh_name_row_layout", nc=2):
                    pm.text(l="mesh name: ")
                    self.mesh_name_text = pm.text()

                pm.button(
                    l="find influenced Vertices",
                    c=self.find_influenced_vertices_button_proc
                )

                pm.button(
                    l="update",
                    c=lambda x: self.update_list()
                )

            self.influence_list_text_scroll_list = \
                pm.textScrollList(numberOfRows=20, sc=self.select)
            pm.popupMenu(parent=self.influence_list_text_scroll_list)
            pm.menuItem(l="switch hold", c=self.switch_hold)

            self.column_layout3 = pm.columnLayout(adj=1, cal="center")
            with self.column_layout3:
                def set_joint_weight_callback(weight, *args):
                    print("weight: %s" % weight)
                    print("args: %s" % args)
                    self.set_joint_weight(weight)
                self.remove_selected_button = \
                    pm.button(l="remove selected",
                              c=functools.partial(set_joint_weight_callback, 0))
                self.add_selected_button = \
                    pm.button(l="add selected",
                              c=functools.partial(set_joint_weight_callback, 1))

        pm.formLayout(
            "skinTools_formLayout1",
            e=1,
            af=[
                [self.column_layout1, "left", 0],
                [self.column_layout1, "right", 0],
                [self.column_layout1, "top", 0],

                [self.influence_list_text_scroll_list, "left", 0],
                [self.influence_list_text_scroll_list, "right", 0],

                [self.column_layout3, "left", 0],
                [self.column_layout3, "right", 0],

                [self.column_layout3, "bottom", 0],
            ],
            an=[
                [self.column_layout1, "bottom"],
                [self.column_layout3, "top"],
            ],

            ac=[
                [self.influence_list_text_scroll_list, "top", 0, self.column_layout1],
                [self.influence_list_text_scroll_list, "bottom", 0, self.column_layout3],
            ]
        )

        self.find_skin_cluster_from_selection_button_proc()
        pm.showWindow(self.window)
        pm.window(self.window, e=1, w=width, h=height)
コード例 #38
0
    def list_shots(*args):
        shot_num = pm.intFieldGrp('shotNum', q=1, v1=1)
        start_frame = pm.intFieldGrp('startFrame', q=1, v1=1)
        shot_count = pm.intFieldGrp('shotCount', q=1, v1=1)

        if len(str(shot_num)) < 2:
            raise RuntimeError('First Shot Number must be at east 2 digits.')

        for shot in pm.ls(type='shot'):
            try:
                cam = shot.get_camera()
                if cam.name() not in ['persp', 'top', 'front', 'side']:
                    pm.delete(cam)
            except:
                pm.delete(shot)

        for shot in pm.ls(type='shot'):
            pm.delete(shot)

        window_name = 'shot_creator_window'
        if pm.window(window_name, q=True, ex=True):
            pm.deleteUI(window_name, wnd=True)

        window_name = 'shot_list_window'
        if pm.window(window_name, q=True, ex=True):
            pm.deleteUI(window_name, wnd=True)

        shot_list_win = pm.window(window_name,
                                  title='Shot Creator',
                                  s=0,
                                  rtf=1)

        with pm.columnLayout():
            with pm.rowColumnLayout(nc=6,
                                    cw=[(1, 20), (2, 70), (3, 70), (4, 70),
                                        (5, 70), (6, 70)]):
                pm.text(l='')
                pm.text(l='Shot Num')
                pm.text(l='Length')
                pm.text(l='Start Frame')
                pm.text(l='End Frame')
                pm.text(l='Shot Name')

                for i in range(0, shot_count):

                    def checkbox_state(*args):
                        check_cnt = 0
                        while pm.checkBox('%s%s' %
                                          ('shotCheckBox', str(check_cnt)),
                                          ex=1):
                            check_cnt += 1

                        for k in range(0, check_cnt):
                            state = pm.checkBox('shotCheckBox%s' % str(k),
                                                q=1,
                                                v=1)
                            if not state:
                                pm.textField('%s%s' % (shot_num_name, str(k)),
                                             e=1,
                                             en=0)
                                pm.textField('%s%s' % (shot_name_name, str(k)),
                                             e=1,
                                             en=0)
                            else:
                                pm.textField('%s%s' % (shot_num_name, str(k)),
                                             e=1,
                                             en=1)
                                pm.textField('%s%s' % (shot_name_name, str(k)),
                                             e=1,
                                             en=1)

                    pm.checkBox('shotCheckBox%s' % str(i),
                                onc=checkbox_state,
                                ofc=checkbox_state)

                    shot_number = ''
                    for j in range(0, 4):
                        digit = len(str(shot_num))
                        if digit == 1:
                            shot_number = '000%s' % str(shot_num)
                        if digit == 2:
                            shot_number = '00%s' % str(shot_num)
                        if digit == 3:
                            shot_number = '0%s' % str(shot_num)
                        if digit == 4:
                            shot_number = '%s' % str(shot_num)

                    pm.textField('%s%s' % (shot_num_name, str(i)),
                                 text=str(shot_number),
                                 en=0)
                    shot_num += 10

                    pm.intField('%s%s' % (shot_length_name, str(i)),
                                cc=set_parameters_from_length,
                                v=1)

                    pm.intField('%s%s' % (start_frame_name, str(i)), en=0, v=1)
                    if i == 0:
                        pm.intField('%s%s' % (start_frame_name, str(i)),
                                    e=1,
                                    v=start_frame)

                    pm.intField('%s%s' % (end_frame_name, str(i)), en=0, v=1)

                    shot_node_name = 'shot%s' % str(i + 1)
                    pm.textField('%s%s' % (shot_name_name, str(i)),
                                 text=shot_node_name,
                                 en=0)

        with pm.columnLayout():

            def exec_create_shots(*args):
                state = pm.checkBox('camera_checkbox_name', q=1, v=1)
                if not state:
                    create_shots(False)
                else:
                    create_shots(True)

            pm.button(l='CREATE SHOTS', w=370, c=exec_create_shots)

        with pm.rowColumnLayout(nc=3,
                                cs=(3, 10),
                                cw=[(1, 60), (2, 120), (3, 100)]):
            pm.text(l='camPrefix')
            pm.textField('camera_prefix_name', text='camera__shotExp_', en=0)

            def checkbox_cameras(*args):
                state = pm.textField('camera_prefix_name', q=1, en=1)
                if not state:
                    pm.textField('camera_prefix_name', e=1, en=1)
                else:
                    pm.textField('camera_prefix_name', e=1, en=0)

            pm.checkBox('camera_checkbox_name',
                        l='create Cameras',
                        onc=checkbox_cameras,
                        ofc=checkbox_cameras)

        pm.showWindow(shot_list_win)
コード例 #39
0
ファイル: ui.py プロジェクト: birdiesama/Public
 def delete_UI(self, ui):
     if pm.window(ui, ex=True):
         pm.deleteUI(ui)
         self.delete_UI(ui)
コード例 #40
0
def move_all_anim_curves():
    def check_overlapping(anim_curves, choice, current_time, offset_val):
        for anim_curve in anim_curves:
            key_cnt = anim_curve.numKeys()
            message = 'Some Keys are overlapping within Offset Value\n'
            message += 'Do you want continue on Moving other Keys ?\n'
            for i in range(0, key_cnt):
                key_time = anim_curve.getTime(i)
                if choice == 'forward':
                    if key_time <= current_time + offset_val:
                        range_dialog = pm.confirmDialog(title='Error',
                                                        message=message,
                                                        button=['Yes', 'No'],
                                                        cancelButton='No',
                                                        dismissString='No')
                        if range_dialog == 'Yes':
                            return 1
                        else:
                            raise RuntimeError(
                                'Move Keys process interrupted by User.')

                if choice == 'back':
                    if key_time >= current_time + offset_val:
                        range_dialog = pm.confirmDialog(title='Error',
                                                        message=message,
                                                        button=['Yes', 'No'],
                                                        cancelButton='No',
                                                        dismissString='No')
                        if range_dialog == 'Yes':
                            return 1
                        else:
                            raise RuntimeError(
                                'Move Keys process interrupted by User.')

    def move_all_keys(choice):
        offset_val = offset_intfield.getValue()

        if offset_val < 1:
            raise RuntimeError('Enter an Offset Value greater than 0.')

        if choice == 'back':
            offset_val = offset_intfield.getValue() * -1

        unlock_val = unlock_state.getValue1()

        current_time = pm.currentTime()

        anim_curves = pm.ls(type='animCurve')
        non_moved_curves = []

        if choice == 'back':
            check_overlapping(anim_curves, choice, current_time, offset_val)

        for anim_curve in anim_curves:
            try:
                if unlock_val is True and anim_curve.isLocked():
                    anim_curve.setLocked(0)

                key_cnt = anim_curve.numKeys()
                for i in range(1, key_cnt + 1):

                    if choice == 'forward':
                        ind = key_cnt - i
                    if choice == 'back':
                        ind = i - 1

                    if anim_curve.getTime(ind) >= current_time:
                        pm.keyframe(anim_curve,
                                    index=ind,
                                    iub=False,
                                    animation='objects',
                                    relative=True,
                                    option='move',
                                    tc=offset_val)
            except:
                if anim_curve not in non_moved_curves:
                    non_moved_curves.append(anim_curve)
                continue

        if not non_moved_curves:
            pm.confirmDialog(title='Info',
                             message='Keys Moved Successfully.',
                             button='OK')
        else:
            message = 'Anim Curves can NOT be moved:\r\n'
            message += '\r'
            for i in range(0, len(non_moved_curves)):
                message += '%s\n' % non_moved_curves[i]
                if i > 30:
                    message += '+ More...\n'
                    break
            print non_moved_curves
            pm.confirmDialog(title='Error', message=message, button='OK')

        # pdm.close()

    window_name = 'move_keys_window'

    if pm.window(window_name, q=True, ex=True):
        pm.deleteUI(window_name, wnd=True)

    move_keys_win = pm.window(window_name, title='Move Keys', s=0, rtf=1)

    with pm.columnLayout(rs=5, cal='center'):
        pm.text(l='                      MOVE ALL KEYS')
        pm.text(l='             relatively from currentTime')
        pm.text(l='    (overlapping Keys will NOT be moved)')
        with pm.rowColumnLayout(nc=3, cw=[(1, 70), (2, 70), (3, 70)]):

            def exec_move_all_keys_back(*args):
                move_all_keys('back')

            pm.button(l='-', c=exec_move_all_keys_back)
            offset_intfield = pm.intField()

            def exec_move_all_keys_forward(*args):
                move_all_keys('forward')

            pm.button(l='+', c=exec_move_all_keys_forward)

    with pm.columnLayout():
        unlock_state = pm.checkBoxGrp(l='Unlock & Move', v1=1)

    pm.showWindow(move_keys_win)
コード例 #41
0
def create_shots_from_scratch():
    shot_num_name = 'shotNumName'
    shot_length_name = 'shotLengthName'
    start_frame_name = 'startFrameName'
    end_frame_name = 'endFrameName'
    shot_name_name = 'shotNameName'

    def create_shots(with_cameras):
        cnt = 0
        while pm.textField('%s%s' % (shot_name_name, str(cnt)), ex=1):
            cnt += 1

        seqs = [
            seq for seq in pm.ls(type='sequencer')
            if seq.referenceFile() is None
        ]
        if len(pm.ls(type='sequencer')) != 1:
            raise RuntimeError('There must be 1 sequencer in a scene.')

        seq = seqs[0]
        for i in range(0, cnt):
            shot_node_name = pm.textField('%s%s' % (shot_name_name, str(i)),
                                          q=1,
                                          text=1)
            start_frame = pm.intField('%s%s' % (start_frame_name, str(i)),
                                      q=1,
                                      v=1)
            end_frame = pm.intField('%s%s' % (end_frame_name, str(i)),
                                    q=1,
                                    v=1)
            shot_num = pm.textField('%s%s' % (shot_num_name, str(i)),
                                    q=1,
                                    text=1)
            shot = pm.createNode('shot', n=shot_node_name)
            shot.setAttr('startFrame', start_frame)
            shot.setAttr('sequenceStartFrame', start_frame)
            shot.setAttr('endFrame', end_frame)
            shot.setAttr('shotName', shot_num)

            seq.add_shot(shot)

            if with_cameras:
                camera_name = '%s%s' % (pm.textField(
                    'camera_prefix_name', q=1, text=1), str(i + 1))
                cam = pm.mel.eval('camera -n "%s";' % camera_name)
                pm.PyNode(cam[1]).setAttr('farClipPlane', 1000000)
                pm.PyNode(cam[1]).setAttr('focalLength', 35)
                pm.PyNode(cam[0]).attr('scaleX').lock()
                pm.PyNode(cam[0]).attr('scaleY').lock()
                pm.PyNode(cam[0]).attr('scaleZ').lock()
                shot.set_camera(pm.PyNode(cam[1]))

    def set_parameters_from_length(*args):
        cnt = 0
        while pm.intField('%s%s' % (shot_length_name, str(cnt)), ex=1):
            cnt += 1

        for i in range(0, cnt):
            if i == 0:
                s_frame = pm.intField('%s%s' % (start_frame_name, str(i)),
                                      q=1,
                                      v=1)
                start_length = pm.intField('%s%s' % (shot_length_name, str(i)),
                                           q=1,
                                           v=1)
                pm.intField('%s%s' % (end_frame_name, str(i)),
                            e=1,
                            v=s_frame + start_length)
            else:
                prev_end_frame = pm.intField('%s%s' %
                                             (end_frame_name, str(i - 1)),
                                             q=1,
                                             v=1)
                pm.intField('%s%s' % (start_frame_name, str(i)),
                            e=1,
                            v=prev_end_frame + 1)
                start_length = pm.intField('%s%s' % (shot_length_name, str(i)),
                                           q=1,
                                           v=1)
                pm.intField('%s%s' % (end_frame_name, str(i)),
                            e=1,
                            v=prev_end_frame + 1 + start_length)

    def list_shots(*args):
        shot_num = pm.intFieldGrp('shotNum', q=1, v1=1)
        start_frame = pm.intFieldGrp('startFrame', q=1, v1=1)
        shot_count = pm.intFieldGrp('shotCount', q=1, v1=1)

        if len(str(shot_num)) < 2:
            raise RuntimeError('First Shot Number must be at east 2 digits.')

        for shot in pm.ls(type='shot'):
            try:
                cam = shot.get_camera()
                if cam.name() not in ['persp', 'top', 'front', 'side']:
                    pm.delete(cam)
            except:
                pm.delete(shot)

        for shot in pm.ls(type='shot'):
            pm.delete(shot)

        window_name = 'shot_creator_window'
        if pm.window(window_name, q=True, ex=True):
            pm.deleteUI(window_name, wnd=True)

        window_name = 'shot_list_window'
        if pm.window(window_name, q=True, ex=True):
            pm.deleteUI(window_name, wnd=True)

        shot_list_win = pm.window(window_name,
                                  title='Shot Creator',
                                  s=0,
                                  rtf=1)

        with pm.columnLayout():
            with pm.rowColumnLayout(nc=6,
                                    cw=[(1, 20), (2, 70), (3, 70), (4, 70),
                                        (5, 70), (6, 70)]):
                pm.text(l='')
                pm.text(l='Shot Num')
                pm.text(l='Length')
                pm.text(l='Start Frame')
                pm.text(l='End Frame')
                pm.text(l='Shot Name')

                for i in range(0, shot_count):

                    def checkbox_state(*args):
                        check_cnt = 0
                        while pm.checkBox('%s%s' %
                                          ('shotCheckBox', str(check_cnt)),
                                          ex=1):
                            check_cnt += 1

                        for k in range(0, check_cnt):
                            state = pm.checkBox('shotCheckBox%s' % str(k),
                                                q=1,
                                                v=1)
                            if not state:
                                pm.textField('%s%s' % (shot_num_name, str(k)),
                                             e=1,
                                             en=0)
                                pm.textField('%s%s' % (shot_name_name, str(k)),
                                             e=1,
                                             en=0)
                            else:
                                pm.textField('%s%s' % (shot_num_name, str(k)),
                                             e=1,
                                             en=1)
                                pm.textField('%s%s' % (shot_name_name, str(k)),
                                             e=1,
                                             en=1)

                    pm.checkBox('shotCheckBox%s' % str(i),
                                onc=checkbox_state,
                                ofc=checkbox_state)

                    shot_number = ''
                    for j in range(0, 4):
                        digit = len(str(shot_num))
                        if digit == 1:
                            shot_number = '000%s' % str(shot_num)
                        if digit == 2:
                            shot_number = '00%s' % str(shot_num)
                        if digit == 3:
                            shot_number = '0%s' % str(shot_num)
                        if digit == 4:
                            shot_number = '%s' % str(shot_num)

                    pm.textField('%s%s' % (shot_num_name, str(i)),
                                 text=str(shot_number),
                                 en=0)
                    shot_num += 10

                    pm.intField('%s%s' % (shot_length_name, str(i)),
                                cc=set_parameters_from_length,
                                v=1)

                    pm.intField('%s%s' % (start_frame_name, str(i)), en=0, v=1)
                    if i == 0:
                        pm.intField('%s%s' % (start_frame_name, str(i)),
                                    e=1,
                                    v=start_frame)

                    pm.intField('%s%s' % (end_frame_name, str(i)), en=0, v=1)

                    shot_node_name = 'shot%s' % str(i + 1)
                    pm.textField('%s%s' % (shot_name_name, str(i)),
                                 text=shot_node_name,
                                 en=0)

        with pm.columnLayout():

            def exec_create_shots(*args):
                state = pm.checkBox('camera_checkbox_name', q=1, v=1)
                if not state:
                    create_shots(False)
                else:
                    create_shots(True)

            pm.button(l='CREATE SHOTS', w=370, c=exec_create_shots)

        with pm.rowColumnLayout(nc=3,
                                cs=(3, 10),
                                cw=[(1, 60), (2, 120), (3, 100)]):
            pm.text(l='camPrefix')
            pm.textField('camera_prefix_name', text='camera__shotExp_', en=0)

            def checkbox_cameras(*args):
                state = pm.textField('camera_prefix_name', q=1, en=1)
                if not state:
                    pm.textField('camera_prefix_name', e=1, en=1)
                else:
                    pm.textField('camera_prefix_name', e=1, en=0)

            pm.checkBox('camera_checkbox_name',
                        l='create Cameras',
                        onc=checkbox_cameras,
                        ofc=checkbox_cameras)

        pm.showWindow(shot_list_win)

    window_name = 'shot_creator_window'
    if pm.window(window_name, q=True, ex=True):
        pm.deleteUI(window_name, wnd=True)

    window_name1 = 'shot_list_window'
    if pm.window(window_name1, q=True, ex=True):
        pm.deleteUI(window_name1, wnd=True)

    shot_creator_win = pm.window(window_name, title='Shot Creator', s=0, rtf=1)

    with pm.columnLayout():
        pm.intFieldGrp('shotNum', l='First Shot Number', cw2=(120, 80), v1=10)
        pm.intFieldGrp('startFrame', l='Start Frame', cw2=(120, 80), v1=0)
        pm.intFieldGrp('shotCount', l='Shot Count', cw2=(120, 80), v1=10)
        pm.button(l='LIST SHOTS', w=200, c=list_shots)
        pm.text(l='            All Shots will be deleted...')
        pm.text(l='            ...to start from scratch.')

    pm.showWindow(shot_creator_win)
コード例 #42
0
 def delete_instances(self):
     """
     Deletes the UI
     """
     if pm.window(self.dialog_name, exists=True):
         pm.deleteUI(self.dialog_name)
コード例 #43
0
ファイル: uvBuddy.py プロジェクト: worrytron/cg
                  r=0,
                  g=0,
                  b=0,
                  ff=fformat,
                  o=True)
    pm.warning('Here is where your UVs went: ' +
               str(pm.mel.toNativePath(file_out)))


#UI

if 'uvWizWin' in locals():
    pm.deleteUI(uvWizWin)
uvWizWin = pm.window(title=",.·'`·.,.·UVs·.,.·`'·.,",
                     iconName='UV_WIZ',
                     widthHeight=(100, 68),
                     s=False,
                     tlb=True)
pm.columnLayout(adjustableColumn=True)
xfer_btn = pm.button(l="C O P Y   U V s",
                     h=45,
                     bgc=[0, 0.38, 0.52],
                     c=transfer_uvs,
                     ann='Select target meshes first, then source mesh.')
pm.separator(st='in', h=5)
snap_btn = pm.button(
    l="S N A P S H O T",
    h=45,
    bgc=[0.52, 0, 0],
    c=lambda *args: snapshot_uvs(pm.intField(res_int, query=True, v=True)))
pm.rowLayout(nc=2)
コード例 #44
0
ファイル: shotAssembler.py プロジェクト: zhmig/AnimationDNA
def baseUI():
    if pm.window('ASSEMBLER', exists=1):
        pm.deleteUI('ASSEMBLER')
    baseWin = pm.window('ASSEMBLER', t='Shot Assembler', w=280, h=100)
    with baseWin:
        mainLayout = pm.columnLayout()
        inputLayout = pm.rowColumnLayout(nc=6, parent=mainLayout)
        pm.text(l='  PART  ')
        partField = pm.textField(tx='REEL_01', w=60, h=30)
        pm.text(l='    SEQ ')
        sequenceField = pm.textField(tx='010', w=45, h=30)
        pm.text(l='    SHOT ')
        shotField = pm.textField(tx='010', w=45, h=30)
        pm.separator(h=5, style='none')
        createLayout = pm.rowColumnLayout(nc=2, parent=mainLayout)
        ANM = pm.button(l='CREATE\r\nANIMATION SCENE', w=140, h=55)
        RND = pm.button(l='CREATE\r\nRENDER SCENE', w=140, h=55)
        ANM.setCommand(
            pm.Callback(shotAssemble, partField, sequenceField, shotField,
                        listANM, actANM))
        RND.setCommand(
            pm.Callback(shotAssemble, partField, sequenceField, shotField,
                        listRND, actRND))
        OPANM = pm.button(l='OPEN ANIMATION SCENE', w=140, h=25)
        OPRND = pm.button(l='OPEN RENDER SCENE', w=140)
        OPANM.setCommand(
            pm.Callback(dna.shotOpen, partField, sequenceField, shotField,
                        listANM))
        OPRND.setCommand(
            pm.Callback(dna.shotOpen, partField, sequenceField, shotField,
                        listRND))
        pm.separator(h=6, style='none')

        editLayout = pm.rowColumnLayout(nc=1, parent=mainLayout)
        check = pm.button(l='CHECK SCENE', w=280, h=45)
        check.setCommand(pm.Callback(dna.checkScene))

        addLayout = pm.rowColumnLayout(nc=3, parent=mainLayout)
        add_A = pm.button(l='ADD ASSSETS', w=90, h=30)
        del_A = pm.button(l='DEL ASSETS', w=90)
        upd = pm.button(l='UPDATE REFS', w=100)
        add_A.setCommand(pm.Callback(dna.addAsset))
        del_A.setCommand(pm.Callback(dna.delAsset))
        upd.setCommand(pm.Callback(dna.updateRefs))

        updLayout = pm.rowColumnLayout(nc=2, parent=mainLayout)
        fixALL = pm.button(l='FIX ALL', w=240, h=30)
        snv = pm.button(l='SNV', w=40)
        fixALL.setCommand(pm.Callback(dna.fixAll))
        snv.setCommand(pm.Callback(saveNext))
        pm.separator(h=8, style='none')

        addLayout = pm.rowColumnLayout(nc=2, parent=mainLayout)
        pm.text(l='   ADD ASSETS:        ')
        assetListField = pm.textField(tx='BENDER', w=180, h=30)

        createLayout = pm.rowColumnLayout(nc=2, parent=mainLayout)
        addANM = pm.button(l='FOR AMIMATION', w=140, h=50)
        addRND = pm.button(l='FOR RENDER', w=140)
        addANM.setCommand(pm.Callback(refDataList, assetListField, 'RIG'))
        addRND.setCommand(pm.Callback(refDataList, assetListField, 'GEO'))

    baseWin.show()
コード例 #45
0
 def create(self):
     """Main UI function
     @usage: selectedCM.UI()
     :return: None
     """
     # delete the window if exists
     if pm.window(self.window, exists=True):
         pm.deleteUI(self.window, window=True)
     # initialize the window
     pm.window(self.window, title=self.title, wh=self.size, s=False)
     # main form layout
     self.mainForm = pm.formLayout()
     # frame for Stored files
     self.textscroll_listFrame = pm.frameLayout(label='Stored Component Files')
     # Stored files grid 2x1 and text_scroll_list which has double_click_cmd and select_cmd
     self.textscroll_listGrid = pm.columnLayout(w=self.size[0]/2-2, h=self.size[1]-2, cw=self.size[0]/2-2)
     pm.separator(h=5)
     self.optionMenuLbl = pm.optionMenuGrp("character_menu", label="Characters:", w=self.size[0]/2-10, h=30,
                                           ct2=['left', 'both'], co2=[5, 0], cw2=[65, 95], cc=self.get_files_cmd)
     pm.separator(h=10)
     # pm.setParent(self.textscroll_listForm)
     self.txtScrlLs = pm.textScrollList("txtScrlLs", w=self.size[0]/2-4, h=410, dcc=self.double_click_cmd,
                                         sc=self.select_cmd)
     # setting the parent to the main form and frame for control buttons
     pm.setParent(self.mainForm)
     self.controlFrame = pm.frameLayout(label='Control')
     # control buttons grid 10x1 and buttons to control the selections and files
     self.controlGrid = pm.columnLayout(w=self.size[0]/2-2, cw=self.size[0]/2-2)
     pm.separator(h=10)
     self.newCharacterBtn = pm.button(label='New Character', w=self.size[0]/2-4, h=30, c=self.new_character_btn_cmd)
     self.renameCharacterBtn = pm.button(label='Rename Character', w=self.size[0]/2-4, h=30,
                                         c=self.rename_character_btn_cmd)
     self.deleteCharacterBtn = pm.button(label='Delete Character', w=self.size[0]/2-4, h=30,
                                         c=self.delete_character_btn_cmd)
     pm.separator(h=40)
     self.newSetBtn = pm.button(label='New Set', w=self.size[0]/2-4, h=30, c=self.new_set_btn_cmd)
     self.updateSetBtn = pm.button(label='Update Set', w=self.size[0]/2-4, h=30, c=self.update_set_btn_cmd)
     self.deleteSetBtn = pm.button(label='Delete Set', w=self.size[0]/2-4, h=30, c=self.delete_set_btn_cmd)
     pm.separator(h=40)
     self.addToSelectionBtn = pm.button(label='Add To Selection', w=self.size[0]/2-4, h=30,
                                        c=self.add_to_selection_btn_cmd)
     self.subFromSelectionBtn = pm.button(label='Sub From Selection', w=self.size[0]/2-4, h=30,
                                          c=self.sub_from_selection_btn_cmd)
     pm.separator(h=40)
     self.doneBtn = pm.button(label='QUIT', w=self.size[0]/2-4, h=30, c=self.done_btn_cmd)
     # attach stored files frame and control buttons frame in main form
     ac = []
     af = []
     ac.append([self.controlFrame, 'left', 0, self.textscroll_listFrame])
     af.append([self.textscroll_listFrame, 'left', 0])
     af.append([self.textscroll_listFrame, 'top', 0])
     af.append([self.textscroll_listFrame, 'bottom', 0])
     af.append([self.controlFrame, 'right', 0])
     af.append([self.controlFrame, 'top', 0])
     af.append([self.controlFrame, 'bottom', 0])
     pm.formLayout(self.mainForm, e=True, attachControl=ac, attachForm=af)
     # show the window
     pm.showWindow(self.window)
     # force the window size
     pm.window(self.window, e=True, wh=self.size)
     self.characterList = init_folder(self.dirName)
     populate_characters(self.dirName, self.selectedCharacter, self.characterList, self.selectedFile)
コード例 #46
0
from pymel.core import *

if window('TheRiggersToolkitX', ex=True):
    deleteUI('TheRiggersToolkitX')
if window('ExamplaeWindow', ex=True):
    deleteUI('ExamplaeWindow')

if cmds.windowPref('TheRiggersToolkitX', exists=True):
    cmds.windowPref('TheRiggersToolkitX', r=1)

template = uiTemplate('TheRiggersToolkitXtemplate', force=True)
template.define(formLayout)

wind = pm.window('TheRiggersToolkitX',
                 t='RigToolkitX',
                 w=300,
                 h=330,
                 s=1,
                 bgc=[(.17), (.18), (.19)])
Tab = tabLayout('Tabs',
                p='TheRiggersToolkitX',
                tc=1,
                stb=1,
                snt=1,
                ntc='NewTab()')

ToolsSc = pm.scrollLayout('Controls', p='Tabs', w=300, h=350)
ToolsSc = pm.scrollLayout('Tools', p='Tabs')
channelbox = pm.channelBox(
    'ChannelBox',
    p='Tabs',
    ac=[(.8), (.9), (1)],
コード例 #47
0
            def createWindow():
                """ try to get data from shotgun project fields
                    need to get context's project
                                context's shotgun instance
                """
                app = self.parent
                project = app.context.project
                sg = app.context.tank.shotgun
                # set filters and search fields for entity type "Project"
                filters = [
                    ["id", "is", project['id']],
                ]
                fields = ["sg_width", "sg_height"]
                result = sg.find_one("Project", filters, fields)
                # with result, set parameters accordingly or use default otherwise
                if result:
                    videoWidth = result.get("sg_width", DEFAULT_WIDTH)
                    videoHeight = result.get("sg_height", DEFAULT_HEIGHT)

                # Find first camera matching pattern and set as active camera
                # if not use default current active camera
                camera_name_pattern = app.get_setting("camera_name_pattern",
                                                      "persp")
                cameraList = [
                    c.name() for c in pm.ls(type="camera", r=True)
                    if re.search(camera_name_pattern, c.name())
                ]
                #print cameraList
                if not "cam" in MODEL_EDITOR_PARAMS.keys() and cameraList:
                    MODEL_EDITOR_PARAMS["cam"] = cameraList[0]
                #print MODEL_EDITOR_PARAMS
                # Give Viewport 2.0 renderer only for Maya 2015++
                # mayaVersionString = cmds.about(version=True)
                # mayaVersion = int(mayaVersionString[:4]) if len(mayaVersionString) >= 4 else 0
                # if mayaVersion >= 2015:
                #     params[ "rendererName" ] = "vp2Renderer"

                # Create window
                if pm.windowPref(PLAYBLAST_WINDOW, exists=True):
                    pm.windowPref(PLAYBLAST_WINDOW, remove=True)
                window = pm.window(PLAYBLAST_WINDOW,
                                   titleBar=True,
                                   iconify=True,
                                   leftEdge=100,
                                   topEdge=100,
                                   width=videoWidth,
                                   height=videoHeight,
                                   sizeable=False)
                # Create editor area
                layout = pm.formLayout()
                editor = pm.modelEditor(**MODEL_EDITOR_PARAMS)
                pm.setFocus(editor)
                pm.formLayout(layout,
                              edit=True,
                              attachForm=((editor, "left", 0), (editor, "top",
                                                                0),
                                          (editor, "right", 0), (editor,
                                                                 "bottom", 0)))
                # Show window
                pm.setFocus(editor)
                pm.showWindow(window)
                pm.refresh()
                try:
                    yield True
                except:
                    traceback.print_exc()
                finally:
                    pm.deleteUI(window)
コード例 #48
0
    def new_character_btn_cmd(self, *args):
        """ This button command opens a new character naming window and creates a new character folder on the directory
        folder.
        :return: None
        """
        def store_character_name_cmd(*args):
            """ This command stores the written name for new character and populate it by using the populate characters
            module
            :return: None
            """
            src = pm.textField("NewCName", q=True, tx=True)
            if src is None or len(src) < 1:
                None
            else:
                new_character = self.dirName + src
                if not os.path.exists(new_character):
                    os.makedirs(new_character)
                    quit_character_win_cmd()
                    self.selectedCharacter = src
                    self.characterList = str(new_character+"/")
                    populate_characters(self.dirName, self.selectedCharacter, self.characterList, self.selectedFile)
                else:
                    pm.confirmDialog(t='Error', b=['OK'], m='This folder name exists.')
                    return None
        # this command checks the side window is open or not.

        def quit_character_win_cmd(*args):
            """ Checks the new character window exists
            :return: None
            """
            if pm.window('newCharacterWin', exists=True):
                pm.deleteUI('newCharacterWin', window=True)
        # side windows tag name
        new_character_win = 'newCharacterWin'
        # activation the delete_set_cmd to check the window
        quit_character_win_cmd()
        # size of the side window
        size = (250, 80)
        # initialize the side window
        pm.window(new_character_win, wh=size, s=False, t='New Character Name')
        # main form layout
        mainForm = pm.formLayout()
        # controls
        new_character_text = pm.text(label='New Character Name')
        new_character_text_field = pm.textField("NewCName", text="")
        new_character_text_btn = pm.button(label='ADD CHARACTER', c=store_character_name_cmd, p=mainForm, w=100, h=26)
        cancel_btn = pm.button(label='CANCEL', c=quit_character_win_cmd, p=mainForm, w=100, h=26)
        # attach the controls to main form
        ac = []
        af = []
        ac.append([new_character_text_field, 'top', 5, new_character_text])
        ac.append([new_character_text_field, 'bottom', 5, new_character_text_btn])
        ac.append([new_character_text_field, 'bottom', 5, cancel_btn])
        af.append([new_character_text, 'top', 5])
        af.append([new_character_text, 'left', 5])
        af.append([new_character_text, 'right', 5])
        af.append([new_character_text_field, 'left', 5])
        af.append([new_character_text_field, 'right', 5])
        af.append([new_character_text_btn, 'left', 5])
        af.append([new_character_text_btn, 'bottom', 5])
        af.append([cancel_btn, 'right', 5])
        af.append([cancel_btn, 'bottom', 5])
        pm.formLayout(mainForm, e=True, attachControl=ac, attachForm=af)
        # force the window size
        pm.window(new_character_win, e=True, wh=size)
        # initialize the window
        pm.showWindow(new_character_win)
コード例 #49
0
ファイル: boResetter.py プロジェクト: jonntd/tak_maya_preset
    def build(self):
        #check for pre-existing window
        if pm.window(self.winName, ex=True):
            pm.deleteUI(self.winName, wnd=True)

        if not pm.windowPref(self.winName, ex=True):
            pm.windowPref(self.winName, tlc=(200, 200))
        pm.windowPref(self.winName, e=True, w=280, h=100)

        with pm.window(self.winName,
                       rtf=1,
                       mb=1,
                       tlb=True,
                       t='Resetter %s' % __version__) as self.win:
            imenu = pm.menu(l='Info')
            pm.setParent(imenu, m=True)
            pm.menuItem(l='List Objects with Defaults',
                        c=pm.Callback(listObjectsWithDefaults))
            pm.menuItem(l='Select Objects with Defaults',
                        c=pm.Callback(selectObjectsWithDefaults))
            pm.menuItem(l='List Defaults', c=pm.Callback(listDefaults))

            with pm.formLayout(nd=100) as form:

                with pm.frameLayout(l='Set/Remove Defaults',
                                    bs='out',
                                    mw=2,
                                    mh=2,
                                    cll=True,
                                    cl=True) as setFrame:
                    with pm.columnLayout(rs=2, adj=True):
                        pm.button(
                            l='Set Defaults',
                            c=pm.Callback(setDefaults),
                            bgc=self.colSet,
                            ann=
                            'Set defaults on the selected objects using all keyable attributes'
                        )
                        pm.button(
                            l='Set Defaults Include Non-Keyable',
                            c=pm.Callback(setDefaultsNonkeyable),
                            bgc=self.colSet,
                            ann=
                            'Set defaults on the selected objects using keyable and non-keyable attributes in the channel box'
                        )
                        pm.button(
                            l='Set Defaults with CB Selection',
                            c=pm.Callback(setDefaultsCBSelection),
                            bgc=self.colSet,
                            ann=
                            'Set defaults on the selected objects using the selected channel box attributes'
                        )
                        pm.button(
                            l='Remove Defaults',
                            c=pm.Callback(removeDefaults),
                            bgc=self.colRemove,
                            ann='Remove all defaults from the selected objects'
                        )
                        pm.button(
                            l='Remove from All Objects',
                            c=pm.Callback(removeAllDefaults),
                            bgc=self.colRemove,
                            ann='Remove defaults from all objects in the scene'
                        )

                with pm.frameLayout(l='Reset', bs='out', mw=2,
                                    mh=2) as resetFrame:
                    with pm.formLayout(nd=100) as resetForm:
                        b6 = pm.button(
                            l='Smart',
                            c=pm.Callback(resetSmart),
                            bgc=self.colReset,
                            ann=
                            'Reset the selected objects. Uses transform standards if no defaults are defined for translate, rotate, and scale'
                        )
                        b7 = pm.button(
                            l='Default',
                            c=pm.Callback(reset),
                            bgc=self.colReset,
                            ann=
                            'Reset the selected objects using only stored defaults, if any'
                        )
                        b8 = pm.button(
                            l='Transform',
                            c=pm.Callback(resetTransform),
                            bgc=self.colReset,
                            ann=
                            'Reset the selected objects using only transform standards for translate, rotate, scale (eg. 0, 0, 1)'
                        )
                        b9 = pm.button(
                            l='All',
                            c=pm.Callback(resetAll),
                            bgc=self.colReset2,
                            ann='Reset all objects in the scene with defaults')
                        pm.formLayout(resetForm,
                                      e=True,
                                      ap=[
                                          (b6, 'left', 0, 0),
                                          (b6, 'right', 2, 25),
                                          (b7, 'left', 2, 25),
                                          (b7, 'right', 2, 50),
                                          (b8, 'left', 2, 50),
                                          (b8, 'right', 2, 75),
                                          (b9, 'left', 2, 75),
                                          (b9, 'right', 2, 100),
                                      ])

                mw = 4
                pm.formLayout(
                    form,
                    e=True,
                    af=[(setFrame, 'left', mw), (setFrame, 'right', mw),
                        (resetFrame, 'left', mw), (resetFrame, 'right', mw)],
                    ac=[(resetFrame, 'top', 2, setFrame)],
                )
コード例 #50
0
 def quit_character_win_cmd(*args):
     """ Checks the new character window exists
     :return: None
     """
     if pm.window('newCharacterWin', exists=True):
         pm.deleteUI('newCharacterWin', window=True)
コード例 #51
0
ファイル: gui.py プロジェクト: milesckt/mgear
    def inspectProperties(self, *args):

        modeSet = ["FK", "IK", "IK/FK"]
        rotOrderSet = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"]
        guideModeSet = ["Final", "WIP"]

        # apply changes
        def applyCloseGuide(root, *args):
            if pm.attributeQuery("mode", node=root, ex=True):
                root.attr("mode").set(guideModeSet.index(pMode.getValue()))
            pm.select(root, r=True)

            pm.deleteUI(window, window=True)

        def skinLoad(root, *args):
            startDir = root.attr("skin").get()
            filePath = pm.fileDialog2(
                dialogStyle=2,
                fileMode=1,
                startingDirectory=startDir,
                fileFilter='mGear skin (*%s)' % skin.FILE_EXT)
            if not filePath:
                return
            if not isinstance(filePath, basestring):
                filePath = filePath[0]

            root.attr("skin").set(filePath)

        def applyCloseComp(root, *args):
            newName = pName.getText()
            newSide = pSide.getValue()
            newIndex = pIndex.getValue1()
            if pm.attributeQuery("mode", node=root, ex=True):
                root.attr("mode").set(modeSet.index(pMode.getValue()))
            if pm.attributeQuery("default_rotorder", node=root, ex=True):
                root.attr("default_rotorder").set(
                    rotOrderSet.index(pRotOrder.getValue()))

            guide = shifter.guide.Rig()
            guide.updateProperties(root, newName, newSide, newIndex)
            pm.select(root, r=True)

            pm.deleteUI(window, window=True)

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

        oSel = pm.selected()
        if oSel:
            root = oSel[0]
        else:
            mgear.log(
                "Select one root Guide or component to edit properties",
                mgear.sev_error)
            return

        if pm.attributeQuery("comp_type", node=root, ex=True):
            # property window constructor
            customAttr = pm.listAttr(root, ud=True)

            window = pm.window(title=root.name())
            pm.columnLayout(adjustableColumn=True, cal="right")

            for attr in customAttr:

                if attr == "comp_name":
                    fl = pm.formLayout()
                    oriVal = root.attr("comp_name").get()
                    pName = pm.textFieldGrp(label="comp_name")
                    pm.setParent('..')
                    pm.formLayout(fl, e=True, af=(pName, "left", 0))
                    pName.setText(oriVal)

                elif attr == "comp_side":
                    sideSet = ["C", "L", "R"]
                    fl = pm.formLayout()
                    pSide = pm.optionMenu(label="comp_side")
                    pSide.addMenuItems(sideSet)
                    pSide.setWidth(120)
                    pm.setParent('..')
                    pm.formLayout(fl, e=1, af=(pSide, "left", 90))
                    oriVal = root.attr("comp_side").get()
                    pSide.setValue(oriVal)
                elif attr == "mode":
                    fl = pm.formLayout()
                    pMode = pm.optionMenu(label="mode")
                    pMode.addMenuItems(modeSet)
                    pMode.setWidth(120)
                    pm.setParent('..')
                    pm.formLayout(fl, e=1, af=(pMode, "left", 115))
                    oriVal = root.attr("mode").get()
                    pMode.setValue(modeSet[oriVal])

                elif attr == "default_rotorder":
                    fl = pm.formLayout()
                    pRotOrder = pm.optionMenu(label="default_rotorder")
                    pRotOrder.addMenuItems(rotOrderSet)
                    pRotOrder.setWidth(140)
                    pm.setParent('..')
                    pm.formLayout(fl, e=1, af=(pRotOrder, "left", 60))
                    oriVal = root.attr("default_rotorder").get()
                    pRotOrder.setValue(rotOrderSet[oriVal])

                elif attr == "comp_index":
                    fl = pm.formLayout()
                    oriVal = root.attr("comp_index").get()
                    pIndex = pm.intFieldGrp(v1=oriVal, label="comp_index")
                    pm.setParent('..')
                    pm.formLayout(fl, e=True, af=(pIndex, "left", 0))

                else:
                    editable = True
                    if attr == "comp_type":
                        editable = False
                    pm.columnLayout(cal="right")
                    pm.attrControlGrp(attribute=root.attr(
                        attr), po=True, en=editable)
                    pm.setParent('..')

            pm.button(label='Apply', command=partial(
                applyCloseComp, root), h=100)
            pm.setParent('..')
            pm.showWindow(window)

        elif pm.attributeQuery("ismodel", node=root, ex=True):
            # property window constructor
            customAttr = pm.listAttr(root, ud=True)

            window = pm.window(title=root.name())
            pm.columnLayout(adjustableColumn=True, cal="right")

            for attr in customAttr:
                if attr.split("_")[-1] not in ["r", "g", "b"]:
                    if attr == "mode":
                        fl = pm.formLayout()
                        pMode = pm.optionMenu(label="mode")
                        pMode.addMenuItems(guideModeSet)
                        pMode.setWidth(120)
                        pm.setParent('..')
                        pm.formLayout(fl, e=1, af=(pMode, "left", 115))
                        oriVal = root.attr("mode").get()
                        pMode.setValue(guideModeSet[oriVal])
                    elif attr == "skin":
                        pm.columnLayout(cal="right")
                        pm.attrControlGrp(attribute=root.attr(attr), po=True)
                        pm.setParent('..')
                        pm.button(label='Load Skin ',
                                  command=partial(skinLoad, root))

                    else:
                        pm.columnLayout(cal="right")
                        pm.attrControlGrp(attribute=root.attr(attr), po=True)
                        pm.setParent('..')

            pm.button(label='Apply', command=partial(
                applyCloseGuide, root), h=50)
            pm.setParent('..')
            pm.showWindow(window)

        else:
            mgear.log(
                "Select a root Guide or component to edit properties",
                mgear.sev_error)
            return
コード例 #52
0
    def rename_character_btn_cmd(self, *args):
        """ Rename the selected character folder from the text scroll field by opening another window
        :return: None
        """
        def rename_character_name_cmd(*args):
            """ Rename the selected character folder
            :return: None
            """
            src = pm.textField("RenameCName", q=True, tx=True)
            if src is None or len(src) < 1:
                None
            else:
                if src == self.selectedCharacter:
                    new_character = str(self.dirName + src)
                else:
                    new_character = str(self.dirName + src + "/")
                if os.path.exists(self.characterList):
                    os.rename(self.characterList, new_character)
                    quit_character_win_cmd()
                    self.selectedCharacter = src
                    self.characterList = str(new_character+"/")
                    populate_characters(self.dirName, self.selectedCharacter, self.characterList, self.selectedFile)
                else:
                    pm.confirmDialog(t='Error', b=['OK'], m='This folder name exists.')
                    return None

        def quit_character_win_cmd(*args):
            """ This command checks the side window is open or not.
            :return: None
            """
            if pm.window(rename_character_win, exists=True):
                pm.deleteUI(rename_character_win, window=True)
        # side windows tag name
        rename_character_win = 'renameCharacterWin'
        # activation the delete_set_cmd to check the window
        quit_character_win_cmd()
        # size of the side window
        size = (250, 100)
        if len(self.selectedCharacter) > size[0]:
            size[0] = len(self.selectedCharacter)+250
        # initialize the side window
        pm.window(rename_character_win, wh=size, s=False, t='Rename Character Name')
        # main form layout
        main_form = pm.formLayout()
        # controls
        rename_character_layout = pm.columnLayout(cat=['both', 2], cw=size[0], rs=10)
        pm.text(label='Rename Character Name')
        pm.text(label=self.selectedCharacter, w=len(self.selectedCharacter)+50)
        pm.setParent(main_form)
        rename_character_text_field = pm.textField("RenameCName", text=self.selectedCharacter,
                                                   ec=rename_character_name_cmd, aie=True)
        rename_character_text_btn = pm.button(label='RENAME', c=rename_character_name_cmd, p=main_form, w=100, h=26)
        cancel_btn = pm.button(label='CANCEL', c=quit_character_win_cmd, p=main_form, w=100, h=26)
        # attach the controls to main form
        ac = []
        af = []
        ac.append([rename_character_text_field, 'top', 5, rename_character_layout])
        ac.append([rename_character_text_field, 'bottom', 5, rename_character_text_btn])
        ac.append([rename_character_text_field, 'bottom', 5, cancel_btn])
        af.append([rename_character_layout, 'top', 5])
        af.append([rename_character_layout, 'left', 5])
        af.append([rename_character_layout, 'right', 5])
        af.append([rename_character_text_field, 'left', 5])
        af.append([rename_character_text_field, 'right', 5])
        af.append([rename_character_text_btn, 'left', 5])
        af.append([rename_character_text_btn, 'bottom', 5])
        af.append([cancel_btn, 'right', 5])
        af.append([cancel_btn, 'bottom', 5])
        pm.formLayout(main_form, e=True, attachControl=ac, attachForm=af)
        # force the window size
        pm.window(rename_character_win, e=True, wh=size)
        # initialize the window
        pm.showWindow(rename_character_win)
コード例 #53
0
ファイル: makeCTRL.py プロジェクト: Betrome/DGM_3670
def createFKControls():
    if cmds.window('Create_FK_Controllers', ex=True):
        cmds.deleteUI('Create_FK_Controllers')

    text = ""
    sel = cmds.ls(sl=True)

    size = 0
    for x in sel:
        size = x

    if size >= 1:
        text = sel[0]

    window = cmds.window(title="Create_FK_Controllers",
                         iconName="Ctrl maker",
                         wh=(310, 110))

    cmds.columnLayout(adj=True)

    cmds.floatSliderGrp('controlSize',
                        label="Control Size",
                        field=True,
                        cw3=(80, 40, 150),
                        minValue=0.01,
                        maxValue=50.0,
                        fieldMinValue=0.1,
                        fieldMaxValue=50,
                        value=2)

    cmds.colorIndexSliderGrp('controlColor',
                             label="Control Color",
                             cw3=(80, 40, 150),
                             min=0,
                             max=31,
                             value=5)

    cmds.intSliderGrp('ctrlShape',
                      label="Control Shape",
                      field=True,
                      cw3=(80, 40, 80),
                      minValue=0,
                      maxValue=2,
                      fieldMinValue=0,
                      fieldMaxValue=2,
                      value=0)

    cmds.textFieldGrp('controlName',
                      label="Control Suffix",
                      text="_CTRL",
                      cw2=(80, 200))

    cz = cmds.floatSliderGrp('controlSize', q=1, value=1.0)

    cs = cmds.floatSliderGrp('controlSize', q=1, value=1.0)

    cr = cmds.colorIndexSliderGrp('controlColor', q=1, value=1)
    cr -= 1

    cn = cmds.textFieldGrp('controlName', q=1, text=1)

    sh = cmds.intSliderGrp('ctrlShape', q=1, value=1)

    createFKButton = cmds.button(label="EXECUTE",
                                 command=lambda x: makeCTRL(cs, cr, cn, sh))

    originalSelection = cmds.ls(sl=True)

    cmds.select(originalSelection, r=True)

    cmds.showWindow(window)

    controlName = cmds.textFieldGrp(text="_CTRL", editable=True)
コード例 #54
0
 def quit_character_win_cmd(*args):
     """ This command checks the side window is open or not.
     :return: None
     """
     if pm.window(rename_character_win, exists=True):
         pm.deleteUI(rename_character_win, window=True)
コード例 #55
0
    def show(self):
        if pm.window(self.windows_name, exists=True):
            pm.deleteUI(self.windows_name)

        self.window = pm.window(self.windows_name, t='Afanasy')

        with pm.columnLayout(adj=True):
            labels_width = 90
            with pm.rowLayout(nc=4, adj=2, cw4=(labels_width, 40, 15, 15)):
                pm.text(l='Start Frame')
                start_time_int_field = pm.intField(
                    'cgru_afanasy__start_frame',
                    v=pm.optionVar.get('cgru_afanasy__start_frame_ov', 1))
                pm.button(l='<',
                          ann='Use minimum animation range',
                          c=functools.partial(
                              self.set_field_value, start_time_int_field,
                              functools.partial(pm.playbackOptions,
                                                q=True,
                                                min=True)))
                pm.button(l='<<',
                          ann='Use minimum playback range',
                          c=functools.partial(
                              self.set_field_value, start_time_int_field,
                              functools.partial(pm.playbackOptions,
                                                q=True,
                                                ast=True)))

            with pm.rowLayout(nc=4, adj=2, cw4=(labels_width, 40, 15, 15)):
                pm.text(l='End Frame')
                end_time_int_field = pm.intField(
                    'cgru_afanasy__end_frame',
                    v=pm.optionVar.get('cgru_afanasy__end_frame_ov', 1))
                pm.button(l='<',
                          ann='Use maximum animation range',
                          c=functools.partial(
                              self.set_field_value, end_time_int_field,
                              functools.partial(pm.playbackOptions,
                                                q=True,
                                                max=True)))
                pm.button(l='<<',
                          ann='Use maximum playback range',
                          c=functools.partial(
                              self.set_field_value, end_time_int_field,
                              functools.partial(pm.playbackOptions,
                                                q=True,
                                                aet=True)))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='Frame Per Task')
                pm.intField('cgru_afanasy__frames_per_task',
                            v=pm.optionVar.get(
                                'cgru_afanasy__frames_per_task_ov', 1))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='By Frame')
                pm.intField('cgru_afanasy__by_frame',
                            v=pm.optionVar.get('cgru_afanasy__by_frame_ov', 1))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='Host Mask')
                pm.textField('cgru_afanasy__hosts_mask',
                             text=pm.optionVar.get(
                                 'cgru_afanasy__hosts_mask_ov', ''))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='Host Exclude')
                pm.textField('cgru_afanasy__hosts_exclude',
                             text=pm.optionVar.get(
                                 'cgru_afanasy__hosts_exclude_ov', ''))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='Life Time (hours)')
                pm.intField('cgru_afanasy__life_time',
                            v=pm.optionVar.get('cgru_afanasy__life_time_ov',
                                               -1))

            pm.checkBox('cgru_afanasy__paused', l='Start Paused', v=0)
            pm.checkBox('cgru_afanasy__separate_layers',
                        l='Submit Render Layers as Separate Tasks',
                        v=pm.optionVar.get('cgru_afanasy__separate_layers_ov',
                                           1))

            pm.button(l='LAUNCH', c=self.launch)

            pm.checkBox('cgru_afanasy__close', l='Close After', v=1)

        pm.showWindow(self.window)
コード例 #56
0
    def new_set_btn_cmd(self, *args):
        """This function is for creating a new selecting set getting the selected component list from get_selection func.
        :return:
        """
        selected_component_list = self.get_selection()
        if selected_component_list is None:
            return
        # this function activates when the user presses the ADD SET btn it gets the file names from the path to compare
        # the new file name otherwise it sends the new file name in the path and the selected component list to
        # export_component function
        if selected_component_list[0].startswith("vtx["):
            suffix = "_vtx"
        elif selected_component_list[0].startswith("vtxFace["):
            suffix = "_vtxFace"
        elif selected_component_list[0].startswith("e["):
            suffix = "_edge"
        elif selected_component_list[0].startswith("f["):
            suffix = "_poly"
        else:
            None

        def store_set_name_cmd(*args):
            """ Stores the new set
            :return: None
            """
            src = pm.textField("NewSName", q=True, tx=True)
            src = src + suffix
            if src is None or len(src) < 1:
                None
            else:
                comp_files = os.listdir(self.characterList)
                if comp_files is None or len(comp_files) < 1:
                    new_path = self.characterList + "/" + src + ".cse"
                    delete_set_cmd()
                    export_component(new_path, selected_component_list)
                    populate_characters(self.dirName, self.selectedCharacter, self.characterList, self.selectedFile)
                else:
                    for comp_file in comp_files:
                        if comp_file.endswith(".cse"):
                            test = str(src+".cse")
                            if test == comp_file:
                                pm.confirmDialog(t='Error', b=['OK'], m='This file name exists.')
                                return None
                            else:
                                new_path = self.characterList + "/" + src + ".cse"
                                delete_set_cmd()
                                export_component(new_path, selected_component_list)
                                populate_characters(self.dirName, self.selectedCharacter, self.characterList,
                                                    self.selectedFile)

        def delete_set_cmd(*args):
            """ This command checks the side window is open or not.
            :return: None
            """
            if pm.window('newSetWin', exists=True):
                pm.deleteUI('newSetWin', window=True)
        # side windows tag name
        new_set_win = 'newSetWin'
        # activation the delete_set_cmd to check the window
        delete_set_cmd()
        # size of the side window
        size = (250, 80)
        # initialize the side window
        pm.window(new_set_win, wh=size, s=False, t='New Set Name')
        # main form layout
        main_form = pm.formLayout()
        # controls
        new_set_text = pm.text(label='New Set Name')
        new_set_text_field = pm.textField("NewSName", text="")
        new_set_text_btn = pm.button(label='ADD SET', c=store_set_name_cmd, p=main_form, w=100, h=26)
        cancel_btn = pm.button(label='CANCEL', c=delete_set_cmd, p=main_form, w=100, h=26)
        # attach the controls to main form
        ac = []
        af = []
        ac.append([new_set_text_field, 'top', 5, new_set_text])
        ac.append([new_set_text_field, 'bottom', 5, new_set_text_btn])
        ac.append([new_set_text_field, 'bottom', 5, cancel_btn])
        af.append([new_set_text, 'top', 5])
        af.append([new_set_text, 'left', 5])
        af.append([new_set_text, 'right', 5])
        af.append([new_set_text_field, 'left', 5])
        af.append([new_set_text_field, 'right', 5])
        af.append([new_set_text_btn, 'left', 5])
        af.append([new_set_text_btn, 'bottom', 5])
        af.append([cancel_btn, 'right', 5])
        af.append([cancel_btn, 'bottom', 5])
        pm.formLayout(main_form, e=True, attachControl=ac, attachForm=af)
        # force the window size
        pm.window(new_set_win, e=True, wh=size)
        # initialize the window
        pm.showWindow(new_set_win)
コード例 #57
0
import pymel.core as pm

def createPolySphere(x_slider, y_slider, z_slider):
    def cmd(*args):
        sphere = pm.polySphere(r=1, sx=20, sy=20, ax=(0, 1, 0), cuv=2, ch=1)[0]
        x_value = x_slider.getValue()
        y_value = y_slider.getValue()
        z_value = z_slider.getValue()
        sphere.setTranslation((x_value, y_value, z_value))
    return cmd

with pm.window(title="Polygon Sphere GUI", widthHeight=(200, 55)) as polysphere_gui:
    def closeWin(*args):
        polysphere_gui.delete()

    with pm.columnLayout():
        x_slider = pm.floatSliderGrp(label="Move X", field=True, minValue=-10.0, maxValue=10.0, value=0.0)
        y_slider = pm.floatSliderGrp(label="Move Y", field=True, minValue=-10.0, maxValue=10.0, value=0.0)
        z_slider = pm.floatSliderGrp(label="Move Z", field=True, minValue=-10.0, maxValue=10.0, value=0.0)

        pm.button(label="Create Polygon Sphere", command=createPolySphere(x_slider, y_slider, z_slider))
        pm.button(label="Close", command=closeWin)
    
コード例 #58
0
 def delete_set_cmd(*args):
     """ This command checks the side window is open or not.
     :return: None
     """
     if pm.window('newSetWin', exists=True):
         pm.deleteUI('newSetWin', window=True)
コード例 #59
0
    def UI(self):
        width = 250
        height = 100
        # create window
        if pm.window('ehm_Renamer_UI', exists=True):
            pm.deleteUI('ehm_Renamer_UI')
        pm.window('ehm_Renamer_UI',
                  title='rename multiple objects',
                  w=width,
                  h=height,
                  mxb=False,
                  mnb=False,
                  sizeable=False)

        # main layout
        mainLayout = pm.columnLayout(w=width, h=height)
        formLayout = pm.formLayout(w=width - 10, h=height - 10)
        frameLayout = pm.frameLayout(borderStyle='etchedIn',
                                     labelVisible=False)

        # left column and form
        pm.setParent(formLayout)
        leftLayout = pm.columnLayout(adj=True)
        leftForm = pm.formLayout(w=(width - 10) / 3, h=height - 10)

        # right column and form
        pm.setParent(formLayout)
        rightLayout = pm.columnLayout(adj=True)
        rightForm = pm.formLayout(w=(width - 10) / 3 * 2, h=height - 10)

        # num of joints slider
        text = pm.text(label="New name:", parent=leftForm)
        self.nameTF = pm.textField(text='newName_###', h=20, parent=rightForm)

        # button
        button = pm.button(label='apply',
                           w=100,
                           h=30,
                           c=partial(self.renamer, None, 'newName_###', False),
                           parent=formLayout)

        # place controls
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(frameLayout, 'left', 3))
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(frameLayout, 'right', 3))
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(frameLayout, 'top', 3))
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(frameLayout, 'bottom', 38))

        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(leftLayout, 'left', 3))
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(leftLayout, 'right', width / 3 * 2))
        pm.formLayout(formLayout, edit=True, attachForm=(leftLayout, 'top', 3))
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(leftLayout, 'bottom', 38))

        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(rightLayout, 'left', width / 3))
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(rightLayout, 'right', 3))
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(rightLayout, 'top', 3))
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(rightLayout, 'bottom', 38))

        pm.formLayout(leftForm, edit=True, attachForm=(text, 'right', 5))
        pm.formLayout(leftForm, edit=True, attachForm=(text, 'top', 13))

        pm.formLayout(rightForm,
                      edit=True,
                      attachForm=(self.nameTF, 'left', 0))
        pm.formLayout(rightForm,
                      edit=True,
                      attachForm=(self.nameTF, 'right', 15))
        pm.formLayout(rightForm,
                      edit=True,
                      attachForm=(self.nameTF, 'top', 13))

        pm.formLayout(formLayout, edit=True, attachForm=(button, 'left', 5))
        pm.formLayout(formLayout, edit=True, attachForm=(button, 'right', 5))
        pm.formLayout(formLayout, edit=True, attachForm=(button, 'bottom', 5))

        # show window
        pm.showWindow('ehm_Renamer_UI')
コード例 #60
0
ファイル: ArmRig.py プロジェクト: timosk92/Github
def gui():
    if(pm.window(newWindow, q=True,exists=True)):
        pm.deleteUI(newWindow)

    if(pm.windowPref(newWindow, q=True, exists=True)):
        pm.windowPref(newWindow,r=True)

    myWindow = pm.window(newWindow, t='Auto Arm Rig', w=150,h=325)
    main_layout=pm.columnLayout('Main Header')

    #Naming
    pm.text('naiming_Text', l="Step 1: Set name options")
    pm.rowColumnLayout(nc=4, cw=[(1,20),(2,40),(3,40),(4,50)])
    pm.text('ori_txt', label='Ori:')
    pm.optionMenu('Ori_Menu', cc = scriptName + '.colorChange()')
    pm.menuItem(label='lf_')
    pm.menuItem(label='rt_')
    pm.menuItem(label='ct_')
    pm.text('label_txt', label='Label:')
    pm.optionMenu('Label_Menu')
    pm.menuItem(label='Leg')
    pm.menuItem(label='Arm')
    pm.setParent(main_layout)

    #Rig type
    pm.text('rigType_text', label ="step 2: Set rig type")
    pm.radioButtonGrp("armType_Btn", labelArray3=('IK','FK','IKFK'),numberOfRadioButtons=3,columnWidth3=[50,50,50],select=3, cc=scriptName +'.armTypeVis()')
    pm.separator('rig_Sep', w=150, h=5)
    #Icon options

    pm.text('conSet_Text',l='Step 3: Set Icon properties')
    pm.rowColumnLayout(nc=2,cw=([1,90],[2,60]))
    pm.text('ikStyleText', label='IK Icon Style:')
    pm.optionMenu('ikIcon_Menu')
    pm.menuItem(label = 'Box')
    pm.menuItem(label = '4 Arrows')
    pm.menuItem(label = '4 Pin')
    pm.text('fkStyle_Text', label ='FK Icon Style:')
    pm.optionMenu('fkIcon_Menu')
    pm.menuItem(label='Circle')
    pm.menuItem('Turn Arrows')
    pm.text('handStyle_Text', label ='Hand Icon Style:')
    pm.optionMenu('handIcon_menu')
    pm.menuItem(label="Circle")
    pm.menuItem('COG')
    pm.text('pvStyle_Text', label ='PV Icon Style:')
    pm.optionMenu('pvIcon_menu')
    pm.menuItem(label='Diamond')
    pm.menuItem(label='Arrow')
    pm.setParent(main_layout)
    pm.button('testIconButton', l='Make test icon to set scale', w=150, c=scriptName + '.armIconScale()')
    pm.separator('style_Sep', w=150, h=5)

    #Icon Colour
    pm.text('armColour_Text', l="Step 4: Pick icon colour")
    pm.gridLayout(nr=1,nc=5, cellWidthHeight = [30,20])
    pm.iconTextButton('darkBlue_button', bgc=[0.000,0.016,0.373])
    pm.iconTextButton('lightBlue_button', bgc=[0,0,1])
    pm.iconTextButton('brown_button', bgc=[0.537,0.278,0.2])
    pm.iconTextButton('red_button', bgc=[1,0,0])
    pm.iconTextButton('yellow_button', bgc=[1,1,0])
    pm.setParent(main_layout)
    pm.colorIndexSliderGrp('armColor', w=150, h=20, cw2=(150,0),min=0, max=31, value = 7)
    pm.separator('icon_Sep', w=150, h=5)

    #Pole Vector
    pm.text('PV_text', label='Step 5: Set IK elbow options')
    pm.radioButtonGrp('addPVElbow_btn', labelArray2 = ('twist','Pole Vector'),numberOfRadioButtons = 2, columnWidth2=[65,85], select =2)
    pm.separator('pole_Sep', w=150, h=5)
    pm.button('final_Button', l='Finalise the arm', w=150)


    pm.showWindow()