[Bf-extensions-cvs] [931be41c] master: Addon: BSurfaces: Some refactoring.

Spivak Vladimir cwolf3d noreply at git.blender.org
Tue Dec 3 00:25:47 CET 2019


Commit: 931be41cb1438a4233e0faadc54e58bb41057d96
Author: Spivak Vladimir (cwolf3d)
Date:   Tue Dec 3 01:25:09 2019 +0200
Branches: master
https://developer.blender.org/rBA931be41cb1438a4233e0faadc54e58bb41057d96

Addon: BSurfaces: Some refactoring.

===================================================================

M	mesh_bsurfaces.py

===================================================================

diff --git a/mesh_bsurfaces.py b/mesh_bsurfaces.py
index 3232c582..68f921cc 100644
--- a/mesh_bsurfaces.py
+++ b/mesh_bsurfaces.py
@@ -108,7 +108,7 @@ class VIEW3D_PT_tools_SURFSK_mesh(Panel):
             col.separator()
 
         col.separator()
-        props = col.operator("mesh.surfsk_add_surface", text="Add Surface")
+        col.operator("mesh.surfsk_add_surface", text="Add Surface")
         col.operator("mesh.surfsk_edit_surface", text="Edit Surface")
 
         col.separator()
@@ -440,7 +440,7 @@ class MESH_OT_SURFSK_add_surface(Operator):
                 verts_count += 1
         else:
             verts_count = 1
-            for n in range(0, fixed_edges_num):
+            for _n in range(0, fixed_edges_num):
                 edges_proportions.append(1 / fixed_edges_num)
                 verts_count += 1
 
@@ -896,7 +896,6 @@ class MESH_OT_SURFSK_add_surface(Operator):
         tuple(a)
         verts_surrounded_by_faces = {}
         for v_idx in edges_per_vert:
-            edges = edges_per_vert[v_idx]
             edges_with_two_faces_count = 0
 
             for ed_idx in edges_per_vert[v_idx]:
@@ -1359,11 +1358,11 @@ class MESH_OT_SURFSK_add_surface(Operator):
                                         dist = (intersec_coords[0] - intersec_coords[1]).length
 
                                         if dist <= self.crosshatch_merge_distance * 1.5:
-                                            temp_co, percent1 = intersect_point_line(
+                                            _temp_co, percent1 = intersect_point_line(
                                                                     intersec_coords[0], bp1_co, bp2_co
                                                                     )
                                             if (percent1 >= -0.02 and percent1 <= 1.02):
-                                                temp_co, percent2 = intersect_point_line(
+                                                _temp_co, percent2 = intersect_point_line(
                                                                         intersec_coords[1], bp3_co, bp4_co
                                                                         )
                                                 if (percent2 >= -0.02 and percent2 <= 1.02):
@@ -1590,7 +1589,6 @@ class MESH_OT_SURFSK_add_surface(Operator):
 
         # Build surface
         all_surface_verts_co = []
-        verts_idx_translation = {}
         for i in range(len(final_points_ob.data.vertices)):
             coords = final_points_ob.data.vertices[i].co
             all_surface_verts_co.append([coords[0], coords[1], coords[2]])
@@ -1635,11 +1633,6 @@ class MESH_OT_SURFSK_add_surface(Operator):
                                 ob_surface.data.vertices[ed.vertices[1]].co
                                 ).length
 
-        if len(ob_surface.data.edges) > 0:
-            average_surface_edges_length = edges_length_sum / len(ob_surface.data.edges)
-        else:
-            average_surface_edges_length = 0.0001
-
         # Make dictionary with all the verts connected to each vert, on the new surface object.
         surface_connected_verts = {}
         for ed in ob_surface.data.edges:
@@ -2079,7 +2072,7 @@ class MESH_OT_SURFSK_add_surface(Operator):
                                 verts_tips_same_chain_idx
                                 )
             # The tip of the selected vertices nearest to the last point of the first sketched stroke
-            nearest_tip_to_first_st_last_pt_idx, temp_dist = \
+            nearest_tip_to_first_st_last_pt_idx, _temp_dist = \
                     self.shortest_distance(
                                 self.main_object,
                                 last_sketched_point_first_stroke_co,
@@ -2096,7 +2089,7 @@ class MESH_OT_SURFSK_add_surface(Operator):
                 # The selected vertex nearest to the first point of the second sketched stroke
                 # (This will be useful to determine the direction of the closed
                 # selection V when extruding along strokes)
-                nearest_vert_to_second_st_first_pt_idx, temp_dist = \
+                nearest_vert_to_second_st_first_pt_idx, _temp_dist = \
                         self.shortest_distance(
                                 self.main_object,
                                 first_sketched_point_second_stroke_co,
@@ -2105,7 +2098,7 @@ class MESH_OT_SURFSK_add_surface(Operator):
                 # The selected vertex nearest to the first point of the second sketched stroke
                 # (This will be useful to determine the direction of the closed
                 # selection V2 when extruding along strokes)
-                nearest_vert_to_second_st_last_pt_idx, temp_dist = \
+                nearest_vert_to_second_st_last_pt_idx, _temp_dist = \
                         self.shortest_distance(
                                 self.main_object,
                                 last_sketched_point_second_stroke_co,
@@ -2124,7 +2117,7 @@ class MESH_OT_SURFSK_add_surface(Operator):
             average_edge_length = edges_sum / len(all_selected_edges_idx)
 
             # Get shortest distance from the first point of the last stroke to any participating vertex
-            temp_idx, shortest_distance_to_last_stroke = \
+            _temp_idx, shortest_distance_to_last_stroke = \
                         self.shortest_distance(
                                 self.main_object,
                                 first_sketched_point_last_stroke_co,
@@ -2143,7 +2136,6 @@ class MESH_OT_SURFSK_add_surface(Operator):
                 if nearest_tip_to_first_st_first_pt_idx not in single_unselected_verts or \
                   nearest_tip_to_first_st_first_pt_idx == middle_vertex_idx:
                     self.selection_V_is_closed = False
-                    first_neighbor_V_idx = None
                     closing_vert_U_idx = None
                     closing_vert_U2_idx = None
                     closing_vert_V_idx = None
@@ -2190,7 +2182,6 @@ class MESH_OT_SURFSK_add_surface(Operator):
                       nearest_tip_to_first_st_last_pt_idx == middle_vertex_idx:
 
                         self.selection_V2_is_closed = False
-                        first_neighbor_V2_idx = None
                         closing_vert_V2_idx = None
                         first_vert_V2_idx = nearest_tip_to_first_st_last_pt_idx
 
@@ -2231,7 +2222,6 @@ class MESH_OT_SURFSK_add_surface(Operator):
                 if nearest_tip_to_first_st_first_pt_idx not in single_unselected_verts or \
                   nearest_tip_to_first_st_first_pt_idx == middle_vertex_idx:
                     self.selection_U_is_closed = False
-                    first_neighbor_U_idx = None
                     closing_vert_U_idx = None
 
                     points_tips = []
@@ -2303,7 +2293,6 @@ class MESH_OT_SURFSK_add_surface(Operator):
                       nearest_tip_to_last_st_first_pt_idx == middle_vertex_idx:
 
                         self.selection_U2_is_closed = False
-                        first_neighbor_U2_idx = None
                         closing_vert_U2_idx = None
                         first_vert_U2_idx = nearest_tip_to_last_st_first_pt_idx
                     else:
@@ -2363,7 +2352,6 @@ class MESH_OT_SURFSK_add_surface(Operator):
                                     all_verts_idx, first_vert_U_idx,
                                     middle_vertex_idx, closing_vert_U_idx
                                     )
-            verts_ordered_U_indices = [x.index for x in verts_ordered_U]
 
         # Get an ordered list of the vertices of Selection-U2
         verts_ordered_U2 = []
@@ -2373,7 +2361,6 @@ class MESH_OT_SURFSK_add_surface(Operator):
                                     all_verts_idx, first_vert_U2_idx,
                                     middle_vertex_idx, closing_vert_U2_idx
                                     )
-            verts_ordered_U2_indices = [x.index for x in verts_ordered_U2]
 
         # Get an ordered list of the vertices of Selection-V
         verts_ordered_V = []
@@ -2393,7 +2380,6 @@ class MESH_OT_SURFSK_add_surface(Operator):
                                     all_verts_idx, first_vert_V2_idx,
                                     middle_vertex_idx, closing_vert_V2_idx
                                     )
-            verts_ordered_V2_indices = [x.index for x in verts_ordered_V2]
 
         # Check if when there are two-not-connected selections both have the same
         # number of verts. If not terminate the script
@@ -2455,7 +2441,6 @@ class MESH_OT_SURFSK_add_surface(Operator):
                                     edges_lengths_U2, edges_lengths_sum_U2,
                                     self.selection_U2_exists, self.edges_V
                                     )
-            verts_count_U2 = len(edges_proportions_U2) + 1
 
         # Proportions V
         edges_proportions_V = []
@@ -2463,7 +2448,6 @@ class MESH_OT_SURFSK_add_surface(Operator):
                                     edges_lengths_V, edges_lengths_sum_V,
                                     self.selection_V_exists, self.edges_V
                                     )
-        verts_count_V = len(edges_proportions_V) + 1
 
         if self.selection_V2_exists:
             edges_proportions_V2 = []
@@ -2471,7 +2455,6 @@ class MESH_OT_SURFSK_add_surface(Operator):
                                     edges_lengths_V2, edges_lengths_sum_V2,
                                     self.selection_V2_exists, self.edges_V
                                     )
-            verts_count_V2 = len(edges_proportions_V2) + 1
 
         # Cyclic Follow: simplify sketched curves, make them Cyclic, and complete
         # the actual sketched curves with a "closing segment"
@@ -2857,7 +2840,7 @@ class MESH_OT_SURFSK_add_surface(Operator):
 
                 for i in range(len(self.main_splines.data.splines)):
                     sp = self.main_splines.data.splines[i]
-                    v_idx, dist_temp = self.shortest_distance(
+                    v_idx, _dist_temp = self.shortest_distance(
                                                 self.main_object,
                  

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list