[Bf-blender-cvs] [a38506b298d] soc-2019-bevel-profiles: Bevel Modal Keymap: Added Keys, reenabled custom status text

Hans Goudey noreply at git.blender.org
Thu Aug 15 17:39:26 CEST 2019


Commit: a38506b298dc886c22642420d359708f02589bd4
Author: Hans Goudey
Date:   Thu Aug 15 11:39:13 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rBa38506b298dc886c22642420d359708f02589bd4

Bevel Modal Keymap: Added Keys, reenabled custom status text

Added custom profile toggle and intersection method cycle
The custom status text shows the current state of the properties making
it necessary to enable it over the automatic one.
But it's getting far too long.

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

M	release/scripts/presets/keyconfig/keymap_data/blender_default.py
M	source/blender/editors/mesh/editmesh_bevel.c

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

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 3f6a5f0a514..a29b511110b 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -4625,6 +4625,8 @@ def km_bevel_modal_map(_params):
         ("MARK_SHARP_TOGGLE", {"type": 'K', "value": 'PRESS', "any": True}, None),
         ("OUTER_MITER_CHANGE", {"type": 'O', "value": 'PRESS', "any": True}, None),
         ("INNER_MITER_CHANGE", {"type": 'I', "value": 'PRESS', "any": True}, None),
+        ("CUSTOM_PROFILE_TOGGLE", {"type": 'Z', "value": 'PRESS', "any": True}, None),
+        ("VERTEX_MESH_CHANGE", {"type": 'N', "value": 'PRESS', "any": True}, None),
     ])
 
     return keymap
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index cdd88d838e6..32bbc6c9a35 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -120,6 +120,8 @@ enum {
   BEV_MODAL_MARK_SHARP_TOGGLE,
   BEV_MODAL_OUTER_MITER_CHANGE,
   BEV_MODAL_INNER_MITER_CHANGE,
+  BEV_MODAL_CUSTOM_PROFILE_TOGGLE,
+  BEV_MODAL_VERTEX_MESH_CHANGE,
 };
 
 static float get_bevel_offset(wmOperator *op)
@@ -135,15 +137,15 @@ static float get_bevel_offset(wmOperator *op)
   return val;
 }
 
-static void edbm_bevel_update_header(bContext *C, wmOperator *op)
+static void edbm_bevel_update_status_text(bContext *C, wmOperator *op)
 {
-  char header[UI_MAX_DRAW_STR];
+  char status_text[UI_MAX_DRAW_STR];
   char buf[UI_MAX_DRAW_STR];
   char *p = buf;
   int available_len = sizeof(buf);
   Scene *sce = CTX_data_scene(C);
   char offset_str[NUM_STR_REP_LEN];
-  const char *mode_str, *omiter_str, *imiter_str;
+  const char *mode_str, *omiter_str, *imiter_str, *vmesh_str;
   PropertyRNA *prop;
 
 #define WM_MODALKEY(_id) \
@@ -154,40 +156,40 @@ static void edbm_bevel_update_header(bContext *C, wmOperator *op)
     BLI_snprintf(offset_str, NUM_STR_REP_LEN, "%.1f%%", RNA_float_get(op->ptr, "offset_pct"));
   }
   else {
-    bUnit_AsString2(offset_str,
-                    NUM_STR_REP_LEN,
-                    (double)RNA_float_get(op->ptr, "offset"),
-                    3,
-                    B_UNIT_LENGTH,
-                    &sce->unit,
-                    true);
+    bUnit_AsString2(offset_str, NUM_STR_REP_LEN, (double)RNA_float_get(op->ptr, "offset"), 3,
+                    B_UNIT_LENGTH, &sce->unit, true);
   }
 
   prop = RNA_struct_find_property(op->ptr, "offset_type");
-  RNA_property_enum_name_gettexted(
-      C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &mode_str);
+  RNA_property_enum_name_gettexted(C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop),
+                                   &mode_str);
   prop = RNA_struct_find_property(op->ptr, "miter_outer");
-  RNA_property_enum_name_gettexted(
-      C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &omiter_str);
+  RNA_property_enum_name_gettexted(C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop),
+                                   &omiter_str);
   prop = RNA_struct_find_property(op->ptr, "miter_inner");
-  RNA_property_enum_name_gettexted(
-      C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &imiter_str);
-
-  BLI_snprintf(header,
-               sizeof(header),
-               TIP_("%s: confirm, "
-                    "%s: cancel, "
-                    "%s: mode (%s), "
-                    "%s: width (%s), "
-                    "%s: segments (%d), "
-                    "%s: profile (%.3f), "
-                    "%s: clamp overlap (%s), "
-                    "%s: vertex only (%s), "
-                    "%s: outer miter (%s), "
-                    "%s: inner miter (%s), "
-                    "%s: harden normals (%s), "
-                    "%s: mark seam (%s), "
-                    "%s: mark sharp (%s)"),
+  RNA_property_enum_name_gettexted(C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop),
+                                   &imiter_str);
+  prop = RNA_struct_find_property(op->ptr, "vmesh_method");
+  RNA_property_enum_name_gettexted(C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop),
+                                   &vmesh_str);
+
+  BLI_snprintf(status_text,
+               sizeof(status_text),
+               TIP_("%s: Confirm, "
+                    "%s: Cancel, "
+                    "%s: Mode (%s), "
+                    "%s: Width (%s), "
+                    "%s: Segments (%d), "
+                    "%s: Profile (%.3f), "
+                    "%s: Clamp Overlap (%s), "
+                    "%s: Vertex Only (%s), "
+                    "%s: Outer Miter (%s), "
+                    "%s: Inner Miter (%s), "
+                    "%s: Harden Normals (%s), "
+                    "%s: Mark Seam (%s), "
+                    "%s: Mark Sharp (%s), "
+                    "%s: Custom Profile (%s), "
+                    "%s: Intersection (%s)"),
                WM_MODALKEY(BEV_MODAL_CONFIRM),
                WM_MODALKEY(BEV_MODAL_CANCEL),
                WM_MODALKEY(BEV_MODAL_OFFSET_MODE_CHANGE),
@@ -211,11 +213,15 @@ static void edbm_bevel_update_header(bContext *C, wmOperator *op)
                WM_MODALKEY(BEV_MODAL_MARK_SEAM_TOGGLE),
                WM_bool_as_string(RNA_boolean_get(op->ptr, "mark_seam")),
                WM_MODALKEY(BEV_MODAL_MARK_SHARP_TOGGLE),
-               WM_bool_as_string(RNA_boolean_get(op->ptr, "mark_sharp")));
+               WM_bool_as_string(RNA_boolean_get(op->ptr, "mark_sharp")),
+               WM_MODALKEY(BEV_MODAL_CUSTOM_PROFILE_TOGGLE),
+               WM_bool_as_string(RNA_boolean_get(op->ptr, "use_custom_profile")),
+               WM_MODALKEY(BEV_MODAL_VERTEX_MESH_CHANGE),
+               vmesh_str);
 
 #undef WM_MODALKEY
 
-  ED_workspace_status_text(C, header);
+  ED_workspace_status_text(C, status_text);
 }
 
 static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
@@ -514,7 +520,7 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 
   edbm_bevel_calc_initial_length(op, event, false);
 
-//  edbm_bevel_update_header(C, op);
+  edbm_bevel_update_status_text(C, op);
 
   if (!edbm_bevel_calc(op)) {
     edbm_bevel_cancel(C, op);
@@ -612,9 +618,9 @@ wmKeyMap *bevel_modal_keymap(wmKeyConfig *keyconf)
   static const EnumPropertyItem modal_items[] = {
       {BEV_MODAL_CANCEL, "CANCEL", 0, "Cancel", "Cancel bevel"},
       {BEV_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", "Confirm bevel"},
-      {BEV_MODAL_VALUE_OFFSET, "VALUE_OFFSET", 0, "Value is offset", "Value changes offset"},
-      {BEV_MODAL_VALUE_PROFILE, "VALUE_PROFILE", 0, "Value is profile", "Value changes profile"},
-      {BEV_MODAL_VALUE_SEGMENTS, "VALUE_SEGMENTS", 0, "Value is segments",
+      {BEV_MODAL_VALUE_OFFSET, "VALUE_OFFSET", 0, "Change offset", "Value changes offset"},
+      {BEV_MODAL_VALUE_PROFILE, "VALUE_PROFILE", 0, "Change profile", "Value changes profile"},
+      {BEV_MODAL_VALUE_SEGMENTS, "VALUE_SEGMENTS", 0, "Change segments",
        "Value changes segments"},
       {BEV_MODAL_SEGMENTS_UP, "SEGMENTS_UP", 0, "Increase segments", "Increase segments"},
       {BEV_MODAL_SEGMENTS_DOWN, "SEGMENTS_DOWN", 0, "Decrease segments", "Decrease segments"},
@@ -634,12 +640,15 @@ wmKeyMap *bevel_modal_keymap(wmKeyConfig *keyconf)
        "Cycle through outer miter kinds"},
       {BEV_MODAL_INNER_MITER_CHANGE, "INNER_MITER_CHANGE", 0, "Change inner miter",
        "Cycle through inner miter kinds"},
+      {BEV_MODAL_CUSTOM_PROFILE_TOGGLE, "CUSTOM_PROFILE_TOGGLE", 0, "Toggle custom profile", ""},
+      {BEV_MODAL_VERTEX_MESH_CHANGE, "VERTEX_MESH_CHANGE", 0, "Change intersection method",
+      "Cycle through intersection methods"},
       {0, NULL, 0, NULL, NULL},
   };
 
   wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Bevel Modal Map");
 
-  /* this function is called for each spacetype, only needs to add map once */
+  /* This function is called for each spacetype, only needs to add map once */
   if (keymap && keymap->modal_items) {
     return NULL;
   }
@@ -669,14 +678,14 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
       handleNumInput(C, &opdata->num_input[opdata->value_mode], event)) {
     edbm_bevel_numinput_set_value(op);
     edbm_bevel_calc(op);
-//    edbm_bevel_update_header(C, op);
+    edbm_bevel_update_status_text(C, op);
     return OPERATOR_RUNNING_MODAL;
   }
   else if (etype == MOUSEMOVE) {
     if (!has_numinput) {
       edbm_bevel_mouse_set_value(op, event);
       edbm_bevel_calc(op);
-//      edbm_bevel_update_header(C, op);
+      edbm_bevel_update_status_text(C, op);
       handled = true;
     }
   }
@@ -690,7 +699,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
     }
     RNA_int_set(op->ptr, "segments", (int)opdata->segments);
     edbm_bevel_calc(op);
-//    edbm_bevel_update_header(C, op);
+    edbm_bevel_update_status_text(C, op);
     handled = true;
   }
   else if (etype == EVT_MODAL_MAP) {
@@ -710,7 +719,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
         opdata->segments = opdata->segments + 1;
         RNA_int_set(op->ptr, "segments", (int)opdata->segments);
         edbm_bevel_calc(op);
-//        edbm_bevel_update_header(C, op);
+        edbm_bevel_update_status_text(C, op);
         handled = true;
         break;
 
@@ -718,7 +727,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
         opdata->segments = max_ff(opdata->segments - 1, 1);
         RNA_int_set(op->ptr, "segments", (int)opdata->segments);
         edbm_bevel_calc(op);
-//        edbm_bevel_update_header(C, op);
+        edbm_bevel_update_status_text(C, op);
         handled = true;
         break;
 
@@ -745,7 +754,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
           edbm_bevel_mouse_set_value(op, event);
         }
         edbm_bevel_calc(op);
-//        edbm_bevel_update_header(C, op);
+        edbm_bevel_update_status_text(C, op);
         handled = true;
    

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list