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


Python cmds.shelfLayout方法代碼示例

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


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

示例1: shelf

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import shelfLayout [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: shelf

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import shelfLayout [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

示例3: get

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import shelfLayout [as 別名]
def get(cls, name, layout=None):
        
        if not layout:
            layout = cls.top_level_layout()

        cmds.setParent(layout)
        shelf = cmds.shelfLayout(name, q=True, exists=True)

        if shelf:
            return cls(name, layout)
        else:
            raise NameError("Unable to find shelf: " + name)

    # ------------------------------------------------------------------------- 
開發者ID:Clemson-DPA,項目名稱:dpa-pipe,代碼行數:16,代碼來源:shelf.py

示例4: create

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import shelfLayout [as 別名]
def create(self):
        cmds.setParent(self.layout)
        cmds.shelfLayout(self.name)
        self._shelf_error_fix()

    # ------------------------------------------------------------------------- 
開發者ID:Clemson-DPA,項目名稱:dpa-pipe,代碼行數:8,代碼來源:shelf.py

示例5: exists

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import shelfLayout [as 別名]
def exists(self):
        cmds.setParent(self.layout)
        return cmds.shelfLayout(self.name, q=True, exists=True)

    # ------------------------------------------------------------------------- 
開發者ID:Clemson-DPA,項目名稱:dpa-pipe,代碼行數:7,代碼來源:shelf.py

示例6: buildMainLayout

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import shelfLayout [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

示例7: refreshShelfLayout

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import shelfLayout [as 別名]
def refreshShelfLayout(self, *args):
        '''Delete and the shelf buttons and remake them
        '''

        shelfButtons = mc.shelfLayout(self.shelfLayout, query=True, childArray=True)
        if shelfButtons:
            for child in shelfButtons:
                mc.deleteUI(child)

        mc.setParent(self.shelfLayout)

        for each in os.listdir(REPOSITORY_PATH):
            if each.endswith('.ctrl'):
                name = os.path.splitext(each)[0]
                icon = None
                imageFile = os.path.join(REPOSITORY_PATH,name+'.png')
                if os.path.isfile(imageFile):
                    icon = imageFile
                filename = os.path.join(REPOSITORY_PATH,each)
                button = mc.shelfButton(command=partial(importControl, name),
                                        image=icon,
                                        width=70,
                                        height=70,
                                        imageOverlayLabel=name.replace('_',' ').replace('  ',' '),
                                        annotation=name)

                menus = mc.shelfButton(button, query=True, popupMenuArray=True)
                if menus:
                    for menu in menus:
                        mc.deleteUI(menu)
                #mc.popupMenu()
                #mc.menuItem('delete', command=partial(self.deleteShelfButton, name)) 
開發者ID:morganloomis,項目名稱:ml_tools,代碼行數:34,代碼來源:ml_controlLibrary.py


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