python中shelf_Python cmds.shelfLayout方法代碼示例

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

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

示例1: shelf

​點讚 6

# 需要導入模塊: 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,

示例2: shelf

​點讚 5

# 需要導入模塊: 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,

示例3: get

​點讚 5

# 需要導入模塊: 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,

示例4: create

​點讚 5

# 需要導入模塊: 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,

示例5: exists

​點讚 5

# 需要導入模塊: 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,

示例6: buildMainLayout

​點讚 5

# 需要導入模塊: 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,

示例7: refreshShelfLayout

​點讚 5

# 需要導入模塊: 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,

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值