def create(obj):
"""Tell ZBrush to treat `obj` as a new object.
Under the hood this changes a gozbruhBrush ID to match object name.
"""
# does not change selection:
cmds.delete(obj, constructionHistory=True)
shape = cmds.ls(obj, type='mesh', dag=True)[0]
xform = cmds.listRelatives(shape, parent=True, fullPath=True)[0]
goz_check_xform = cmds.attributeQuery(
'gozbruhBrushID', node=xform, exists=True)
goz_check_shape = cmds.attributeQuery(
'gozbruhBrushID', node=shape, exists=True)
if goz_check_shape:
cmds.setAttr(shape + '.gozbruhBrushID', obj, type='string')
if goz_check_xform:
cmds.setAttr(xform + '.gozbruhBrushID', obj, type='string')
return xform
评论列表
文章目录