當前位置: 首頁>>代碼示例>>Python>>正文


Python cmds.tabLayout方法代碼示例

本文整理匯總了Python中maya.cmds.tabLayout方法的典型用法代碼示例。如果您正苦於以下問題:Python cmds.tabLayout方法的具體用法?Python cmds.tabLayout怎麽用?Python cmds.tabLayout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在maya.cmds的用法示例。


在下文中一共展示了cmds.tabLayout方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: shelf

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import tabLayout [as 別名]
def shelf():
    """
    Add a new shelf in Maya with all the tools that are provided in the
    SHELF_TOOLS variable. If the tab exists it will be deleted and re-created
    from scratch.
    """
    # get top shelf
    gShelfTopLevel = mel.eval("$tmpVar=$gShelfTopLevel")

    # get top shelf names
    shelves = cmds.tabLayout(gShelfTopLevel, query=1, ca=1)
    
    # delete shelf if it exists
    if SHELF_NAME in shelves:
        cmds.deleteUI(SHELF_NAME)

    # create shelf
    cmds.shelfLayout(SHELF_NAME, parent=gShelfTopLevel)
    
    # add modules
    for tool in SHELF_TOOLS:
        if tool.get("image1"):
            cmds.shelfButton(style="iconOnly", parent=SHELF_NAME, **tool)
        else:
            cmds.shelfButton(style="textOnly", parent=SHELF_NAME, **tool) 
開發者ID:robertjoosten,項目名稱:maya-skinning-tools,代碼行數:27,代碼來源:install.py

示例2: dpColorizeUI

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import tabLayout [as 別名]
def dpColorizeUI(self, *args):
        """ Show a little window to choose the color of the button and the override the guide.
        """
        #Get Maya colors
        #Manually add the "none" color
        colorList = [[0.627, 0.627, 0.627]]
        #WARNING --> color index in maya start to 1
        colorList += [cmds.colorIndex(iColor, q=True) for iColor in range(1,32)]
        
        # creating colorOverride Window:
        if cmds.window('dpColorOverrideWindow', query=True, exists=True):
            cmds.deleteUI('dpColorOverrideWindow', window=True)
        colorOverride_winWidth  = 170
        colorOverride_winHeight = 115
        dpColorOverrideWin = cmds.window('dpColorOverrideWindow', title='Color Override '+DPCO_VERSION, iconName='dpColorOverride', widthHeight=(colorOverride_winWidth, colorOverride_winHeight), menuBar=False, sizeable=True, minimizeButton=False, maximizeButton=False, menuBarVisible=False, titleBar=True)
        
        # creating layout:
        colorTabLayout = cmds.tabLayout('colorTabLayout', innerMarginWidth=5, innerMarginHeight=5, parent=dpColorOverrideWin)
        
        # Index layout:
        colorIndexLayout = cmds.gridLayout('colorIndexLayout', numberOfColumns=8, cellWidthHeight=(20,20), parent=colorTabLayout)
        # creating buttons
        for colorIndex, colorValues in enumerate(colorList):
            cmds.button('indexColor_'+str(colorIndex)+'_BT', label=str(colorIndex), backgroundColor=(colorValues[0], colorValues[1], colorValues[2]), command=partial(self.dpSetColorIndexToSelect, colorIndex), parent=colorIndexLayout)
        
        # RGB layout:
        colorRGBLayout = cmds.columnLayout('colorRGBLayout', adjustableColumn=True, columnAlign='left', rowSpacing=10, parent=colorTabLayout)
        cmds.separator(height=10, style='none', parent=colorRGBLayout)
        self.colorRGBSlider = cmds.colorSliderGrp('colorRGBSlider', label='Color', columnAlign3=('right', 'left', 'left'), columnWidth3=(30, 60, 50), columnOffset3=(10, 10, 10), rgbValue=(0, 0, 0), changeCommand=self.dpSetColorRGBToSelect, parent=colorRGBLayout)
        
        # renaming tabLayouts:
        cmds.tabLayout(colorTabLayout, edit=True, tabLabel=((colorIndexLayout, "Index"), (colorRGBLayout, "RGB")))
        # call colorIndex Window:
        cmds.showWindow(dpColorOverrideWin) 
開發者ID:nilouco,項目名稱:dpAutoRigSystem,代碼行數:36,代碼來源:dpColorOverride.py

示例3: shelf

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import tabLayout [as 別名]
def shelf():
    """
    Add a new shelf in Maya with the tools that is provided in the SHELF_TOOL
    variable. If the tab exists it will be checked to see if the button is
    already added. If this is the case the previous button will be deleted and
    a new one will be created in its place.
    """
    # get top shelf
    gShelfTopLevel = mel.eval("$tmpVar=$gShelfTopLevel")

    # get top shelf names
    shelves = cmds.tabLayout(gShelfTopLevel, query=1, ca=1)

    # create shelf
    if SHELF_NAME not in shelves:
        cmds.shelfLayout(SHELF_NAME, parent=gShelfTopLevel)

    # get existing members
    names = cmds.shelfLayout(SHELF_NAME, query=True, childArray=True) or []
    labels = [cmds.shelfButton(n, query=True, label=True) for n in names]

    # delete existing button
    if SHELF_TOOL.get("label") in labels:
        index = labels.index(SHELF_TOOL.get("label"))
        cmds.deleteUI(names[index])

    # add button
    cmds.shelfButton(style="iconOnly", parent=SHELF_NAME, **SHELF_TOOL) 
開發者ID:robertjoosten,項目名稱:maya-spline-ik,代碼行數:30,代碼來源:install.py

示例4: add_callbacks

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import tabLayout [as 別名]
def add_callbacks(self):
        """ add callbacks """

        if self.callbacks.length() <= 1:
            self.logger.debug('Add selection shanged callback')
            m_node = node_utils.get_mobject_from_name(self._node)
            self.callbacks.append(om.MEventMessage.addEventCallback('SelectionChanged', self.selection_changed))

    #  def add_ae_change_command(self):
    #      ae_tabs = maya.mel.eval('$temp = $gAETabLayoutName;')
    #      cmds.tabLayout(ae_tabs, e=True, changeCommand=self.ae_tab_switched) 
開發者ID:wiremas,項目名稱:spore,代碼行數:13,代碼來源:AEsporeNodeTemplate.py

示例5: set_active

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import tabLayout [as 別名]
def set_active(self):
        prop = cmds.toolPropertyWindow(q=True, loc=True)
        cmds.tabLayout(prop, e=True, selectTab=self.name)


# ---------------------------------------------
# convenience constants 
開發者ID:theodox,項目名稱:mGui,代碼行數:9,代碼來源:ctx.py

示例6: buildMainLayout

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import tabLayout [as 別名]
def buildMainLayout(self):
        '''Build the main part of the ui
        '''

        #tabs = mc.tabLayout()

        #tab1 = mc.columnLayout(adj=True)
        #self.swatch_selected = self.colorControlLayout()
        #mc.button(label='Color Selected', command=self.colorSelected)
        #mc.setParent('..')

        #tab2 = mc.columnLayout(adj=True)
        self.swatch_range1 = self.colorControlLayout(label='First Selected')
        self.swatch_range2 = self.colorControlLayout(label='Last Selected')
        mc.separator(horizontal=True, height=10)
        mc.button(label='Color Selected Nodes', command=self.colorSelectedRange)
        #mc.setParent('..')

        #tab3 = mc.columnLayout(adj=True)
        #self.positionWidgets = {}
        #for xyz in 'XYZ':
            #for m in ['Min','Max']:
                #self.positionWidgets[m+xyz] = self.colorControlLayout(label='{} {}'.format(m,xyz))

        mc.setParent('..')

        #mc.tabLayout( tabs, edit=True, tabLabel=((tab1, 'Color Control'), (tab2, 'Color Range')) ) 
開發者ID:morganloomis,項目名稱:ml_tools,代碼行數:29,代碼來源:ml_colorControl.py

示例7: buildMainLayout

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import tabLayout [as 別名]
def buildMainLayout(self):
        '''Build the main part of the ui
        '''

        tabs = mc.tabLayout()
        tab1 = mc.columnLayout(adj=True)

        mc.scrollLayout(cr=True)
        self.shelfLayout = mc.shelfLayout()

        self.refreshShelfLayout()

        mc.setParent(tabs)

        tab2 = mc.columnLayout(adj=True)

        mc.separator(height=8, style='none')
        mc.text('Select curve(s) to export. Multiple selected curves will be combined.')
        mc.text('Center and fit the curve in the viewport,')
        mc.text('and make sure nothing else is visible for best icon creation.')
        mc.separator(height=16, style='in')

        mc.button('Export Selected Curve', command=self.exportControl, annotation='Select a nurbsCurve to export.')

        mc.tabLayout( tabs, edit=True, tabLabel=((tab1, 'Import'),
                                                 (tab2, 'Export')
                                                 ))

        if not mc.shelfLayout(self.shelfLayout, query=True, numberOfChildren=True):
            mc.tabLayout( tabs, edit=True, selectTab=tab2) 
開發者ID:morganloomis,項目名稱:ml_tools,代碼行數:32,代碼來源:ml_controlLibrary.py

示例8: update_instance_list

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import tabLayout [as 別名]
def update_instance_list(self, *args):
        """ update the instance listi.
        1. try to get current node based on ae tab name. this failse if the
           nodename is not unique. if this happends...
        2. try to get the node based on last item in selection. this fails
           if not the item is not a spore shape or spore transform.
        this method fails when:
            - two spore locator are parented under the same transform.
            - the user reaches the node interface without selecting the node """

        found = False

        # get current ae tab name
        ae_tabs = mel.eval('$temp = $gAETabLayoutName;')
        tab_index = int(cmds.tabLayout(ae_tabs, q=1, st=1).replace('formTab', ''))
        current_tab = cmds.tabLayout(ae_tabs, q=1, tl=1)[tab_index]

        # try to get node based on selection
        selection = cmds.ls(sl=True, l=True)[-1]
        shapes = cmds.listRelatives(selection, s=True, f=True)

        # check if node name is unique or selection is node
        nodes = cmds.ls(current_tab, l=True)
        if len(nodes) == 1 or cmds.objectType(selection) == 'sporeNode':
            if cmds.objectType(selection) == 'sporeNode':
                self._node = selection
            else:
                self._node = nodes[0]
            found = True

        if len(nodes) > 1:
            if shapes:
                # note: this fails in case there are two spore nodes parented under
                # the same transform
                for i, shape in enumerate(shapes):
                    if cmds.objectType(shape) == 'sporeNode':
                        self._node = shape
                        found = True
            else:
                # TODO - we could also try to catch node based on instancer
                # ae tab name. this would also fail if the instancer name is
                # not unique
                pass

        cmds.textScrollList('instanceList', e=1, removeAll=True)
        if found:
            instanced_geo = node_utils.get_instanced_geo(self._node)
            instanced_geo = ['[{}]: {}'.format(i, name) for i, name in enumerate(instanced_geo)]

            cmds.textScrollList('instanceList', e=1, append=instanced_geo)
        else:
            msg = 'Could not update objects list. Node name "{}" not unique'.format(current_tab)
            self.logger.warn(msg)
            cmds.textScrollList('instanceList', e=1, append=msg.split('. ')) 
開發者ID:wiremas,項目名稱:spore,代碼行數:56,代碼來源:AEsporeNodeTemplate.py

示例9: ui

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import tabLayout [as 別名]
def ui():
    '''
    User interface for world bake
    '''

    with utl.MlUi('ml_worldBake', 'World Bake', width=400, height=175, info='''Select objects, bake to locators in world, camera, or custom space.
When you're ready to bake back, select locators
and bake "from locators" to re-apply your animation.''') as win:

        mc.checkBoxGrp('ml_worldBake_bakeOnOnes_checkBox',label='Bake on Ones',
                       annotation='Bake every frame. If deselected, the tool will preserve keytimes.')

        tabs = mc.tabLayout()
        tab1 = mc.columnLayout(adj=True)
        mc.radioButtonGrp('ml_worldBake_space_radioButton', label='Bake To Space', numberOfRadioButtons=3,
                          labelArray3=('World','Camera','Last Selected'), select=1,
                          annotation='The locators will be parented to world, the current camera, or the last selection.')
        mc.checkBoxGrp('ml_worldBake_constrain_checkBox',label='Maintain Constraints',
                       annotation='Constrain source nodes to the created locators, after baking.')

        win.ButtonWithPopup(label='Bake Selection To Locators', command=toLocators, annotation='Bake selected object to locators specified space.',
            readUI_toArgs={'bakeOnOnes':'ml_worldBake_bakeOnOnes_checkBox',
                           'spaceInt':'ml_worldBake_space_radioButton',
                           'constrainSource':'ml_worldBake_constrain_checkBox'},
            name=win.name)#this last arg is temp..
        mc.setParent('..')

        tab2 = mc.columnLayout(adj=True)
        win.ButtonWithPopup(label='Bake Selected Locators Back To Objects', command=fromLocators, annotation='Bake from selected locators back to their source objects.',
            readUI_toArgs={'bakeOnOnes':'ml_worldBake_bakeOnOnes_checkBox'}, name=win.name)#this last arg is temp..
        mc.setParent('..')

        tab3 = mc.columnLayout(adj=True)
        win.ButtonWithPopup(label='Re-Parent Animated', command=reparent, annotation='Parent all selected nodes to the last selection.',
            readUI_toArgs={'bakeOnOnes':'ml_worldBake_bakeOnOnes_checkBox'}, name=win.name)
        win.ButtonWithPopup(label='Un-Parent Animated', command=unparent, annotation='Parent all selected to world.',
            readUI_toArgs={'bakeOnOnes':'ml_worldBake_bakeOnOnes_checkBox'}, name=win.name)

        mc.separator()

        mc.checkBoxGrp('ml_worldBake_maintainOffset_checkBox',label='Maintain Offset',
                       annotation='Maintain the offset between nodes, rather than snapping.')
        win.ButtonWithPopup(label='Bake Selected', command=utl.matchBake, annotation='Bake from the first selected object directly to the second.',
            readUI_toArgs={'bakeOnOnes':'ml_worldBake_bakeOnOnes_checkBox',
                           'maintainOffset':'ml_worldBake_maintainOffset_checkBox'}, name=win.name)

        mc.tabLayout( tabs, edit=True, tabLabel=((tab1, 'Bake To Locators'), (tab2, 'Bake From Locators'), (tab3, 'Bake Selection')) )
#        win.ButtonWithPopup(label='Bake Selected With Offset', command=matchBake, annotation='Bake from the first selected object directly to the second, maintaining offset.',
#            readUI_toArgs={'bakeOnOnes':'ml_worldBake_bakeOnOnes_checkBox'}, name=win.name)#this last arg is temp.. 
開發者ID:morganloomis,項目名稱:ml_tools,代碼行數:51,代碼來源:ml_worldBake.py

示例10: createShelfButton

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import tabLayout [as 別名]
def createShelfButton(command, label='', name=None, description='',
                      image=None, #the default image is a circle
                      labelColor=(1, 0.5, 0),
                      labelBackgroundColor=(0, 0, 0, 0.5),
                      backgroundColor=None
                      ):
    '''
    Create a shelf button for the command on the current shelf
    '''
    #some good default icons:
    #menuIconConstraints - !
    #render_useBackground - circle
    #render_volumeShader - black dot
    #menuIconShow - eye

    gShelfTopLevel = mm.eval('$temp=$gShelfTopLevel')
    if not mc.tabLayout(gShelfTopLevel, exists=True):
        OpenMaya.MGlobal.displayWarning('Shelf not visible.')
        return

    if not name:
        name = label

    if not image:
        image = getIcon(name)
    if not image:
        image = 'render_useBackground'

    shelfTab = mc.shelfTabLayout(gShelfTopLevel, query=True, selectTab=True)
    shelfTab = gShelfTopLevel+'|'+shelfTab

    #add additional args depending on what version of maya we're in
    kwargs = {}
    if MAYA_VERSION >= 2009:
        kwargs['commandRepeatable'] = True
    if MAYA_VERSION >= 2011:
        kwargs['overlayLabelColor'] = labelColor
        kwargs['overlayLabelBackColor'] = labelBackgroundColor
        if backgroundColor:
            kwargs['enableBackground'] = bool(backgroundColor)
            kwargs['backgroundColor'] = backgroundColor

    return mc.shelfButton(parent=shelfTab, label=name, command=command,
                          imageOverlayLabel=label, image=image, annotation=description,
                          width=32, height=32, align='center', **kwargs) 
開發者ID:morganloomis,項目名稱:ml_tools,代碼行數:47,代碼來源:ml_utilities.py


注:本文中的maya.cmds.tabLayout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。