예제 #1
0
    def populate_selection_layout(self):        
        
        pm.setParent(self.widgets['selectionSet_vertical'])
        self.widgets['selectionSet_vertical'].clear()        
        
        treeViewSelected =  pm.treeView (self.widgets["directory_treeView"], q=True, selectItem=True)
        
        if not treeViewSelected:
            return
        
        pm.scrollLayout(cr=True)

        path = os.path.abspath(treeViewSelected[0])
        
        set_paths = []
        for dir in os.listdir(path):
             if dir.find(self.library_objects_suffix[2]) != -1: #.set 
                 set_paths.append(os.path.abspath(os.path.join(path, dir)))        
                
        for set_path in set_paths:
            print "create button"
            set_obj = Set(set_path)
            
            infos = set_obj.get_info()
            label = infos['name'].split('.')[0]

            pm.iconTextButton(style='textOnly',label=label, c=pm.Callback(self.selection_set_button_load, set_obj))
            pm.popupMenu()
            pm.menuItem(label='Save Pose', c=pm.Callback(self.selection_set_button_save, set_obj))        
            pm.menuItem(label='Load Pose', c=pm.Callback(self.selection_set_button_load, set_obj))
 
        self.widgets["selectionSet_vertical"].redistribute()
예제 #2
0
 def customCreateFlt(self, attr):
     # print "creating %s" % attr
     pname = attr.split('.')[-1]
     ptype = self.params[pname].ptype
     plabel = self.params[pname].label
     pann = self.params[pname].annotation
     presets = self.params[pname].presets
     precision = self.params[pname].precision
     controlName = pname + 'Ctrl'
     l = plabel
     if presets is not None:
         l += ' <span>&#8801;</span>'  # fix unicode problem in Windows using html
     pm.attrFieldSliderGrp(controlName,
                           attribute=attr,
                           label=l,
                           annotation=pann,
                           precision=precision)
     if presets is not None:
         # pm.attrFieldSliderGrp(controlName, edit=True)
         # pm.popupMenu()
         # for k in sorted(presets, key=presets.get):
         #     pm.menuItem(label=k, command=pm.Callback(setPresetFlt, controlName, presets[k]))
         attrChildren = pm.layout(controlName, query=True, childArray=True)
         pm.popupMenu(button=1, parent=attrChildren[0])
         for k in sorted(presets, key=presets.get):
             pm.menuItem(label=k,
                         command=pm.Callback(setPresetFlt, controlName,
                                             presets[k]))
예제 #3
0
 def reset_menu(self):
     '''
     Clears out the node, menu_dict, and delets all items from our context menu
     '''
     self.node = None
     self.menu_dict = {}
     pm.popupMenu(self.menu, e=True, deleteAllItems=True)
    def test_rowGroupLayout(self):
        self.assertEqual(pm.currentParent(), self.win)
        self.assertEqual(pm.currentMenuParent(), None)
        with pm.textFieldButtonGrp( label='Label', text='Text', buttonLabel='Button' ) as tfbg:
            self.assertEqual(pm.currentParent(), tfbg)
            self.assertEqual(pm.currentMenuParent(), None)
            cmds.button()
            with pm.popupMenu() as m:
                self.assertEqual(pm.currentParent(), tfbg)
                self.assertEqual(pm.currentMenuParent(), m)
                with pm.menuItem(subMenu=1) as sm:
                    self.assertEqual(pm.currentParent(), tfbg)
                    self.assertEqual(pm.currentMenuParent(), sm)
                self.assertEqual(pm.currentParent(), tfbg)
                self.assertEqual(pm.currentMenuParent(), m)
            self.assertEqual(pm.currentParent(), tfbg)
        self.assertEqual(pm.currentParent(), self.win)

        fl = pm.formLayout()
        tfbg2 = pm.textFieldButtonGrp( label='Label', text='Text', buttonLabel='Button' )
        self.assertEqual(pm.currentParent(), fl)
        with pm.columnLayout() as cl:
            cmds.button()
            with pm.popupMenu() as m:
                self.assertEqual(pm.currentParent(), cl)
                self.assertEqual(pm.currentMenuParent(), m)
                with pm.menuItem(subMenu=1) as sm:
                    self.assertEqual(pm.currentParent(), cl)
                    self.assertEqual(pm.currentMenuParent(), sm)
                self.assertEqual(pm.currentParent(), cl)
                self.assertEqual(pm.currentMenuParent(), m)
            self.assertEqual(pm.currentParent(), cl)
        self.assertEqual(pm.currentParent(), fl)
예제 #5
0
파일: pbUV.py 프로젝트: aaronfang/pbUV
    def __init__(self, par, editor):
        ToolsUI.__init__(self, par)
        self.editor = editor
        with pm.gridLayout(p=par, nc=2, cwh=[26, 26]) as self.layout:
            swapbg = pm.iconTextCheckBox(image1='swapBG.png',
                                         value=pm.optionVar['displayEditorImage'],
                                         ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kUVTextureEditorBakingAnnot'),
                                         cc=lambda *args: pm.mel.textureWindowToggleEditorImage(self.editor))
            pm.popupMenu(button=3, p=swapbg, pmc=lambda *arg: pm.mel.performTextureViewBakeTextureOptions(1))

            pm.iconTextButton(image1='updatePsdTextureEditor.png',
                              ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kUpdatePSDNetworksAnnot'),
                              c=lambda *args: pm.mel.psdUpdateTextures(),
                              commandRepeatable=True)

            pm.iconTextButton(image1='bakeEditor.png',
                              ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kForceEditorTextureRebakeAnnot'),
                              c=lambda *args: pm.mel.textureWindowBakeEditorImage(),
                              commandRepeatable=True)

            pm.iconTextCheckBox(image1='imageRatio.png',
                                ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kUseImageRatioAnnot'),
                                value=pm.textureWindow(self.editor, q=True, imageRatio=True),
                                onc=lambda *args: pm.textureWindow(self.editor, e=True, imageRatio=True),
                                ofc=lambda *args: pm.textureWindow(self.editor, e=True, imageRatio=False))
예제 #6
0
    def _buildMarkingMenu(self, menu, parent):
        '''This is where all the elements of the marking menu our built.'''
        pm.popupMenu(MENU_NAME, e=True, dai=True)

        # Tool Launch Menu
        pm.menuItem(p=menu,
                    l='Script Editor',
                    c=pm.Callback(pm.mel.eval, 'ScriptEditor;'))
        pm.menuItem(p=menu,
                    l='Node Editor',
                    c=pm.Callback(pm.mel.eval, 'NodeEditorWindow;'))
        pm.menuItem(p=menu,
                    l='Connection Editor',
                    c=pm.Callback(pm.mel.eval, 'ConnectionEditor;'))
        pm.menuItem(p=menu,
                    l='Outliner',
                    c=pm.Callback(pm.mel.eval, 'OutlinerWindow;'))
        pm.menuItem(p=menu, d=True)
        pm.menuItem(p=menu,
                    l='Paint Weights',
                    c=pm.Callback(pm.mel.eval,
                                  'ArtPaintSkinWeightsToolOptions;'))
        pm.menuItem(p=menu, d=True)

        # Rebuild
        cmds.menuItem(p=menu, l="Rebuild Marking Menu", c=rebuildMarkingMenu)

        # Build Sub-Radial Menus
        self._buildJointMenu(menu, parent)
        self._buildLocatorMenu(menu, parent)
예제 #7
0
 def createList(self, parentWidget):
     self.parentWidget = parentWidget
     a = pm.scrollLayout(p=self.parentWidget, childResizable=True, h=200)
     self.widgetName = pm.flowLayout(p=a, backgroundColor=(.17, .17, .17), columnSpacing=5, h=1000, wrap=True,
                                     dropCallback=self.dropCallback)
     pm.popupMenu(parent=self.widgetName)
     pm.menuItem(label='add item', c=self.addItemCallBack)
예제 #8
0
파일: pbUV.py 프로젝트: aaronfang/pbUV
    def __init__(self, par, editor):
        self.editor = editor
        ToolsUI.__init__(self, par)

        with pm.gridLayout(p=par, nc=2, cwh=[26, 26]) as self.layout:
            griddisp = pm.iconTextCheckBox(image1='gridDisplay.png',
                                           value=pm.textureWindow(self.editor, q=True, toggle=True),
                                           onc=lambda *args: pm.textureWindow(self.editor, e=True, toggle=True),
                                           ofc=lambda *args: pm.textureWindow(self.editor, e=True, toggle=False),
                                           ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kViewGridAnnot'))
            pm.popupMenu(button=3, p=griddisp, pmc=lambda *args: pm.mel.performTextureViewGridOptions(1))

            pxsnap = pm.iconTextCheckBox(image1='pixelSnap.png',
                                         value=pm.snapMode(q=True, pixelSnap=True),
                                         onc=lambda *args: pm.snapMode(pixelSnap=True),
                                         ofc=lambda *args: pm.snapMode(pixelSnap=False),
                                         ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kPixelSnapAnnot'))
            pm.popupMenu(button=3, p=pxsnap, pmc=lambda *args: pm.mel.performPixelSnapOptions(1))

            pm.iconTextButton(image1='textureEditorDisplayColor.png',
                              c=lambda *args: pm.textureWindow(self.editor, e=True, displayStyle='color'),
                              ann='m_textureWindowCreateToolBar.kDisplayRGBChannelsAnnot')

            pm.iconTextButton(image1='textureEditorDisplayAlpha.png',
                              c=lambda *args: pm.textureWindow(self.editor, e=True, displayStyle='mask'),
                              ann='m_textureWindowCreateToolBar.kDisplayAlphaChannelsAnnot')
예제 #9
0
    def __init__(self):
        if pm.window(win, q=True, exists=True ): 
            pm.deleteUI(win)

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

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

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

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

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

                    (btm, 'left', 3), 
                    (btm, 'right', 3), 
                    (btm, 'bottom', 3),
                    ], 
                attachControl=[
                    (self.mid, 'top', 3, top), 
                    (self.mid, 'bottom', 0, btm)
                    ],
                )
예제 #10
0
 def buildPopupMenu(self, menu, parent):
     if self.outputsChanged:
         pm.popupMenu(self.popupMenu, edit=True, deleteAllItems=True)
         pm.cmds.menuItem(parent=menu, label='Select AOV Node', c=lambda *args: pm.select(self.aov.node))
         pm.cmds.menuItem(parent=menu, label='Remove AOV', c=lambda *args: self.parent.removeAOV(self.aov))
         pm.cmds.menuItem(parent=menu, label='Add New Output Driver', c=lambda *args: self.addOutput())
         pm.cmds.menuItem(parent=menu, divider=True)
         if len(self.outputs) > 1:
             for i, outputRow in enumerate(self.outputs):
                 subMenu = pm.cmds.menuItem(parent=menu, label='Output Driver %d' % (i+1), subMenu=True)
                 pm.cmds.menuItem(parent=subMenu, label='Select Driver',
                                  c=pm.Callback(pm.select, outputRow.driverNode))
                 pm.cmds.menuItem(parent=subMenu, label='Select Filter',
                                  c=pm.Callback(pm.select, outputRow.filterNode))
                 pm.cmds.menuItem(parent=subMenu, divider=True)
                 pm.cmds.menuItem(parent=subMenu, label='Remove',
                                  c=pm.Callback(self.removeOutput, i))
         elif len(self.outputs) == 1:
             outputRow = self.outputs[0]
             pm.cmds.menuItem(parent=menu, label='Select Driver',
                              c=pm.Callback(pm.select, outputRow.driverNode))
             pm.cmds.menuItem(parent=menu, label='Select Filter',
                              c=pm.Callback(pm.select, outputRow.filterNode))
         self.outputsChanged = False
     return menu
예제 #11
0
파일: pbUV.py 프로젝트: aaronfang/pbUV
    def __init__(self, par):
        ToolsUI.__init__(self, par)
        with pm.gridLayout(p=par, nc=3, cwh=[26, 26]) as self.layout:
            pm.iconTextButton(image1='cutUV.png',
                              c=lambda *args: pm.polyMapCut(),
                              commandRepeatable=True,
                              ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kSeparateUVsAlongSelectedEdgesAnnot'))

            pm.iconTextButton(image1='polySplitUVs.png',
                              ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kSplitSelectedUV'),
                              c=lambda *args: pm.mel.polySplitTextureUV(),
                              commandRepeatable=True)

            pm.iconTextButton(image1='tearface', ann='Tear Off Selected Face From UVs',
                              c=self.tear_face,
                              commandRepeatable=True)

            sewuv = pm.iconTextButton(image1='sew_uv.png',
                                      c=self.sew_uv, commandRepeatable=True,
                                      ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kSewSelectedUVsTogetherAnnot'))
            pm.popupMenu(button=3, p=sewuv, pmc=lambda *args: pm.mel.performPolyMergeUV(1))

            movesewuv = pm.iconTextButton(image1='moveSewUV.png',
                                          c=lambda *args: pm.mel.performPolyMapSewMove(0),
                                          commandRepeatable=True,
                                          ann=pm.mel.uiRes(
                                              'm_textureWindowCreateToolBar.kMoveAndSewSelectedEdgesAnnot'))
            pm.popupMenu(button=3, p=movesewuv, pmc=lambda *args: pm.mel.performPolyMapSewMove(1))
예제 #12
0
def createTrail():
    if pm.window('trailUI',ex=1):
        pm.deleteUI('trailUI')
    
    pm.window('trailUI')
    pm.columnLayout(adj=1)
    fsSample = pm.floatSliderGrp('sampleSlider', label='Sample by', cw=(1,70), adj=1, en=1,minValue=0.01, maxValue=100, fieldMinValue=0.01, fieldMaxValue=100,pre=2, field=1, v=1)
    pm.separator (height=4,style="in")
    startFrame = pm.playbackOptions(q=1,min=1)
    currentFrame = pm.currentTime(q=1)
    if currentFrame > startFrame:
        startFrame = currentFrame
    pm.intSliderGrp('startFrameSlider', label='Start frame', cw=(1,70), adj=1, en=1,minValue=0, maxValue=100, fieldMinValue=0, fieldMaxValue=10000, field=1, v=startFrame)
    pm.popupMenu(button=3,pmc = functools.partial(setTime,'start'))
    pm.intSliderGrp('endFrameSlider', label='End frame', cw=(1,70), adj=1, en=1,minValue=0, maxValue=100, fieldMinValue=0, fieldMaxValue=10000, field=1, v=startFrame+30)
    pm.popupMenu(button=3,pmc = functools.partial(setTime,'end'))
    pm.intSliderGrp('trailDivisions', label='Trail divisions', cw=(1,70), adj=1, en=1,minValue=1, maxValue=100, fieldMinValue=1, fieldMaxValue=10000, field=1, v=40)
    pm.separator (height=4,style="in")
    cbUvDistorted = pm.checkBox('cbUV',l='UV distorted',v=1)
    pm.separator (height=4,style="in")
    
    rowBtn = pm.rowColumnLayout(numberOfRows=1)
    pm.button(l='Create Trail',command=functools.partial(createTrailMesh))
    pm.button(l='Rebuil uvs',c=functools.partial(createTrailUv,''))
    pm.button(l='ELP !!!',c=openHelpPage)
    pm.showWindow('trailUI')
예제 #13
0
 def createMenus(self):
     pm.popupMenu(parent=self.widgetName)
     pm.menuItem(label='add folder', c=self.addFolderCallBack)
     pm.menuItem(label='add multiple folders', c=self.addMultipleFoldersCallback)
     pm.menuItem(label='remove folder', c=self.removeFolderCallBack)
     if self.projectName:
         self.getFolderTree()
예제 #14
0
def Control_MM_UI():
	
	if pm.popupMenu('ControlMenu', ex=1):
		pm.deleteUI('ControlMenu')
    	
	
	CtlMenu = pm.popupMenu('ControlMenu', mm=1, b=(1), aob=1, ctl=0, alt=0, sh=0, p="ControlBase", pmo=1)
    
	pm.menuItem(p=CtlMenu, l="Print Fn", rp="SW", c="print 'SouthWest'")
	pm.menuItem(p=CtlMenu, l="Circle", rp="NE", c="pm.circle()")
예제 #15
0
 def setup_popup_menu_elems(popup, group, param_name):
     pm.popupMenu(popup, edit=True, deleteAllItems=True)
     grid_names_str = pm.getAttr("%s.gridNames" % param_name.split(".")[0])
     if grid_names_str is not None and len(grid_names_str) > 0:
         for each in grid_names_str.split(" "):
             pm.menuItem(
                 label=each,
                 parent=popup,
                 command=
                 'pm.setAttr("%s", "%s", type="string"); pm.textFieldGrp("%s", edit=True, text="%s")'
                 % (param_name, each, group, each))
예제 #16
0
    def addMenus(self):
        pm.popupMenu(parent=self.widgetName)

        if self.task == 'asset':
            pm.menuItem(label='remove asset', c=self.removeCallback)
        elif self.task == 'shot':
            pm.menuItem(label='shot manager', c=self.shotManagerCallback)
            pm.menuItem(label='remove shot', c=self.removeCallback)
        else:
            pm.menuItem(label='build', c=self.buildCallback)
            pm.menuItem(label='open', c=self.openCallback)
예제 #17
0
 def setup_velocity_grid_menus(popup, group, param_name):
     pm.popupMenu(popup, edit=True, deleteAllItems=True)
     grids = pm.getAttr("%s.gridNames" %
                        param_name.split(".")[0]).split(" ")
     if grids is not None and len(grids) > 0:
         for grid in grids:
             pm.menuItem(
                 label=grid,
                 parent=popup,
                 command=
                 'import AEvdb_visualizerTemplate; AEvdb_visualizerTemplate.AEvdb_visualizerTemplate.add_velocity_grid("%s", "%s", "%s")'
                 % (param_name, group, grid))
예제 #18
0
 def _addAssetButton(self, fileID, sceneName, versionID):
     thumbnailPath = _Database.getThumbnailPath(fileID, versionID)
     if not _os.path.exists(thumbnailPath):
         thumbnailPath = "cube.png"
     buttonName = self._assetBtnName(fileID)
     button = _pmCore.iconTextButton(buttonName, style='iconAndTextVertical', image1=thumbnailPath, label=sceneName, command=_pmCore.Callback(self._assetSelected, fileID))
     self._uiWidget.setdefault(_UiWidgetEnum.assetBtnList, {})[buttonName] = button
     _pmCore.popupMenu()  
     _pmCore.menuItem(label='Open', command=_pmCore.Callback(_functools.partial(_MayaFunctions.openScene, _Database.getFilePath(fileID))))
     _pmCore.menuItem(label='Import', command=_pmCore.Callback(_functools.partial(_MayaFunctions.importScene, _Database.getFilePath(fileID))))
     _pmCore.menuItem(label='Reference', command=_pmCore.Callback(_functools.partial(_MayaFunctions.referenceScene, _Database.getFilePath(fileID))))
     _pmCore.menuItem(label='Versions/Comments', command=_pmCore.Callback(_functools.partial(_AssetVersionDialog, fileID)))
예제 #19
0
파일: pbUV.py 프로젝트: aaronfang/pbUV
    def __init__(self):
        with pm.frameLayout(l='Transform:', cll=True, cl=False, bs='out'):
            with pm.columnLayout():
                with pm.gridLayout(nc=5):
                    pm.iconTextButton(image1='pbUV/tRot90CCW.png', c=lambda *args: self.rotate(angle=90, dir='ccw'),
                                      commandRepeatable=True)
                    pm.iconTextButton(image1='pbUV/tRotCCW.png', c=lambda *args: self.rotate(dir='ccw'),
                                      commandRepeatable=True)
                    pm.iconTextButton(image1='pbUV/tTranslateUp.png', c=lambda *args: self.move(v=1),
                                      commandRepeatable=True)
                    pm.iconTextButton(image1='pbUV/tRotCW.png', c=lambda *args: self.rotate(dir='cw'))
                    pm.iconTextButton(image1='pbUV/tRot90CW.png', c=lambda *args: self.rotate(angle=90, dir='cw'),
                                      commandRepeatable=True)

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

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

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

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

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

                with pm.columnLayout(cal='left'):
                    pm.text(l='Pivot:')
                    self.pivType = pm.radioButtonGrp(nrb=2, labelArray2=['Selection', 'Custom'], cw2=[64, 64],
                                                     cc=self._piv_change, sl=1)
                    with pm.rowLayout(nc=3, en=False) as self.pivPos:
                        pm.text('POS:')
                        self.pivU = pm.floatField()
                        self.pivV = pm.floatField()
                    self.sampleSel = pm.button(l='Sample Selection', height=18, en=False, c=self.sample_sel_cmd)
예제 #20
0
 def initialiseLayout(self):
     """ define the layout of the ui,
         also find every module under the TOOL_FOLDER, create a button for each module found"""
     
     #=======================================================================
     #DEFINE LAYOUT
     #=======================================================================
     self.widgets["toplevel_column"] = pm.columnLayout(adj=True)
     
     # ASSET LAYOUT
     pm.setParent(self.widgets["toplevel_column"])
     pm.frameLayout(label='Asset', collapsable=False, labelVisible=False)
     h = pm.horizontalLayout(ratios=[1,5])
     pm.text("Search :")
     self.widgets['assets_searchFilter_textField'] = pm.textField(cc=self.refresh_asset_textScroll)
     h.redistribute()
     pm.setParent("..")
     self.widgets['assets_textScroll'] = pm.textScrollList(ams=True, h=200, selectCommand=self.select_asset_callback)
     
     # IMAGE LAYOUT
     pm.setParent(self.widgets["toplevel_column"])
     pm.frameLayout(label='Image', collapsable=True, labelVisible=True)
     pm.scrollLayout(h=130)
     pm.popupMenu()        
     pm.menuItem(label='Open Thumbnail Directory', c=self.thumbnail_directory_open_callback)
     self.widgets['thumbnails_brower'] = pm.horizontalLayout()
     self.widgets['thumbnails_brower'].redistribute()
     
     #
     pm.setParent(self.widgets["toplevel_column"])
     pm.frameLayout(label='Settings', collapsable=True, labelVisible=True)
     pm.rowColumnLayout(numberOfColumns=4)
     pm.text(label='Zoom', w=100)
     self.widgets['zoom_field'] = pm.floatField(minValue=1, value=1, precision=2, w=100)
     pm.separator(style='none')
     pm.separator(style='none')
     pm.text(label='Width', w=100)
     self.widgets['width_field'] = pm.intField(value=100, w=100)
     pm.text(label='Height', w=100)
     self.widgets['height_field'] = pm.intField(value=100, w=100)
     pm.text(label='Offset W', w=100)
     self.widgets['shiftWidth_field'] = pm.floatField( value=0, precision=2, w=100)
     pm.text(label='Offset H', w=100)
     self.widgets['shiftHeight_field'] = pm.floatField( value=0, precision=2, w=100)
     
     
     #
     pm.setParent(self.widgets["toplevel_column"])
     pm.button(label='Generate Thumbnails', c=self.generate_thumbnail)
     
     #INITIAL
     self.refresh_asset_textScroll()
 def update_channel(self, channel_name, param_name):
     grp = "OpenVDB%sChannelGrp" % channel_name
     attr_value = pm.getAttr(param_name)
     pm.textFieldGrp(grp, edit=True,
                     text="" if attr_value is None else attr_value,
                     changeCommand=lambda val: pm.setAttr(param_name, val))
     pm.scriptJob(parent=grp,
                  replacePrevious=True,
                  attributeChange=[param_name,
                                   lambda : pm.textFieldGrp(grp, edit=True,
                                                           text=pm.getAttr(param_name))])
     self.clear_popups(grp)
     pm.popupMenu(parent=grp, postMenuCommand=lambda popup, popup_parent: AEvdb_visualizerTemplate.setup_popup_menu_elems(popup, popup_parent, param_name))
 def update_channel(self, channel_name, param_name):
     grp = "OpenVDB%sChannelGrp" % channel_name
     attr_value = pm.getAttr(param_name)
     pm.textFieldGrp(grp, edit=True,
                     text="" if attr_value is None else attr_value,
                     changeCommand=lambda val: pm.setAttr(param_name, val))
     pm.scriptJob(parent=grp,
                  replacePrevious=True,
                  attributeChange=[param_name,
                                   lambda : pm.textFieldGrp(grp, edit=True,
                                                           text=pm.getAttr(param_name))])
     self.clear_popups(grp)
     pm.popupMenu(parent=grp, postMenuCommand=lambda popup, popup_parent: AEvdb_visualizerTemplate.setup_popup_menu_elems(popup, popup_parent, param_name))
예제 #23
0
파일: pbUV.py 프로젝트: aaronfang/pbUV
    def __init__(self, par):
        ToolsUI.__init__(self, par)
        with pm.columnLayout() as self.layout:
            with pm.rowLayout(nc=4):
                pm.floatField('uvEntryFieldU', precision=3, ed=True, width=46,
                              ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kEnterValueTotransformInUAnnot'),
                              cc=lambda *args: pm.mel.textureWindowUVEntryCommand(1))

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

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

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

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

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

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

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

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

                pm.iconTextButton(image1='cycleUVs.png',
                                  ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kCycleUVsCounterClockwiseAnnot'),
                                  c=lambda *args: pm.mel.polyRotateUVsByVertex(),
                                  commandRepeatable=True)
예제 #24
0
파일: pbUV.py 프로젝트: aaronfang/pbUV
    def __init__(self, par):
        ToolsUI.__init__(self, par)
        with pm.gridLayout(p=par, nc=2, cwh=[26, 26]) as self.layout:
            layoutbutton = pm.iconTextButton(image='layoutUV.png',
                                             ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kSelectFacesToMoveAnnot'),
                                             c=lambda *args: pm.mel.performPolyLayoutUV(0),
                                             commandRepeatable=True)
            pm.popupMenu(button=3, parent=layoutbutton, pmc=lambda *args: pm.mel.performPolyLayoutUV(1))

            layout_u_or_v = pm.iconTextButton(image='layoutUV.png',  # FIXME new image
                                              ann='Select Faces to be moved in U or V Space',
                                              c=lambda *args: self.u_or_v(0),
                                              commandRepeatable=True)
            pm.popupMenu(button=3, parent=layout_u_or_v, pmc=lambda *args: self.u_or_v(1))
예제 #25
0
 def create(cls):
     Logger.info("Building marking menu...")
     cls._delete_old()
     pm.popupMenu(cls.NAME,
                  mm=1,
                  aob=1,
                  button=2,
                  ctl=1,
                  alt=1,
                  sh=0,
                  p="viewPanes",
                  pmo=0,
                  pmc=cls.__populate)
     Logger.info("Successfully added marking menu: (CTL+ALT+MMB)")
예제 #26
0
 def customCreateRgb(self, attr):
     pname = attr.split('.')[-1]
     ptype = self.params[pname].ptype
     plabel = self.params[pname].label
     pann = self.params[pname].annotation
     presets = self.params[pname].presets
     l = plabel
     if presets is not None:
         l = unicode(plabel) + u' \u1392'
     self.controls[pname] = pm.attrColorSliderGrp(pname + 'Ctrl', attribute=attr, label=l, annotation=pann)
     if presets is not None:
         pm.attrColorSliderGrp(self.controls[pname], edit=True)
         pm.popupMenu()
         for k in sorted(presets):
             pm.menuItem(label=k, command=pm.Callback(setPresetRgb, self.controls[pname], presets[k]))
예제 #27
0
    def menus(self):

        # popUpMenu
        self.popUp = pm.popupMenu(parent=self.scrollField)
        #opening the file
        self.commentFile = open(self.fileName, 'r')
        # reading
        self.comments = self.commentFile.readlines()
        # closing
        self.commentFile.close()

        # the label is the first line
        # the actual comment is after the label
        # so the pattern is label, comment, label, comment, label, comment
        label = 0
        comment = 1
        pm.menuItem(label='Clear', command=pm.Callback(self.clear))
        pm.menuItem(label='Custom', command=pm.Callback(self.custom))
        while comment < len(self.comments):
            # menuItems for the popUpMenu
            write = self.comments[comment]
            pm.menuItem(label=self.comments[label],
                        command=pm.Callback(self.insertText, write))
            label += 2
            comment += 2
예제 #28
0
 def buildNetworkAOVs(self, nodeAttr, aovList):
     '''
     Populate the UI with an attrNavigationControlGrp for each AOV in the network
     '''
     for aov in aovList:
         if aov.name in self.networkAOVs:
             at = self.getAOVAttr(nodeAttr, aov.name)
             #at = nodeAttr[aov.index]
             #at.aovName.set(aov.name)
             ctrl = pm.cmds.attrNavigationControlGrp(at=at.aovInput.name(),
                                                label=aov.name)
             self._msgCtrls.append(ctrl)
             pm.popupMenu(parent=ctrl);
             pm.menuItem(subMenu=True, label="Goto Node")
             for node in self.aovNodes[aov.name]:
                 pm.cmds.menuItem(label=node.name(), command=lambda arg, node=node: pm.select(node))
예제 #29
0
def get_shelf_submenus(shelf_button):
    popup_menus = pm.shelfButton(shelf_button, q=True, popupMenuArray=True)
    if not popup_menus:
        return []

    popup_menu = popup_menus[0]
    popup_menu_items = pm.popupMenu(popup_menu, q=True, itemArray=True) or []

    # Ignore popup items that are defaults, eg. "Open" and "Edit" that appear in the
    # shelf context menu.
    def is_default_menu_item(popup):
        cmd = pm.menuItem(p, q=True, command=True)
        return isinstance(cmd, basestring) and cmd.startswith('/*dSBRMBMI*/')

    popup_menu_items = [
        p for p in popup_menu_items if not is_default_menu_item(p)
    ]

    # popupMenu returns ambiguous paths.  Prefix the path to the popup menu to make
    # sure we query the right thing.
    popup_menu_items = [popup_menu + '|' + item for item in popup_menu_items]

    # Replace any dividers with separator.
    popup_menu_items = [
        separator if pm.menuItem(p, q=True, divider=True) else p
        for p in popup_menu_items
    ]

    return popup_menu_items
예제 #30
0
 def customCreateFlt(self, attr):
     print "creating %s" % attr
     pname = attr.split('.')[-1]
     ptype = self.params[pname].ptype
     plabel = self.params[pname].label
     pann = self.params[pname].annotation
     presets = self.params[pname].presets
     precision = self.params[pname].precision
     l = plabel
     if presets is not None:
         l = unicode(plabel) + u' \u1392'
     self.controls[pname] = pm.attrFieldSliderGrp(pname + 'Ctrl', attribute=attr, label=l, annotation=pann, precision=precision)
     if presets is not None:
         pm.attrFieldSliderGrp(self.controls[pname], edit=True)
         pm.popupMenu()
         for k in sorted(presets, key=presets.get):
             pm.menuItem(label=k, command=pm.Callback(setPresetFlt, self.controls[pname], presets[k]))
예제 #31
0
파일: pbUV.py 프로젝트: aaronfang/pbUV
    def __init__(self, par, editor):
        self.editor = editor
        ToolsUI.__init__(self, par)
        with pm.columnLayout(p=par) as self.layout:
            with pm.rowLayout(nc=4):
                self.imageDisplay = pm.iconTextCheckBox('imageDisplayButton', image1='imageDisplay.png',
                                                        v=pm.textureWindow(self.editor, q=True, id=True),
                                                        cc=self.toggle_image_display,
                                                        ann=pm.mel.uiRes(
                                                            'm_textureWindowCreateToolBar.kDisplayImageAnnot'))
                pm.popupMenu(button=3, p=self.imageDisplay,
                             pmc=lambda *args: pm.mel.performTextureViewImageRangeOptions(1))

                pm.iconTextCheckBox(image1='textureEditorShadeUVs.png',
                                    value=pm.textureWindow(self.editor, q=True, displaySolidMap=True),
                                    onc=lambda *args: pm.textureWindow(self.editor, e=True, displaySolidMap=True),
                                    ofc=lambda *args: pm.textureWindow(self.editor, e=True, displaySolidMap=False),
                                    ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kOverlapAnnot'))

                self.edgeColorBtn = pm.iconTextButton(image1='pbUV/opts01EdgeColor.png', c=self.edge_col_cmd)
                self.edgeColSld = pm.intSlider(min=1, max=31,
                                               value=pm.displayColor('polymesh', q=True, active=True) + 1,
                                               dc=self.edge_col_attr)

            with pm.rowLayout(nc=4):
                pm.iconTextCheckBox(image1='filteredMode.png', v=pm.textureWindow(self.editor, q=True, iuf=True),
                                    onc=lambda *args: pm.textureWindow(self.editor, e=True, iuf=True),
                                    ofc=lambda *args: pm.textureWindow(self.editor, e=True, iuf=False),
                                    ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kToggleFilteredImageAnnot'))

                polyOpts = pm.iconTextButton(image1='textureBorder.png', c=self.toggle_tx_border,
                                             ann=pm.mel.uiRes(
                                                 'm_textureWindowCreateToolBar.kToggleTextureBordersAnnot'))
                pm.popupMenu(button=3, p=polyOpts, pmc=lambda *args: pm.mel.CustomPolygonDisplayOptions())

                self.dimImageBtn = pm.iconTextCheckBox('dimmerButton', image1='dimTexture.png',
                                                       ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kDimImageAnnot'),
                                                       onc=lambda *args: self.dim_image_cmd(True),
                                                       ofc=lambda *args: self.dim_image_cmd(False),
                                                       value=pm.textureWindow(self.editor, q=True,
                                                                              imageBaseColor=True) < 0.9)

                self.dimImage = pm.floatSlider(minValue=0.0, maxValue=1.0,
                                               value=pm.textureWindow(self.editor, q=True, imageBaseColor=True)[0],
                                               cc=self.dim_image_attr, dc=self.dim_image_attr)
예제 #32
0
 def buildBody(self, nodeName):
     self.thisNode = pm.PyNode(nodeName)
     pa = Corona.passes.getAOVs()
     typeid = self.thisNode.passType.get()
     self.passTypeName = pa[typeid]
     self.beginLayout("Corona Pass" ,collapse=0)
     self.beginNoOptimize()
     self.addControl("mapChannel", "Map Channel")
     pm.popupMenu()
     pm.menuItem()
     self.addControl("elementType", "Element Type")
     self.addControl("minDepth", "Min Depth")
     self.addControl("maxDepth", "Max Depth")
     self.callCustom( self.componentsNew, self.componentsReplace, "components")
     self.addSeparator()
     self.endNoOptimize()
     self.endLayout()
     
예제 #33
0
 def buildBody(self, nodeName):
     self.thisNode = pm.PyNode(nodeName)
     pa = Corona.passes.getAOVs()
     typeid = self.thisNode.passType.get()
     self.passTypeName = pa[typeid]
     self.beginLayout("Corona Pass", collapse=0)
     self.beginNoOptimize()
     self.addControl("mapChannel", "Map Channel")
     pm.popupMenu()
     pm.menuItem()
     self.addControl("elementType", "Element Type")
     self.addControl("minDepth", "Min Depth")
     self.addControl("maxDepth", "Max Depth")
     self.callCustom(self.componentsNew, self.componentsReplace,
                     "components")
     self.addSeparator()
     self.endNoOptimize()
     self.endLayout()
예제 #34
0
 def buildNetworkAOVs(self, nodeAttr, aovList):
     '''
     Populate the UI with an attrNavigationControlGrp for each AOV in the network
     '''
     for aov in aovList:
         if aov.name in self.networkAOVs:
             at = self.getAOVAttr(nodeAttr, aov.name)
             #at = nodeAttr[aov.index]
             #at.aovName.set(aov.name)
             ctrl = pm.cmds.attrNavigationControlGrp(at=at.aovInput.name(),
                                                     label=aov.name)
             self._msgCtrls.append(ctrl)
             pm.popupMenu(parent=ctrl)
             pm.menuItem(subMenu=True, label="Goto Node")
             for node in self.aovNodes[aov.name]:
                 pm.cmds.menuItem(
                     label=node.name(),
                     command=lambda arg, node=node: pm.select(node))
예제 #35
0
    def __populate(cls, root_menu, parent):
        # Delete old items
        pm.popupMenu(cls.NAME, mm=1, e=1, dai=1)
        # Populate menu based on selection
        selection = pm.selected()
        if not selection:
            return

        if cls.MODE == cls.Modes.RIGGER.value:
            if luna_rig.Control.is_control(selection[-1]):
                cls.__add_rigger_control_actions(root_menu, selection)
            elif isinstance(selection[-1], luna_rig.nt.Joint):
                cls.__add_joint_actions(root_menu, selection)
            elif isinstance(selection[-1], luna_rig.nt.Transform):
                cls.__add_transform_actions(root_menu, selection)
        else:
            if luna_rig.Control.is_control(selection[-1]):
                cls.__add_animator_control_actions(root_menu, selection)
예제 #36
0
    def customCreateRgb(self, attr):
        pname = attr.split('.')[-1]
        ptype = self.params[pname].ptype
        plabel = self.params[pname].label
        pann = self.params[pname].annotation
        presets = self.params[pname].presets
        controlName = pname + 'Ctrl'

        l = plabel
        if presets is not None:
            l += ' <span>&#8801;</span>' # fix unicode problem in Windows using html
        pm.attrColorSliderGrp(controlName, attribute=attr, label=l, annotation=pann)
        if presets is not None:
            # pm.attrColorSliderGrp(controlName, edit=True)
            # pm.popupMenu()
            attrChildren = pm.layout(controlName, query=True, childArray=True)
            pm.popupMenu(button=1, parent=attrChildren[0])
            for k in sorted(presets):
                pm.menuItem(label=k, command=pm.Callback(setPresetRgb, controlName, presets[k]))
예제 #37
0
 def buildPopupMenu(self, menu, parent):
     if self.outputsChanged:
         pm.popupMenu(self.popupMenu, edit=True, deleteAllItems=True)
         pm.cmds.menuItem(parent=menu,
                          label='Select AOV Node',
                          c=lambda *args: pm.select(self.aov.node))
         pm.cmds.menuItem(parent=menu,
                          label='Remove AOV',
                          c=lambda *args: self.parent.removeAOV(self.aov))
         pm.cmds.menuItem(parent=menu,
                          label='Add New Output Driver',
                          c=lambda *args: self.addOutput())
         pm.cmds.menuItem(parent=menu, divider=True)
         if len(self.outputs) > 1:
             for i, outputRow in enumerate(self.outputs):
                 subMenu = pm.cmds.menuItem(parent=menu,
                                            label='Output Driver %d' %
                                            (i + 1),
                                            subMenu=True)
                 pm.cmds.menuItem(parent=subMenu,
                                  label='Select Driver',
                                  c=pm.Callback(pm.select,
                                                outputRow.driverNode))
                 pm.cmds.menuItem(parent=subMenu,
                                  label='Select Filter',
                                  c=pm.Callback(pm.select,
                                                outputRow.filterNode))
                 pm.cmds.menuItem(parent=subMenu, divider=True)
                 pm.cmds.menuItem(parent=subMenu,
                                  label='Remove',
                                  c=pm.Callback(self.removeOutput, i))
         elif len(self.outputs) == 1:
             outputRow = self.outputs[0]
             pm.cmds.menuItem(parent=menu,
                              label='Select Driver',
                              c=pm.Callback(pm.select,
                                            outputRow.driverNode))
             pm.cmds.menuItem(parent=menu,
                              label='Select Filter',
                              c=pm.Callback(pm.select,
                                            outputRow.filterNode))
         self.outputsChanged = False
     return menu
예제 #38
0
	def _UI(self):
		if pm.window("mainWin",exists=1):
			pm.deleteUI("mainWin",window=1)
		
		w=280
		
		window=pm.window("mainWin",t="Shuffle Slice Tool",s=0,mb=1,mnb=0,mxb=0,rtf=1,w=w)
		pm.columnLayout("mainColumn",p="mainWin",columnAttach=('both', 2), rowSpacing=10, columnWidth=w)
		pm.text("warningText",p="mainColumn",l="---===Select something to slice===---",al="center")
		pm.intSliderGrp("colsSlider",p="mainColumn",cw3=(30,45,50),field=True,label='Parts',minValue=1,fieldMinValue=1,value=1,fs=1,ss=1)
		pm.radioButtonGrp("radioBtnGrp",l=" ",labelArray2=['List', 'Group'],cw3=[60,90,80],numberOfRadioButtons=2,sl=1)
		
		pm.textScrollList("listScroll",p="mainColumn",numberOfRows=5, allowMultiSelection=False,sc=self.selPart)
		pm.popupMenu("listPopUp",p="listScroll")
		pm.menuItem(p="listPopUp",l="Create Group for the parts",c=self.groupPartsFunc)
		
		pm.button(p="mainColumn",l="Shuffle Slice",c=self.shuffleSlice)
		

		pm.showWindow("mainWin")
예제 #39
0
 def _build(self):
     menu = pm.popupMenu(MENU_NAME,
                         mm=1,
                         b=2,
                         aob=1,
                         ctl=1,
                         alt=1,
                         sh=0,
                         p="viewPanes",
                         pmo=1,
                         pmc=self._buildMarkingMenu)
예제 #40
0
 def _build(self):
     '''Creates the marking menu context and calls the _buildMarkingMenu() method to populate it with all items.'''
     menu = pm.popupMenu(MENU_NAME,
                         markingMenu=True,
                         button=1,
                         allowOptionBoxes=True,
                         ctrlModifier=False,
                         altModifier=False,
                         shiftModifier=False,
                         parent="viewPanes",
                         postMenuCommandOnce=True,
                         postMenuCommand=self._build_marking_menu)
예제 #41
0
 def customCreateRgb(self, attr):
     pname = attr.split('.')[-1]
     ptype = self.params[pname].ptype
     plabel = self.params[pname].label
     pann = self.params[pname].annotation
     presets = self.params[pname].presets
     l = plabel
     if presets is not None:
         l = unicode(plabel) + u' \u1392'
     self.controls[pname] = pm.attrColorSliderGrp(pname + 'Ctrl',
                                                  attribute=attr,
                                                  label=l,
                                                  annotation=pann)
     if presets is not None:
         pm.attrColorSliderGrp(self.controls[pname], edit=True)
         pm.popupMenu()
         for k in sorted(presets):
             pm.menuItem(label=k,
                         command=pm.Callback(setPresetRgb,
                                             self.controls[pname],
                                             presets[k]))
예제 #42
0
 def ec_face_mirror_gui(self):
     win_name = 'facemirrorgui'
     title = 'Face Mirror'
     size = (148, 84)
     if py.window(win_name, exists=True):
         py.deleteUI(win_name, window=True)
     window = py.window(win_name, title=title, widthHeight=size, menuBar=True, sizeable=False)
     face_frame = py.frameLayout('ctrl_frame', l='Mirror Faces', p=win_name)
     face_row = py.rowLayout(p=face_frame, numberOfColumns=2)
     face1_col = py.columnLayout('face1_col', p=face_row)
     face2_col = py.columnLayout('face2_col', p=face_row)
     py.button('nameButton', l='>>', c=py.Callback(self.check_tx), p=face1_col)
     py.textField('nameText', tx='Name of Mesh', p=face2_col)
     face2_row = py.rowLayout(p=face_frame, numberOfColumns=2)
     py.button('mirrorButton', l='Mirror Selection', p=face2_row, c=py.Callback(self.ec_face_mirror))
     py.popupMenu(p='mirrorButton', ctl=False, button=3)
     py.menuItem(l='Mirror XY', command=py.Callback(self.ec_face_mirror, axis='sz'))
     py.menuItem(l='Mirror YZ', command=py.Callback(self.ec_face_mirror, axis='sx'))
     py.menuItem(l='Mirror XZ', command=py.Callback(self.ec_face_mirror, axis='sy'))
     py.button('helpButton', l='Help', p=face2_row, c=py.Callback(self.ec_face_help))
     window.show()
예제 #43
0
    def _buildMenu(self, menu, parent):
        pm.popupMenu(self.menuName, e=True, dai=True)

        pm.menuItem(p=menu, l='Script Editor', c=pm.Callback(pm.mel.eval, 'ScriptEditor;'))
        pm.menuItem(p=menu, l='Node Editor', c=pm.Callback(pm.mel.eval, 'NodeEditorWindow;'))
        pm.menuItem(p=menu, l='Connection Editor', c=pm.Callback(pm.mel.eval, 'ConnectionEditor;'))
        pm.menuItem(p=menu, l='Outliner', c=pm.Callback(pm.mel.eval, 'OutlinerWindow;'))
        pm.menuItem(p=menu, d=True)
        pm.menuItem(p=menu, l='Paint Weights', c=pm.Callback(pm.mel.eval, 'ArtPaintSkinWeightsToolOptions;'))
        pm.menuItem(p=menu, d=True)

        for recentFile in pm.optionVar['RecentFilesList'][-3:]:
            pm.menuItem(p=menu, l=recentFile.split(os.sep)[-1], c=pm.Callback(pm.openFile, recentFile, force=True))

        self._buildControlMenu(menu, parent)
        self._buildJointMenu(menu, parent)
        self._buildColorMenu(menu, parent)
        self._buildTransformMenu(menu, parent)
        self._buildSkinningMenu(menu, parent)
        self._buildDisplayMenu(menu, parent)
        self._buildProjectMenu(menu, parent)
        self._buildTargetMenu(menu, parent)
예제 #44
0
    def makePopup(self):
        self.projPopUp = pm.popupMenu(parent=self.widgetName)
        pm.menuItem(label='new project', c=self.newProjectCallback)

        allProjects = database.getAllProjects()

        for proj in allProjects:
            if not self.projectName:
                self.projectName = proj['projectName']
                database.setCurrentProject(self.projectName)
                self.changeProjectCallBack(self.projectName)

            pm.menuItem(label=proj['projectName'], c=lambda x, y=proj['projectName']: self.changeProjectCallBack(y))
예제 #45
0
    def build_menu(self, menu, panel):
        '''
        Resets the menu, then builds all menu items based on the node and adds them to the context menu

        Args:
            menu (ui.PopupMenu): menu to add items to
            panel (ui.Panel): The active model panel, generally the active viewport
        '''
        self.reset_menu()

        pm.dagObjectHit(mn=self.menu)
        dag_menu = pm.popupMenu(self.menu, q=True, itemArray=True)

        context_pynode = None
        if dag_menu:
            context_obj = pm.menuItem(dag_menu[0], q=True, l=True).strip(".")
            context_pynode = pm.PyNode(context_obj)

        sel_node = pm.ls(sl=True)[-1] if pm.ls(sl=True) else None

        pm.popupMenu(self.menu, e=True, deleteAllItems=True)
        if context_pynode:
            self.node = context_pynode
        elif sel_node:
            self.node = sel_node

        if self.node:
            node_simple_name = self.node.name().split('|')[-1]
            #pm.inViewMessage(assistMessage = node_simple_name, position = "topCenter", fade = True, fontSize = 10, fst = 2000, dragKill = False)
            rig_menu = pm.menuItem(label=node_simple_name,
                                   parent=self.menu,
                                   rp="N")
            if not metadata.meta_properties.get_properties_dict(self.node).get(
                    metadata.meta_properties.ControlProperty):
                # Build our Context Menu if we've found a dag object
                self.menu_dict['properties'] = self.build_property_menu()
            else:
                self.menu_dict['rigging'] = self.build_rig_component_menu()
예제 #46
0
    def populate_library_layout(self):

        pm.setParent(self.widgets['library_vertical'])
        self.widgets['library_vertical'].clear()        
        
        treeViewSelected =  pm.treeView (self.widgets["directory_treeView"], q=True, selectItem=True)
        
        if not treeViewSelected:
            return
        
        pm.scrollLayout(cr=True)
        pm.rowColumnLayout(numberOfColumns=4)

        path = os.path.abspath(treeViewSelected[0])
        
        pose_paths = []
        for dir in os.listdir(path):
             if dir.find(self.library_objects_suffix[0]) != -1: #.pose 
                 pose_paths.append(os.path.abspath(os.path.join(path, dir)))        
                
        for pose_path in pose_paths:
            pose_obj = Pose(pose_path)
            
            infos = pose_obj.get_info()
            label = infos['name'].split('.')[0]
            image = pose_obj.thumbnail_path
            
            pm.columnLayout(adj=True)

            pm.iconTextButton( w=80, h=80, style='iconOnly', image=image, label=label, c=pm.Callback(self.library_button_load_pose, pose_obj))
            pm.popupMenu()
            pm.menuItem(label='Save Pose', c=pm.Callback(self.library_button_save_pose, pose_obj))        
            pm.menuItem(label='Load Pose', c=pm.Callback(self.library_button_load_pose, pose_obj))
            pm.text(label, bgc=[0.1,0.1,0.1])
            
            pm.setParent('..')
 
        self.widgets["library_vertical"].redistribute()
예제 #47
0
 def new(self, plug):
     plug = pm.Attribute(plug)
     with pm.ui.UITemplate("attributeEditorTemplate"):
         with pm.rowLayout(numberOfColumns=3, adjustableColumn=2) as self._coordsysLayout:
             if not self.attr.label:
                 label = pm.interToUI(self.attr.longname)
             else:
                 label = self.attr.label
             pm.text(label=label, annotation=self.attr.help)
             self._coordsys = pm.textField(annotation=help)
             self._browserButton = pm.symbolButton(image="coordsys.png", annotation=self.attr.help)
             self._popupMenu = pm.popupMenu(parent=self._browserButton, button=1)
     
     self.replace(str(plug))
예제 #48
0
 def drawPopup(self):
     """
     """
     self.deletePopup()
     
     with pm.popupMenu(parent='viewPanes', ctl=True, alt=True, button=1, mm=True) as mm:
         for posId, (label, item) in self.menuItems.items():
             print posId
             if posId < 8:
                 pm.menuItem(l=label, rp=getRadialPos(posId))
             else:
                 pm.menuItem(l=label)
                 
     self.popupMenu = mm
예제 #49
0
def Control_MM_UI():

    if pm.popupMenu('ControlMenu', ex=1):
        pm.deleteUI('ControlMenu')

    CtlMenu = pm.popupMenu('ControlMenu',
                           mm=1,
                           b=(1),
                           aob=1,
                           ctl=0,
                           alt=0,
                           sh=0,
                           p="ControlBase",
                           pmo=1)

    pm.menuItem(p=CtlMenu,
                l="Ctrl At Each Piv",
                rp="SW",
                c="print 'SouthWest'")
    pm.menuItem(p=CtlMenu,
                l="Ctrl At Ctr",
                rp="NE",
                c="pm.circle(n = 'pSolid_Ctrl')")
예제 #50
0
파일: transfer.py 프로젝트: jzboylxj/XDLibs
 def template_item_list(self):
     frame_layout = pm.frameLayout(label="Output Frame", mh=5, w=504)
     pm.textFieldGrp("namespaceField",
                     adj=2,
                     label="Namespace:",
                     cw2=[80, 200],
                     text=self.namespace,
                     cc=lambda *args: self.set_namespace())
     pm.textFieldButtonGrp("outputPathField",
                           label="Output Path:",
                           bl="Set Path",
                           adj=2,
                           text=self.output_path,
                           cw3=[80, 200, 100],
                           bc=lambda *args: self.set_output_location())
     pm.textScrollList("outputItemScrollList", a=self.output_items)
     pm.popupMenu()
     pm.menuItem(label=u"载入数据", c=lambda *args: self.load_dict_data())
     pm.menuItem(label=u"移除选择", c=lambda *args: self.remove_selected_item())
     pm.menuItem(label=u"移除所有", c=lambda *args: self.remove_all_item())
     pm.button(label="Build", c=lambda *args: self.write_output())
     pm.setParent("..")
     return frame_layout
예제 #51
0
    def initialiseLayout(self):
        
        #=======================================================================
        # Define Top Level Layout
        #=======================================================================
        self.widgets['top_level_layout'] = pm.verticalLayout(w=self.windowWidth, h=self.windowHeight)
        
        #=======================================================================
        # OVERALL LAYOUT
        #=======================================================================
        h = pm.horizontalLayout(ratios=[1,3])
        
        pm.setParent(h)
        v2 = pm.verticalLayout(ratios=[1, 20, 1, 10])

        pm.setParent(v2)
        pm.text(label="Directory", bgc=[0.1,0.1,0.1])
        
        pm.setParent(v2)
        self.widgets["directory_vertical"] = pm.verticalLayout(bgc=[0.2,0.2,0.2])
        pm.popupMenu()
        pm.menuItem(label='Create New Directory', c=pm.Callback(self.create_new_directory_prompt))
        pm.menuItem(label='Refresh', c=pm.Callback(self.populate_directory_layout))
        self.populate_directory_layout()
        
        pm.setParent(v2)
        pm.text(label="Selection Set", bgc=[0.1,0.1,0.1])
        
        pm.setParent(v2)
        self.widgets['selectionSet_vertical'] = pm.verticalLayout(bgc=[0.2,0.2,0.2])
        pm.popupMenu()
        pm.menuItem(label='Create New Selection Set', c=pm.Callback(self.create_new_selection_prompt))
        pm.menuItem(label='Refresh', c=pm.Callback(self.populate_selection_layout))        
        self.populate_selection_layout()
        
        pm.setParent(h)
        v = pm.verticalLayout(ratios=[1, 6, 10])
        pm.setParent(v)        
        self.widgets["namespace_horizontal"] = pm.horizontalLayout(ratios = [2,5,1], bgc=[0.3,0.3,0.4])
        self.populate_namespace_horizontal()        

        pm.setParent(v)        
        self.widgets["detail_vertical"] = pm.verticalLayout(bgc=[0.2,0.2,0.3])
        self.populate_detail_layout()
        
        pm.setParent(v)
        self.widgets["library_vertical"] = pm.verticalLayout(bgc=[0.3,0.2,0.2])
        pm.popupMenu()
        pm.menuItem(label='Create New Pose', c=pm.Callback(self.create_new_pose_prompt))
        pm.menuItem(label='Refresh', c=pm.Callback(self.populate_library_layout))        
        self.populate_library_layout()
        
        v.redistribute()
        v2.redistribute()
        h.redistribute()
        
        self.widgets['top_level_layout'].redistribute()
예제 #52
0
    def test_rowGroupLayout(self):
        self.assertEqual(pm.currentParent(), self.win)
        self.assertEqual(pm.currentMenuParent(), None)
        with pm.textFieldButtonGrp(label='Label',
                                   text='Text',
                                   buttonLabel='Button') as tfbg:
            self.assertEqual(pm.currentParent(), tfbg)
            self.assertEqual(pm.currentMenuParent(), None)
            cmds.button()
            with pm.popupMenu() as m:
                self.assertEqual(pm.currentParent(), tfbg)
                self.assertEqual(pm.currentMenuParent(), m)
                with pm.menuItem(subMenu=1) as sm:
                    self.assertEqual(pm.currentParent(), tfbg)
                    self.assertEqual(pm.currentMenuParent(), sm)
                self.assertEqual(pm.currentParent(), tfbg)
                self.assertEqual(pm.currentMenuParent(), m)
            self.assertEqual(pm.currentParent(), tfbg)
        self.assertEqual(pm.currentParent(), self.win)

        fl = pm.formLayout()
        tfbg2 = pm.textFieldButtonGrp(label='Label',
                                      text='Text',
                                      buttonLabel='Button')
        self.assertEqual(pm.currentParent(), fl)
        with pm.columnLayout() as cl:
            cmds.button()
            with pm.popupMenu() as m:
                self.assertEqual(pm.currentParent(), cl)
                self.assertEqual(pm.currentMenuParent(), m)
                with pm.menuItem(subMenu=1) as sm:
                    self.assertEqual(pm.currentParent(), cl)
                    self.assertEqual(pm.currentMenuParent(), sm)
                self.assertEqual(pm.currentParent(), cl)
                self.assertEqual(pm.currentMenuParent(), m)
            self.assertEqual(pm.currentParent(), cl)
        self.assertEqual(pm.currentParent(), fl)
예제 #53
0
def _updateFileHistoryPopup( control, popup, optionName, basename=False ):

    historyList = pm.optionVar.get( 'pathHistory_%s' % optionName, [] )

    if isinstance( historyList, pm.OptionVarList ):
        historyList = list( historyList )
    elif historyList:
        historyList = [historyList]

    pm.popupMenu( popup, edit=True, deleteAllItems=True )

    if historyList:

        for path in historyList:

            pm.setParent( popup, menu=True )
            pm.menuItem ( label=path.replace( '/', '\\' ), command=pm.Callback( control.setText, ( path ) ) )

    if not basename:
        pm.setParent( popup, menu=True )
        pm.menuItem( divider=True )
        pm.menuItem( label='go to folder',
                  command=lambda *args: utils.revealInFileManager( _Path( control.getText() ) )
                  )
예제 #54
0
 def customCreateFlt(self, attr):
     print "creating %s" % attr
     pname = attr.split('.')[-1]
     ptype = self.params[pname].ptype
     plabel = self.params[pname].label
     pann = self.params[pname].annotation
     presets = self.params[pname].presets
     precision = self.params[pname].precision
     l = plabel
     if presets is not None:
         l = unicode(plabel) + u' \u1392'
     self.controls[pname] = pm.attrFieldSliderGrp(pname + 'Ctrl',
                                                  attribute=attr,
                                                  label=l,
                                                  annotation=pann,
                                                  precision=precision)
     if presets is not None:
         pm.attrFieldSliderGrp(self.controls[pname], edit=True)
         pm.popupMenu()
         for k in sorted(presets, key=presets.get):
             pm.menuItem(label=k,
                         command=pm.Callback(setPresetFlt,
                                             self.controls[pname],
                                             presets[k]))
예제 #55
0
 def create_menu(self):
     '''
     Create's the base menu associated to the current model panel(which should always be the active viewport)
     '''
     model_panel_list = pm.getPanel(type='modelPanel')
     visible_panel_list = pm.getPanel(vis=True)
     self.model_panel = [
         x for x in model_panel_list if x in visible_panel_list
     ][0]
     self.menu = pm.popupMenu(p=self.model_panel,
                              button=1,
                              alt=True,
                              ctl=True,
                              mm=True,
                              pmc=self.build_menu)
 def test_nestedMenu(self):
     self.assertEqual(pm.currentParent(), self.win)
     self.assertEqual(pm.currentMenuParent(), None)
     with ui.ColumnLayout() as cl:
         self.assertEqual(pm.currentParent(), cl)
         self.assertEqual(pm.currentMenuParent(), None)
         cmds.button()
         with pm.popupMenu() as m:
             self.assertEqual(pm.currentParent(), cl)
             self.assertEqual(pm.currentMenuParent(), m)
             with ui.MenuItem(subMenu=1) as sm:
                 self.assertEqual(pm.currentParent(), cl)
                 self.assertEqual(pm.currentMenuParent(), sm)
             self.assertEqual(pm.currentParent(), cl)
             self.assertEqual(pm.currentMenuParent(), m)
         self.assertEqual(pm.currentParent(), cl)
     self.assertEqual(pm.currentParent(), self.win)
예제 #57
0
	def _UI(self):
		if pm.window("blendshapeWin",exists=1):
			pm.deleteUI("blendshapeWin",window=1)
		w=450
		w2=190
		
		self.window=pm.window("blendshapeWin",t="BlendShape Tools",s=0,mb=1,rtf=1,w=w)
		h=pm.window("blendshapeWin",q=1,h=1)
		
		pm.columnLayout("mainColumn",p="blendshapeWin",columnAttach=('both', 2), rowSpacing=10, columnWidth=w)
		
		pm.button(p="mainColumn",l="abSymMesh",c=self.abSymMeshFunc)
		pm.button(p="mirrorSepShapeFrame",l="Mirror Shape",c=self.mirrorSepratedShapes)
		
		
		# ----------------------------------------------------------------------------------------

		pm.frameLayout("updateShapeFrame",p="mainColumn", label='Update Shapes', borderStyle='in',cll=1,cc=self.resizeWin4UpdateShape,ec=self.resizeWin4UpdateShape)
		pm.rowLayout("ShapeNamesRow",p="updateShapeFrame",w=w,numberOfColumns=3,columnWidth3=(w2,30,w2),adjustableColumn=2, columnAlign3=[('center'),('center'),('center')], columnAttach=[(1, 'both', 1), (2, 'both', 0), (3, 'both',5)])
		pm.button(p="ShapeNamesRow",l="New Shapes",c=self.newShapeList)
		pm.text(p="ShapeNamesRow",l=" ")
		pm.button(p="ShapeNamesRow",l="Current Shapes",c=self.curShapeList)
		
		pm.rowLayout("shapeListRow",p="updateShapeFrame",w=w,numberOfColumns=3,columnWidth3=(30,30,30),adjustableColumn=2, columnAlign3=[('center'),('center'),('center')], columnAttach=[(1, 'both', 1), (2, 'both', 0), (3, 'both',5)])
		pm.textScrollList("newShapeList",p="shapeListRow",w=w2,numberOfRows=8, allowMultiSelection=True)
		pm.popupMenu("newShapelistPopUp",p="newShapeList")
		pm.menuItem(p="newShapelistPopUp",l="Add To List",c=self.newShapeList)
		pm.menuItem(p="newShapelistPopUp",l="Remove All From List",c=self.rmvAllFromNewList)

			
		self.button=pm.button(p="shapeListRow",l="update",c=self.updateShape)
		
		pm.textScrollList("curShapeList",p="shapeListRow",w=w2,numberOfRows=8, allowMultiSelection=True)
		pm.popupMenu("curShapelistPopUp",p="curShapeList")
		pm.menuItem(p="curShapelistPopUp",l="Add To List",c=self.curShapeList)
		pm.menuItem(p="curShapelistPopUp",l="Remove All From List",c=self.rmvAllFromCurList)

		#---------------------------------------------------------------------

		pm.frameLayout("stripShapesFrame",p="mainColumn", label='Strip Shapes', borderStyle='in',cll=1,cc=self.resizeWin4StripShape,ec=self.resizeWin4StripShape)
		pm.button(p="stripShapesFrame",l="Get BlendShapes",c=self.getBlendShapes)
		pm.rowLayout("stripShapesRow",p="stripShapesFrame",w=w,numberOfColumns=2,columnWidth2=(30,30),adjustableColumn=2, columnAlign2=[('center'),('center')], columnAttach=[(1, 'both', 0), (2, 'both', 0)])
		pm.textScrollList("blendshapeList",p="stripShapesRow",w=140,numberOfRows=8, allowMultiSelection=False,sc=self.getTargetShapes)
		pm.popupMenu("blendShapeListPopUp",p="blendshapeList")
		pm.menuItem(p="blendShapeListPopUp",l="Remove All From List",c=self.rmvAllFromblendShapeList)
		
		pm.textScrollList("targetShapeList",p="stripShapesRow",w=140,numberOfRows=8, allowMultiSelection=True)	

		self.button=pm.button(p="stripShapesFrame",l="Strip Shapes",c=self.stripShapes)

		
		pm.showWindow(self.window)
예제 #58
0
 def menus(self):
     
     # popUpMenu
     self.popUp = pm.popupMenu( parent = self.scrollField )
     #opening the file
     self.commentFile = open(self.fileName, 'r')
     # reading
     self.comments =  self.commentFile.readlines()
     # closing
     self.commentFile.close()
     
     # the label is the first line
     # the actual comment is after the label
     # so the pattern is label, comment, label, comment, label, comment
     label = 0
     comment = 1
     pm.menuItem( label = 'Clear' , command = pm.Callback(self.clear))
     pm.menuItem( label = 'Custom' , command = pm.Callback(self.custom))
     while comment < len(self.comments):
         # menuItems for the popUpMenu
         write = self.comments[comment]
         pm.menuItem(label = self.comments[label], command = pm.Callback(self.insertText,  write))
         label += 2
         comment += 2