def create_shelf():
"""
Create the OBB shelf
Raises:
None
Returns:
None
"""
tab_layout = mel.eval('$pytmp=$gShelfTopLevel')
shelf_exists = cmds.shelfLayout('OBB', exists=True)
if shelf_exists:
cmds.deleteUI('OBB', layout=True)
shelf = cmds.shelfLayout('OBB', parent=tab_layout)
for button, kwargs in buttons.items():
img = QtGui.QImage(kwargs['image'])
kwargs['width'] = img.width()
kwargs['height'] = img.height()
cmds.shelfButton(label=button, parent=shelf, **kwargs)
# Fix object 0 error.
shelves = cmds.shelfTabLayout(tab_layout, query=True, tabLabelIndex=True)
for index, shelf in enumerate(shelves):
cmds.optionVar(stringValue=("shelfName%d" % (index+1), str(shelf)))
评论列表
文章目录