def connectShapeVis(*args):
"""Connects the attr from the assoc. text field to the shape Visibility of selected objects"""
sel = cmds.ls(sl=True, type="transform")
driver = cmds.textFieldButtonGrp(widgets["toShapeVis"], q=True, tx=True)
if sel:
if driver:
for obj in sel:
shapes = cmds.listRelatives(obj, s=True)
for shape in shapes:
try:
cmds.connectAttr(driver, "%s.v" % shape, f=True)
cmds.warning("Connected %s to %s" % (driver, shape))
except:
cmds.warning("Couldn't connect %s to %s. Sorry! Check the Script Editor." % (driver, shape))
else:
cmds.warning("You need to select an object to connect the shape.vis!")
评论列表
文章目录