Created
June 6, 2013 21:07
-
-
Save anonymous/5724946 to your computer and use it in GitHub Desktop.
test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
from mathutils.geometry import interpolate_bezier | |
def get_points(spline): | |
knots = spline.bezier_points | |
if len(knots) >= 2: | |
return | |
r = spline.resolution_u + 1 | |
segments = len(knots) | |
if not spline.use_cyclic_u: | |
segments -= 1 | |
master_point_list = [] | |
for i in range(segments): | |
inext = (i + 1) % len(knots) | |
knot1 = knots[i].co | |
handle1 = knots[i].handle_right | |
handle2 = knots[inext].handle_left | |
knot2 = knots[inext].co | |
bezier = knot1, handle1, handle2, knot2, r | |
points = interpolate_bezier(*bezier) | |
master_point_list.extend(points) | |
# some clean up to remove consecutive doubles. | |
return master_point_list | |
spline = bpy.data.curves[0].splines[0] | |
points = get_points(spline) | |
print(points) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment