Beispiel #1
1
def mayaUIContent(parent):
    """ Contents by Maya standard UI widgets """

    layout = cmds.columnLayout(adjustableColumn=True, parent=parent)

    cmds.frameLayout("Sample Frame 1", collapsable=True)
    cmds.columnLayout(adjustableColumn=True, rowSpacing=2)
    cmds.button("maya button 1")
    cmds.button("maya button 2")
    cmds.button("maya button 3")
    cmds.setParent('..')
    cmds.setParent('..')

    cmds.frameLayout("Sample Frame 2", collapsable=True)
    cmds.gridLayout(numberOfColumns=6, cellWidthHeight=(35, 35))
    cmds.shelfButton(image1="polySphere.png", rpt=True, c=cmds.polySphere)
    cmds.shelfButton(image1="sphere.png", rpt=True, c=cmds.sphere)
    cmds.setParent('..')
    cmds.setParent('..')

    cmds.setParent('..')  # columnLayout

    ptr = OpenMayaUI.MQtUtil.findLayout(layout)
    obj = shiboken2.wrapInstance(long(ptr), QtWidgets.QWidget)

    return obj
Beispiel #2
0
    def buildUI(self):
        column = cmds.columnLayout()
        cmds.frameLayout(label="Choose an Object type")

        cmds.columnLayout()
        self.objType = cmds.radioCollection("objectCreationType")
        cmds.radioButton(label="Sphere")
        cmds.radioButton(label="Cube", select=True)
        cmds.radioButton(label="Cone")

        self.intField = cmds.intField("numObjects", value=3)

        cmds.setParent(column)
        frame = cmds.frameLayout("Choose your max range")

        cmds.gridLayout(numberOfColumns=2, cellWidth=100)

        for axis in 'xyz':
            cmds.text(label='%s axis' % axis)
            cmds.floatField('%sAxisField' % axis, value=random.uniform(0, 10))

        cmds.setParent(frame)
        cmds.rowLayout(numberOfColumns=2)
        cmds.radioCollection("randomMode")
        cmds.radioButton(label='Absolute', select=True)
        cmds.radioButton(label='Relative')

        cmds.setParent(column)
        cmds.rowLayout(numberOfColumns=2)
        cmds.button(label='Create', command=self.onCreateClick)
        cmds.button(label='Randomize', command=self.onRandomClick)
Beispiel #3
0
 def bitsGUI( self ):
     col = cmds.columnLayout( adjustableColumn=True, columnAttach=('both', 5), parent=self.fillArea )
     cmds.separator( style='none', height=4, width=413 )
     
     # Primitives section.
     cmds.text( label='BIT PRIMITIVES', height=20, font='boldLabelFont', backgroundColor=[0.2,0.2,0.2] )
     cmds.separator( style='none', height=5 )
     cmds.gridLayout( numberOfColumns=5, cellWidthHeight=( 50, 50 ) )
     cmds.button( label='Sphere', command=lambda b, a1='glSphere': cmds.makeGLBit( objecttype=a1 ) )
     cmds.button( label='Box', command=lambda b, a1='glBox': cmds.makeGLBit( objecttype=a1 ) )
     cmds.button( label='Cylinder', command=lambda b, a1='glCylinder': cmds.makeGLBit( objecttype=a1 ) )
     cmds.button( label='Cone', command=lambda b, a1='glCone': cmds.makeGLBit( objecttype=a1 ) )
     cmds.button( label='Torus', command=lambda b, a1='glTorus': cmds.makeGLBit( objecttype=a1 ) )
     cmds.setParent( '..' )#gridLayout
     cmds.separator( style='none', height=10 )
     
     # Transform section.
     cmds.text( label='TRANSFORM TOOLS', height=20, font='boldLabelFont', backgroundColor=[0.2,0.2,0.2] )
     cmds.separator( style='none', height=5 )
     cmds.gridLayout( numberOfColumns=3, cellWidthHeight=( 50, 50 ) )
     cmds.iconTextButton( annotation='match translation', style='iconOnly',
                          image1='icon_match_translation.png',
                          command=lambda a1='tran': TransformUtility.matchTransforms(a1) )
     cmds.iconTextButton( annotation='match rotation', style='iconOnly',
                          image1='icon_match_rotation.png',
                          label='match rotation', command=lambda a1='rot': TransformUtility.matchTransforms(a1) )
     cmds.iconTextButton( annotation='match all', style='iconOnly',
                          image1='icon_match_all.png',
                          label='match all', command=lambda a1='all': TransformUtility.matchTransforms(a1) )
     cmds.setParent( '..' )#gridLayout
     cmds.separator( style='none', height=10 )
     
     cmds.setParent( '..' )#col 
Beispiel #4
0
    def updateData(self, data, *args):

        # From Dict

        for lay in data:

            # Create Tab

            layoutLabel = lay.split('_')[0]

            cmds.gridLayout(lay,
                            cellWidthHeight=(self.cel, self.cel),
                            ag=True,
                            cr=True,
                            p=self.tab)
            cmds.setParent('..')

            cmds.shelfTabLayout(self.tab, e=True, tabLabel=(lay, layoutLabel))

            for ctl in data[lay]:
                # Create Object

                annot = data[lay][ctl]['annotation']
                bgc = data[lay][ctl]['color']

                buttonCtl = cmds.button(ctl,
                                        l=ctl.split('_')[0],
                                        rs=True,
                                        p=lay,
                                        annotation=annot,
                                        c=partial(self.selectObjects, annot),
                                        bgc=bgc)

                self.pickerPopupMenu(buttonCtl)
    def UI_skipAttr(self, UIparent):

        nameColumn = 'skipAttrColumn'
        nameGrid = 'skipAttrGrid'

        mc.columnLayout(nameColumn,
                        p=UIparent,
                        columnAttach=['both', 10],
                        rowSpacing=0,
                        columnWidth=100,
                        bgc=[0.27, 0.27, 0.27])
        mc.text(l='SKIP ATTR', p=nameColumn, w=60)

        mc.gridLayout(nameGrid, p=nameColumn, cw=15, ch=15, nr=4, nc=4)

        mc.text(l='', p=nameGrid)
        mc.text(l='X', p=nameGrid)
        mc.text(l='Y', p=nameGrid)
        mc.text(l='Z', p=nameGrid)

        textTRS = ['T', 'R', 'S']

        for lap in range(0, 3):
            mc.text(l=textTRS[lap], p=nameGrid)
            for i in range(0, 3):
                mc.checkBox(self.ui_skipAttrChoice[lap * 3 + i],
                            v=self.ui_skipAttrValue[lap * 3 + i],
                            l='',
                            p=nameGrid)
Beispiel #6
0
    def create_main_window(self):
        main_window = cmds.window(title=".Burn the witch "+u"\u0028\u256F\u00B0\u25A1\u00B0\u0029\u256F\uFE35\u0020\u253B\u2501\u253B", widthHeight=(500, 560), tlc=(450, 1100))
        cmds.scrollLayout()
        # witch_dock = cmds.dockControl(label=".Burn the witch", area='right', content=main_window, fl=True, width=510,
        #                               height=570)
        cmds.text(label='Pickle path is: ' + str(self.global_work_space['miscData']['picklePath']))
        cmds.gridLayout(numberOfColumns=3, cellWidthHeight=(100, 25))
        cmds.button(label='SaveData', height=25, backgroundColor=[0.3, 0.3, 0.3],
                    command=partial(self.helper.heyWitch_stashDictionary, self.global_work_space))
        cmds.button(label='Refresh', height=25, backgroundColor=[0.3, 0.3, 0.3],
                    command=partial(self.refresh_main_window, main_window))
        cmds.setParent('..')
        tab_layout = cmds.tabLayout(innerMarginWidth=5, innerMarginHeight=5)

        toolkit_column_layout = self.main_tabs_manager.toolkit_tab_builder()

        mswPane = self.main_tabs_manager.msw_tab_builder()
        mapsPane = self.main_tabs_manager.magic_maps_tab_builder()
        bjcCol = self.main_tabs_manager.bjc_tab_builder()

        cmds.tabLayout(tab_layout, edit=True, tabLabel=(
            (toolkit_column_layout, 'Toolkit'), (mswPane, 'Mesh Skinning Workspace'), (mapsPane, 'Magic Maps'), (bjcCol, 'Bind Joint Clusters')))
        # cmds.setParent('..')
        cmds.setParent('..')
        # end of scroll and row layouts for both
        cmds.showWindow(main_window)
        cmds.window(main_window, edit=True, visible=True)
    def createUI(self):
        if cmds.window(self.winName, exists=True):
            cmds.deleteUI(self.winName)

        cmds.window(self.winName, title=self.winTitle, maximizeButton=False, minimizeButton=False, resizeToFitChildren=True)
        self.mainCol = cmds.columnLayout( adjustableColumn=True )
        
        cmds.gridLayout(numberOfRowsColumns=[2,2], cellWidthHeight=[120,20])
        cmds.text('OSC port')
        self.ui_oscport = cmds.intField(minValue=0, maxValue=65535, value=self.osc_port, changeCommand=partial(self.set_port), enable=not self.ServerStarted)
        cmds.text('Scale')
        self.ui_scaling = cmds.floatField(minValue=0, maxValue=1000, value=self.scaling, changeCommand=partial(self.set_scaling))
        cmds.setParent(upLevel=True)
        
        self.nullsbox = cmds.checkBox( value=self.create, label='Create locators based on received data', changeCommand=partial(self.set_create) )
        self.recbox = cmds.checkBox( value=self.record, label='Record motion capture', changeCommand=partial(self.set_record) )
        self.rootbox = cmds.checkBox(value=self.createRoot, label='Parent locators to a root object', changeCommand=partial(self.set_createRoot))
        
        
        if self.ServerStarted:
            self.receiveButton = cmds.button( label='Stop Receiving', command=partial(self.toggle_server) )
        else:
            self.receiveButton = cmds.button( label='Start Receiving', command=partial(self.toggle_server) )
        
        cmds.showWindow( self.winName )
Beispiel #8
0
def Char_ModelLibWin():
    winWH = [500,420]
    winName = 'ModelLibraryWin'
    if cmds.window(winName,q = True,ex = True):
        cmds.deleteUI(winName)
    cmds.window(winName,wh = winWH,t = 'ModelLibrary',mb = True)
    cmds.menu(l = '文件')
    cmds.menuItem(l = '整理文件信息',c = 'fb.mod.charLibrary.propList()')
    cmds.menuItem(l = '添加角色',c = 'fb.mod.charLibrary.Char_AddPropWin()')
    cmds.menuItem('addSelmen',l = '叠加选择',cb = False)
    cmds.menu(l = '刷新')
    cmds.menuItem(l = '刷新窗口',c = 'fb.mod.charLibrary.Char_ModelLibWin()')
    cmds.formLayout('Char_MLformLayout',nd=100)
    coLayoutTop = cmds.columnLayout(adj = True,cat = ['both',0],rs = 10)
    cmds.text(l = '角色库')
    cmds.separator()
    cmds.setParent('..')
    treeList = cmds.treeLister('Char_TreeList')
    #cmds.popupMenu()
    #cmds.menuItem('Char_OpenScenesFolder',l = '打开场景文件夹')
    #cmds.menuItem('Char_OpenImageFolder',l = '打开图片文件夹')
    scLy = cmds.frameLayout('PicFrameLay',l = '图片',bs = 'etchedOut')
    cmds.scrollLayout('picScrolLY',cr = True,hst = 1000,vst = 1000,mcw = 1000,rc = 'fb.mod.charLibrary.Char_Rcmd()')
    cmds.gridLayout('Char_GridLY',cwh =(100,100))
    cmds.setParent('..')
    cmds.showWindow(winName)
    cmds.formLayout('Char_MLformLayout',e = True,
    af = [(coLayoutTop,'top',5),(coLayoutTop,'left',5),(coLayoutTop,'right',5),(treeList,'left',5),(treeList,'bottom',5),(scLy,'right',5),(scLy,'bottom',0)],
    ac = [(treeList,'top',0,coLayoutTop),(scLy,'top',0,coLayoutTop),(scLy,'left',0,treeList)],
    ap = [(treeList,'right',5,40)])
    if cmds.window('addPropWin',q = True,ex = True):
        cmds.deleteUI('addPropWin')
    Char_TreeList()
def showImportDialog(filesCount):

    windowSize = (200, 120)
    mc.window(winID, title="Ninja Ripper (options)", widthHeight=(windowSize[0], windowSize[1]), sizeable=False,
              minimizeButton=False, maximizeButton=False)

    mc.columnLayout("mainColumn", adjustableColumn=True)

    mc.separator(style="none", height=10)

    mc.gridLayout("gridLayout", numberOfRowsColumns=(1, 2), cellWidthHeight=(80, 20))
    mc.text(label="Texture index")

    global textureIndexField
    textureIndexField = mc.intField(minValue=0, maxValue=16, value=0)
    mc.setParent("..")

    global flipUvField
    flipUvField = mc.checkBox("Flip UV (vertical)", value=False)

    mc.separator(style="none", height=15)

    buttonCommand = "doImport()"
    # print buttonCommand
    mc.button(label="Import " + str(filesCount) + " file(s)", command=buttonCommand, backgroundColor=(0.0, 0.6, 0.0))
    mc.separator(style="none", height=2)
    mc.button(label="Cancel", command=('mc.deleteUI(\"' + winID + '\", window=True)'), backgroundColor=(0.6, 0.0, 0.0))

    global progressBarControl
    progressBarControl = mc.progressBar(maxValue=filesCount)

    mc.showWindow()

    return
Beispiel #10
0
def shuai_addBlendAttr():
	global lineID
	lineID=0
	global blendAttrList
	blendAttrList=[]
	if mc.window('addBlendAttrWin',ex=1):
		mc.deleteUI('addBlendAttrWin')
	mc.window('addBlendAttrWin',t='添加融合属性面板')
	mc.columnLayout('mainLayout',rowSpacing=5)
	mc.frameLayout('atrrListLayout',bs='etchedOut',l='融合属性列表',font='fixedWidthFont',collapsable=1,borderVisible=1)
	
	mc.rowLayout('textLayout',numberOfColumns=4)
	mc.text('属性名',w=200,h=25,font='fixedWidthFont')
	mc.text('开始值',w=100,h=25,font='fixedWidthFont')
	mc.text('结束值',w=100,h=25,font='fixedWidthFont')
	mc.text('',w=100,h=25,font='fixedWidthFont')
	mc.setParent('..')
	
	mc.gridLayout(numberOfColumns=2,cellWidth=254,p='mainLayout')
	mc.button('addBlendAttrBt',l='添加融合属性',c='shuai_addBlendAttr.addBlendAttrCmd()')
	mc.button('removeAllBlendAttrBt',l='移除所有属性',c='shuai_addBlendAttr.removeAllAttrCmd()')
	mc.setParent('..')
	mc.textFieldGrp('attrName',label='融合属性名称:')
	mc.textFieldButtonGrp('blendAttrObj',label='融合属性添加到:',buttonLabel='>>',bc='shuai_addBlendAttr.getBlendAttrObjCmd()')
	mc.button('addBlendAttrToObjBt',l='添加',w=510,h=50,p='mainLayout',c='shuai_addBlendAttr.blendAttrCmd()',en=0)
	
	mc.showWindow('addBlendAttrWin')
Beispiel #11
0
    def buildUI(self):
       
        column = cmds.columnLayout()
        cmds.frameLayout(label='Choose an axis')
        
        cmds.gridLayout(numberOfColumns=3, cellWidth=50)

        cmds.radioCollection()
        self.xAxis = cmds.radioButton(label='x', select=True)
        self.yAxis = cmds.radioButton(label='y')
        self.zAxis = cmds.radioButton(label='z')
        
        createIconButton('XAxis.png', command=partial(self.onOptionClick, self.xAxis))
        createIconButton('YAxis.png', command=partial(self.onOptionClick, self.yAxis))
        createIconButton('ZAxis.png', command=partial(self.onOptionClick, self.zAxis))
        
        cmds.setParent(column)

        cmds.frameLayout(label='Choose where to align')

        cmds.gridLayout(numberOfColumns=3,cellWidth=50)

        cmds.radioCollection()

        self.minMode = cmds.radioButton(label='min')
        self.midMode = cmds.radioButton(label='mid', select=True)
        self.maxMode = cmds.radioButton(label='max')
       
        createIconButton('MinAxis.png', command=partial(self.onOptionClick, self.minMode))
        createIconButton('MidAxis.png', command=partial(self.onOptionClick, self.midMode))
        createIconButton('MaxAxis.png', command=partial(self.onOptionClick, self.maxMode))
       
        cmds.setParent(column)
        cmds.button(label='Align', command=self.onApplyClick, bgc=(0.2, 0.5, 0.9))
Beispiel #12
0
def create_asset_entries(entries):
    in_assets_layout = False

    cmds.columnLayout(adjustableColumn=True)

    for entry in sorted(entries, cmp=compare_asset_entry):
        if entry["type"] == "folder":
            if in_assets_layout:
                in_assets_layout = False
                cmds.setParent(upLevel=True)

            cmds.frameLayout(collapsable=True,
                             label=entry["name"],
                             marginWidth=child_entries_margin)

            create_asset_entries(entry["entries"])

            cmds.setParent(upLevel=True)
        elif entry["type"] == "asset":
            if not in_assets_layout:
                in_assets_layout = True
                cmds.gridLayout(numberOfColumns=child_assets_column,
                                cellWidthHeight=[asset_size, asset_size])

            create_asset_entry(entry)

    if in_assets_layout:
        in_assets_layout = False
        cmds.setParent(upLevel=True)

    cmds.setParent(upLevel=True)
Beispiel #13
0
def setAttributeVectorUI():
    global tfXIn, tfXOut, tfYIn, tfYOut, tfZIn, tfZOut, tslVectorList, tfXAdd, tfYAdd, tfZAdd, vectorUI
    vectorUI = 'vectorUI'
    closeUI(vectorUI)
    cmds.window(vectorUI, title='vectorUI')
    cmds.columnLayout(columnAttach=['both', 5], rowSpacing=5, columnWidth=210)
    cmds.text('..: random range :..', backgroundColor=[0.15, 0.15, 0.0])
    cmds.gridLayout(numberOfColumns=6, cellWidthHeight=(33, 20))
    tfXIn = cmds.textField(text='0.0', backgroundColor=[0.15, 0.1, 0.0])
    tfXOut = cmds.textField(text='1.0', backgroundColor=[0.15, 0.1, 0.0])
    tfYIn = cmds.textField(text='0.0', backgroundColor=[0.0, 0.15, 0.1])
    tfYOut = cmds.textField(text='1.0', backgroundColor=[0.0, 0.15, 0.1])
    tfZIn = cmds.textField(text='0.0', backgroundColor=[0.0, 0.1, 0.15])
    tfZOut = cmds.textField(text='1.0', backgroundColor=[0.0, 0.1, 0.15])
    cmds.setParent('..')
    cmds.button('ok', command='setAttributeVectorRandom()')
    cmds.separator(style='out')
    cmds.text('..: vector list :..', backgroundColor=[0.0, 0.15, 0.15])
    tslVectorList = cmds.textScrollList(allowMultiSelection=True)
    cmds.button('remove', command='removeScrollListVector()')
    cmds.gridLayout(numberOfColumns=4, cellWidthHeight=(50, 20))
    tfXAdd = cmds.textField(text='0.0', backgroundColor=[0.15, 0.1, 0.0])
    tfYAdd = cmds.textField(text='0.0', backgroundColor=[0.0, 0.15, 0.1])
    tfZAdd = cmds.textField(text='0.0', backgroundColor=[0.0, 0.1, 0.15])
    cmds.button('add..', command='addScrollListVector()')
    cmds.setParent('..')
    cmds.button('random', command='setAttributeListVectorRandom()')
    cmds.button('increment %', command='setAttributeListVectorInc()')
    cmds.setParent('..')
    cmds.showWindow()
def mayaUIContent(parent):
    """ Contents by Maya standard UI widgets """

    layout = cmds.columnLayout(adjustableColumn=True, parent=parent)

    cmds.frameLayout("Sample Frame 1", collapsable=True)
    cmds.columnLayout(adjustableColumn=True, rowSpacing=2)
    cmds.button("maya button 1")
    cmds.button("maya button 2")
    cmds.button("maya button 3")
    cmds.setParent('..')
    cmds.setParent('..')

    cmds.frameLayout("Sample Frame 2", collapsable=True)
    cmds.gridLayout(numberOfColumns=6, cellWidthHeight=(35, 35))
    cmds.shelfButton(image1="polySphere.png", rpt=True, c=cmds.polySphere)
    cmds.shelfButton(image1="sphere.png", rpt=True, c=cmds.sphere)
    cmds.setParent('..')
    cmds.setParent('..')

    cmds.setParent('..')  # columnLayout

    ptr = OpenMayaUI.MQtUtil.findLayout(layout)
    obj = shiboken2.wrapInstance(long(ptr), QtWidgets.QWidget)

    return obj
Beispiel #15
0
    def create_controller_window(self, winName="Controller"):
        global colMenu
        if cmds.window(self.winName, exists=True):
                cmds.deleteUI(self.winName)

        self.window = cmds.window(self.winName, title=self.winTitle, tbm=1, w=150, h=100 )

        cmds.menuBarLayout(h=30)
        cmds.rowColumnLayout  (' selectArrayRow ', nr=1, w=150)

        cmds.frameLayout('LrRow', label='', lv=0, nch=1, borderStyle='out', bv=1, p='selectArrayRow')


        getCtrlType=["cluster", "circle"]        
        cmds.rowLayout  (' rMainRow ', w=300, numberOfColumns=6, p='selectArrayRow')
        cmds.columnLayout ('selectArrayColumn', parent = 'rMainRow')
        cmds.setParent ('selectArrayColumn')
        cmds.separator(h=10, p='selectArrayColumn')
        cmds.gridLayout('listBuildButtonLayout', p='selectArrayColumn', numberOfColumns=1, cellWidthHeight=(150, 20))
#         colMenu=cmds.optionMenu( label='ControllerType')
#         for each in getCtrlType:
#             cmds.menuItem( label=each)            
        cmds.button (label='make cluster control', p='listBuildButtonLayout', command = self.make_cluster_ctrl)
        cmds.button (label='make circle control', p='listBuildButtonLayout', command = self.make_circle_ctrl)
        cmds.button (label='make locator control', p='listBuildButtonLayout', command = self.make_loc_ctrl)
        cmds.showWindow(self.window)    
    def toolGrid(self, UIparent):

        toolList = [
            'buildConstaint2by2', 'buildConstaintOneMaster',
            'buildConstraintProxy', 'deleteConstraint', 'resetConstraints',
            'selectConstraintMasters', 'selectConstraintSlaves'
        ]

        toolGridName = 'toolGridLayout'

        mc.gridLayout(toolGridName,
                      numberOfColumns=5,
                      cellWidthHeight=[50, 50],
                      bgc=[0.27, 0.27, 0.27],
                      p=UIparent)

        for tool in toolList:

            exec('import {0}.{1}.{1}'.format(self.modulPathInGlobal,
                                             tool)) in globals()
            cmds = ('{0}.{1}.{1}.{1}()'.format(self.modulPathInGlobal, tool))
            path = (self.globalPath + '/' + tool + '/' + tool + '.jpg')

            mc.symbolButton((tool + '_button'),
                            c=cmds,
                            i=path,
                            ann=tool,
                            p=toolGridName)
Beispiel #17
0
    def __init__(self):
        winName = "Size set"
        global typeMenu
        winTitle = winName
        if cmds.window(winName, exists=True):
                cmds.deleteUI(winName)

#         self.window = cmds.window(self.winName, title=self.winTitle, tbm=1, w=150, h=100 )
        window = cmds.window(winName, title=winTitle, tbm=1, w=250, h=100 )

        cmds.menuBarLayout(h=30)
        cmds.rowColumnLayout  (' selectArrayRow ', nr=1, w=250)

        cmds.frameLayout('LrRow', label='', lv=0, nch=1, borderStyle='out', bv=1, p='selectArrayRow')
        
        cmds.rowLayout  (' rMainRow ', w=300, numberOfColumns=6, p='selectArrayRow')
        cmds.columnLayout ('selectArrayColumn', parent = 'rMainRow')
        cmds.setParent ('selectArrayColumn')
        cmds.separator(h=10, p='selectArrayColumn')
        cmds.gridLayout('listBuildButtonLayout', p='selectArrayColumn', numberOfColumns=2, cellWidthHeight=(100, 20))
        typeMenu=cmds.optionMenu( label='ctrl size')
        cmds.menuItem( label="Large" )
        cmds.menuItem( label="Med" )
        cmds.menuItem( label="Small" )           
        cmds.button (label='Change Selection', p='listBuildButtonLayout', command = lambda *args:self.controllerSize())
        cmds.showWindow(window)    
def setAttributeVectorUI():
    global tfXIn, tfXOut, tfYIn, tfYOut, tfZIn, tfZOut, tslVectorList, tfXAdd, tfYAdd, tfZAdd, vectorUI
    vectorUI = 'vectorUI'
    closeUI(vectorUI)
    cmds.window(vectorUI, title = 'vectorUI')
    cmds.columnLayout(columnAttach = ['both', 5], rowSpacing = 5, columnWidth = 210)
    cmds.text('..: random range :..', backgroundColor = [0.15, 0.15, 0.0])
    cmds.gridLayout(numberOfColumns = 6, cellWidthHeight = (33, 20))
    tfXIn = cmds.textField(text = '0.0', backgroundColor = [0.15, 0.1, 0.0])
    tfXOut = cmds.textField(text = '1.0', backgroundColor = [0.15, 0.1, 0.0])
    tfYIn = cmds.textField(text = '0.0', backgroundColor = [0.0, 0.15, 0.1])
    tfYOut = cmds.textField(text = '1.0', backgroundColor = [0.0, 0.15, 0.1])
    tfZIn = cmds.textField(text = '0.0', backgroundColor = [0.0, 0.1, 0.15])
    tfZOut = cmds.textField(text = '1.0', backgroundColor = [0.0, 0.1, 0.15])
    cmds.setParent('..')
    cmds.button('ok', command = 'setAttributeVectorRandom()')
    cmds.separator(style = 'out')
    cmds.text('..: vector list :..', backgroundColor = [0.0, 0.15, 0.15])
    tslVectorList = cmds.textScrollList(allowMultiSelection = True)
    cmds.button('remove', command = 'removeScrollListVector()')
    cmds.gridLayout(numberOfColumns = 4, cellWidthHeight = (50, 20))
    tfXAdd = cmds.textField(text = '0.0', backgroundColor = [0.15, 0.1, 0.0])
    tfYAdd = cmds.textField(text = '0.0', backgroundColor = [0.0, 0.15, 0.1])
    tfZAdd = cmds.textField(text = '0.0', backgroundColor = [0.0, 0.1, 0.15])
    cmds.button('add..', command = 'addScrollListVector()')
    cmds.setParent('..')
    cmds.button('random', command = 'setAttributeListVectorRandom()')
    cmds.button('increment %', command = 'setAttributeListVectorInc()')
    cmds.setParent('..')
    cmds.showWindow()
Beispiel #19
0
def showWindow():
	name = "RandomizerWindow"
	if cmds.window(name , query=True , exists=True):
		cmds.deleteUI(name)
	cmds.window(name)  	
	cmds.showWindow()


	column = cmds.columnLayout()
	cmds.showWindow()

	column = cmds.columnLayout()
	cmds.frameLayout(label = "Select a object type")

	cmds.columnLayout()
	cmds.radioCollection("objectCreationType ")
	cmds.radioButton(label="Sphere")
	cmds.radioButton(label="Cube", select=True)
	cmds.radioButton(label="Cone")

	cmds.intField("numObjects", value=3)

	cmds.setParent(column)
	frame = cmds.frameLayout("Choose range")

	cmds.gridLayout(numberOfColumns=2, cellWidth=100)

	for axis in 'xyz':
	cmds.text(label = '%s axis' % axis)
	cmds.float('%sAxisField' % axis, value=random.uniform(0,10))

	cmds.setParent(frame)
	cmds.rowLayout(numberOfColumns=2)

	cmds.radioCollection('randomMode')
	cmds.radioButton(label = 'Absolute', select = True)
	cmds.radioButton(label = 'Relative')

	cmds.setParent(column)
	cmds.rowLayout(numberOfColumns=2)
	cmds.button(label='Create', command=onCreateClick)
	cmds.button(label='Randomize', command = onRandomClick )

def onCreateClick(*args):
	radio = cmds.radioCollection("objectCreationType", query=True, select=True)
	mode = cmds.radioButton(radio, query=True, label=True)
	numObjects = cmds.intField("numObjects", query=True, label=True)

	createObjects(mode, numObects)
	onRandomClick()
def onRandomClick(*args):
	radio = cmds.radioCollection("randomMode", query=True, select=True)
	mode = cmds.radioButton(radio, query=True, label=True)
	
	for axis in xyz:
		val =cmds.floatField("%s AxisField" % axis, query=True, label=True)
		randomize(minValue=val*=-1, maxValue = val, mode=mode, axes = axis)
Beispiel #20
0
def Char_PicList(picPaths = []):
    isSel = cmds.menuItem('addSelmen',q = True,cb = True)
    picList = cmds.gridLayout('Char_GridLY',q= True,ca = True)
    if picList and not isSel:
        cmds.deleteUI(cmds.gridLayout('Char_GridLY',q= True,ca = True))
    for name,picPath in picPaths:
        imageFloder = '%s/character_Library/%s/images'%(Char_Desk(),os.path.dirname(picPath))
        sceneFloder = '%s/character_Library/%s/scenes'%(Char_Desk(),os.path.dirname(picPath))
        filePath = '%s/character_Library/%s/scenes/%s.mb'%(Char_Desk(),os.path.dirname(picPath),os.path.basename(picPath))
        if cmds.columnLayout('col%s'%os.path.basename(picPath),q = True,ex = True):
            cmds.deleteUI('col%s'%os.path.basename(picPath))
        if os.path.isdir(imageFloder):
            pics = [c for c in os.listdir(imageFloder) if re.match('^.+\.(jpg|jpeg|bmp|png|iff|tif)$',c) and c.split('.')[0] == os.path.basename(picPath)]
            if pics:
                p = pics[0]
                cmds.columnLayout('col%s'%os.path.basename(picPath),p = 'Char_GridLY',adj = True)
                if os.path.isfile('%s/%s'%(imageFloder,re.sub('\.','_Big.',p))):
                    bigp = re.sub('\.','_Big.',p)
                    cmds.iconTextButton(os.path.basename(picPath),i='%s/%s'%(imageFloder,p),w = 100,h = 80,c = 'fb.mod.charLibrary.Char_OpenPicture(picPath = \'%s/%s\')'%(imageFloder,bigp))
                else:
                    cmds.iconTextButton(os.path.basename(picPath),i='%s/%s'%(imageFloder,p),w = 100,h = 80,c = 'fb.mod.charLibrary.Char_OpenPicture(picPath = \'%s/%s\')'%(imageFloder,p))
                cmds.popupMenu()
                if os.path.isfile(filePath):
                    cmds.menuItem(l = '导入到场景',c = 'fb.mod.charLibrary.Char_ImportProp(filePath = \'%s\')'%filePath)
                else:
                    cmds.menuItem(l = '导入到场景',en = False)
                cmds.menuItem(l = '打开角色文件夹',c = 'import os;os.startfile(\'%s\')'%sceneFloder.replace("/","\\\\"))
                cmds.menuItem(l = '打开图片文件夹',c = 'import os;os.startfile(\'%s\')'%imageFloder.replace("/","\\\\"))
                #cmds.menuItem(l = '列出上一层及所有图片',c = 'os.startfile(\'%s\')'%imageFloder)
                cmds.text(h = 20,l = name,bgc = [1,1,1])
                cmds.setParent('..')
            '''else:
                cmds.popupMenu(p = 'Char_GridLY')
                if os.path.isfile(filePath):
                    cmds.menuItem(l = '导入到场景',c = 'fb.mod.charLibrary.Char_ImportProp(filePath = \'%s\')'%filePath)
                    cmds.menuItem('Char_ImportFile',e = True,c = 'fb.mod.charLibrary.Char_ImportProp(filePath = \'%s\')'%filePath)
                else:
                    cmds.menuItem(l = '导入到场景',en = False)
                    cmds.menuItem('Char_ImportFile',e = True,en = False)
                cmds.menuItem(l = '打开场景文件夹',c = 'os.startfile(\'%s\')'%sceneFloder)
                cmds.menuItem(l = '打开图片文件夹',c = 'os.startfile(\'%s\')'%imageFloder)
                cmds.menuItem('Char_OpenScenesFolder',e = True,en = True,c = 'os.startfile(\'%s\')'%sceneFloder)
                cmds.menuItem('Char_OpenImageFolder',e = True,en = True,c = 'os.startfile(\'%s\')'%imageFloder)'''
        elif os.path.isdir(sceneFloder):
            cmds.popupMenu(p = 'Char_GridLY')
            if os.path.isfile(filePath):
                cmds.menuItem(l = '导入到场景',c = 'fb.mod.charLibrary.Char_ImportProp(filePath = \'%s\')'%filePath)
                cmds.menuItem('Char_ImportFile',e = True,c = 'fb.mod.charLibrary.Char_ImportProp(filePath = \'%s\')'%filePath)
            else:
                cmds.menuItem(l = '导入到场景',en = False)
                cmds.menuItem('Char_ImportFile',e = True,en = False)
            cmds.menuItem(l = '打开角色文件夹',c = 'os.startfile(\'%s\')'%sceneFloder.replace("/","\\\\"))
            cmds.menuItem('Char_OpenScenesFolder',e = True,en = True,c = 'os.startfile(\'%s\')'%sceneFloder)
            cmds.menuItem('Char_OpenImageFolder',e = True,en = False)
        else:
            pass
Beispiel #21
0
    def __init__(self): 
        #check to see if window exists
        if cmds.window ('RangeToolUI', exists = True):
            cmds.deleteUI('RangeToolUI')
        window = cmds.window( 'RangeToolUI', title = 'Range Tool UI', w =300, h =300) 

        cmds.rowColumnLayout(numberOfColumns = 1)
        cmds.separator( height=20, width = 300, style='in' )
        cmds.setParent('..')
        
        cmds.gridLayout(numberOfColumns=4, cellWidthHeight=(80, 20))
        self.txLabel = cmds.text(label = 'translateX')
        self.txMinFloatField = cmds.floatField()
        self.txMidText = cmds.text(label = ' ----- ', width = 10)
        self.txMaxFloatField = cmds.floatField()
        
        self.tyLabel = cmds.text(label = 'translateY')
        self.tyMinFloatField = cmds.floatField()
        self.tyMidText = cmds.text(label = ' ----- ', width = 10)
        self.tyMaxFloatField = cmds.floatField()

        self.tzLabel = cmds.text(label = 'translateZ')
        self.tzMinFloatField = cmds.floatField()
        self.tzMidText = cmds.text(label = ' ----- ', width = 10)
        self.tzMaxFloatField = cmds.floatField()
                
        self.rxLabel = cmds.text(label = 'rotateX')
        self.rxMinFloatField = cmds.floatField()
        self.rxMidText = cmds.text(label = ' ----- ', width = 10)
        self.rxMaxFloatField = cmds.floatField()
        
        self.ryLabel = cmds.text(label = 'rotateY')
        self.ryMinFloatField = cmds.floatField()
        self.ryMidText = cmds.text(label = ' ----- ', width = 10)
        self.ryMaxFloatField = cmds.floatField()

        self.rzLabel = cmds.text(label = 'rotateZ')
        self.rzMinFloatField = cmds.floatField()
        self.rzMidText = cmds.text(label = ' ----- ', width = 10)
        self.rzMaxFloatField = cmds.floatField()
        
        self.empty1 = cmds.text(label = '')
        self.empty2 = cmds.text(label = '')
        self.empty3 = cmds.text(label = '')
        self.empty4 = cmds.text(label = '')
        
        self.loadButton    = cmds.button(l = 'Load Ctl', c = self.locadCtl)      
        self.conformButton = cmds.button(l = 'Confirm', c = self.ctlSetLimits)        
        
        cmds.setParent('..')
        
        cmds.rowColumnLayout(numberOfColumns = 1)
        cmds.separator( height=20, width = 300, style='in' )
        cmds.setParent('..')
        
        cmds.showWindow()      
Beispiel #22
0
def doAdjustGridSize(arg=None):
    '''Adjust the number of grid columns when size of window changed.
    '''
    # Get size of window.
    width=cmds.scrollLayout("displayAssetsSL", query=True, width=True)
    cellWidth = 165
    # Calculate number of columns.
    numberOfColumns = math.ceil(width / cellWidth)
    cmds.gridLayout("displayAssetsGL", edit=True, numberOfColumns=numberOfColumns)
    # Refresh asset display.
    doRefreshAssetDisplay()
 def create(self):
     """Draw the window"""
     # delete the window if its handle exists
     if(cmds.window(self.window, exists=True)):
         cmds.deleteUI(self.window, window=True)
     # initialize the window
     self.window = cmds.window(self.window, title=self.title, wh=self.size, s=False)
     # main form layout
     self.mainForm = cmds.formLayout()
     # frame for copy/paste
     self.copyPasteFrame = cmds.frameLayout(l='Copy and Paste Poses')
     # form layout inside of frame
     self.copyPasteForm = cmds.formLayout()
     # create buttons in a 2-column grid
     self.copyPasteGrid = cmds.gridLayout(cw=self.size[0]/2-2, nc=2)
     self.copyBtn = cmds.button(l='Copy Pose', c=self.copyBtnCmd)
     self.pasteBtn = cmds.button(l='Paste Pose', c=self.pasteBtnCmd)
     # scroll view with label for clipboard status
     cmds.setParent(self.copyPasteForm)
     self.clipboardLayout = cmds.scrollLayout(h=42, w=self.size[0]-4)
     self.clipboardLbl = cmds.text(l=self.clipboardStat)
     # attach controls in the copyPaste form
     ac = []; af = []
     ac.append([self.clipboardLayout,'top',0,self.copyPasteGrid])
     af.append([self.copyPasteGrid,'top',0])
     af.append([self.clipboardLayout,'bottom',0])
     cmds.formLayout(
         self.copyPasteForm, e=True,
         attachControl=ac, attachForm=af
     )
     # frame for save/load
     cmds.setParent(self.mainForm)
     self.loadSaveFrame = cmds.frameLayout(l='Save and Load Poses')
     # create buttons in a 2-column grid
     self.loadSaveBtnLayout = cmds.gridLayout(cw=self.size[0]/2-2, nc=2)
     self.saveBtn = cmds.button(l='Save Pose', c=self.saveBtnCmd)
     self.loadBtn = cmds.button(l='Load Pose', c=self.loadBtnCmd)
     # attach frames to main form
     ac = []; af = []
     ac.append([self.loadSaveFrame,'top',0,self.copyPasteFrame])
     af.append([self.copyPasteFrame,'top',0])
     af.append([self.copyPasteFrame,'left',0])
     af.append([self.copyPasteFrame,'right',0])
     af.append([self.loadSaveFrame,'bottom',0])
     af.append([self.loadSaveFrame,'left',0])
     af.append([self.loadSaveFrame,'right',0])
     cmds.formLayout(
         self.mainForm, e=True,
         attachControl=ac, attachForm=af
     )
     # show the window
     cmds.showWindow(self.window)
     # force window size
     cmds.window(self.window, e=True, wh=self.size)
Beispiel #24
0
 def heyWitch_selByChopShader(self, chpMshKey, chpMshVal, *args):
     sel_by_chop_win = cmds.window(title='selByChopShader')
     cmds.scrollLayout()
     cmds.columnLayout()
     cmds.separator()
     cmds.text(label='Select by Chop Shader for Chop Set ' +
               str(chpMshVal.set_label))
     cmds.separator()
     cmds.frameLayout(label='Single select')
     cmds.gridLayout(numberOfColumns=3, cellWidthHeight=(125, 25))
     for k0, v0 in chpMshVal.all_shaders.items():
         shortLblTemp = k0.replace('btw_' + chpMshVal.set_label + '_', '')
         shortLbl = shortLblTemp.replace('_geoChp_Mtl', '')
         cmds.button(label=shortLbl,
                     backgroundColor=[v0.red, v0.green, v0.blue],
                     command=partial(self.helper.execute_string_command,
                                     v0.single_sel_command))
     cmds.setParent('..')
     cmds.frameLayout(label='Add to selection')
     cmds.gridLayout(numberOfColumns=3, cellWidthHeight=(125, 25))
     for k0, v0 in chpMshVal.all_shaders.items():
         shortLblTemp = k0.replace('btw_' + chpMshVal.set_label + '_', '')
         shortLbl = shortLblTemp.replace('_geoChp_Mtl', '')
         cmds.button(label=shortLbl,
                     backgroundColor=[v0.red, v0.green, v0.blue],
                     command=partial(self.helper.execute_string_command,
                                     v0.add_to_sel_command))
     cmds.setParent('..')
     cmds.button(label='Intersect',
                 command=partial(self.heyWitch_intersectVerts, chpMshVal))
     cmds.button(label='Configure intersection data stash',
                 command=partial(self.configure_intersections, chpMshVal,
                                 chpMshKey, sel_by_chop_win))
     if chpMshVal.int_config != {}:
         cmds.frameLayout(label='Currently configured:', collapsable=True)
         for k0, v0 in chpMshVal.int_config.items():
             cmds.rowLayout(numberOfColumns=3)
             cmds.text(label=k0 + ' + ')
             cmds.columnLayout()
             for k1, v1 in v0.items():
                 if v1 != 'cmds.select(add=True)':
                     string_command = str(chpMshVal.int_config[k0][k1])
                     cmds.button(label=k1,
                                 command=partial(
                                     self.helper.execute_string_command,
                                     string_command))
             cmds.setParent('..')
             cmds.setParent('..')
         cmds.setParent('..')
     cmds.setParent('..')
     cmds.setParent('..')
     cmds.setParent('..')
     cmds.showWindow()
Beispiel #25
0
    def create_colour_window(self, winName="Colors"):
        global colMenu
        if cmds.window(self.winName, exists=True):
                cmds.deleteUI(self.winName)

        self.window = cmds.window(self.winName, title=self.winTitle, tbm=1, w=300, h=100 )

        cmds.menuBarLayout(h=30)
        stringField='''"Colours"  (launches window)colour multiple objects(controllers) without having to go through
    attribute editor
        * Step 1: select object(s)
        * Step 2: launch window
        * Step 3: set colour from dropdown menu
        * Step 4: press "go" will change the display colors of all selected items'''
        self.fileMenu = cmds.menu( label='Help', hm=1, pmc=lambda *args:toolClass.helpWin(stringField))        
        cmds.rowColumnLayout  (' selectArrayRow ', nr=1, w=150)

        cmds.frameLayout('LrRow', label='', lv=0, nch=1, borderStyle='out', bv=1, p='selectArrayRow')
        
        cmds.rowLayout  (' rMainRow ', w=300, numberOfColumns=6, p='selectArrayRow')
        cmds.columnLayout ('selectArrayColumn', parent = 'rMainRow')
        cmds.setParent ('selectArrayColumn')
        cmds.separator(h=10, p='selectArrayColumn')
        cmds.gridLayout('listBuildButtonLayout', p='selectArrayColumn', numberOfColumns=2, cellWidthHeight=(150, 20))
        colMenu=cmds.optionMenu( label='Colors', w=150)
        cmds.menuItem( label='Bright Red' )#1
        cmds.menuItem( label='Bright Blue' )#2
        cmds.menuItem( label='Bright Green' )#3
        cmds.menuItem( label='Bright Yellow' )#4
        cmds.menuItem( label='Dark Yellow' )#5    
        cmds.menuItem( label='Dull Green' )#6     
        cmds.menuItem( label='Dark Red' )#7  
        cmds.menuItem( label='Dark Purple' )#8 
        cmds.menuItem( label='Darkest Blue' ) #9
        cmds.menuItem( label='Dark Green' ) #10
        cmds.menuItem( label='Dark Blue' )#11
        cmds.menuItem( label='Darkest Blue' )#12
        cmds.menuItem( label='Light Pink' ) #13 
        cmds.menuItem( label='Light Brown' )#14
        cmds.menuItem( label='Light Blue' )#15
        cmds.menuItem( label='Maroon' )#16
        cmds.menuItem( label='Torquise' )#17             
        cmds.menuItem( label='Skin' )#18
        cmds.menuItem( label='Brown' )#19
        cmds.menuItem( label='White' )#20     
        cmds.menuItem( label='Pink' )#21
        cmds.menuItem( label='Forest Green' )#22
        cmds.menuItem( label='Teal Green' )#23
        cmds.menuItem( label='Purple' )#24
        cmds.menuItem( label='Black' ) #25
        cmds.menuItem( label='Grey' ) #26
        cmds.button (label='Go', w=150, p='listBuildButtonLayout', command = self._change_colour)
        cmds.showWindow(self.window)
Beispiel #26
0
def add_toolbox_menu():
	gridLayout= 'hj_gridLayout'
	if mc.gridLayout(gridLayout,q=1,ex=1):
		mc.deleteUI(gridLayout)

	mc.setParent('flowLayout2')
	mc.gridLayout(gridLayout,nc=1,cwh=[32,32])
	mc.setParent(gridLayout)

	global_vars = inspect.getouterframes(inspect.currentframe())[-1][0].f_globals
	# global_vars = globals()
	mc.shelfButton(i='tools.png',c=lambda *x: __import__("pyshell").main(global_vars))
Beispiel #27
0
    def addCurrentToSelection(self, *args):
        currentTree = self.getCurrentWeights()
        self.generationSelection.append(currentTree)

        IMG_PATH = 'C:/Users/cs/Documents/maya/projects/rigGAShri/images/tmp/'

        SELECTION_SIZE = len(self.generationSelection)
        currentRenderFile = "GASelectionGen%i" % SELECTION_SIZE
        cmds.setAttr("defaultRenderGlobals.imageFilePrefix",
                     currentRenderFile,
                     type="string")
        cmds.render('renderCam')
        print "Rendering %s\n" % currentRenderFile

        selectionUI = 'selectionUI'

        if cmds.window(selectionUI, exists=True):
            cmds.deleteUI(selectionUI)

        cmds.window(selectionUI, width=300, height=100)

        cmds.columnLayout("allLayout", adjustableColumn=True)
        cmds.columnLayout("topLayout", parent="allLayout")
        cmds.button('selectAll',
                    label='Select All',
                    command=partial(self.changeAllSelection, True),
                    parent="topLayout")
        cmds.button('clearAll',
                    label='Clear All',
                    command=partial(self.changeAllSelection, False),
                    parent="topLayout")

        cmds.separator(parent="allLayout")

        cmds.gridLayout("gridLayout",
                        numberOfColumns=6,
                        cellWidthHeight=(256, 256),
                        parent="allLayout")

        buttonList = []
        for face in range(SELECTION_SIZE):
            currentImg = IMG_PATH + "GASelectionGen" + str(face + 1) + ".jpeg"
            print currentImg
            buttonName = 'button%i' % face
            buttonList.append(buttonName)
            print buttonList
            cmds.symbolCheckBox(buttonName,
                                image=currentImg,
                                parent="gridLayout")
        cmds.showWindow(selectionUI)

        self.buttonList = buttonList
Beispiel #28
0
def add_toolbox_menu():
    gridLayout = "hj_gridLayout"
    if mc.gridLayout(gridLayout, q=1, ex=1):
        mc.deleteUI(gridLayout)

    mc.setParent("flowLayout2")
    size = 36
    mc.gridLayout(gridLayout, nc=1, cwh=[size, size])
    mc.setParent(gridLayout)

    global_vars = inspect.getouterframes(inspect.currentframe())[-1][0].f_globals
    # global_vars = globals()
    mc.shelfButton(i="play.png", c=lambda *x: __import__("pyshell").main(global_vars), w=40)
Beispiel #29
0
    def __init__(self):
        name = 'cmt_orientjoints'
        if cmds.window(name, exists=True):
            cmds.deleteUI(name, window=True)
        if cmds.windowPref(name, exists=True):
            cmds.windowPref(name, remove=True)
        self.window = cmds.window(name, title='CMT Orient Joints', widthHeight=(358, 330))
        cmds.columnLayout(adjustableColumn=True)
        margin_width = 4
        cmds.frameLayout(bv=False, label='Quick Actions', collapsable=True, mw=margin_width)
        cmds.gridLayout(numberOfColumns=2, cellWidthHeight=(175, 65))
        cmds.button(label='Make Planar Orientation', command=self.make_planar)
        cmds.button(label='Project to Planar Position', command=partial(make_position_planar))
        cmds.button(label='Align Up With Child', command=self.align_with_child)
        cmds.button(label='Zero Orient', command=self.zero_orient)
        cmds.button(label='Orient to World', command=self.orient_to_world)
        cmds.rowColumnLayout(numberOfColumns=4)

        height = 20
        label_width = 60
        icon_left = 'nudgeLeft.png'
        icon_right = 'nudgeRight.png'
        cmds.text(label='Offset X', align='right', width=label_width)
        cmds.iconTextButton(style='iconOnly', image1=icon_left, label='spotlight', h=height, w=height, c=partial(self.offset_orient_x, direction=-1))
        self.offset_x = cmds.floatField(value=90.0)
        cmds.iconTextButton(style='iconOnly', image1=icon_right, label='spotlight', h=height, w=height, c=partial(self.offset_orient_x, direction=1))
        cmds.text(label='Offset Y', align='right', width=label_width)
        cmds.iconTextButton(style='iconOnly', image1=icon_left, label='spotlight', h=height, w=height, c=partial(self.offset_orient_y, direction=-1))
        self.offset_y = cmds.floatField(value=90.0)
        cmds.iconTextButton(style='iconOnly', image1=icon_right, label='spotlight', h=height, w=height, c=partial(self.offset_orient_y, direction=1))
        cmds.text(label='Offset Z', align='right', width=label_width)
        cmds.iconTextButton(style='iconOnly', image1=icon_left, label='spotlight', h=height, w=height, c=partial(self.offset_orient_z, direction=-1))
        self.offset_z = cmds.floatField(value=90.0)
        cmds.iconTextButton(style='iconOnly', image1=icon_right, label='spotlight', h=height, w=height, c=partial(self.offset_orient_z, direction=1))

        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.frameLayout(bv=False, label='Manual Orient', collapsable=True, mw=margin_width)
        cmds.columnLayout(adj=True)
        cmds.rowLayout(numberOfColumns=2, cw2=(150, 150))
        self.reorient_children = cmds.checkBox(label='Reorient children', value=True, align='left')
        self.reset_orientation = cmds.checkBox(label='Reset orientation', value=True, align='left')
        cmds.setParent('..')
        cmds.gridLayout(numberOfColumns=2, cellWidthHeight=(175, 65))
        cmds.button(label='Template Joints', command=partial(self.template_joints))
        cmds.button(label='Rebuild Joints', command=partial(rebuild_joints))
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.showWindow(self.window)
 def create(self):
     """
     Draw the window
     """
     # delete the window if its handle exists
     if(cmds.window(self.window, exists=True)):
         cmds.deleteUI(self.window, window=True)
     # initialize the window
     self.window = cmds.window(self.window, title=self.title, widthHeight=self.size, sizeable=False)
     # main form layout
     self.mainForm = cmds.formLayout()
     # frameLayout below window for copy and paste poses
     self.copyPasteFrame = cmds.frameLayout(label='Copy and Paste Poses')
     # formLayout inside of frame
     self.copyPasteForm = cmds.formLayout()
     # create buttons in a 2-column grid
     self.copyPasteGrid = cmds.gridLayout(cellWidth=(self.size[0]/2)-2, numberOfColumns=2)
     # create two buttons for copy and paste
     self.copyBtn = cmds.button(label='Copy Pose', command=self.copyBtnCmd)
     self.pasteBtn = cmds.button(label='Paste Pose', command=self.pasteBtnCmd)
     # set parent to self.copyPasteForm
     cmds.setParent(self.copyPasteForm)
     # scroll view with label for clipboard status
     self.clipboardLayout = cmds.scrollLayout(height=42, width=self.size[0]-4)
     self.clipboardLb = cmds.text(label=self.clipboardStat)
     # attach controls in the copyPaste form
     at_c = []; at_f = []
     at_c.append([self.clipboardLayout, 'top', 0, self.copyPasteGrid])
     at_f.append([self.copyPasteGrid, 'top', 0])
     at_f.append([self.clipboardLayout, 'bottom', 0])
     cmds.formLayout(self.copyPasteForm, edit=True, attachControl= at_c, attachForm=at_f)
     # set parent to self.mainForm
     cmds.setParent(self.mainForm)
     # frameLayout for saving and loading poses
     self.loadSaveFrame = cmds.frameLayout(label='Save and load Poses')
     # create buttons in a 2-column grid
     self.loadSaveBtnLayout = cmds.gridLayout(cellWidth=(self.size[0]/2)-2, numberOfColumns=2)
     self.saveBtn = cmds.button(label='Save Pose', command=self.saveBtnCmd)
     self.loadBtn = cmds.button(label='Load Pose', command=self.loadBtnCmd)
     # now attach frames to self.mainForm
     at_c = []; at_f = []
     at_c.append([self.loadSaveFrame, 'top', 0, self.copyPasteFrame])
     at_f.append([self.copyPasteFrame, 'top', 0])
     at_f.append([self.copyPasteFrame, 'left', 0])
     at_f.append([self.copyPasteFrame, 'right', 0])
     at_f.append([self.loadSaveFrame, 'bottom', 0])
     at_f.append([self.loadSaveFrame, 'left', 0])
     at_f.append([self.loadSaveFrame, 'right', 0])
     cmds.formLayout(self.mainForm, edit=True, attachControl=at_c,attachForm=at_f)
     # show the window
     cmds.showWindow(self.window)
Beispiel #31
0
def mayaStepSTUI():
    global cb01, cb02, cb03, tfbg
    closeUI(script)
    cmds.window(script, title = title, widthHeight = (210, 30))
    cmds.columnLayout(columnAttach = ['both', 5], rowSpacing = 5, columnWidth = 210)
    cmds.gridLayout(numberOfColumns = 3, cellWidthHeight = (70, 20))
    cb01 = cmds.checkBox(label = 's', value = True)
    cb02 = cmds.checkBox(label = 't', value = True)
    cb03 = cmds.checkBox(label = 'random', value = False)
    cmds.setParent('..')
    cmds.text(label = '..: steps :..', backgroundColor = [0, 0, 0])
    tfbg = cmds.textFieldButtonGrp(text = '32', buttonLabel = '  ok  ', columnWidth2 = [160, 50], buttonCommand = 'mayaStepST()')
    cmds.setParent('..')
    cmds.showWindow()
Beispiel #32
0
    def showUI(self):

        from functools import partial

        def setToPose(psd, poseName, v):
            psd.setToPose(poseName)

        def selectInScene(jt, v):
            cmds.select(jt)

        cmds.window()
        cmds.scrollLayout(horizontalScrollBarThickness=16,
                          verticalScrollBarThickness=16)
        cmds.gridLayout(numberOfColumns=5, cellWidthHeight=(200, 25))
        cmds.text(label='Pose')
        cmds.text(label='Weight')
        cmds.text(label='Joint')
        cmds.text(label='Rotation')
        cmds.text(label='FallOff')
        cmds.separator()
        cmds.separator()
        cmds.separator()
        cmds.separator()
        cmds.separator()
        for poseName in self.poseNames():
            poseAttr = self.poseAttr(poseName)
            cmds.text(label=poseName)
            cmds.attrControlGrp(attribute=poseAttr + '.poseWeight')
            jts = self.poseJoints(poseName)
            if len(jts) == 1:
                cmds.button(label=jts[0],
                            c=partial(selectInScene, jts[0]),
                            ann='Click to select joint')
                jtIdx = cmds.getAttr(poseAttr + '.poseJoint', mi=1)[0]
                jtRot = cmds.getAttr('{}.poseJoint[{}].poseJointRot'.format(
                    poseAttr, jtIdx))[0]
                jtRot = '{:.2f}, {:.2f}, {:.2f}'.format(
                    jtRot[0], jtRot[1], jtRot[2])
                cmds.button(label=jtRot,
                            c=partial(setToPose, self, poseName),
                            ann='Click to setToPose')
                cmds.attrControlGrp(
                    attribute='{}.poseJoint[{}].poseJointFallOff'.format(
                        poseAttr, jtIdx))
            else:
                cmds.text(label='multiple joints')
                cmds.text(label='')
                cmds.text(label='')
        cmds.showWindow()
Beispiel #33
0
    def buildUI(self):

        if cmds.window(winID, q=True, exists=True):
            cmds.deleteUI(winID)

        cmds.window(winID, t=winTitle)
        mlo = cmds.columnLayout()

        # Add radio buttons for axis
        cmds.frameLayout(l='Choose an axis')

        cmds.gridLayout(nc=3, cw=50)
        cmds.radioCollection()
        self.xAxis = cmds.radioButton(l='x', select=True)
        self.yAxis = cmds.radioButton(l='y')
        self.zAxis = cmds.radioButton(l='z')

        createIconButton('XAxis.png', partial(self.onOptionClick, self.xAxis))
        createIconButton('YAxis.png', partial(self.onOptionClick, self.yAxis))
        createIconButton('ZAxis.png', partial(self.onOptionClick, self.zAxis))

        cmds.setParent(mlo)

        # Add radio buttons for fn
        cmds.frameLayout(l='Choose where to algin')

        cmds.rowLayout(nc=3)

        cmds.gridLayout(nc=3, cw=50)
        cmds.radioCollection()
        self.minMode = cmds.radioButton(l='Min')
        self.midMode = cmds.radioButton(l='Mid', select=True)
        self.maxMode = cmds.radioButton(l='Max')

        createIconButton('MinAxis.png',
                         partial(self.onOptionClick, self.minMode))
        createIconButton('MidAxis.png',
                         partial(self.onOptionClick, self.midMode))
        createIconButton('MaxAxis.png',
                         partial(self.onOptionClick, self.maxMode))

        cmds.setParent(mlo)

        # Add apply okButton
        cmds.button(l='Align', c=self.onApplyClick, w=150, bgc=(.2, .5, .9))

        cmds.showWindow(winID)

        cmds.window(winID, e=True, resizeToFitChildren=True)
Beispiel #34
0
def add_toolbox_menu():
    gridLayout = 'hj_gridLayout'
    if mc.gridLayout(gridLayout, q=1, ex=1):
        mc.deleteUI(gridLayout)

    mc.setParent('flowLayout2')
    size=36
    mc.gridLayout(gridLayout, nc=1, cwh=[size, size])
    mc.setParent(gridLayout)

    global_vars = inspect.getouterframes(
        inspect.currentframe())[-1][0].f_globals
    # global_vars = globals()
    mc.shelfButton(
        i='play.png', c=lambda *x: __import__("pyshell").main(global_vars),w=40)
Beispiel #35
0
def gridDropCallback(dragControl,dropControl,messages,x,y,dragTypes):
    print dragControl + '\n'
    print dropControl + '\n'
    print str(x) + ',' + str(y) + '\n'
    gridOrder = cmds.gridLayout('testGridLayout',q=True,go=True,fpn=True)
    dragName = dragControl.split('|')
    dropName = dropControl.split('|')
    dragOrder = gridOrder.index(dragName[-1])
    dropOrder = gridOrder.index(dropName[-1])
    cmds.gridLayout('testGridLayout',e=True,pos=[dragName[-1],dropOrder+1])
    cmds.gridLayout('testGridLayout',e=True,pos=[dropName[-1],dragOrder+1])
    cmds.setFocus('testGridLayout')
    
    print messages
    print dragTypes
Beispiel #36
0
    def createUI(self):
        if cmds.window(self.winName, exists=True):
            cmds.deleteUI(self.winName)

        cmds.window(self.winName,
                    title=self.winTitle,
                    maximizeButton=False,
                    minimizeButton=False,
                    resizeToFitChildren=True)
        self.mainCol = cmds.columnLayout(adjustableColumn=True)

        cmds.gridLayout(numberOfRowsColumns=[2, 2], cellWidthHeight=[120, 20])
        cmds.text('OSC port')
        self.ui_oscport = cmds.intField(minValue=0,
                                        maxValue=65535,
                                        value=self.osc_port,
                                        changeCommand=partial(self.set_port),
                                        enable=not self.ServerStarted)
        cmds.text('Scale')
        self.ui_scaling = cmds.floatField(minValue=0,
                                          maxValue=1000,
                                          value=self.scaling,
                                          changeCommand=partial(
                                              self.set_scaling))
        cmds.setParent(upLevel=True)

        self.nullsbox = cmds.checkBox(
            value=self.create,
            label='Create locators based on received data',
            changeCommand=partial(self.set_create))
        self.recbox = cmds.checkBox(value=self.record,
                                    label='Record motion capture',
                                    changeCommand=partial(self.set_record))
        self.rootbox = cmds.checkBox(value=self.createRoot,
                                     label='Parent locators to a root object',
                                     changeCommand=partial(
                                         self.set_createRoot))

        if self.ServerStarted:
            self.receiveButton = cmds.button(label='Stop Receiving',
                                             command=partial(
                                                 self.toggle_server))
        else:
            self.receiveButton = cmds.button(label='Start Receiving',
                                             command=partial(
                                                 self.toggle_server))

        cmds.showWindow(self.winName)
Beispiel #37
0
    def __init__(self):
        self.window = mc.window(title="Pillars UV Tools", width=200, height=300)
        mc.setParent(self.window)
        mc.columnLayout(adjustableColumn=True)

        mc.frameLayout(label='Mari UV Mover', borderStyle='out', cll=True)
        mc.gridLayout(numberOfRowsColumns=(3, 3), cellWidthHeight=(50, 50))
        mc.text(label='')
        mc.button(label='Up', c=lambda *args: move_uv(0.0, 1.0))
        mc.text(label='')

        mc.button(label='Left', c=lambda *args: move_uv(-1.0, 0.0))
        mc.text(label='^_^')
        mc.button(label='Right', c=lambda *args: move_uv(1.0, 0.0))

        mc.text(label='')
        mc.button(label='Down', c=lambda *args: move_uv(0.0, -1.0))
        mc.text(label='')

        mc.setParent('..')

        mc.setParent('..')

        mc.frameLayout(label='UV Transfer', borderStyle='out', cll=True)
        mc.columnLayout(adjustableColumn=False, cal="center")
        mc.rowLayout(nc=2)
        mc.button(label='Copy Mesh UV', width=self.button_width * 2, c=lambda *args: copy_mesh_uv())
        mc.button(label='Paste Mesh UV', width=self.button_width * 2, c=lambda *args: past_mesh_uv())
        mc.setParent('..')

        mc.rowLayout(nc=2)
        mc.button(label='Copy Group UV', width=self.button_width * 2, c=lambda *args: copy_group_uv())
        mc.button(label='Past Group UV', width=self.button_width * 2, c=lambda *args: past_group_uv())
        mc.setParent('..')

        mc.rowLayout(nc=2)
        mc.button(label='Export Mesh UV', width=self.button_width * 2, c=lambda *args: export_mesh_uv())
        mc.button(label='Import Mesh UV', width=self.button_width * 2, c=lambda *args: import_mesh_uv())
        mc.setParent('..')

        mc.rowLayout(nc=2)
        mc.button(label='Export Group UV', width=self.button_width * 2, c=lambda *args: export_group_uv())
        mc.button(label='Import Group UV', width=self.button_width * 2, c=lambda *args: import_group_uv())
        mc.setParent('..')

        mc.setParent('..')

        mc.showWindow(self.window)
Beispiel #38
0
 def colorizeModuleUI(self, colorIndex, *args):
     """ Show a little window to choose the color of the button and the override the guide.
     """
     # verify integrity of the guideModule:
     if self.verifyGuideModuleIntegrity():
         # creating colorIndex Window:
         if cmds.window('dpColorIndexWindow', query=True, exists=True):
             cmds.deleteUI('dpColorIndexWindow', window=True)
         colorIndex_winWidth = 160
         colorIndex_winHeight = 80
         self.dpColorIndexWin = cmds.window(
             'dpColorIndexWindow',
             title='Color Index',
             iconName='dpColorIndex',
             widthHeight=(colorIndex_winWidth, colorIndex_winHeight),
             menuBar=False,
             sizeable=False,
             minimizeButton=False,
             maximizeButton=False,
             menuBarVisible=False,
             titleBar=True)
         # creating layout:
         colorIndexLayout = cmds.gridLayout('colorIndexLayout',
                                            numberOfColumns=8,
                                            cellWidthHeight=(20, 20))
         # creating buttons:
         for colorIndex, colorValues in enumerate(self.colorList):
             cmds.button('indexColor_' + str(colorIndex) + '_BT',
                         label=str(colorIndex),
                         backgroundColor=(colorValues[0], colorValues[1],
                                          colorValues[2]),
                         command=partial(self.setColorModule, colorIndex),
                         parent=colorIndexLayout)
         # call colorIndex Window:
         cmds.showWindow(self.dpColorIndexWin)
Beispiel #39
0
    def CreateWindow(self):

        self.delete()

        self.my_window = cmds.window(self.my_window,
                                     title="Incremental Renamer",
                                     widthHeight=(300, 150))

        self.grid_Layout = cmds.gridLayout(parent=self.my_window,
                                           numberOfColumns=2,
                                           cellWidthHeight=(150, 25),
                                           autoGrow=True,
                                           allowEmptyCells=True)

        cmds.text(parent=self.grid_Layout, label="Enter new name", height=75)

        cmds.text(parent=self.grid_Layout, label="e.g. Arm_##_Jnt", height=75)

        self.userInput = cmds.textField(
            parent=self.grid_Layout, placeholderText='Name of new object...')

        cmds.button(parent=self.grid_Layout,
                    label='Rename',
                    c=lambda *x: self.getUserInput())

        cmds.button(parent=self.grid_Layout,
                    label='Close',
                    command=('cmds.deleteUI(\"' + self.my_window +
                             '\", window=True)'))

        cmds.showWindow(self.my_window)
Beispiel #40
0
    def __init__(s):
        """ Load up window! """
        threads = []
        win = cmds.window(t="Versions", rtf=True)
        col = cmds.columnLayout(adj=True)
        placeholder = cmds.text(l="No versions can be found...")
        anim = Animation(win)

        path = cmds.file(q=True, sn=True)
        if path:
            root = os.path.join(os.path.dirname(path), "archive")
            scene = os.path.splitext(os.path.basename(path))[0]
            if os.path.isdir(root):
                strip = re.compile(r"[^\w]")
                scene_strip = strip.sub("", scene)
                form = re.compile(r"(.+)_(\d+)_(.+?)\.zip")
                scan = (form.match(a) for a in os.listdir(root))
                versions = [a for a in scan if a and strip.sub("", a.group(1)) == scene_strip]
                if versions:
                    cmds.deleteUI(placeholder)
                    max_versions = 10
                    max_cols = int((max_versions ** -0.5) * max_versions + 1)
                    grid = cmds.gridLayout(p=col, cw=WIDTH, ch=HEIGHT, nc=max_cols)
                    for version in sorted(versions, reverse=True, key=lambda x: x.group(2))[:10]:
                        space = cmds.columnLayout(adj=True, p=grid)
                        img = cmds.text(hl=True, l="", p=space)
                        nt = cmds.text(ww=True, l="", p=space)
                        # Version().run(img, nt, root, version, anim)
                        threads.append(threading.Thread(
                            target=Version().run,
                            args=(img, nt, root, version, anim)))
        cmds.showWindow(win)
        for t in threads:
            t.start()
Beispiel #41
0
 def moduleGUI( self ):
     col = cmds.columnLayout( adjustableColumn=True, columnAttach=('both', 5), parent=self.fillArea )
     
     # Frame area.
     cmds.text( label='FRAMES', height=20, font='boldLabelFont', backgroundColor=[0.2,0.2,0.2] )
     cmds.separator( style='none', height=5 )
     
     # Frame template section.
     cmds.rowColumnLayout( numberOfColumns=2, columnWidth=[(1, 40), (2, self.winWidth-40)] )
     # Left column.
     self.toggleColumn = cmds.rowColumnLayout( numberOfColumns=1 )
     cmds.symbolCheckBox( image='icon_root.png', value=0, annotation='roots', changeCommand=self.moduleButtons )
     cmds.symbolCheckBox( image='icon_spine.png', value=0, annotation='spines', changeCommand=self.moduleButtons )
     cmds.symbolCheckBox( image='icon_arm.png', annotation='arms', changeCommand=self.moduleButtons )
     cmds.symbolCheckBox( image='icon_leg.png', annotation='legs', changeCommand=self.moduleButtons )
     cmds.symbolCheckBox( image='icon_hand.png', annotation='hands', changeCommand=self.moduleButtons )
     cmds.symbolCheckBox( image='icon_foot.png', annotation='feet', changeCommand=self.moduleButtons )
     cmds.symbolCheckBox( image='icon_head.png', annotation='heads', changeCommand=self.moduleButtons )
     cmds.setParent( '..' )#toggleColumn
     # Right column.
     cmds.scrollLayout( horizontalScrollBarThickness=16, verticalScrollBarThickness=16, height=100 )
     self.frameGrid = cmds.gridLayout( numberOfColumns=4, cellWidthHeight=( 50, 50 ) )
     self.moduleButtons()
     cmds.setParent( '..' )#frameGrid
     cmds.setParent( '..' )#scrollLayout
     cmds.setParent( '..' )#rowColumnLayout
     cmds.separator( style='none', height=10 )
     cmds.setParent( '..' )#col
Beispiel #42
0
 def grid_layout(*args, **kwargs):
     try:
         return cmds.gridLayout(*args, **kwargs)
     except Exception as exp:
         LOG.debug(
             "MayaAPI exception in 'grid_layout': {0}".format(exp).strip())
         return None
Beispiel #43
0
def deselectAllAssets(arg=None):
    '''Deselect the assets.
    '''
    allItems = cmds.gridLayout("displayAssetsGL", query=True, childArray=True) or []
    for item in allItems:
        cmds.iconTextCheckBox(item, edit=True, value=False)
    text = cmds.textField("currentAssetTFD", edit=True, text="")
Beispiel #44
0
    def AverageUI(self):
        import maya.cmds as cmds
	import maya.mel as mel
	import sys

        if cmds.window('AverageTool',exists=True):
            cmds.deleteUI('AverageTool')

        cmds.window('AverageTool') 
        grid=cmds.gridLayout( numberOfColumns=2, cellWidthHeight=(120, 150) )
        column=cmds.columnLayout()
        cmds.button('Creat',c='creat()',h=100)
        cmds.button('Key',c='key()',h=50)
        cmds.columnLayout(column,edit=1,columnAttach=('both',0),adj=1,co=('both',50),columnWidth=120)
        cmds.setParent(column)
        cmds.setParent( '..' )



        cmds.frameLayout( label='Average', borderStyle='in' )
        cmds.columnLayout()
        cmds.rowLayout( numberOfColumns=3, columnWidth3=(35, 30, 35), adjustableColumn=2, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)] )
        cmds.intField('min',minValue=0,value=0)
        cmds.text('To')
        cmds.intField('max',minValue=0, value=0)
        cmds.setParent( '..' )
        cmds.setParent( '..' )

        cmds.frameLayout( label='Iterations', borderStyle='out' )
        cmds.intField('iterations',minValue=0,maxValue=10,value=0)


        cmds.frameLayout( label='Key', borderStyle='out' )
        cmds.button('Delect',c='Delect()')
        cmds.showWindow()
Beispiel #45
0
def deselectAll(arg=None):
    '''Deselect the shaders.
    '''
    allItems = cmds.gridLayout("displaySwatchesGL", query=True, childArray=True)
    for item in allItems:
        cmds.iconTextCheckBox(item, edit=True, value=False)
    text = cmds.textField("currentlySelectedTFD", edit=True, text="")
def materialDeluxeUI():
    if cmds.window('materialDeluxeWindow', exists=True):
        cmds.deleteUI('materialDeluxeWindow')

    widgets['window'] = cmds.window(
        'materialDeluxeWindow', title='Material ID Deluxe', w=600, h=600, mxb=False, mnb=False)
    mainLayout = cmds.frameLayout(w=600, h=300)

    # Materials
    widgets['gradlayout'] = cmds.gridLayout(
        numberOfColumns=2, cellWidthHeight=(300, 30), cr=True)
    for each in texturePathList:
        file_name = os.path.basename(each)
        new_list.append(file_name)

    for texture in allTextures:

        if cmds.attributeQuery('vrayMaterialId', node=texture):

            file_name = os.path.basename(texturePath)
            widgets[(texture+'_nodeTextType')] = cmds.text(label=texture +
                                                           "("+file_name+")", parent=widgets['gradlayout'])
            widgets[(texture+'_filterType')
                    ] = cmds.attrControlGrp(attribute=(texture+'.vrayMaterialId'))
            widgets[(texture+'_selectButton')] = cmds.button(label='Select node',
                                                             command='cmds.select("'+texture+'")', parent=widgets['gradlayout'])

    cmds.setParent('..')
    cmds.frameLayout(w=600, h=100, borderStyle='etchedIn')
    cmds.button(label='Close', command='closeWin()')
    cmds.showWindow(widgets['window'])
Beispiel #47
0
def ehAutoRiggerUI():
    winName = 'ehAutoRigger'
    if (cmds.window(winName, ex=True)):
        cmds.deleteUI(winName)
    ehARWin = cmds.window(winName, title="Auto Rigger", width=400, height=300)
    ehARColumn = cmds.frameLayout('Autorigger by Eric Hicken', mh=5, mw=5)
    ehARGrid = cmds.gridLayout(numberOfRowsColumns=(3, 1),
                               cellWidthHeight=(80, 20),
                               p=ehARColumn)
    presetMenu = cmds.optionMenu(label='Preset Templates', p=ehARColumn)
    cmds.menuItem(label='Preset 1', p=presetMenu)
    cmds.menuItem(label='Preset 2', p=presetMenu)
    cmds.menuItem(label='Preset 3', p=presetMenu)
    cmds.text(label='Character Name')
    nameField = cmds.textField()
    butTemplate = cmds.button(l='Create Template',
                              c=lambda x: setupTemplate(presetMenu, False),
                              p=ehARColumn)
    butRig = cmds.button(l='Create Rig from Template',
                         c=lambda x: AutoRiggerRun(False, nameField),
                         p=ehARColumn)
    butEx = cmds.button(l='Exit',
                        command=('cmds.deleteUI(\"' + ehARWin +
                                 '\", window=True)'),
                        p=ehARColumn)
    cmds.showWindow(winName)
Beispiel #48
0
    def create(self):
        
        if cmds.window(self.winName, exists=True):
                cmds.deleteUI(self.winName)

        self.window = cmds.window(self.winName, title=self.winTitle, tbm=1, w=320, h=600 )

        cmds.menuBarLayout(h=30)
        cmds.rowColumnLayout  (' selectArrayRow ', nr=1, w=200)

        cmds.frameLayout('LrRow', label='', lv=0, nch=1, borderStyle='out', bv=1, p='selectArrayRow')

        cmds.rowLayout  (' rMainRow ', w=320, numberOfColumns=6, p='selectArrayRow')
        cmds.columnLayout ('selectArrayColumn', parent = 'rMainRow')
        cmds.setParent ('selectArrayColumn')
        cmds.separator(h=10, p='selectArrayColumn')
        cmds.gridLayout('listBuildButtonLayout', p='selectArrayColumn', numberOfColumns=2, cellWidthHeight=(120, 20))
        cmds.button (label='Schematic', p='listBuildButtonLayout', ann="This will open a schematic for selected character", command = self._schematic)         
        cmds.button (label='CombineSelectMirror', p='listBuildButtonLayout', ann="This will add opposite control to the selection", command = self._combine_select)         
        cmds.button (label='MirrorTransform', p='listBuildButtonLayout', ann="This will mirror the transform to the opposite controller", command = self._mirror_transform) 
#         cmds.button (label='MirrorTransformFace', p='listBuildButtonLayout', ann="This will mirror the transform to the opposite controller", command = self._mirror_transform_face) 
        cmds.button (label='MatchTransform', p='listBuildButtonLayout', ann="This will match the relative transform of the first selection", command = self._match_transform) 
        cmds.button (label='MatchMatrix', p='listBuildButtonLayout', ann="This will match the exact matrix of the first selection", command = self._match_matrix) 
        #cmds.button (label='SelectMouth', p='listBuildButtonLayout', ann="This will select the characters mouth",command = self._select_mouth) 
        cmds.button (label='mirrorSelect', p='listBuildButtonLayout',  ann="This will change the selection to the mirror controller of the current selected",command = self._mirror_select) 
        cmds.button (label='mirrorMouth', p='listBuildButtonLayout', ann="This will mirror one side of the mouth to the other(will not affect control box attributes)", command = self._mirror_mouth) 
        cmds.button (label='mirrorBrows', p='listBuildButtonLayout', ann="This will mirror a brow position to the other(will not affect control box attributes)", command = self._mirror_brows)  
        cmds.button (label='mirrorEyes', p='listBuildButtonLayout', ann="This will mirror an eye position to the other", command = self._mirror_eyes)  
        cmds.button (label='mirrorFace', p='listBuildButtonLayout', ann="This will mirror the entire face to the other(will not affect control box attributes)", command = self._mirror_face)  
        cmds.button (label='ResetMouth', p='listBuildButtonLayout', ann="This will reset the mouth positions(anim transform controls only - will not affect control box attributes)",command = self._reset_mouth) 
        cmds.button (label='ResetSelected', p='listBuildButtonLayout', ann="This will reset the selected to 0.0(transforms only - will not affect control box attributes)", command = self._reset_selected)
        cmds.button (label='DisplayAnim', p='listBuildButtonLayout', ann="This sets the viewport to show only poly and curve", command = self._display_anim)
#         cmds.button (label='Shapes', p='listBuildButtonLayout', command = self._make_shape)           
        #cmds.text(label="")
        cmds.text(label="FK=IK")
        #cmds.separator()
        cmds.text(label="")
        cmds.button (label='ArmIK_2_FK', p='listBuildButtonLayout', ann="This will match the arm IK chain to the FK position",command = self._ikToFK_Arm)
        cmds.button (label='ArmFK_2_IK', p='listBuildButtonLayout', ann="This will match the arm FK chain to the IK position", command = self._fkToIK_Arm)
        cmds.button (label='LegIK_2_FK', p='listBuildButtonLayout', ann="This will match the leg IK chain to the FK position",command = self._ikToFK_Leg)
        cmds.button (label='LegFK_2_IK', p='listBuildButtonLayout', ann="This will match the leg FK chain to the IK position", command = self._fkToIK_Leg)
        cmds.text(label="other tools")
        cmds.text(label="")
        cmds.button (label='SelectArray', p='listBuildButtonLayout', ann="This is a custom tool to build up a user selection array or search and filter for specific nodes/names", command = self._select_array)        
        cmds.button (label='Switch Arm Cnst', p='listBuildButtonLayout', ann="resets arm in position on constraint switch", command = self._switch_arm_ik_cnstrnt)        
        #cmds.symbolButton (p='listBuildButtonLayout', command = self.Face, image="D:\myGraphics\icons\SP.jpg")      
        cmds.showWindow(self.window)
Beispiel #49
0
def add_control_grid(control_set, picker_namespace):
    #going to make a grid for the controls, POC, but in future other layouts possible
    grid = cmds.gridLayout( numberOfColumns=control_set['group_count'],
                            cellWidthHeight=(50, 50) )

    control_prefix = control_set['control_prefix']
    control_suffix = control_set['control_suffix']
    color = control_set['color']

    namespace_prefix = ""
    #generate namespace prefix if needed
    if picker_namespace:
        namespace_prefix = "{0}:".format(picker_namespace)

    #formatting information would ideally be standardised across the auto rigger
    template = control_prefix+"{0}"+control_suffix

    group_list = control_set['groups']

    #add the column headers, this will use up the iterator, will need to make a new one
    #bit messy, but used because you cant reuse an iterator again in the grid loop
    for item in group_list:
        if item['name'] != "_EMPTY_":
            cmds.text(label = item['name'], backgroundColor = COLOR_ORANGE)
        else:
            cmds.separator(style='none')

    #cast to int from string in the json
    max_group_members = int(control_set['max_members'])

    for nr in range(max_group_members):
        #i know nested for loops are bad but the gridlayout wants it this way

        for group in group_list: #for each finger in the hand set
            #get how many controls are in this group
            control_count = int(group['control_count'])
            controls = group['controls']

            #catch empties and exceeded total control counts
            if nr < control_count and controls[nr] != "_EMPTY_":
                control_name = template.format(controls[nr])

                #make the button command, holding shift will let you add to the selection
                formatted_name = "{0}{1}".format(namespace_prefix, control_name)
                #ignore to bypass the boolean def into lambdas by default
                button_command = lambda ignore, _fn = formatted_name: modified_select(_fn)

                #make the button
                cmds.button(label = controls[nr], 
                            backgroundColor = color,
                            command = button_command)
            else:
                cmds.separator(style='none') #take up layout slot


    #escape the grid layout 
    cmds.setParent('..')
    #return this grid layout so it can be made into a tab
    return grid
Beispiel #50
0
def mayaStepSTUI():
    global cb01, cb02, cb03, tfbg
    closeUI(script)
    cmds.window(script, title=title, widthHeight=(210, 30))
    cmds.columnLayout(columnAttach=['both', 5], rowSpacing=5, columnWidth=210)
    cmds.gridLayout(numberOfColumns=3, cellWidthHeight=(70, 20))
    cb01 = cmds.checkBox(label='s', value=True)
    cb02 = cmds.checkBox(label='t', value=True)
    cb03 = cmds.checkBox(label='random', value=False)
    cmds.setParent('..')
    cmds.text(label='..: steps :..', backgroundColor=[0, 0, 0])
    tfbg = cmds.textFieldButtonGrp(text='32',
                                   buttonLabel='  ok  ',
                                   columnWidth2=[160, 50],
                                   buttonCommand='mayaStepST()')
    cmds.setParent('..')
    cmds.showWindow()
Beispiel #51
0
    def createTab(self, *args):

        name = self.nameInput(layout=self.tab, title='Create Tab')

        if name:
            layoutName = '%s_%s' % (name, self.colSuffix)

            # cmds.columnLayout(layoutName, adj=True, )
            cmds.gridLayout(layoutName,
                            cellWidthHeight=(self.cel, self.cel),
                            ag=True,
                            cr=True,
                            p=self.tab,
                            aec=False)
            cmds.setParent('..')

            cmds.shelfTabLayout(self.tab, e=True, tabLabel=(layoutName, name))
Beispiel #52
0
    def __init__(s, i18n, char, requestCharEdit, requestClipEdit, sendRunClip):
        s.i18n = i18n
        s.char = char
        s.requestClipEdit = requestClipEdit # We're asking to edit the clip
        s.sendRunClip = sendRunClip # User wants to place the clip
        s.clips = [] # Init clips!
        name = s.char.metadata.get("name", "CLips").title()

        if not char.data: # Does the character contain nothing?
            with warn:
                requestCharEdit(char, s.refresh)

        s.winName = "%sWin" % name
        if cmds.window(s.winName, ex=True):
            cmds.deleteUI(s.winName)
        s.window = cmds.window(s.winName, rtf=True, s=False, t="%s %s" % (name, i18n["clips.title"]))
        cmds.columnLayout(adj=True)
        cmds.rowLayout(nc=2, adj=2) # Open Row
        cmds.iconTextButton(
            ann=i18n["clips.editChar"],
            style="iconOnly",
            font="boldLabelFont",
            image="goToBindPose.png",
            h=50,
            w=50,
            bgc=[0.3,0.3,0.3],
            c=lambda: requestCharEdit(s.char, s.refresh)
        )
        cmds.text(
            l="<h1>%s</h1>" % name,
            hl=True,
            h=50
            )
        cmds.setParent("..") # Close row
        cmds.columnLayout(adj=True) # Open Col
        cmds.button(
            l=i18n["clips.newClip"],
            h=50,
            c=lambda x: warn.run(requestClipEdit, s.char, s.refresh)
            )
        cmds.setParent("..") # Close row
        cmds.floatSlider(
            min=50,
            max=200,
            v=100,
            dc=s.sizeClips,
            h=20
            )
        cmds.separator()
        cmds.frameLayout(l=i18n["clips.moreInfo"], font="tinyBoldLabelFont")
        cmds.scrollLayout(cr=True, bgc=[0.2,0.2,0.2], h=400)
        s.wrapper = cmds.gridLayout(w=400, cwh=[100, 120], cr=True, aec=False)
        cmds.setParent("..") # Close grid
        cmds.setParent("..") # Close Scroll
        cmds.separator()
        cmds.showWindow(s.window)
        cmds.scriptJob(uid=[s.window, s.cleanup], ro=True)
        s.refresh()
Beispiel #53
0
def diMayaAiIDshaderUI():
    global cb01, cb02, cb03, cb04, cb05, cb06  #checkbox
    closeUI(script)
    cmds.window(script, title = title, sizeable = False)
    cmds.columnLayout(columnAttach = ['both', 5], rowSpacing = 5, columnWidth = 315)
    cmds.separator(style = 'in')
    cmds.text(label = '..: id shader :..', backgroundColor = [0, 0, 0])
    cmds.separator(style = 'out')
    cmds.gridLayout(numberOfColumns = 3, cellWidthHeight = (105, 20))
    cb01 = cmds.checkBox(label = 'red', value = True)
    cb02 = cmds.checkBox(label = 'green', value = True)
    cb03 = cmds.checkBox(label = 'blue', value = True)
    cb04 = cmds.checkBox(label = 'black', value = False)
    cb05 = cmds.checkBox(label = 'white', value = False)
    cb06 = cmds.checkBox(label = 'black hole', value = False)
    cmds.setParent('..')
    cmds.button('ok', command = 'diMayaAiIDshader()')
    cmds.showWindow()
Beispiel #54
0
 def helpWin(self, stringField):
     '''--------------------------------------------------------------------------------------------------------------------------------------
     Interface Layout
     --------------------------------------------------------------------------------------------------------------------------------------'''
     # def helpPage(self, arg=None):
     winName = "Description"
     winTitle = winName
     if cmds.window(winName, exists=True):
             deleteUI(winName)
     window = cmds.window(winName, title=winTitle, tbm=1, w=700, h=400 )
     cmds.menuBarLayout(h=30)
     cmds.rowColumnLayout  (' selectArrayRow ', nr=1, w=700)
     cmds.frameLayout('LrRow', label='', lv=0, nch=1, borderStyle='out', bv=1, p='selectArrayRow')
     cmds.rowLayout  (' rMainRow ', w=700, numberOfColumns=6, p='selectArrayRow')
     cmds.columnLayout ('selectArrayColumn', parent = 'rMainRow')
     cmds.setParent ('selectArrayColumn')
     cmds.gridLayout('txvaluemeter', p='selectArrayColumn', numberOfColumns=2, cellWidthHeight=(700, 400))
     self.list=cmds.scrollField( editable=False, wordWrap=True, ebg=1,bgc=[0.11, 0.15, 0.15], w=700, text=str(stringField))
     cmds.showWindow(window)
Beispiel #55
0
    def doIt( self, *args ):
        # ui settings.
        self.winWidth = 306
        self.winHeight = 400
        self.iconWidth = 32
        self.iconHeight = 32
        
        # clean up old uis before opening a new one.
        try:
            cmds.deleteUI( self.winName )
        except:
            pass
        
        self.mainWindow = cmds.window( self.winName, title=self.winTitle, sizeable=False, resizeToFitChildren=False )
        cmds.frameLayout( borderVisible=False, labelVisible=False )
        
        self.conTools = cmds.columnLayout( height=self.winHeight/3 )
        cmds.text( label='Controller Tools', width=self.winWidth, wordWrap=True, align='center', font='boldLabelFont', backgroundColor=(0.15,0.15,0.15) )
        cmds.separator( style='none', height=4 )
        self.conGrid = cmds.gridLayout( numberOfColumns=4, numberOfRows=2, cellWidthHeight=(self.winWidth/4, 50) )
        cmds.button( label='Make Control', command='cmds.rigController()' )
        cmds.button( label='Make From XML', command='XMLUtility.createControlFromXML()' )
        cmds.button( label='Apply XML', command='XMLUtility.applyXMLtoControl()' )
        cmds.button( label='Save XML', command='XMLUtility.createControlXML()' )
        cmds.button( label='Make Deformer', command='makeDeformerMesh()')
        cmds.button( label='Apply Deformer', command='applyDeformerMesh()')
        cmds.setParent( '..' )#self.conGrid
        cmds.separator( style='none', height=20 )
        cmds.text( label='Position Tools', width=self.winWidth, wordWrap=True, align='center', font='boldLabelFont', backgroundColor=(0.15,0.15,0.15) )
        cmds.separator( style='none', height=4 )
        self.transGrid = cmds.gridLayout( numberOfColumns=3, cellWidthHeight=(self.winWidth/3, 50) )
        cmds.button( label='Match Translation', command=lambda *args: TransformUtility.matchTransforms( 'tran' ) )
        cmds.button( label='Match Rotation', command=lambda *args: TransformUtility.matchTransforms( 'rot' )  )
        cmds.button( label='Match All', command=lambda *args: TransformUtility.matchTransforms( 'all' )  )
        cmds.setParent( '..' )#self.transGrid
        cmds.setParent( '..' )#self.conTools
        
        cmds.setParent( '..' )#framelayout

         # show the ui.
        cmds.showWindow( self.winName )
def	setButtonIcon	():
	_width			=	cmds.gridLayout			(	'grid_selectAxis',		query	=	True,	width	=	True	)
	_axis			=	cmds.radioCollection	(	'radioCollection_axis',	query	=	True,	select	=	True	)
	_keepShape		=	cmds.checkBox			(	'check_keepShape',		query	=	True,	value	=	True	)
	
	if	_keepShape:	_keepShape	=	'KeepShape'
	else:			_keepShape	=	''
	
	cmds.symbolButton		(	'orientMinusButton',	edit	=	True,	width	=	_width	/	2,
								image	=	'ford_riggingAid__orient'+_axis+'minus'+_keepShape+'.xpm'	)
	cmds.symbolButton		(	'orientPlusButton',		edit	=	True,	width	=	_width	/	2,
								image	=	'ford_riggingAid__orient'+_axis+'plus'+_keepShape+'.xpm'	)
Beispiel #57
0
 def _choser_gen_group_window(self, getListAttr):
     choose_gen_grp_win = "Pick from below"
     if cmds.window(choose_gen_grp_win, exists=True):
         cmds.deleteUI(choose_gen_grp_win)
     window = cmds.window(choose_gen_grp_win, title=choose_gen_grp_win, tbm=1, w=800, h=150)
     cmds.menuBarLayout(h=30)
     cmds.rowColumnLayout  (' selectArrayRow ', nr=1, w=800)
     cmds.frameLayout('LrRow', label='', lv=0, nch=1, borderStyle='out', bv=1, p='selectArrayRow')
     cmds.rowLayout  (' rMainRow ', w=800, numberOfColumns=1, p='selectArrayRow')
     cmds.columnLayout ('selectArrayColumn', parent = 'rMainRow')
     cmds.setParent ('selectArrayColumn')
     cmds.separator(h=10, p='selectArrayColumn')
     cmds.frameLayout('title1', bgc=[0.15, 0.15, 0.15], cll=1, label='Select version', lv=1, nch=1, borderStyle='out', bv=1, w=800, fn="tinyBoldLabelFont", p='selectArrayColumn')
     cmds.gridLayout('valuebuttonlayout', p='title1', numberOfColumns=2, cellWidthHeight=(800, 20))  
     self.attributepath=cmds.optionMenu( label='Find')
     for each in getListAttr:
         cmds.menuItem( label=each)
     cmds.gridLayout('listBuildButtonLayout', p='title1', numberOfColumns=3, cellWidthHeight=(148, 20))
     cmds.button (label='Ok', p='listBuildButtonLayout', w=150, command = lambda *args:self.open_genAttributesWindow(getPath=cmds.optionMenu(self.attributepath, q=1, v=1)))
     cmds.button (label='open folder', p='listBuildButtonLayout', w=150, command = lambda *args:self._open_defined_path(cmds.optionMenu(self.attributepath, q=1, v=1)))
     cmds.showWindow(window) 
Beispiel #58
0
    def performTransfer(self):
        getMesh=cmds.ls(sl=1)
        if len(getMesh)<2:
            print "select a skinned mesh group and an unskinned target mesh group"
            return
        else:
            pass
        getMeshController=getMesh[0]
        getMeshTarget=getMesh[1]
        getChildrenController=cmds.listRelatives(getMeshController, c=1, typ="transform")
        if getChildrenController==None:
            getChildrenController=([getMeshController])
        getChildrenTarget=cmds.listRelatives(getMeshTarget, c=1, typ="transform")
        if getChildrenTarget==None:
            getChildrenTarget=([getMeshTarget])

        ####Window
        #folderPath="G:\\_PIPELINE_MANAGEMENT\\Published\\maya\\guides\\"
        winName = "Save xml"
        winTitle = winName
        global skinPath
        if cmds.window(winName, exists=True):
                cmds.deleteUI(winName)

        window = cmds.window(winName, title=winTitle, tbm=1, w=300, h=100 )

        cmds.menuBarLayout(h=30)
        cmds.rowColumnLayout  (' selectArrayRow ', nr=1, w=300)

        cmds.frameLayout('LrRow', label='', lv=0, nch=1, borderStyle='out', bv=1, p='selectArrayRow')
        
        cmds.rowLayout  (' rMainRow ', w=300, numberOfColumns=6, p='selectArrayRow')
        cmds.columnLayout ('selectArrayColumn', parent = 'rMainRow')
        cmds.setParent ('selectArrayColumn')
        cmds.separator(h=10, p='selectArrayColumn')
        cmds.gridLayout('listBuildButtonLayout', p='selectArrayColumn', numberOfColumns=1, cellWidthHeight=(300, 20))      
        skinPath=cmds.textField(w=250, h=25, p='listBuildButtonLayout', tx="C:\Users\\"+str(getFolderName)+"\Documents\maya\projects\default\scenes\\")
        cmds.button (w=80, label='Proceed', p='listBuildButtonLayout', command = lambda *args:self.callJointsWin(getChildrenController, getChildrenTarget, skinPath))
        cmds.button (w=80,label='Open folder', p='listBuildButtonLayout', command = lambda *args:self.get_path(skinPath))
        cmds.showWindow(window)     
Beispiel #59
0
    def create_MATID_win(self, winName="MaterialID"):
        global colMenu
        if cmds.window(self.winName, exists=True):
                cmds.deleteUI(self.winName)

        self.window = cmds.window(self.winName, title=self.winTitle, tbm=1, w=300, h=250 )

        cmds.menuBarLayout(h=30)
        cmds.rowColumnLayout  (' selectArrayRow ', nr=1, w=300)

        cmds.frameLayout('LrRow', label='', lv=0, nch=1, borderStyle='out', bv=1, p='selectArrayRow')
        
        cmds.rowLayout  (' rMainRow ', w=300, numberOfColumns=6, p='selectArrayRow')
        cmds.columnLayout ('selectArrayColumn', parent = 'rMainRow')
        cmds.setParent ('selectArrayColumn')
        cmds.separator(h=10, p='selectArrayColumn')
        cmds.gridLayout('listBuildButtonLayout', p='selectArrayColumn', numberOfColumns=2, cellWidthHeight=(150, 20))
        colMenu=cmds.optionMenu( label='ID')
        cmds.menuItem( label='Skin' )
        cmds.menuItem( label='Eye' )
        cmds.menuItem( label='Spec' )
        cmds.menuItem( label='Lash' )
        cmds.menuItem( label='Brows' )    
        cmds.menuItem( label='Hair' )        
        cmds.menuItem( label='Mouth' )        
        cmds.menuItem( label='Other' )    
        cmds.menuItem( label='Costume' )             
        cmds.button (label='Mat ID', p='listBuildButtonLayout', command =lambda *args:self._add_id(queryColor=cmds.optionMenu(colMenu, q=1, sl=1)))
        cmds.button (label='Add CH Pref', p='listBuildButtonLayout', command = self._add_pref)
        cmds.button (label='Add type Suf', p='listBuildButtonLayout', command = self._add_suf)
        cmds.button (label='ShadeNetworkSel', p='listBuildButtonLayout', command = self._shade_network)
        cmds.button (label='selectMissingID', p='listBuildButtonLayout', command = self._select_nonID)
        cmds.button (label='vray gamma', p='listBuildButtonLayout', command = self._vray_gamma)     
        cmds.button (label='FTM', p='listBuildButtonLayout', command = self._file_texture_manager)     
        cmds.button (label='Open work folder', p='listBuildButtonLayout', command = self._open_work_folder) 
        cmds.button (label='Open texture folder', p='listBuildButtonLayout', command = self._open_texture_folder)   
        cmds.button (label='Open Image in PS', p='listBuildButtonLayout', command = self._open_texture_file_ps)  
        cmds.button (label='Open Image in Gimp', p='listBuildButtonLayout', command = self._open_texture_file_gmp) 

        cmds.showWindow(self.window)
def setAttributeIntUI():
    global tfInI, tfOutI, tfStepI, intUI
    intUI = 'intUI'
    closeUI(intUI)
    cmds.window(intUI, title = 'intUI')
    cmds.columnLayout(columnAttach = ['both', 5], rowSpacing = 5, columnWidth = 210)
    cmds.separator(style = 'in')
    cmds.text(label = '..: random range :..', backgroundColor = [0.15, 0.1, 0])
    cmds.separator(style = 'out')
    cmds.gridLayout(numberOfColumns = 2, cellWidthHeight = (100, 20))
    tfInI = cmds.textField(text = '0')
    tfOutI = cmds.textField(text = '4')
    cmds.setParent('..')
    cmds.button(label = 'ok', command = 'setAttributeIntRandom()')
    cmds.separator(style = 'in')
    cmds.text(label = '..: increment step :..', backgroundColor = [0, 0.1, 0.15])
    cmds.separator(style = 'out')
    tfStepI = cmds.textField(text = '1')
    cmds.separator(style = 'out')
    cmds.button(label = 'ok', command = 'setAttributeIntIncrement()')
    cmds.setParent('..')
    cmds.showWindow()