diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-07-25 12:48:58 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-07-25 12:48:58 +0400 |
commit | 48c9da843c40ff8a97b462d8539185b662ba1567 (patch) | |
tree | 5ef66e3398e8a8b852e405cd29ba26ce3f617404 /mesh_bsurfaces.py | |
parent | 7690c2a38db02317d7ad289a16b8c55b5ec0ed3a (diff) |
swap vector multiplication order, also some style changes
Diffstat (limited to 'mesh_bsurfaces.py')
-rw-r--r-- | mesh_bsurfaces.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/mesh_bsurfaces.py b/mesh_bsurfaces.py index 645138bc..2bb0fc0e 100644 --- a/mesh_bsurfaces.py +++ b/mesh_bsurfaces.py @@ -113,15 +113,15 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): #### Calculates length of a chain of points. def get_chain_length(self, object, verts_ordered): - matrix = object.matrix_world + matrix = object.matrix_world.copy() edges_lengths = [] edges_lengths_sum = 0 for i in range(0, len(verts_ordered)): if i == 0: - prev_v_co = verts_ordered[i].co * matrix + prev_v_co = matrix * verts_ordered[i].co else: - v_co = verts_ordered[i].co * matrix + v_co = matrix * verts_ordered[i].co v_difs = [prev_v_co[0] - v_co[0], prev_v_co[1] - v_co[1], prev_v_co[2] - v_co[2]] edge_length = abs(sqrt(v_difs[0] * v_difs[0] + v_difs[1] * v_difs[1] + v_difs[2] * v_difs[2])) @@ -334,11 +334,11 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): points_B = [] points_first_stroke_tips = [] - points_A.append(self.main_object.data.vertices[verts_tips_parsed_idx[0]].co * self.main_object.matrix_world) - points_A.append(self.main_object.data.vertices[middle_vertex_idx].co * self.main_object.matrix_world) + points_A.append(self.main_object.matrix_world * self.main_object.data.vertices[verts_tips_parsed_idx[0]].co) + points_A.append(self.main_object.matrix_world * self.main_object.data.vertices[middle_vertex_idx].co) - points_B.append(self.main_object.data.vertices[verts_tips_parsed_idx[1]].co * self.main_object.matrix_world) - points_B.append(self.main_object.data.vertices[middle_vertex_idx].co * self.main_object.matrix_world) + points_B.append(self.main_object.matrix_world * self.main_object.data.vertices[verts_tips_parsed_idx[1]].co) + points_B.append(self.main_object.matrix_world * self.main_object.data.vertices[middle_vertex_idx].co) points_first_stroke_tips.append(ob_gp_strokes.data.splines[0].bezier_points[0].co) points_first_stroke_tips.append(ob_gp_strokes.data.splines[0].bezier_points[len(ob_gp_strokes.data.splines[0].bezier_points) - 1].co) @@ -363,7 +363,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): prev_dist = 999999999999 for i in range(0, len(verts_tips_same_chain_idx)): for v_idx in range(0, len(verts_tips_same_chain_idx[i])): - dist = self.pts_distance(first_sketched_point_first_stroke_co, self.main_object.data.vertices[verts_tips_same_chain_idx[i][v_idx]].co * self.main_object.matrix_world) + dist = self.pts_distance(first_sketched_point_first_stroke_co, self.main_object.matrix_world * self.main_object.data.vertices[verts_tips_same_chain_idx[i][v_idx]].co) if dist < prev_dist: prev_dist = dist @@ -379,7 +379,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): prev_dist = 999999999999 for i in range(0, len(verts_tips_same_chain_idx)): for v_idx in range(0, len(verts_tips_same_chain_idx[i])): - dist = self.pts_distance(last_sketched_point_first_stroke_co, self.main_object.data.vertices[verts_tips_same_chain_idx[i][v_idx]].co * self.main_object.matrix_world) + dist = self.pts_distance(last_sketched_point_first_stroke_co, self.main_object.matrix_world * self.main_object.data.vertices[verts_tips_same_chain_idx[i][v_idx]].co) if dist < prev_dist: prev_dist = dist @@ -391,7 +391,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): prev_dist = 999999999999 for i in range(0, len(verts_tips_same_chain_idx)): for v_idx in range(0, len(verts_tips_same_chain_idx[i])): - dist = self.pts_distance(first_sketched_point_last_stroke_co, self.main_object.data.vertices[verts_tips_same_chain_idx[i][v_idx]].co * self.main_object.matrix_world) + dist = self.pts_distance(first_sketched_point_last_stroke_co, self.main_object.matrix_world * self.main_object.data.vertices[verts_tips_same_chain_idx[i][v_idx]].co) if dist < prev_dist: prev_dist = dist @@ -405,7 +405,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): # Determine if the single selection will be treated as U or as V. edges_sum = 0 for i in all_selected_edges_idx: - edges_sum += self.pts_distance(self.main_object.data.vertices[self.main_object.data.edges[i].vertices[0]].co * self.main_object.matrix_world, self.main_object.data.vertices[self.main_object.data.edges[i].vertices[1]].co * self.main_object.matrix_world) + edges_sum += self.pts_distance(self.main_object.matrix_world * self.main_object.data.vertices[self.main_object.data.edges[i].vertices[0]].co, self.main_object.matrix_world * self.main_object.data.vertices[self.main_object.data.edges[i].vertices[1]].co) average_edge_length = edges_sum / len(all_selected_edges_idx) @@ -430,8 +430,8 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): selection_U_exists = True selection_V_exists = False - points_tips.append(self.main_object.data.vertices[verts_tips_same_chain_idx[nearest_tip_first_st_first_pt_idx][0]].co * self.main_object.matrix_world) - points_tips.append(self.main_object.data.vertices[verts_tips_same_chain_idx[nearest_tip_first_st_first_pt_idx][1]].co * self.main_object.matrix_world) + points_tips.append(self.main_object.matrix_world * self.main_object.data.vertices[verts_tips_same_chain_idx[nearest_tip_first_st_first_pt_idx][0]].co) + points_tips.append(self.main_object.matrix_world * self.main_object.data.vertices[verts_tips_same_chain_idx[nearest_tip_first_st_first_pt_idx][1]].co) points_first_stroke_tips.append(ob_gp_strokes.data.splines[0].bezier_points[0].co) points_first_stroke_tips.append(ob_gp_strokes.data.splines[0].bezier_points[len(ob_gp_strokes.data.splines[0].bezier_points) - 1].co) @@ -565,7 +565,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): if selection_type == "TWO_NOT_CONNECTED": if selection_U2_exists: for i in range(0, len(sketched_splines_parsed[len(sketched_splines_parsed) - 1])): - sketched_splines_parsed[len(sketched_splines_parsed) - 1][i] = verts_ordered_U2[i].co * self.main_object.matrix_world + sketched_splines_parsed[len(sketched_splines_parsed) - 1][i] = self.main_object.matrix_world * verts_ordered_U2[i].co #### Create temporary curves along the "control-points" found on the sketched curves and the mesh selection. @@ -582,7 +582,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): if selection_U_exists: ob_ctrl_pts.data.vertices.add(1) last_v = ob_ctrl_pts.data.vertices[len(ob_ctrl_pts.data.vertices) - 1] - last_v.co = verts_ordered_U[i].co * self.main_object.matrix_world + last_v.co = self.main_object.matrix_world * verts_ordered_U[i].co vert_num_in_spline += 1 @@ -675,12 +675,12 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator): # Set the first and last verts of each spline to the locations of the respective verts in the selections. if selection_V_exists: for i in range(0, len(surface_splines_parsed[0])): - surface_splines_parsed[len(surface_splines_parsed) - 1][i] = verts_ordered_V[i].co * self.main_object.matrix_world + surface_splines_parsed[len(surface_splines_parsed) - 1][i] = self.main_object.matrix_world * verts_ordered_V[i].co if selection_type == "TWO_NOT_CONNECTED": if selection_V2_exists: for i in range(0, len(surface_splines_parsed[0])): - surface_splines_parsed[0][i] = verts_ordered_V2[i].co * self.main_object.matrix_world + surface_splines_parsed[0][i] = self.main_object.matrix_world * verts_ordered_V2[i].co #### Delete object with control points and object from grease pencil convertion. |