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))
评论列表
文章目录