Normals Menu: fix Average to be able to specify type.
authorHoward Trickey <howard.trickey@gmail.com>
Wed, 8 May 2019 11:44:15 +0000 (07:44 -0400)
committerHoward Trickey <howard.trickey@gmail.com>
Wed, 8 May 2019 11:44:15 +0000 (07:44 -0400)
Also removed some rogue debugging printfs from normal selection code.

release/scripts/startup/bl_ui/space_view3d.py
source/blender/bmesh/intern/bmesh_mesh.c

index 33fc3ad..3f67dbd 100644 (file)
@@ -3786,6 +3786,16 @@ class VIEW3D_MT_edit_mesh_normals_set_strength(Menu):
         op.set = True
         op.face_strength = 'STRONG'
 
+class VIEW3D_MT_edit_mesh_normals_average(Menu):
+    bl_label = "Average"
+
+    def draw(self, _context):
+        layout = self.layout
+
+        layout.operator("mesh.average_normals", text="Custom Normal").average_type = 'CUSTOM_NORMAL'
+        layout.operator("mesh.average_normals", text="Face Area").average_type = 'FACE_AREA'
+        layout.operator("mesh.average_normals", text="Corner Angle").average_type = 'CORNER_ANGLE'
+
 class VIEW3D_MT_edit_mesh_normals(Menu):
     bl_label = "Normals"
 
@@ -3803,7 +3813,7 @@ class VIEW3D_MT_edit_mesh_normals(Menu):
         layout.operator("mesh.point_normals", text="Point to Target")
         layout.operator("mesh.merge_normals", text="Merge")
         layout.operator("mesh.split_normals", text="Split")
-        layout.operator("mesh.average_normals", text="Average")
+        layout.menu("VIEW3D_MT_edit_mesh_normals_average", text="Average")
 
         layout.separator()
 
@@ -6489,6 +6499,7 @@ classes = (
     VIEW3D_MT_edit_mesh_normals,
     VIEW3D_MT_edit_mesh_normals_select_strength,
     VIEW3D_MT_edit_mesh_normals_set_strength,
+    VIEW3D_MT_edit_mesh_normals_average,
     VIEW3D_MT_edit_mesh_shading,
     VIEW3D_MT_edit_mesh_weights,
     VIEW3D_MT_edit_mesh_clean,
index cb10ec9..a35d10d 100644 (file)
@@ -1440,7 +1440,6 @@ static int bm_loop_normal_mark_indiv(BMesh *bm, BLI_bitmap *loops)
      * Note that this is OnĀ² piece of code,
      * but it is not designed to be used with huge selection sets,
      * rather with only a few items selected at most.*/
-    printf("using face history selection\n");
     /* Goes from last selected to the first selected element. */
     for (ese = bm->selected.last; ese; ese = ese->prev) {
       if (ese->htype == BM_FACE) {
@@ -1473,7 +1472,6 @@ static int bm_loop_normal_mark_indiv(BMesh *bm, BLI_bitmap *loops)
   else {
     if (sel_faces) {
       /* Only select all loops of selected faces. */
-      printf("using face selection\n");
       BMLoop *l;
       BMFace *f;
       BMIter liter, fiter;
@@ -1487,7 +1485,6 @@ static int bm_loop_normal_mark_indiv(BMesh *bm, BLI_bitmap *loops)
     }
     if (sel_edges) {
       /* Only select all loops of selected edges. */
-      printf("using edge selection\n");
       BMLoop *l;
       BMEdge *e;
       BMIter liter, eiter;
@@ -1510,7 +1507,6 @@ static int bm_loop_normal_mark_indiv(BMesh *bm, BLI_bitmap *loops)
     }
     if (sel_verts) {
       /* Select all loops of selected verts. */
-      printf("using vert selection\n");
       BMLoop *l;
       BMVert *v;
       BMIter liter, viter;