예제 #1
0
def gui():
	global txt_list
	
	if (cmds.window(win, q=True, ex=True)):
		cmds.deleteUI(win)
		
	cmds.window(win, w=170)
	main_layout= cmds.columnLayout(adj=True)
	
	cmds.paneLayout(cn='vertical2', w=width)
	txt_list = cmds.textScrollList(w=width, a=test_list)
	
	cmds.columnLayout(adj=True, w=width/2)
	cmds.button(l='Move Up', w=width/1.5, c=scriptname + '.move_up()')
	cmds.button(l='Move Down', w=width/1.5, c=scriptname + '.move_down()')
	cmds.button(l='Delete', w=width/1.5, c=scriptname + '.remove_item()')
	
	cmds.text(l='Sort')
	cmds.button(l='ABC', w=width/1.5, c=scriptname + '.sort_abc()')
	cmds.button(l='Type', w=width/1.5)
	cmds.button(l='Default', w=width/1.5, c=scriptname + '.sort_default()')
	cmds.setParent(main_layout)
	
	cmds.separator(w=width, h=5)
	cmds.text(l='Create')
	
	cmds.rowColumnLayout(nc=2)
	cmds.button(l='pmAvg', w=width/4)
	cmds.button(l='multDiv', w=width/4)
	
	cmds.showWindow(win)
예제 #2
0
def userGuide(*argv):
    
    if cmds.window("UserGuideWindow", exists = True):
        cmds.deleteUI("UserGuideWindow")
        
    window = cmds.window("UserGuideWindow",title = "User Guide for Galaxy Modifier v0.2", w = 600,  
                         minimizeButton = True, maximizeButton = False, sizeable = True) 
    
    cmds.paneLayout()
    
    cmds.textScrollList( "guideInfo", allowMultiSelection = False, 
                         append=[ "//    作者:李宏杰",
                                  "//    星系编辑脚本,版本V0.1,20150415",
                                  "//    脚本主页:http://lhj.nkco.org/?p=1173", 
                                  "",
                                  "*使用步骤:",
                                  "    1、使用Maya打开随脚本一起下载的MyGalaxy.mb,同时把脚本放到Maya的脚本目录下,", 
                                  "        例如 C:\Users\Lee\Documents\maya\2015-x64\zh_CN\scripts;", 
                                  "    2、在Maya的Python命令框输入以下语句,并拖动到工具栏:",
                                  "        import MyGalaxy", 
                                  "        reload(MyGalaxy)", 
                                  "        MyGalaxy.createUI()", 
                                  "    3、自由调节各参数至获得满意效果即可。", 
                                  "", 
                                  "*参数说明:(模型中的星系由两层粒子组成,一层代表星星,一层代表星云)", 
                                  "    Scale Factor: 按比例放大/缩小;", 
                                  "    Galaxy Color:星系的主体颜色。星系的颜色会以该颜色为基色随机。", 
                                  "    Star Count:星星的数量;", 
                                  "    Star Radius:星星的密度(多点半径);", 
                                  "    Cloud Radius:星云的粒子半径;", 
                                  "    Star Opacity, Cloud Opacity:星星/星云的透明度;"]
                         )    
    
    cmds.showWindow(window)
예제 #3
0
def view_outliner(floating=False):
    """
    Toggle the outliner on as a dock window to the right side of the viewport,
    if floating is ture then toggle outliner to a floating window.

    makes sure to delete the dockControl UI when visibility is lost to
    ensure the name is available for maya.

    .. old::
        panel_window = 'outlinerPanel1Window'
        if cmds.window(panel_window, q=True, exists=True):
            cmds.deleteUI(panel_window, window=True)
        else:
            panel = cmds.getPanel(withLabel='Outliner')
            cmds.outlinerPanel(panel, e=True, tearOff=True)
    """
    # Constants
    TABLAYOUT = "MAM_TAB_LAYOUT"
    DOCK_CONTROL_OUTLINER = "MAM_DOCK_CONTROL_OUTLINER"

    if not cmds.paneLayout(TABLAYOUT, q=True, ex=True):
        cmds.paneLayout(TABLAYOUT, p="viewPanes")  # mel.eval('$tmp = $gMainWindow'))

    # Creat or show outliner.
    if not cmds.dockControl(DOCK_CONTROL_OUTLINER, q=True, ex=True):
        cmds.dockControl(
            DOCK_CONTROL_OUTLINER,
            label="Outliner",
            width=280,
            content=TABLAYOUT,
            allowedArea=["left", "right"],
            area="right",
        )

    # Tear it off or dock it depending on floating arg.
    vis_state = cmds.dockControl(DOCK_CONTROL_OUTLINER, q=True, vis=True)
    fl_state = cmds.dockControl(DOCK_CONTROL_OUTLINER, q=True, fl=True)
    cmds.dockControl(DOCK_CONTROL_OUTLINER, e=True, fl=floating)
    if vis_state and not fl_state == floating:
        pass
    else:
        cmds.dockControl(
            DOCK_CONTROL_OUTLINER, e=True, vis=not (cmds.dockControl(DOCK_CONTROL_OUTLINER, q=True, vis=True))
        )

    if not cmds.dockControl(DOCK_CONTROL_OUTLINER, q=True, vis=True):
        try:
            cmds.deleteUI(DOCK_CONTROL_OUTLINER)
        except RuntimeError:
            pass
    else:
        # Create outliner pane under tablayout if it's not there.
        outliner_window = "outlinerPanel1Window"
        if not cmds.control(outliner_window, q=True, ex=True):
            panel = cmds.getPanel(withLabel="Outliner")
            cmds.outlinerPanel(panel, e=True, p=TABLAYOUT)
            # cmds.control(outliner_window, e=True, p=TABLAYOUT)

    if floating:
        cmds.dockControl(DOCK_CONTROL_OUTLINER, e=True, height=600)
	def displayUI(self):
		
		windowName = 'LCMTUIWindow'
		if cmds.window(windowName, exists=True):
			cmds.deleteUI(windowName)
		window = cmds.window(windowName, menuBar = True,t="LCMT v3.1.1")
		fileMenu = cmds.menu( label='Manage Light Types')
		cmds.menuItem( label='Add More Light Types',command=lambda *args:self.addLightTypes()) 
		cmds.menuItem( label='See Current Light Types', command=lambda *args:self.displayLightTypes()) 
		cmds.menuItem( label='Reset Light Types to Default Values', command=lambda *args:self.resetLightTypesToDefault()) 
		
		cmds.paneLayout( configuration='vertical2' )
		lightStageColumn = cmds.columnLayout(adjustableColumn=True)
		cmds.text('Lights in the SCENE')
		lights = cmds.ls(dag =True,visible=True,lights=True, type='mentalrayIblShape')  
		lightList = cmds.iconTextScrollList(allowMultiSelection=True,  append=lights)
		cmds.rowLayout(numberOfColumns = 2)
		useGroupLights = cmds.checkBox( label='Group Lights', onCommand = lambda *args: self.updateScollList(True, lightList), offCommand = lambda *args: self.updateScollList(False, lightList))    
		cmds.checkBox( label='Save Images?', cc = lambda *args: self.toggleSaveImages())  
		cmds.setParent('..')
		cmds.iconTextScrollList(lightList,edit=True,selectCommand=lambda *args: cmds.select(self.getElementsFromLightScrollList(lightList,useGroupLights),vis=True))    
		cmds.button(label='Render Lights!', command = lambda *args: self.renderAllLights(self.getElementsFromLightScrollList(lightList,useGroupLights),cmds.checkBox(useGroupLights, query=True, value=True)))  
		cmds.setParent('..')
		renderLayersColumn = cmds.columnLayout(adjustableColumn=True)
		#new column    
		cmds.text('Geometry in the SCENE')
		geometry =  cmds.ls(geometry=True)
		#take out the ibl shapes from the geo selection
		geometry = list(set(geometry) - set(lights))   
		geoList = cmds.iconTextScrollList(allowMultiSelection=True, append=geometry,selectCommand=lambda *args: cmds.select(cmds.iconTextScrollList(geoList, query=True, si=True )) )
		cmds.text('Create Render Layers from selected geometry and lights')      
		cmds.button(label='Create Render Layers!', command = lambda *args: self.createLayersFromLights(cmds.iconTextScrollList(geoList, query=True, si=True ),self.getElementsFromLightScrollList(lightList,useGroupLights)))  
		cmds.setParent('..')
		cmds.showWindow()
예제 #5
0
def SelectionError(*args):
	WindowCheck = cmds.window(title = 'ERROR', widthHeight = (400, 100))
	CHECK = cmds.ls( selection=True )
	if len(CHECK) == 0:
		#cmds.error( "###     Please Select CHAR_HULL_BASE     ###" )
		cmds.paneLayout()
		cmds.scrollField(wordWrap=True, text='       ###     Please Select CHAR_HULL_GEO     ###')
		cmds.showWindow(WindowCheck)
		cmds.showSelectionInTitle(WindowCheck)
def FBXExporter_AnimationHelpWindow():
    ui_animHelpWindow = "ui_FBXExporter_AnimationHelpWindow"
    if cmds.window(ui_animHelpWindow, exists=True):
        cmds.deleteUI(ui_animHelpWindow)
        
    cmds.window(ui_animHelpWindow, s=True, width=500, height=500, menuBar=True, title="Help on Animation Export")
    cmds.paneLayout(configuration='horizontal4')
    cmds.scrollField(editable=False, wordWrap=True, text="Animation Export: \nAnimation export assumes single-level referencing with proper namesapce.\n\nActors: \nAll referenced characters with a origin joint tagged with the origin attribute will be listed in the Actor's field by their namespace. Please see the modeling help window for how to tage a character's origin with the origin attribute.\n\nExport Nodes:\nThe Export Nodes panel will fill in with export nodes connected to the origin of the selected actor from the Actor's field. Clicking on the New Export Node will create a new node. Each export node represents a seperate animation.\n\nExport:\nThe Export flag means the current export ndoe will be available for export. All nodes wihtout this checked will not be exported.\n\nMove to origin:\nNot yet supported\n\nSub Range:\nTurn this on to enable the sub-range option for the selected node. This will enable the Start Frame and End Frame fields where you can set the range for the specified animation. Otherwise, the animation will use the frame range of the file.\n\nExport File Name:\nClick on the Browse button to browse to where you want the file to go. The path will be project relative.\n\nExport Selected Animation:\nClick this button to export the animation selected in Export Nodes\n\nExport All Animations For Selected Character:\nClick this button to export all animations for the selected actor in the Actors filed. This flag will ignore what is selected in Export Nodes and export from all found nodes for the character\n\nExport All Animations:\nClick this button to export all animations for all characters. All selections will be ignored" )		
    
    cmds.showWindow(ui_animHelpWindow)
def FBXExporter_ModelHelpWindow():
    ui_modelHelpWindow = "ui_FBXExporter_ModelHelpWindow"
    if cmds.window(ui_modelHelpWindow, exists=True):
        cmds.deleteUI(ui_modelHelpWindow)
        
    cmds.window(ui_modelHelpWindow, s=True, width=500, height=500, menuBar=True, title="Help on Model Export")
    cmds.paneLayout(configuration='horizontal4')
    cmds.scrollField(editable=False, wordWrap=True, text="Model Export: \nModel exporter assumes one skeleton for export. Referencing for model export is not supported\n\nRoot Joints: \nPanel will list all the joints tagged with the \"origin\" attribute. If no joint is tagged with the attribute, it will list all joints in the scene and turn red. Select the root joint and click the Tag as Origin button.\n\nExport Nodes:\nThe Export Nodes panel will fill in with export nodes connected to the origin of the selected actor from the Actor's field. Clicking on the New Export Node will create a new node. Each export node represents a seperate character export (for example, seperate LOD's).\n\nMeshes:\nThe Meshes panel shows all the geometry associated with the selected export node. This can be used if you have mesh variations skinned to the same rig or LOD's.\n\nExport File Name:\nClick on the Browse button to browse to where you want the file to go. The path will be project relative.\n\nExport Selected Character:\nClick this button to export the character selected in Export Nodes\n\nExport All Characters:\nClick this button to export all character definitions for the skeleton. All selections will be ignored" )

    cmds.showWindow(ui_modelHelpWindow)
 def takePicture(self,*args):
     global screenShotPanelVar
     cmds.formLayout()
     cmas=cmds.columnLayout(adj=True)
     cmds.paneLayout(w=150,h=150)
     screenShotPanelVar=cmds.modelPanel(cam='persp',mbv=False)
     cmds.modelEditor(screenShotPanelVar,e=True,da='smoothShaded',hud=False,jx=False,dtx=True,grid=False)
     cmds.separator(p=cmas)
     cmds.button(l='SET AS PREVIEW',p=cmas, c=self.takePictureProcess)
     return
    def Dock_Win_Management(self, title="Defualt"):
        Title_Name = title

        def mayaToQT(name):
            # Maya -> QWidget
            ptr = omui.MQtUtil.findControl(name)
            if ptr is None: ptr = omui.MQtUtil.findLayout(name)
            if ptr is None: ptr = omui.MQtUtil.findMenuItem(name)
            if ptr is not None: return wrapInstance(long(ptr), QWidget)

        if self.DOCK == "undock":
            # undock 窗口
            # win = omui.MQtUtil_mainWindow()
            if mel.eval("getApplicationVersionAsFloat;") >= 2017:
                self.undockWindow = cmds.window(title=Title_Name,
                                                cc=self.Save_Json_Fun)
            else:
                self.undockWindow = cmds.window(title=Title_Name,
                                                rc=self.Save_Json_Fun)
            cmds.paneLayout()
            cmds.showWindow(self.undockWindow)
            ptr = mayaToQT(self.undockWindow)
            return ptr

        elif self.DOCK == "dock":
            window = cmds.window(title=Title_Name)
            cmds.paneLayout()
            self.dockControl = cmds.dockControl(
                area='right',
                fl=False,
                content=window,
                label=Title_Name,
                floatChangeCommand=self.Save_Json_Fun,
                vcc=self.Save_Json_Fun)

            # 显示当前面板
            cmds.evalDeferred("cmds.dockControl(\"" + self.dockControl +
                              "\",e=True,r=True)")

            dock = mayaToQT(window)
            return dock

        elif self.DOCK == "workspace":
            name = title
            self.workspaceCtrl = cmds.workspaceControl(
                name,
                tabToControl=["ChannelBoxLayerEditor", 0],
                label=Title_Name,
                vcc=self.Save_Json_Fun)

            # 显示当前面板
            cmds.evalDeferred("cmds.workspaceControl(\"" + self.workspaceCtrl +
                              "\",e=True,r=True)")
            workspace = mayaToQT(self.workspaceCtrl)
            return workspace
예제 #10
0
 def rotate_layout(self):
     if cmds.paneLayout(self.m_pane, q=True, cn=True) == 'vertical2':
         self.node_pane_width = cmds.paneLayout(self.m_pane,
                                                q=True,
                                                paneSize=True)[0]
         if self.node_pane_width < 20:
             self.node_pane_width = 0
         cmds.paneLayout(self.m_pane,
                         e=True,
                         configuration='horizontal2',
                         paneSize=[(1, 100, self.node_pane_height),
                                   (2, 100, 100 - self.node_pane_height)])
     else:
         self.node_pane_height = cmds.paneLayout(self.m_pane,
                                                 q=True,
                                                 paneSize=True)[1]
         if self.node_pane_height < 20:
             self.node_pane_height = 0
         cmds.paneLayout(self.m_pane,
                         e=True,
                         configuration='vertical2',
                         paneSize=[(1, self.node_pane_width, 100),
                                   (2, 100 - self.node_pane_width, 100)])
     cmds.paneLayout(self.m_pane, e=True, swp=True, shp=True)
     return
예제 #11
0
 def _MakeModelPanel(self):
     window = cmds.window(widthHeight=(400, 400))
     cmds.paneLayout()
     panel = cmds.modelPanel()
     cmds.modelPanel(panel, edit=True, camera='top')
     cmds.modelEditor(cmds.modelPanel(panel, q=True, modelEditor=True),
                      edit=True,
                      displayAppearance='smoothShaded',
                      rnm='vp2Renderer')
     cmds.showWindow(window)
     return panel
예제 #12
0
def spreadSheetUI(*args):
    if cmds.window("sheetID", exists=True):
        cmds.deleteUI('sheetID')

    sheetID = cmds.window("sheetID",
                          t="Spread Sheet Editor",
                          widthHeight=(400, 300))
    cmds.paneLayout()
    activeList = cmds.selectionConnection(activeList=True)
    cmds.spreadSheetEditor(mainListConnection=activeList)
    cmds.showWindow(sheetID)
예제 #13
0
def getParentPanel():
    """return the parent panel """
    upPanel = cmds.getPanel(up=True)
    if cmds.panel(upPanel, q=True, ex=True):
        upPanelLayout = cmds.layout(upPanel, q=True, p=True)
        while not cmds.paneLayout(upPanelLayout, q=True, ex=True):
            upPanelLayout = cmds.control(upPanelLayout, q=True, p=True)
        if cmds.paneLayout(upPanelLayout, q=True, ex=True):
            return upPanelLayout
    else:
        return "viewPanes"
예제 #14
0
 def UI(self, meshes=[]):
     if cmds.window('CheckColorVertex', exists=True):
         cmds.deleteUI('CheckColorVertex', window=True)
     
     win = cmds.window('CheckColorVertex', t='Check Color Vertex')
     cmds.paneLayout()
     cmds.textScrollList('textScroll',
                         numberOfRows=8,
                         allowMultiSelection=True,
                         selectCommand=self.selectNode,
                         append=[str(mesh) for mesh in meshes])
     cmds.showWindow()
예제 #15
0
 def imageViewer(self):
         """
         Click thumbnail to see enlarged image
         """
         selectedImage=os.path.join(cmds.textField('location',q=True,tx=True),cmds.textScrollList('fileLister',q=True,
                                                                                                  si=True)[0]).split(" > ")[0]
         for each in ["jpg","png",'tif',"iff"]:
                 if selectedImage.endswith(each):
                         window = cmds.window(t="Image Viewer")
                         cmds.paneLayout()
                         cmds.image( image=selectedImage)
                         cmds.showWindow( window )
예제 #16
0
파일: key_ui.py 프로젝트: boochos/work
    def win(self):
        if cmds.window(self.intWinName, exists=True):
            cmds.deleteUI(self.intWinName, window=True)

        cmds.window(self.intWinName, menuBar=True, title=self.visWinName, width=400, height=650)
        self.buildMenuBar()
        cmds.paneLayout(configuration="horizontal2", h=100, ps=[1, 100, 25])
        self.buildNameContents()
        self.addControls()
        self.parseSceneNameAndPopulate()
        self.buildName()
        cmds.showWindow(self.intWinName)
예제 #17
0
def spreadSheetWin(self):
    if mel.window('autoProSpreadSheetWindow', exists=1):
        mel.deleteUI('autoProSpreadSheetWindow', window=1)

    window = mel.window('autoProSpreadSheetWindow',
                        title="autoPro SpreadSheet",
                        iconName="autoProSprSht",
                        widthHeight=(400, 300))
    mel.paneLayout()
    activeList = mel.selectionConnection(activeList=True)
    mel.spreadSheetEditor(mainListConnection=activeList)
    mel.showWindow('autoProSpreadSheetWindow')
예제 #18
0
def sjKillGUI():
	'''
	GUI guts
	'''
	global mainCol
	global tsl
	
	# mainCol = cmds.columnLayout( adjustableColumn=True )
	cmds.paneLayout()
	tsl = cmds.textScrollList( w=1200, h=180, ams=True,
		append=cmds.scriptJob(listJobs=True))
	'''
예제 #19
0
    def testObjectPosition(self):
        """
        Tests that an object created interactively is positioned correctly on
        the live surface.
        """
        # Load our reference assembly.
        UsdMaya.LoadReferenceAssemblies()

        # Create a new custom viewport.
        window = cmds.window(widthHeight=(500, 400))
        cmds.paneLayout()
        panel = cmds.modelPanel()
        cmds.modelPanel(panel, edit=True, camera='persp')
        cmds.modelEditor(cmds.modelPanel(panel, q=True, modelEditor=True),
                         edit=True,
                         displayAppearance='smoothShaded',
                         rnm='vp2Renderer')
        cmds.showWindow(window)

        # Force all views to re-draw. This causes us to block until the
        # geometry we're making live has actually been evaluated and is present
        # in the viewport. Otherwise execution of the test may continue and the
        # create tool may be invoked before there's any geometry there, in
        # which case the tool won't create anything.
        cmds.refresh()

        # Get the viewport widget.
        view = OMUI.M3dView()
        OMUI.M3dView.getM3dViewFromModelPanel(panel, view)
        viewWidget = wrapInstance(long(view.widget()), QWidget)

        # Make our assembly live.
        cmds.makeLive('Block_1')

        # Enter interactive creation context.
        cmds.setToolTo('CreatePolyTorusCtx')

        # Click in the center of the viewport widget.
        QTest.mouseClick(viewWidget, QtCore.Qt.LeftButton,
                         QtCore.Qt.NoModifier,
                         viewWidget.rect().center())

        # Find the torus (it should be called pTorus1).
        self.assertTrue(cmds.ls('pTorus1'))

        # Check the torus's transform.
        # The Block_1 is originally 1 unit deep and centered at the origin, so
        # its original top plane is aligned at z=0.5.
        # It is scaled 5x, which makes the top plane aligned at z=2.5.
        # Then it is translated along z by 4.0, so its top plane is finally
        # aligned at z=6.5.
        translate = cmds.xform('pTorus1', q=True, t=True)
        self.assertAlmostEqual(translate[2], 6.5, places=3)
예제 #20
0
파일: uvdeluxe.py 프로젝트: xbxcw/scripts
def createUI(*args):
    if mc.window('UVDeluxe', exists=True):
        #remove when not in dev mode
        mc.deleteUI('UVDeluxe')

    mc.window('UVDeluxe',
              s=True,
              width=440,
              title='UV Deluxe %s' % version,
              toolbox=False)

    #Create Scriptjobs
    jobNumber1 = mc.scriptJob(
        parent='UVDeluxe',
        event=['linearUnitChanged', lambda *args: updateUI('units_text')])

    ### Define texture panel ###
    # Figure out percentage
    pnSize = (220 / float(uis.widthHeight[0])) * 100

    try:
        #swp flag only available in 2011 and beyond
        pane = mc.paneLayout('textureEditorPanel',
                             paneSize=[1, pnSize, 1],
                             cn='vertical2',
                             swp=1)
    except:
        pane = mc.paneLayout('textureEditorPanel',
                             paneSize=[1, pnSize, 1],
                             cn='vertical2')

    uvTextureViews = mc.getPanel(scriptType='polyTexturePlacementPanel')
    if len(uvTextureViews):
        mc.scriptedPanel(uvTextureViews[0], e=True, unParent=True)

    #Load main ui elements#
    mc.columnLayout('MainColumn', columnWidth=220)
    ui_Settings(0)
    ui_Mover()
    ui_Scaler()
    ui_Ratio()
    ui_MatchUV()
    ui_Straighten()
    ui_Align()
    #ui_SelectionSet()
    ui_QuickSnap()

    #Add texture panel to window
    mc.scriptedPanel(uvTextureViews[0], e=True, parent=pane)

    # SHOW WINDOW #
    mc.showWindow('UVDeluxe')
    mc.window('UVDeluxe', edit=True, mnb=True, widthHeight=uis.widthHeight)
예제 #21
0
    def ui(self):
        '''
        Launch a UI to display the marks that were recorded.
        '''
        
        with utl.MlUi('ml_stopwatchReport', 'Stopwatch Report', width=400, height=400, info='''This is the report from the stopwatch you just ran.
Adjust the start frame, and then press the frame buttons to jump to that frame.
The fields on the right can be used for notes.''', menu=False) as win:

            self.uiSlider = mc.intSliderGrp(field=True, label='Start Frame', value=self.startFrame, 
                minValue=((-0.5*self.frameMarks[-1])+self.startFrame), maxValue=(self.frameMarks[-1]/2)+self.startFrame, 
                fieldMinValue=-1000, fieldMaxValue=1000,
                changeCommand=self.uiUpdateStartFrame)
                
            self.frameRateField = mc.intFieldGrp(label='Frame Rate', value1=self.frameRate, enable1=False, extraLabel='fps', annotation='')

            mc.scrollLayout()
            mc.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 50), (2, 80), (3, 340)])
            mc.text('Frame')
            mc.text('Duration')
            mc.text('Notes')

            for i in range(3):
                mc.separator(style='single', height=15)
            
            self.uiButton = list()
            
            for i in range(len(self.frameMarks)):
                
                #frame button
                frame = self.frameMarks[i]+self.startFrame
                self.uiButton.append(mc.button(label=str(frame), annotation='Go to frame %i' % frame,command='import maya.cmds;maya.cmds.currentTime(%i,edit=True)' % frame))
              
                #duration text
                if i:
                    mc.text(label=str(self.frameMarks[i]-self.frameMarks[i-1]))
                else:
                    mc.text(label='Start')
                    
                #notes field
                mc.textField()
            
            #add the stop
            mc.text(label='')
            mc.text(label='Stop')
            mc.setParent('..')
            mc.setParent('..')
            
            #next and prev buttons!
            mc.paneLayout(configuration='vertical2',separatorThickness=1)
            mc.button(label='<< Previous', command=self.previousFrame, annotation='Go to the previous frame in the list.')
            mc.button(label='Next >>', command=self.nextFrame, annotation='Go to the next frame in the list.')
예제 #22
0
    def Cam_3_Model_Win_menu_MoDou(self):
        self.closeAllCamMenu()
        self.DeletePlane()
        self.SetRightSize()
        if mc.window('Cam_3_Model_Win_menu_MoDou', ex=True):
            mc.deleteUI('Cam_3_Model_Win_menu_MoDou')
        mc.window('Cam_3_Model_Win_menu_MoDou',
                  t='Cam_3_Model_Win_menu_MoDou',
                  wh=[500, 500],
                  sizeable=True,
                  rtf=True)
        form = mc.formLayout(numberOfDivisions=100)
        pane1 = mc.paneLayout('pane1',
                              w=150,
                              h=150,
                              configuration='single',
                              p=form,
                              aft=0,
                              st=1)
        pane2 = mc.paneLayout('pane2',
                              w=150,
                              h=150,
                              configuration='single',
                              p=form,
                              aft=0,
                              st=1)
        pane3 = mc.paneLayout('pane3',
                              w=150,
                              h=150,
                              configuration='single',
                              p=form,
                              aft=0,
                              st=1)

        mc.formLayout(form,
                      e=True,
                      attachForm=[(pane1, 'left', 1), (pane1, 'top', 1),
                                  (pane2, 'top', 1), (pane3, 'top', 1),
                                  (pane3, 'right', 1), (pane1, 'bottom', 1),
                                  (pane2, 'bottom', 1), (pane3, 'bottom', 1)],
                      attachPosition=[(pane1, 'left', 0, 0),
                                      (pane1, 'right', 0, 33),
                                      (pane2, 'left', 0, 33),
                                      (pane2, 'right', 0, 66),
                                      (pane3, 'left', 0, 66),
                                      (pane3, 'right', 0, 99)])

        self.AddSevenGroup_1()
        mm.eval('toggleModelEditorBarsInAllPanels 1;')
        mm.eval('toggleMenuBarsInAllPanels 0;')
        mc.showWindow('Cam_3_Model_Win_menu_MoDou')
        mc.window('Cam_3_Model_Win_menu_MoDou', e=True, wh=[607, 702])
예제 #23
0
    def centeredPivotsCheck(self):
        self.log('centeredPivotsCheck', prefix='Standard')

        #if the attribute has already been created there is no purpose in wasting the cycles to create it again.
        try:
            self.utilityObject.pivotsNotCenter
        except AttributeError:
            self.log('AttributeError -- Creating pivotsNotCenter class attr')
            #grabs method specific data and sets attr pivotsNotCenter to that hold that data
            self.utilityObject.pivotsNotCenter = self.utilityObject.pivotsCentered(
                self.utilityObject.sortedNodes)

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

        ##After script completion comment out this section.
        ##This section forces Maya to recreate the window dimensions each time
        if cmds.windowPref("pivotsNotCenter_Utility_Window", exists=True):
            cmds.windowPref("pivotsNotCenter_Utility_Window", remove=True)

        cmds.window("pivotsNotCenter_Utility_Window",
                    resizeToFitChildren=True,
                    widthHeight=self.popupWinWidthHeight)
        cmds.paneLayout(configuration='horizontal2', staticHeightPane=2)
        cmds.textScrollList(
            'pivotsNotCenter_textScroll',
            numberOfRows=8,
            allowMultiSelection=True,
            showIndexedItem=4,
            selectCommand=
            'import maya.cmds as cmds;\ncmds.select(cmds.textScrollList("pivotsNotCenter_textScroll", query = True, selectItem = True))'
        )
        for item in self.utilityObject.pivotsNotCenter:
            cmds.textScrollList('pivotsNotCenter_textScroll',
                                edit=True,
                                append=str(item))
        cmds.columnLayout(adjustableColumn=True)
        cmds.button(
            'pivotsNotCenter_Select',
            label='Select NonCentered Pivots',
            command=
            'import maya.cmds as cmds;cmds.select(clear = True);\nfor item in %r:\n cmds.select(item, add=True)'
            % self.utilityObject.pivotsNotCenter)
        cmds.button(
            'pivotsNotCenter_Button',
            label=("Count: %s  - Close Window" %
                   len(self.utilityObject.pivotsNotCenter)),
            command=
            'import maya.cmds as cmds; cmds.deleteUI("pivotsNotCenter_Utility_Window", window=True)'
        )
        cmds.setParent('..')
        cmds.showWindow()
예제 #24
0
def show(name=NAME, *args):
	cmds.paneLayout(mayaUI.channelPane, e=True, cn='horizontal3')

	# Main Layout
	if cmds.layout(name, exists=True):
		cmds.deleteUI(name)

	cmds.formLayout(name, p=mayaUI.channelPane)

	cmds.separator(st='none', h=PADDING)

	# Menu
	menuUI = PreferencesMenu().getUI()

	# Main Layout
	tab = cmds.tabLayout()

	keyUI = cmds.scrollLayout(cr=True)
	anim_mancer.tools.tweenKey.UI()
	cmds.setParent('..')

	motionTrailUI = anim_mancer.tools.motionTrail.ui()

	ghostUI = anim_mancer.tools.ghost.ui()
	noteUI = anim_mancer.tools.note.ui()
	refUI = refman.ui()

	# End UI
	cmds.setParent('..')  # end tab
	cmds.setParent('..')  # end form

	cmds.tabLayout(tab,
				   edit=True,
				   tabLabel=((keyUI, 'Tween'),
							 (motionTrailUI, 'Motion Trail'),
							 (noteUI, 'Notes'),
							 (ghostUI, 'Ghost'),
							 (refUI, 'Reference')
							 ))

	cmds.formLayout('animToolsChannelBoxUI', e=True,
					attachForm=[(tab, 'left', 0),
								(tab, 'bottom', 0),
								(tab, 'right', 0),
								(menuUI, 'left', 0),
								(menuUI, 'top', 0),
								(menuUI, 'right', 0),
								],
					attachControl=[[tab, 'top', 0, menuUI]]
					)

	return
예제 #25
0
def glBlast(name, startFrame, endFrame):
    mc.setAttr('defaultHardwareRenderGlobals.filename', name, type="string")
    #image settings
    mc.setAttr('defaultHardwareRenderGlobals.startFrame', startFrame)
    mc.setAttr('defaultHardwareRenderGlobals.endFrame', endFrame)
    mc.setAttr('defaultHardwareRenderGlobals.extension', 4)
    mc.setAttr('defaultHardwareRenderGlobals.imageFormat', 8)
    mc.setAttr('defaultHardwareRenderGlobals.fullImageResolution', 1)
    mc.setAttr('defaultHardwareRenderGlobals.resolution',
               'HD576 1024 576 1.778',
               type='string')
    mc.setAttr('defaultHardwareRenderGlobals.backgroundColor',
               0.5,
               0.5,
               0.5,
               type='double3')
    #motion blur
    mc.setAttr('defaultHardwareRenderGlobals.edgeSmoothing', 1)
    mc.setAttr('defaultHardwareRenderGlobals.lineSmoothing', 1)
    mc.setAttr('defaultHardwareRenderGlobals.multiPassRendering', 1)
    mc.setAttr('defaultHardwareRenderGlobals.renderPasses', 5)
    mc.setAttr('defaultHardwareRenderGlobals.antiAliasPolygons', 1)
    mc.setAttr('defaultHardwareRenderGlobals.motionBlur', 0.5)
    mc.setAttr('defaultHardwareRenderGlobals.backgroundColor',
               0.5,
               0.5,
               0.5,
               type='double3')
    #lighting
    mc.setAttr('defaultHardwareRenderGlobals.lightingMode', 1)
    mc.setAttr('defaultHardwareRenderGlobals.drawStyle', 3)
    mc.setAttr('defaultHardwareRenderGlobals.texturing', 1)

    currentPanel = mc.getPanel(wf=True)
    currentCamera = mc.modelEditor(currentPanel, q=True, camera=True)

    #=========================BROKEN RIGHT NOW=========================
    glWindow = mc.window()
    mc.paneLayout()
    mc.glRenderEditor(lookThru=currentCamera)
    mc.showWindow(glWindow)
    # mc.glRender(glWindow, renderSequence=True)
    #=========================BROKEN RIGHT NOW=========================

    print "playblast saved here: " + name + ".mov"

    mc.confirmDialog(title='Error',
                     message='Doesn\'t work yet!',
                     button=['Ok'],
                     defaultButton='Ok',
                     cancelButton='Ok',
                     dismissString='Ok')
예제 #26
0
def get_parent_panel():
    """
    Return current panels parent.
    """
    panel = cmds.getPanel(up=True)
    if cmds.panel(panel, q=True, ex=True):
        panel_layout = cmds.layout(panel, q=True, p=True)
        while not cmds.paneLayout(panel_layout, q=True, ex=True):
            panel_layout = cmds.control(panel_layout, q=True, p=True)
        if cmds.paneLayout(panel_layout, q=True, ex=True):
            return panel_layout
        else:
            return 'viewPanes'
예제 #27
0
def get_parent_panel():
    """
    Return current panels parent.
    """
    panel = cmds.getPanel(up=True)
    if cmds.panel(panel, q=True, ex=True):
        panel_layout = cmds.layout(panel, q=True, p=True)
        while not cmds.paneLayout(panel_layout, q=True, ex=True):
            panel_layout = cmds.control(panel_layout, q=True, p=True)
        if cmds.paneLayout(panel_layout, q=True, ex=True):
            return panel_layout
        else:
            return 'viewPanes'
예제 #28
0
 def MyWindows_model_zwz(self, myWinName, myCamera):
     myPaneLayoutName = '%s_p' % myWinName
     myModelPanelName = '%s_m' % myWinName
     myCameraShortName = myCamera.split(":")[-1]
     myCameraShortName = myCameraShortName.replace('|','')
     mc.window(myWinName, t=myCameraShortName, w=10, h=10, s=True, rtf=True)
     mc.paneLayout(myPaneLayoutName, w=int(self.myRenderwidth)+4, h=int(self.myRenderheight)+5, configuration='single', aft=0, st=1)
     mc.modelPanel(myModelPanelName, camera=myCamera, mbv=False)
     mc.showWindow(myWinName)
     # mc.paneLayout(myPaneLayoutName, e=True, w=self.myRenderwidth+4, h=self.myRenderheight+5)
     self.myAllWindows.append(myWinName)
     self.myAllModePlanes.append(myModelPanelName)
     return myWinName
예제 #29
0
def showHotkeysList():
    """shows the current user hotkeys mapping and its name"""
    reload(hotkeys)
    lines = []
    for key in hotkeys.HOTKEYS:
        lines.append('key:  '+str(key['key'])+'  ctrl:  '+str(key['ctrl'])+'  alt:  '+str(key['alt'])+'  '+str(key['name']))

    window = cmds.window('hotkeysWindow')
    cmds.paneLayout()
    cmds.textScrollList(numberOfRows=8,
                        allowMultiSelection=True,
                        append=lines,)
    cmds.showWindow()
예제 #30
0
def _independent_panel(width, height, off_screen=False):
    """Create capture-window context without decorations

    Arguments:
        width (int): Width of panel
        height (int): Height of panel

    Example:
        >>> with _independent_panel(800, 600):
        ...   cmds.capture()

    """

    # center panel on screen
    screen_width, screen_height = _get_screen_size()
    topLeft = [
        int((screen_height - height) / 2.0),
        int((screen_width - width) / 2.0)
    ]

    window = cmds.window(width=width,
                         height=height,
                         topLeftCorner=topLeft,
                         menuBarVisible=False,
                         titleBar=False,
                         visible=not off_screen)
    cmds.paneLayout()
    panel = cmds.modelPanel(menuBarVisible=False, label='CapturePanel')

    # Hide icons under panel menus
    bar_layout = cmds.modelPanel(panel, q=True, barLayout=True)
    cmds.frameLayout(bar_layout, edit=True, collapse=True)

    if not off_screen:
        cmds.showWindow(window)

    # Set the modelEditor of the modelPanel as the active view so it takes
    # the playback focus. Does seem redundant with the `refresh` added in.
    editor = cmds.modelPanel(panel, query=True, modelEditor=True)
    cmds.modelEditor(editor, edit=True, activeView=True)

    # Force a draw refresh of Maya so it keeps focus on the new panel
    # This focus is required to force preview playback in the independent panel
    cmds.refresh(force=True)

    try:
        yield panel
    finally:
        # Delete the panel to fix memory leak (about 5 mb per capture)
        cmds.deleteUI(panel, panel=True)
        cmds.deleteUI(window)
 def __init__(self):
     global NEWNAMEtxtfld, CONTROLLERtxtscr, CACHEsrvr,IMAGEimg, SCRSHTPANELvar, SCRSHTPANEL2var
     if cmds.window('mncRigLibrary', exists=True):cmds.deleteUI('mncRigLibrary', wnd=True)
     cmds.window('mncRigLibrary',t='Controller Library',s=False)
     cmas=cmds.columnLayout(adj=True)
     tabs=cmds.tabLayout()
     
     child1=cmds.columnLayout(adj=True)
     f1=cmds.frameLayout(l='Export Controller',p=child1,w=300)
     cmds.columnLayout(adj=True)   
     cmds.text(l='Controller New Name: ')
     NEWNAMEtxtfld=cmds.textField()
     cmds.separator()
     cmds.text(l='Screen Shot Frame:')
     cmds.paneLayout(w=300,h=300)
     SCRSHTPANELvar=cmds.modelPanel(cam='persp',mbv=False)
     cmds.columnLayout(adj=True,p=child1)
     cmds.separator()
     cmds.text(l='')
     cmds.separator()
     cmds.button(l='REGISTER CONTROLLER' ,h=40, bgc=[1.0,0.643835616566,0.0],c=self.REGISTERfn)
     
     cmds.setParent('..')
     cmds.setParent('..')
     
     child2=cmds.columnLayout(adj=True)
     f2=cmds.frameLayout(l='Import Update Controller',p=child2)
     cmds.columnLayout(adj=True)
     cmds.text(l='Select Controller: ')
     cmds.button(l='<<CONTROLLER PREVIEW>>',h=20, bgc=[1.0,0.643835616566,0.0],c=self.PREVIEWfn)
     CONTROLLERtxtscr=cmds.textScrollList(h=100)
     cmds.button(l='IMPORT CONTROLLER' , bgc=[1.0,0.643835616566,0.0],c=self.IMPORTCONTROLLERfn)
     cmds.separator()
     cmds.text(l='Screen Shot Frame: ')        
     cmds.paneLayout(w=300,h=300)
     SCRSHTPANEL2var=cmds.modelPanel(cam='persp',mbv=False)   
     cmds.button(l='UPDATE CONTROLLER' , bgc=[1.0,0.643835616566,0.0],c=self.UPDATECONTROLLERfn)
     
     cmds.separator(p=cmas)
     cmds.button(l='REFRESH',c=self.REFRESHfn,p=cmas)
     cmds.setParent('..')
     cmds.setParent('..')
     
     cmds.tabLayout( tabs, edit=True, tabLabel=((child1, 'REGISTER CONTROLLER'), (child2, 'IMPORT CONTROLLER')) )
     cmds.showWindow()
     
     CTRLlis=os.listdir(CACHEsrvr+'library/')
     for chk in CTRLlis:
         if chk.endswith('.png')==False:
             cmds.textScrollList(CONTROLLERtxtscr,e=True,append=chk[:-3])
     return
예제 #32
0
def sjKillGUI():
    '''
	GUI guts
	'''
    global mainCol
    global tsl

    # mainCol = cmds.columnLayout( adjustableColumn=True )
    cmds.paneLayout()
    tsl = cmds.textScrollList(w=1200,
                              h=180,
                              ams=True,
                              append=cmds.scriptJob(listJobs=True))
    '''
예제 #33
0
def helpWin(*args):
    '''help file on how to use the transfer weights tool
    '''
    win_name = "atom_tw_help win"
    if cmds.window(win_name, exists=True):
        cmds.deleteUI(win_name)
    win = cmds.window(win_name, t='Atom Trasfer Weights Help', rtf=True)
    cmds.paneLayout()
    cmds.textScrollList('aton_helpTsl',
                        append=['This tool was designed to trasfer influence weights. When Mayas mirror weights',
                                'puts weighting on both sides of the mesh using with one influence.', 'Usage:',
                                'Select the vertex you want to transfer weighting to', 'Middle mouse drag the influences in the Copy and Paste',
                                'Click the Transfer Weighting button'])
    cmds.showWindow(win)
예제 #34
0
def ui():
    '''
    user interface for ml_hold
    '''

    with utl.MlUi('ml_hold', 'Hold Keys', width=400, height=150, info='''Press Next and Previous to match keys to the next or previous keyframes.
Press Current or Average to turn a frame range into a hold.''') as win:

        win.buttonWithPopup(label='Hold Current', command=current, annotation='Creates a hold for the selected range, or the surrounding keys, based on current frame.', shelfLabel='cur', shelfIcon='defaultTwoStackedLayout')
        win.buttonWithPopup(label='Hold Average', command=average, annotation='Creates a hold for the selected range, or the surrounding keys, based on average of keys.', shelfLabel='avg', shelfIcon='defaultTwoStackedLayout')
        
        mc.paneLayout(configuration='vertical2',separatorThickness=1)
        win.buttonWithPopup(label='<< Previous', command=previous, annotation='Matches selected key or current frame to the previous keyframe value.', shelfLabel='<_', shelfIcon='defaultTwoStackedLayout')
        win.buttonWithPopup(label='Next >>', command=next, annotation='Matches selected key or current frame to the next keyframe value.', shelfLabel='_>', shelfIcon='defaultTwoStackedLayout')
예제 #35
0
    def _GetViewportWidget(self, cameraName, rendererName):
        self._testWindow = cmds.window('SelectionTestWindow',
            widthHeight=(self._viewWindowWidth, self._viewWindowHeight))
        cmds.paneLayout()
        testModelPanel = cmds.modelPanel(menuBarVisible=False)
        testModelEditor = cmds.modelPanel(testModelPanel, q=True, modelEditor=True)
        cmds.modelEditor(testModelEditor, edit=True, camera=cameraName,
            displayAppearance='smoothShaded', rendererName=rendererName)
        cmds.showWindow(self._testWindow)

        m3dView = OMUI.M3dView.getM3dViewFromModelPanel(testModelPanel)
        viewWidget = wrapInstance(long(m3dView.widget()), QWidget)

        return viewWidget
예제 #36
0
def ui():
    '''
    User interface for breakdown
    '''

    with utl.MlUi('ml_breakdown',
                  'Breakdown Tools',
                  width=400,
                  height=180,
                  info='''Select objects.
Press Breakdown Dragger to create a new key and weight it by dragging in the viewport.
Otherwise use the increment buttons to nudge a key's value toward the next or previous key.'''
                  ) as win:

        win.buttonWithPopup(
            label='Breakdown Dragger',
            command=drag,
            annotation=
            'Drag in the viewport to weight a breakdown toward the next or previous frame.',
            shelfLabel='BDD')

        mc.separator(height=20)
        mc.floatSliderGrp('ml_breakdown_value_floatSlider',
                          value=0.2,
                          field=True,
                          minValue=0,
                          maxValue=2)
        mc.paneLayout(configuration='vertical3', separatorThickness=1)
        win.ButtonWithPopup(
            label='<<',
            command=weightPrevious,
            annotation='Weight toward the previous frame.',
            shelfLabel='<',
            shelfIcon='defaultTwoStackedLayout',
            readUI_toArgs={'weight': 'ml_breakdown_value_floatSlider'})
        win.ButtonWithPopup(
            label='Average',
            command=weightAverage,
            annotation=
            'Weight toward the average of the next and previous frame.',
            shelfLabel='><',
            shelfIcon='defaultTwoStackedLayout',
            readUI_toArgs={'weight': 'ml_breakdown_value_floatSlider'})
        win.ButtonWithPopup(
            label='>>',
            command=weightNext,
            annotation='Weight toward the next frame.',
            shelfLabel='>',
            shelfIcon='defaultTwoStackedLayout',
            readUI_toArgs={'weight': 'ml_breakdown_value_floatSlider'})
예제 #37
0
def _independent_panel(width, height, off_screen=False):
    """Create capture-window context without decorations

    Arguments:
        width (int): Width of panel
        height (int): Height of panel

    Example:
        >>> with _independent_panel(800, 600):
        ...   cmds.capture()

    """

    # center panel on screen
    screen_width, screen_height = _get_screen_size()
    topLeft = [int((screen_height-height)/2.0),
               int((screen_width-width)/2.0)]

    window = cmds.window(width=width,
                         height=height,
                         topLeftCorner=topLeft,
                         menuBarVisible=False,
                         titleBar=False,
                         visible=not off_screen)
    cmds.paneLayout()
    panel = cmds.modelPanel(menuBarVisible=False,
                            label='CapturePanel')

    # Hide icons under panel menus
    bar_layout = cmds.modelPanel(panel, q=True, barLayout=True)
    cmds.frameLayout(bar_layout, edit=True, collapse=True)

    if not off_screen:
        cmds.showWindow(window)

    # Set the modelEditor of the modelPanel as the active view so it takes
    # the playback focus. Does seem redundant with the `refresh` added in.
    editor = cmds.modelPanel(panel, query=True, modelEditor=True)
    cmds.modelEditor(editor, edit=True, activeView=True)

    # Force a draw refresh of Maya so it keeps focus on the new panel
    # This focus is required to force preview playback in the independent panel
    cmds.refresh(force=True)

    try:
        yield panel
    finally:
        # Delete the panel to fix memory leak (about 5 mb per capture)
        cmds.deleteUI(panel, panel=True)
        cmds.deleteUI(window)
예제 #38
0
 def setupUi(self):
     title = 'SelectMe'
     mc.window(
         self.win_name,
         t=title,
         rtf=1,
         wh=[225, 250],
     )
     mc.paneLayout(
         cn='horizontal3',
         ps=[[1, 100, 1], [2, 100, 98], [3, 100, 1]],
         shp=1,
     )
     mc.columnLayout(adj=True)
     mc.text(label='Selection Sets')
     mc.separator(style='in')
     mc.rowLayout(nc=5, adj=2)
     mc.text(label=' Label:', w=35)
     mc.textField('ld_selSets_name_tField',
                  ann='Button name, first 5 characters used as icon label',
                  w=100)
     mc.button(label='clear',
               w=50,
               c=lambda *args: self.clear('ld_selSets_objs_tsList'))
     mc.columnLayout()
     mc.button(label='+',
               w=25,
               h=15,
               c=lambda *args: self.add('ld_selSets_objs_tsList'))
     mc.button(label='-',
               w=25,
               h=15,
               c=lambda *args: self.remove('ld_selSets_objs_tsList'))
     mc.setParent('..')
     mc.setParent('..')
     mc.setParent('..')
     mc.textScrollList(
         'ld_selSets_objs_tsList',
         w=150,
         h=75,
         ams=1,
         sc=lambda *_: self.select('ld_selSets_objs_tsList'),
         dkc=lambda *_: self.remove('ld_selSets_objs_tsList'),
     )
     mc.button(label='Create Selection Set',
               h=30,
               c=lambda *_: self.dh.create('ld_selSets_objs_tsList',
                                           'ld_selSets_name_tField'))
     mc.setParent('..')
예제 #39
0
def newScriptEditor():
    """
    simpler script editor test
    """
    win = cmds.window(t='New Script Editor', menuBar= True, w = 650, h = 300)
    form = cmds.formLayout()
    pane = cmds.paneLayout(configuration='horizontal2', paneSize=[[1,100,40],[2,100,60]])
    # top layout
    formTop = cmds.formLayout()
    reporter = cmds.cmdScrollFieldReporter('reporter')
    cmds.setParent('..')
    cmds.formLayout(formTop, e=True,
            attachForm=\
                [
                    (reporter, "top", 5),
                    (reporter, "bottom", 5),
                    (reporter, "left", 5),
                    (reporter, "right", 5),
                ]
        )
    cmds.paneLayout(pane, edit=True, setPane = [formTop, 2])
    # bottom layout
    formBottom = cmds.formLayout()
    shelf = cmds.shelfTabLayout()
    tab1 = cmds.cmdScrollFieldExecuter('python1', sourceType="python")
    cmds.setParent('..')
    cmds.formLayout(formBottom, e=True,
            attachForm=\
                [
                    (shelf, "top", 5),
                    (shelf, "bottom", 5),
                    (shelf, "left", 5),
                    (shelf, "right", 5),
                ]
        )
    
    cmds.paneLayout(pane, edit=True, setPane = [formTop, 1])
    
    cmds.formLayout(form, e=True,
            attachForm=\
                [
                    (pane, "top", 5),
                    (pane, "bottom", 5),
                    (pane, "left", 5),
                    (pane, "right", 5),
                ]
        )
    
    cmds.showWindow()
예제 #40
0
 def __init__(self):
     if cmds.window('w06', exists=True):
         cmds.deleteUI('w06')
         
     cmds.window('w06',title='w06_T_nParticlesBake', wh=[320,400], sizeable=False)
     cmds.columnLayout( 'w06_L01', p='w06', adj=True)
     cmds.button( 'w06_uiSelParticles', p='w06_L01', l="Bake", h=50, bgc=[.3, 1, .3], c=self.w06_MainCmd )
    
 
     cmds.separator(p='w06_L01',h=10, en=False, style='in')
     
     cmds.rowColumnLayout('w06_L04', p='w06', nc=2, columnWidth=[(1, 250), (2, 70)])
     cmds.textField('w06_uiMessage', p='w06_L04', en=0, text="Select a particle object and click Get")
     cmds.button('w06_uiGetPar', p='w06_L04', l='Get', bgc=[.4,.4,.4], c= self.w06_setPartileName )
     
     cmds.optionMenu( 'w06_uiInstancers', p='w06_L04', label='Instancer Node' ) 
     cmds.separator(p='w06_L01',h=10, en=False, style='in')
     cmds.text( label='Duplicate Options', p='w06_L01')
     cmds.checkBox('w06_uiRenameChildren', p='w06_L01', l="Assign unique name to child nodes", align="left", v=1)
     cmds.checkBox('w06_uiInputCon', p='w06_L01', l="Duplicate input connections", align="left", v=0)    
     cmds.checkBox('w06_uiInstanceLeaf', p='w06_L01', l="Instance leaf nodes", align="left", v=0) 
     
     cmds.separator(p='w06_L01',h=10, en=False, style='in')
     cmds.separator(p='w06_L01',h=10, en=False, style='in')
     cmds.checkBox('w06_uiBakePosition', p='w06_L01', l="position", align="left", v=1)
     cmds.checkBox('w06_uiBakeRotate', p='w06_L01', l="rotation", align="left", v=1)
     cmds.checkBox('w06_uiBakeScale', p='w06_L01', l="scale", align="left", v=1)
     cmds.separator(p='w06_L01',h=10, en=False, style='in')
     
     cmds.rowColumnLayout('w06_L02', p='w06', nc=2,columnWidth=[(1, 155), (2, 155)])
     cmds.checkBox('w06_uiTimeRangeCBox', p='w06_L02', label="Timeline Range:", v=True,\
                  cc="w06_uiTimeRangeCBoxCmd()"  )
     cmds.text(label="", p='w06_L02')
     cmds.text(label="Start:", p='w06_L02')
     cmds.text(label="End:", p='w06_L02')
     cmds.intField('w06_startField', p='w06_L02', en=0, v=cmds.playbackOptions(q=True, min=True) ) 
     cmds.intField('w06_endField', p='w06_L02', en=0, v=cmds.playbackOptions(q=True, max=True) )
     
     cmds.separator(p='w06_L01',h=10,en=False, style='in')
     
     #my modify
     cmds.checkBox('w06_uiAttrListSwitch', p='w06_L01', label="Create New Attributes:", h=20,\
                  onc=self.w06_addAttrsListCmd, 
                  ofc="cmds.textScrollList('w06_uiAttrList', e=True, en=False)",\
                  v=False)
     
     cmds.paneLayout('w06_L03', p='w06')
     cmds.textScrollList('w06_uiAttrList', p='w06_L03', numberOfRows=8, allowMultiSelection=True, en=0, h=300, bgc=[.2,.2,.2], showIndexedItem=4)
     cmds.showWindow( 'w06')
예제 #41
0
def makeShadeAndBakeGUI_SE():
    selection = cmds.ls(sl=True, long=True)
    if (cmds.window("shadeAndBakeWindowSE", exists=True)):
        cmds.deleteUI("shadeAndBakeWindowSE")

    shadeAndBakeWindowSE = cmds.window('shadeAndBakeWindowSE',
                                       title="Shader Baking",
                                       rtf=True)
    cmds.paneLayout()
    scrollList = cmds.textScrollList("Shader Connects",
                                     numberOfRows=2,
                                     allowMultiSelection=True,
                                     append=filterSelection())

    cmds.showWindow('shadeAndBakeWindowSE')
예제 #42
0
def mvgCreateWindow():

    import maya.cmds as cmds
    mvgDeleteWindow()

    win = cmds.window('mayaMVG')
    cmds.paneLayout('mainPane', configuration='vertical3')
    mvgReloadPanels()
    # custom Qt content
    cmds.paneLayout('mvgMenuPanel')
    cmds.setParent('..')
    cmds.setParent('..')
    cmds.showWindow(win)
    cmds.window(win, e=True, widthHeight=[1000, 800])
    return win
예제 #43
0
    def wrap(*args, **kwargs):
        # type: (*str, **str) -> None

        # Turn $gMainPane Off:
        gMainPane = mel.eval('global string $gMainPane; $temp = $gMainPane;')
        cmds.paneLayout(gMainPane, edit=True, manage=False)

        try:
            return func(*args, **kwargs)

        except Exception as e:
            raise e

        finally:
            cmds.paneLayout(gMainPane, edit=True, manage=True)
예제 #44
0
파일: window.py 프로젝트: jonntd/mayaMVG
def mvgCreateWindow():
    
    import maya.cmds as cmds
    mvgDeleteWindow()
 
    win = cmds.window('mayaMVG')
    cmds.paneLayout('mainPane', configuration='vertical3')
    mvgReloadPanels()
    # custom Qt content
    cmds.paneLayout('mvgMenuPanel')
    cmds.setParent('..')
    cmds.setParent('..')
    cmds.showWindow(win)
    cmds.window(win, e=True, widthHeight=[1000,800])
    return win
예제 #45
0
def defaultButtonPush08(*args):
	cmds.progressWindow(isInterruptable = 1)

	while True:
		WindowCheck = cmds.window(title = '"Press Esc"', widthHeight = (400, 200))
		cmds.paneLayout()
		cmds.scrollField(wordWrap=True, text='"Press Esc"')
		cmds.showWindow(WindowCheck)
		cmds.showSelectionInTitle(WindowCheck)
		cmds.deleteUI(WindowCheck)
	
		if cmds.progressWindow(query = 1, isCancelled = 1):
			cmds.progressWindow(endProgress = 1)
			break
		
		cmds.refresh()
예제 #46
0
 def build(self):  # ( No need to change )
     if cmds.window(self.win, exists=1):
         #self.update()
         return
     cmds.window(self.win, title=self.title, wh=(320, 250))
     cmds.formLayout('MAINFORM', nd=100)
     r = cmds.button(h=32, l='Restart', c=self.update)
     c = cmds.button(h=32, l='Close', c=self.close)
     h = cmds.button(h=32, l='Help', c=self.help)
     p = cmds.paneLayout(configuration='horizontal2', ps=(1, 100, 70))
     self.listScr = cmds.scrollLayout(vst=1, hst=0, cr=1)
     self.list = cmds.columnLayout(adj=1)
     cmds.setParent(p)
     cmds.scrollLayout(vst=1, hst=0, cr=1)
     self.info = cmds.columnLayout(adj=1)
     self.setInfoUI()
     self.updateList()  # after setInfoUI
     self.updateListBGC()
     cmds.formLayout('MAINFORM',
                     e=1,
                     af=[(r, 'bottom', 5), (r, 'left', 5), (h, 'right', 5),
                         (c, 'bottom', 5), (h, 'bottom', 5), (p, 'left', 2),
                         (p, 'right', 2), (p, 'top', 2)],
                     ac=[(p, 'bottom', 5, r), (c, 'left', 3, r),
                         (c, 'right', 3, h)],
                     ap=[(r, 'right', 0, 30), (h, 'left', 0, 70)])
     #print window(self.win,q=1,wh=1)
     cmds.window(self.win, e=1,
                 wh=[self.win_width,
                     self.win_height])  # Set the size of the window
예제 #47
0
 def parent_maya_layout(self):
     object_name = str(self.objectName())
     self.floating_layout = cmds.paneLayout(
         cn='single', w=self.width, p=platforms.get_main_window())
     cmds.dockControl(self.tool_kit_object, l=self.tool_kit_titile, area='right',
                      content=self.floating_layout, allowedArea=['right', 'left'])
     cmds.control(object_name, e=1, p=self.floating_layout)
예제 #48
0
def dock_with_dockControl(widget):
    """Create a docked widget for Maya 2016.5 and lower.

    Args:
        widget: QWidget to parent to dock control

    Returns:
        str: Name of the new dock control
    """
    dock_name = '{0}Dock'.format(widget.objectName())

    try:
        cmds.deleteUI(dock_name)
    except RuntimeError as e:
        LOG.exception(e)

    panel = cmds.paneLayout(configuration='single')
    cmds.control(widget.objectName(), e=True, p=panel)
    cmds.evalDeferred(
        lambda *args: cmds.dockControl(dock_name,
                                       r=True,
                                       vis=True,
                                       closeCommand=widget.close,
                                       area='right',
                                       content=panel,
                                       label=widget.windowTitle(),
                                       width=550))

    return dock_name
예제 #49
0
    def create(self):

        if cmds.window(Win_Global.winName, q=1, ex=1):
            cmds.deleteUI(Win_Global.winName)

        cmds.window(Win_Global.winName, title=Win_Global.title)

        formOuter = cmds.formLayout()

        formInner = cmds.paneLayout(configuration='horizontal4')
        for folderList in self.ui_folderLists:
            folderList.create()
        cmds.setParent('..')

        closeButton = cmds.button(l='CLOSE',
                                  c="cmds.deleteUI('%s')" % Win_Global.winName)
        cmds.formLayout(formOuter,
                        e=1,
                        af=[(formInner, 'top', 0), (formInner, 'left', 0),
                            (formInner, 'right', 0), (closeButton, 'bottom',
                                                      0),
                            (closeButton, 'left', 0),
                            (closeButton, 'right', 0)],
                        ac=[(formInner, 'bottom', 0, closeButton)])
        cmds.setParent('..')

        cmds.showWindow(Win_Global.winName)
예제 #50
0
    def saveScreenshot(self, name):
        path = os.path.join(self.userPath, '%s.jpg' % name)
        activePanel = cmds.paneLayout('viewPanes', q=True, pane1=True)

        cmds.viewFit()
        cmds.setAttr('defaultRenderGlobals.imageFormat', 8)

        # Isolate selection
        if cmds.ls(selection=True):
            cmds.isolateSelect(activePanel, update=1)
            cmds.isolateSelect(activePanel, state=1)
            cmds.isolateSelect(activePanel, addSelected=1)

        cmds.modelEditor(activePanel, edit=True, sel=False)

        cmds.playblast(completeFilename=path,
                       forceOverwrite=True,
                       format='image',
                       width=200,
                       height=200,
                       showOrnaments=False,
                       startTime=1,
                       endTime=1,
                       viewer=False)

        cmds.modelEditor(activePanel, edit=True, sel=True)

        cmds.isolateSelect(activePanel, state=0)
예제 #51
0
    def show_nodes(self,
                   nodes,
                   select_second=None,
                   isolate=False,
                   select=False):
        """Displays the desired nodes and any parent nodes that may be hidden

        Args:
            nodes (list): of desired nodes
            isolate (bool, optional): isolate in viewport
            select (bool, optional): should desired nodes be selected as well
        """
        cmds.hide(cmds.listRelatives(self.root_node, ad=True,
                                     type="transform"))
        cmds.showHidden(nodes, a=True)

        if select or isolate:
            cmds.select(nodes)
            if select_second:
                cmds.select(select_second, add=True)

        if isolate:
            isolated_panel = cmds.paneLayout('viewPanes', q=True, pane1=True)
            cmds.isolateSelect(isolated_panel, state=True)
            cmds.isolateSelect(isolated_panel, aso=True)
예제 #52
0
    def createLayerListsUI(self,parent):
        cmds.setParent(parent)
        #self.outerFrame = cmds.frameLayout(label='Skinning Layers',collapsable=False,borderVisible=True,borderStyle="etchedIn",labelAlign="center")

        paneLayout = cmds.paneLayout(configuration="vertical2",width=100,height=200)
            
        

        leftForm = form = FormLayout()
        label = cmds.text("Layers:",align="left",font='boldLabelFont')
        list = self.controls.layerDisplay = LayersTreeView()
        list.onSelectionChanged.addHandler(self.layerSelectionChanged)
        list.itemDropped = self.layerDropped
        
        form.attachForm(label,10,0,None,Constants.MARGIN_SPACING_HORIZONTAL)
        form.attachForm(list.control,None,0,0,Constants.MARGIN_SPACING_HORIZONTAL)
        form.attachControl(list.control,label,3,None,None,None)
        
        cmds.setParent("..")
        rightForm = form = FormLayout()
        label = cmds.text("Influences:",align="left",font='boldLabelFont')
        

        list = self.controls.influenceDisplay = InfluencesTreeView(allowMultiSelection=True)
        list.onSelectionChanged.addHandler(self.execInfluenceSelected)
        
        self.createLayersListRMBMenu()
        self.createInfluenceListRMBMenu()

        form.attachForm(label,10,Constants.MARGIN_SPACING_HORIZONTAL,None,0)
        form.attachForm(list.control,None,Constants.MARGIN_SPACING_HORIZONTAL,0,0)
        form.attachControl(list.control,label,3,None,None,None)

        return paneLayout
예제 #53
0
def vrayReUI():
	if cmds.dockControl('vrayRendElem', exists=True):
		cmds.deleteUI('vrayRendElem', ctl=True)
	awVrayRETools = cmds.loadUI (f = 'Q:/Tools/maya/2012/scripts/python/UI/awRenderElem.ui')
	awVrayREPane = cmds.paneLayout (cn = 'single', parent = awVrayRETools)
	awVrayDock = cmds.dockControl ( 'vrayRendElem',allowedArea = ("right","left"), area = "right", floating = False ,con = awVrayRETools, label = 'Render Element tools')
	vrayUpdateUI()
예제 #54
0
파일: ui.py 프로젝트: jonntd/dmptools
 def doublePane(self):
     """build the double pane layout for the selection display"""
     # create the main form
     form = cmds.formLayout("mtn_optionsForm")
     # build bottom helpLine
     helpline = self.helpLine()
     cmds.setParent('..')
     # main frame layout
     frameL = cmds.frameLayout('mtn_doublePaneMainFrameLayout',
                             label='Items ready for export:',
                             cll=False,
                             cl=False,
                             bv=True)
     # create double paneLayout and its default separation value
     paneLayout = cmds.paneLayout('mtn_doublePane',
                                 configuration='vertical2',
                                 paneSize=[[1,0,100],[2,100,100]])
     # build the left panelayout
     items = ['list of items', ]
     leftPanel = self.scrollListPane(items)
     # build the right panelayout
     rightPanel = self.rightPane()
     # set the panes on their good position
     cmds.paneLayout('mtn_doublePane', edit=True, setPane=[ leftPanel, 1])
     cmds.paneLayout('mtn_doublePane', edit=True, setPane=[ rightPanel, 2])
     # attatch the forms
     cmds.formLayout(form,
                     edit=True,
                     attachForm=
                         [
                             (frameL, "left", 5),
                             (frameL, "right", 5),
                             (frameL, "top", 5),
                             (helpline, "left", 5),
                             (helpline, "right", 5),
                             (helpline, "bottom", 2)
                         ]
                     )
     cmds.formLayout(form,
                     edit=True,
                     attachControl=
                         [
                             (frameL, "bottom", 5, helpline)
                         ]
                     )
     return form
예제 #55
0
def createWindow(cameraList):
	#c = global.currentCamera()
	x = cmds.window('cameraWindow', query=1 , exists = 1)
	if x is False:
		print 'not found, creating window'
		cmds.window('cameraWindow', wh = [ 512, 288 ] )
		cmds.paneLayout()
		if Sel.getType(0)[1] == 'LIGHT' or Sel.getType(0)[1] == 'CAMERA':
			i = cmds.ls(selection=True)
		else:
			i = ('perspShape')
		Cache.modelPanel = cmds.modelPanel( mbv = 0, cam = i[0])
		cmds.modelEditor( Cache.modelPanel, edit=True, displayAppearance='smoothShaded', cameras = 1 )
		cmds.showWindow('cameraWindow')
	else:
		cmds.select( cameraList [Cache.camSceneOffset] )
		cmds.modelEditor(Cache.modelPanel, edit=True, cam = cameraList [Cache.camSceneOffset] )
예제 #56
0
    def __createUI(self):
        self.win = CurveToolUI.win_name
        
        if not cmds.uiTemplate('CurveToolsUITemplate', exists=True):
            cmds.uiTemplate('CurveToolsUITemplate')
            
        if cmds.window(self.win, exists=True):
            cmds.deleteUI(self.win)
            
        self.win = cmds.window(self.win, t=CurveToolUI.win_title, 
                               mb=True, w=656, h=385)
        
        self.main_menu = cmds.menu(label="Menu", parent=self.win)
        #cmds.menuItem(label="Refresh List", c=self.handleRefreshMenu)
        
        self.help_menu = cmds.menu(label="Help", parent=self.win)
        #cmds.menuItem(label="Help", c=self.handleHelpMenu)
        
        self.mainLayout = cmds.rowColumnLayout(nc=2, cw=[(1, 292), (2, 360)])
        self.leftLayout = cmds.rowColumnLayout(nr=3, parent=self.mainLayout,
                                               rh=[(1, 48), (2, 256), (3, 48)])
        self.topRow = cmds.rowColumnLayout(nc=3, parent=self.leftLayout)
        
        self.shapesList = cmds.textScrollList(parent=self.leftLayout, nr=24)
        
        self.btmRow = cmds.rowColumnLayout(nc=3, parent=self.leftLayout, w=128)
        
        self.createBtn =  cmds.button(l="Create",  w=96, h=48, parent=self.topRow)
        self.replaceBtn = cmds.button(l="Replace", w=96, h=48, parent=self.topRow)
        self.appendBtn =  cmds.button(l="Append",  w=96, h=48, parent=self.topRow)

        self.saveBtn = cmds.button(l="Save", w=96, h=48, parent=self.btmRow)
        self.overwriteBtn = cmds.button(l="Overwrite", w=96, h=48, parent=self.btmRow)
        self.deleteBtn = cmds.button(l="Delete", w=96, h=48, parent=self.btmRow)
        
        self.paneLayout = cmds.paneLayout(parent=self.mainLayout)            
        self.viewport = cmds.modelPanel(mbv=False, 
                                        parent=self.paneLayout)
        
        #------------------------------------------- install click handlers ---
        cmds.button(self.createBtn,  e=True, c=self.__handleCreateClick)
        cmds.button(self.replaceBtn, e=True, c=self.__handleReplaceClick)
        cmds.button(self.appendBtn,  e=True, c=self.__handleAppendClick)
        
        cmds.button(self.saveBtn,  e=True, c=self.__handleSaveClick)
        cmds.button(self.overwriteBtn, e=True, c=self.__handleOverwriteClick)
        cmds.button(self.deleteBtn,  e=True, c=self.__handleDeleteClick)   
        
        cmds.textScrollList(self.shapesList, e=True, 
                            sc=self.__handleShapeListSelection)
        
        #----------------------------------------- setup UiDeleted callback ---
        self.__uiCallback = OpenMayaUI.MUiMessage.addUiDeletedCallback(
            self.win, 
            self.__handleUIClosed
        )
        
        cmds.showWindow(self.win)
예제 #57
0
def script_output(direction):
    """
    Script output dock for layouts.
    """
    dock_control = config['WINDOW_SCRIPT_OUTPUT_DOCK']
    dock_window = config['WINDOW_SCRIPT_OUTPUT']
    if cmds.dockControl(dock_control, ex=True):
        return cmds.dockControl(dock_control, e=True, vis=True, fl=False)

    if cmds.window(dock_window, ex=True):
        main_win = dock_window
    else:
        main_win = cmds.window(dock_window, title='Output Window')

    cmds.paneLayout(parent=main_win)

    # context menu
    output_win = cmds.cmdScrollFieldReporter(fst="")
    cmds.popupMenu(parent=output_win)
    cmds.menuItem(
        label='Clear Output',
        command=lambda c: cmds.cmdScrollFieldReporter(
            output_win, e=True, clear=True),
    )
    # Echo all commands toggle
    cmds.menuItem(
        label='Toggle Echo Commands',
        command=lambda c: cmds.commandEcho(
            state=not(cmds.commandEcho(q=True, state=True))),
    )
    # Go to python reference
    cmds.menuItem(
        label='Python Command Reference',
        command=lambda c: cmds.showHelp('DocsPythonCommands'),
    )

    cmds.dockControl(
        dock_control,
        content=main_win,
        label='Output Window',
        area=direction,
        height=500,
        floating=False,
        allowedArea=['left', 'right']
    )
예제 #58
0
    def wrap(*args, **kwargs):
        try:
            # Turn $gMainPane Off, only possible in GUI mode
            cmds.paneLayout(getMayaGlobals('gMainPane'), edit=True, manage=False)
            disabled = True
        except:
            disabled = False

        # Decorator will try/except running the function.
        # But it will always turn on the viewport at the end.
        # In case the function failed, it will prevent leaving maya viewport off.
        try:
            return func(*args, **kwargs)
        except Exception:
            raise  # will raise original error
        finally:
            if disabled:
                cmds.paneLayout(getMayaGlobals('gMainPane'), edit=True, manage=True)
예제 #59
0
def getUserSetting():
    allSettings = SETTINGS.getAll()
    lines = []
    for item in allSettings:
        lines.append(item.keys()[0])
    
    if cmds.window('settingsWindow', exists=True):
        cmds.deleteUI('settingsWindow', window=True)

    window = cmds.window('settingsWindow')
    cmds.paneLayout()
    cmds.textScrollList('settingsList',
                        numberOfRows=8,
                        allowMultiSelection=True,
                        append=lines,
                        dcc=selectSetting)
    
    cmds.showWindow('settingsWindow')