def softSelectionSkinWeights(*args):
model = mc.ls(sl=True, o=True)
joints = mc.ls(model, type='joint')
mc.select(joints, deselect=True)
weights = getSoftSelectionWeights()
if not model or not joints or not weights:
raise RuntimeError('Select vertices followed by a joint')
if len(joints) > 1:
raise RuntimeError('Only one joint can be selected at a time')
joint = joints[0]
skin = utl.getSkinCluster(model[0])
if not skin:
raise RuntimeError('Mesh must have an existing skinCluster')
influences = mc.skinCluster(skin, query=True, influence=True)
if joint not in influences:
mc.skinCluster(skin, edit=True, addInfluence=joint, lockWeights=False, weight=0)
for influence in influences:
mc.skinCluster(skin, edit=True, influence=influence, lockWeights=False)
for vertex, weight in weights.items():
mc.skinPercent(skin, vertex, transformValue=(joint, weight))
mc.select(joint)
# ______________________
# - -/__ Revision History __/- - - - - - - - - - - - - - - - - - - - - - - -
#
# Revision 1: 2016-12-31 : Initial publish
评论列表
文章目录