def cross_stitch(stitches=108, stitch_points=8, u_offset=0, tangent_offset=0, normal_fn=None):
'''Create cross stitching between two curves'''
a, b = cmds.ls(sl=True, dag=True, leaf=True)
if not normal_fn:
normal_fn = partial(sphere_normal, center=MVector(0, 0, 0))
half_stitches = int(stitches * 0.5)
u_offset_a = u_offset
u_offset_b = u_offset + 1.0 / (half_stitches * 2)
a0, a1 = MVector(*point_at_parameter(a, 0)), MVector(*point_at_parameter(a, u_offset_b))
tangent_offset += (a0-a1).length() * 0.3
print tangent_offset
points = stitch_curves(a, b, half_stitches, stitch_points, u_offset_a, tangent_offset, normal_fn)
cmds.curve(point=points)
points = stitch_curves(a, b, half_stitches, stitch_points, u_offset_b, tangent_offset, normal_fn)
cmds.curve(point=points)
评论列表
文章目录