strands.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:mayakit 作者: danbradham 项目源码 文件源码
def curve_to_hair(curve_shape, hair_system):

    curve = cmds.listRelatives(curve_shape, parent=True, f=True)[0]
    curve_name = curve.split('|')[-1]

    # Create follicle
    follicle_shape = cmds.createNode('follicle')
    follicle = cmds.listRelatives(follicle_shape, parent=True, f=True)[0]
    follicle = cmds.rename(follicle, curve_name + '_follicle#')
    follicle_shape = cmds.listRelatives(follicle, shapes=True, f=True)[0]
    cmds.connectAttr(curve + '.worldMatrix', follicle_shape + '.startPositionMatrix')
    cmds.connectAttr(curve_shape + '.local', follicle_shape + '.startPosition')

    # # Create output curve
    out_curve_shape = cmds.createNode('nurbsCurve')
    out_curve = cmds.listRelatives(out_curve_shape, parent=True, f=True)[0]
    out_curve = cmds.rename(out_curve, curve_name + '_out#')
    out_curve_shape = cmds.listRelatives(out_curve, shapes=True, f=True)[0]
    cmds.connectAttr(follicle + '.outCurve', out_curve_shape + '.create')

    # Add follicle to hair system
    add_follicle(follicle_shape, hair_system)

    return [[follicle, follicle_shape], [out_curve, out_curve_shape]]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号