diff --git a/__init__.py b/__init__.py index 628f48a..d8e0aa0 100755 --- a/__init__.py +++ b/__init__.py @@ -1,7 +1,7 @@ bl_info = { "name": "gp interpolate", "author": "Christophe Seux, Samuel Bernou", - "version": (0, 4, 1), + "version": (0, 4, 2), "blender": (3, 6, 0), "location": "Sidebar > Gpencil Tab > Interpolate", "description": "Interpolate Grease pencil strokes over 3D", diff --git a/interpolate_strokes/interpolate_simple.py b/interpolate_strokes/interpolate_simple.py index 458e9f7..07a942d 100755 --- a/interpolate_strokes/interpolate_simple.py +++ b/interpolate_strokes/interpolate_simple.py @@ -22,7 +22,7 @@ from mathutils.geometry import (barycentric_transform, tessellate_polygon) ## /!\ Old code kept for testing -## use pseudo plane coordinate instead of rayvast on real mesh plane +## use pseudo plane coordinate instead of raycast on real mesh plane class GP_OT_interpolate_stroke_simple(bpy.types.Operator): diff --git a/interpolate_strokes/operators.py b/interpolate_strokes/operators.py index 7bacace..e7b04d4 100644 --- a/interpolate_strokes/operators.py +++ b/interpolate_strokes/operators.py @@ -63,7 +63,9 @@ class GP_OT_interpolate_stroke(bpy.types.Operator): gp = context.object - matrix = np.array(gp.matrix_world, dtype='float64')#.inverted() + # matrix = gp.matrix_world + # origin = scn.camera.matrix_world.to_translation() + matrix = np.array(gp.matrix_world, dtype='float64') origin = np.array(scn.camera.matrix_world.to_translation(), 'float64') col = settings.target_collection @@ -239,6 +241,8 @@ class GP_OT_interpolate_stroke(bpy.types.Operator): for f in frames_to_jump: wm.progress_update(f) # Pgs scn.frame_set(f) + # origin = scn.camera.matrix_world.to_translation() + origin = np.array(scn.camera.matrix_world.to_translation(), 'float64') plan_co, plane_no = get_gp_draw_plane(gp) bpy.ops.gpencil.paste() @@ -271,7 +275,12 @@ class GP_OT_interpolate_stroke(bpy.types.Operator): world_co_3d.append(new_loc) - # Reproject on plane + ## Test with point in 3D space (Debug) + # nb_points = len(new_stroke.points) + # new_stroke.points.foreach_set('co', np.array(world_co_3d).reshape(nb_points*3)) + # new_stroke.points.update() + + ## Reproject on plane new_world_co_3d = [intersect_line_plane(origin, p, plan_co, plane_no) for p in world_co_3d] new_local_co_3d = matrix_transform(new_world_co_3d, matrix_inv)