Python maya.cmds 模块,paneLayout() 实例源码

我们从Python开源项目中,提取了以下10个代码示例,用于说明如何使用maya.cmds.paneLayout()

项目:ml_tools    作者:morganloomis    | 项目源码 | 文件源码
def buildMainLayout(self):
        '''Build the main part of the ui
        '''
        #self.cbBakeOnes = mc.checkBoxGrp(label='Bake on Ones', 
                                         #annotation='Bake every frame. If deselected, the tool will preserve keytimes.')

        #mc.separator()
        self.ButtonWithPopup(label='Create Live COM', 
                             command=createCenterOfMass, 
                             annotation='Create a constrained COM node based on selected Root Control.')

        mc.paneLayout(configuration='vertical2',separatorThickness=1)
        self.ButtonWithPopup(label='Transfer Root Anim to COM', 
                             command=bakeCenterOfMass, 
                             annotation='Bake out the Root animation to the COM node.')
        self.ButtonWithPopup(label='Transfer COM back to Root', 
                             command=bakeRoot, 
                             annotation='A previously baked COM will be baked back to its corresponding Root.')
        mc.setParent('..')
项目:ml_tools    作者:morganloomis    | 项目源码 | 文件源码
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'})
项目:ml_tools    作者:morganloomis    | 项目源码 | 文件源码
def quickBreakDownUI():
    winName = 'ml_quickBreakdownWin'
    if mc.window(winName, exists=True):
        mc.deleteUI(winName)

    mc.window(winName, title='ml :: QBD', iconName='Quick Breakdown', width=100, height=500)

    mc.columnLayout(adj=True)

    mc.paneLayout(configuration='vertical2', separatorThickness=1)
    mc.text('<<')
    mc.text('>>')
    mc.setParent('..')

    for v in (10,20,50,80,90,100,110,120,150):
        mc.paneLayout(configuration='vertical2',separatorThickness=1)

        mc.button(label=str(v)+' %', command=partial(weightPrevious,v/100.0))
        mc.button(label=str(v)+' %', command=partial(weightNext,v/100.0))
        mc.setParent('..')

    mc.showWindow(winName)

    mc.window(winName, edit=True, width=100, height=250)
项目:mgear    作者:miquelcampos    | 项目源码 | 文件源码
def viewport_off(func):
    """Decorator - Turn off Maya display while func is running.

    if func will fail, the error will be raised after.

    type: (function) -> function

    """
    @wraps(func)
    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)

    return wrap
项目:MSide    作者:jamesbdunlop    | 项目源码 | 文件源码
def __init__(self, parent = None):
        super(Outliner, self).__init__(parent)
        ## Build the qt layout that we will parent the sip paneLayout to later
        self.mainLayout = QGridLayout(self)
        self.mainLayout.setObjectName('OutlinerQGridLayout')
        self.__initUI()
        self.setMinimumWidth(200)
        try:self.parent().closed.connect(self.close)
        except AttributeError:pass
项目:MSide    作者:jamesbdunlop    | 项目源码 | 文件源码
def parentMaya(self):
            cmds.paneLayout('ChannelsLayersPaneLayout', edit = True, parent = 'MainChannelsLayersLayout')
            for form in cmds.layout('MainChannelsLayersLayout', query = True, ca = True):
                if 'ChannelButtonForm' in form:
                    cmds.formLayout('MainChannelsLayersLayout', edit = True, af = [('ChannelButtonForm', 'top', 0)])
                else:
                    cmds.formLayout('MainChannelsLayersLayout', edit = True, af = [(form, 'top', 20), (form, 'left', 0), (form, 'bottom', 0), (form, 'right', 0)])
项目:ml_tools    作者:morganloomis    | 项目源码 | 文件源码
def ui():
    '''
    user interface for ml_goToKeyframe
    '''

    with utl.MlUi('ml_goToKeyframe', 'Go To Keyframe', width=400, height=130, info='''Press Next and Previous to advance time to the next or previous keyframes
within the graph editor or your selection.
Check Round to Nearest Frame to avoid stopping time on non-whole frames.''') as win:

        mc.checkBoxGrp('ml_goToKeyframe_selected_checkBox', 
                       label='Within Selection', 
                       annotation='Only search for next and previous within the selected keys.',
                       changeCommand=uiSetCheckBox)
        mc.checkBoxGrp('ml_goToKeyframe_selectKeys_checkBox', 
                       label='Select Keys', 
                       annotation='Select the keyframe(s) on the frame navigated to.',
                       changeCommand=uiSetCheckBox)
        mc.checkBoxGrp('ml_goToKeyframe_round_checkBox', 
                       label='Round to Nearest Frame', 
                       annotation='Only go to whole-number frames, even if keys are on sub-frames.')
        mc.checkBoxGrp('ml_goToKeyframe_hierarchy_checkBox', 
                       label='Search Hierarchy', 
                       annotation='Go to the next or previous keyframe in the whole hierarchy.')

        mc.paneLayout(configuration='vertical2', separatorThickness=1)

        win.ButtonWithPopup(label='<< Previous', name=win.name, command=previous, 
                            annotation='Go to previous keyframe.', 
                            readUI_toArgs={'roundFrame':'ml_goToKeyframe_round_checkBox',
                                           'selected':'ml_goToKeyframe_selected_checkBox',
                                           'selectKeys':'ml_goToKeyframe_selectKeys_checkBox',
                                           'searchHierarchy':'ml_goToKeyframe_hierarchy_checkBox'})

        win.ButtonWithPopup(label='Next >>', name=win.name, command=next, 
                            annotation='Go to next keyframe.', 
                            readUI_toArgs={'roundFrame':'ml_goToKeyframe_round_checkBox',
                                           'selected':'ml_goToKeyframe_selected_checkBox',
                                           'selectKeys':'ml_goToKeyframe_selectKeys_checkBox',
                                           'searchHierarchy':'ml_goToKeyframe_hierarchy_checkBox'})
        mc.setParent('..')
项目:MSide    作者:jamesbdunlop    | 项目源码 | 文件源码
def __initUI(self):
        self.lyName = 'nOutlinerPaneLayout'
        self.outlinerPanelName = 'nOutlinerPanel'
        if not cmds.paneLayout(self.lyName, query = True, exists = True):
            ## Create the pane to parent the outliner to
            self.outlinerPanelLayout = cmds.paneLayout(self.lyName)
            cmds.setParent()
            self.outlinerPaneLayout_Ptr = mui.MQtUtil.findLayout(self.outlinerPanelLayout)

            ## Wrap the maya paneLayout as a QWidget
            self.outlinerPaneWidget = shiboken.wrapInstance(long(self.outlinerPaneLayout_Ptr), QWidget)
            self.outlinerPaneWidget.setObjectName('CustomOutlinerWidget')

            ## Check to see if the custom outliner panel already exists
            existPanels = [pnl for pnl in cmds.lsUI(panels = True) if self.outlinerPanelName in pnl]
            if existPanels:
                self.outlinerPanel = mui.MQtUtil.findLayout(self.outlinerPanelName)
                cmds.outlinerPanel(self.outlinerPanelName, edit = True, p = self.outlinerPanelLayout)
            else:
                self.outlinerPanel = cmds.outlinerPanel(self.outlinerPanelName,  l = self.outlinerPanelName, to = False, init = False, mbv = True, p = self.outlinerPanelLayout)

            ## Set up the defaults for the view
            self.fixEditor = cmds.outlinerEditor(self.outlinerPanelName, edit = True,
                                                 mainListConnection='worldList',
                                                 selectionConnection='modelList',
                                                 showShapes=False,
                                                 showAttributes=False,
                                                 showConnected=False,
                                                 showAnimCurvesOnly=False,
                                                 autoExpand=False,
                                                 showDagOnly=True,
                                                 ignoreDagHierarchy=False,
                                                 expandConnections=False,
                                                 showCompounds=True,
                                                 showNumericAttrsOnly=False,
                                                 highlightActive=True,
                                                 autoSelectNewObjects=False,
                                                 doNotSelectNewObjects=False,
                                                 transmitFilters=False,
                                                 showSetMembers=True,
                                                 setFilter='defaultSetFilter' )
        else:
            self.outlinerPaneLayout_Ptr = mui.MQtUtil.findLayout(self.lyName)
            self.outlinerPaneWidget = shiboken.wrapInstance(long(self.outlinerPaneLayout_Ptr), QWidget)
            self.outlinerPaneWidget.setObjectName('nOutlinerWidget')

        self.mainLayout.addWidget(self.outlinerPaneWidget, 1, 0)
        self.mainLayout.setContentsMargins(1,1,1,1)
        self.setContentsMargins(1,1,1,1)
项目:MSide    作者:jamesbdunlop    | 项目源码 | 文件源码
def __init__(self, parent = None):
        super(ModelEditor, self).__init__(parent)
        self.modelEditorName = 'cstMEd'
        self.paneLayoutName = 'ModEdPaneLayout'
        self.modelEditorLayout = QGridLayout(self)
        self.modelEditorLayout.setObjectName('%sQGridLayout' % self.modelEditorName)
        self.editorPane = None
        self.mymodelEditorPane = None

        ## delete existing editor
        for each in cmds.lsUI(editors = True):
            if self.modelEditorName in each:
                cmds.deleteUI(each)

        self.ptrVLayout = mui.MQtUtil.fullName(long(shiboken.getCppPointer(self.modelEditorLayout)[0]))
        self.camera = 'persp'

        ## Define a maya pane for parenting to
        self.editorPane = cmds.paneLayout(self.paneLayoutName)
        self.wrapThisModelEditorPane = mui.MQtUtil.findLayout(self.editorPane)

        ## Wrap the pane for pyqt for parenting to
        self.mymodelEditorPane = shiboken.wrapInstance(long(self.wrapThisModelEditorPane), QWidget)
        self.mymodelEditorPane.setObjectName(self.paneLayoutName)

        if cmds.modelEditor(self.modelEditorName, query = True, exists = True):
            self.modelEditor = cmds.modelEditor(self.modelEditorName, edit = True, p = self.editorPane, activeView = True, nud = True, camera = self.camera)
        else:
            self.modelEditor = cmds.modelEditor(self.modelEditorName, p = self.editorPane, activeView = True, nud = True, camera = self.camera)

        if cmds.modelEditor(self.modelEditorName, query = True, exists = True):           
            self.modelEditor = cmds.modelEditor(self.modelEditorName, edit = True, activeView = True, nud = True, camera = self.camera, p = self.editorPane)
        else:
            try:
                self.modelEditor = cmds.modelEditor(self.modelEditorName, activeView = True, nud = True, camera = self.camera, p = self.editorPane)
            except RuntimeError:
                cmds.warning('Model Editor failed... Object base_OpenGL_Renderer not found.')
                pass

        # ## Add the menu at the top
        self.menu = Menu(editor = self.modelEditorName)
        self.modelEditorLayout.addWidget(self.menu, 0, 0)
        self.modelEditorLayout.addWidget(self.mymodelEditorPane, 1, 0)
        self.modelEditorLayout.setRowStretch(1, 1)
        cmds.modelEditor(self.modelEditorName, edit = True, activeView = True)
        self.modelEditorLayout.setContentsMargins(0,0,0,0)
        self.setContentsMargins(0,0,0,0)
        try:self.parent().closed.connect(self.close)
        except AttributeError:pass
项目:ml_tools    作者:morganloomis    | 项目源码 | 文件源码
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.')