[Bf-blender-cvs] [e4669199bf9] master: Normals menu for face strength improved.

Howard Trickey noreply at git.blender.org
Tue May 7 14:47:37 CEST 2019


Commit: e4669199bf9c819d82072f7dd93ff7156e9e72aa
Author: Howard Trickey
Date:   Tue May 7 08:45:01 2019 -0400
Branches: master
https://developer.blender.org/rBe4669199bf9c819d82072f7dd93ff7156e9e72aa

Normals menu for face strength improved.

Now cascading menus in Mesh > Normals set and select face
strength with explicit choices of Weak / Medium / Strong.

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

M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/editors/mesh/editmesh_tools.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index da18d60786f..82b997427f4 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -3748,6 +3748,41 @@ class VIEW3D_MT_edit_mesh_faces(Menu):
 
         layout.menu("VIEW3D_MT_edit_mesh_faces_data")
 
+class VIEW3D_MT_edit_mesh_normals_select_strength(Menu):
+    bl_label = "Select by Face Strength"
+
+    def draw(self, _context):
+        layout = self.layout
+
+        op = layout.operator("mesh.mod_weighted_strength", text="Weak")
+        op.set = False
+        op.face_strength = 'WEAK'
+
+        op = layout.operator("mesh.mod_weighted_strength", text="Medium")
+        op.set = False
+        op.face_strength = 'MEDIUM'
+
+        op = layout.operator("mesh.mod_weighted_strength", text="Strong")
+        op.set = False
+        op.face_strength = 'STRONG'
+
+class VIEW3D_MT_edit_mesh_normals_set_strength(Menu):
+    bl_label = "Select by Face Strength"
+
+    def draw(self, _context):
+        layout = self.layout
+
+        op = layout.operator("mesh.mod_weighted_strength", text="Weak")
+        op.set = True
+        op.face_strength = 'WEAK'
+
+        op = layout.operator("mesh.mod_weighted_strength", text="Medium")
+        op.set = True
+        op.face_strength = 'MEDIUM'
+
+        op = layout.operator("mesh.mod_weighted_strength", text="Strong")
+        op.set = True
+        op.face_strength = 'STRONG'
 
 class VIEW3D_MT_edit_mesh_normals(Menu):
     bl_label = "Normals"
@@ -3780,8 +3815,8 @@ class VIEW3D_MT_edit_mesh_normals(Menu):
 
         layout.separator()
 
-        layout.operator("mesh.mod_weighted_strength", text="Get Face Strength").set = False
-        layout.operator("mesh.mod_weighted_strength", text="Set Face Strength").set = True
+        layout.menu("VIEW3D_MT_edit_mesh_normals_select_strength", text="Select by Face Strength")
+        layout.menu("VIEW3D_MT_edit_mesh_normals_set_strength", text="Set Face Strength")
 
 
 class VIEW3D_MT_edit_mesh_shading(Menu):
@@ -6450,6 +6485,8 @@ classes = (
     VIEW3D_MT_edit_mesh_faces,
     VIEW3D_MT_edit_mesh_faces_data,
     VIEW3D_MT_edit_mesh_normals,
+    VIEW3D_MT_edit_mesh_normals_select_strength,
+    VIEW3D_MT_edit_mesh_normals_set_strength,
     VIEW3D_MT_edit_mesh_shading,
     VIEW3D_MT_edit_mesh_weights,
     VIEW3D_MT_edit_mesh_clean,
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 40d64f06f7b..9dae42508db 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -8973,7 +8973,7 @@ static int edbm_mod_weighted_strength_exec(bContext *C, wmOperator *op)
   const int cd_prop_int_offset = CustomData_get_n_offset(
       &bm->pdata, CD_PROP_INT, cd_prop_int_index);
 
-  const int face_strength = scene->toolsettings->face_strength;
+  const int face_strength = RNA_enum_get(op->ptr, "face_strength");
   const bool set = RNA_boolean_get(op->ptr, "set");
   BM_mesh_elem_index_ensure(bm, BM_FACE);
 
@@ -9002,6 +9002,13 @@ static int edbm_mod_weighted_strength_exec(bContext *C, wmOperator *op)
   return OPERATOR_FINISHED;
 }
 
+static const EnumPropertyItem prop_mesh_face_strength_types[] = {
+    {FACE_STRENGTH_WEAK, "WEAK", 0, "Weak", ""},
+    {FACE_STRENGTH_MEDIUM, "MEDIUM", 0, "Medium", ""},
+    {FACE_STRENGTH_STRONG, "STRONG", 0, "Strong", ""},
+    {0, NULL, 0, NULL, NULL},
+};
+
 void MESH_OT_mod_weighted_strength(struct wmOperatorType *ot)
 {
   /* identifiers */
@@ -9017,5 +9024,12 @@ void MESH_OT_mod_weighted_strength(struct wmOperatorType *ot)
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
   ot->prop = RNA_def_boolean(ot->srna, "set", 0, "Set value", "Set Value of faces");
-  RNA_def_property_flag(ot->prop, PROP_HIDDEN);
+
+  ot->prop = RNA_def_enum(
+      ot->srna,
+      "face_strength",
+      prop_mesh_face_strength_types,
+      FACE_STRENGTH_MEDIUM,
+      "Face Strength",
+      "Strength to use for assigning or selecting face influence for weighted normal modifier");
 }



More information about the Bf-blender-cvs mailing list