[Bf-blender-cvs] [fb27a9bb983] master: Gizmo: show groups flagged with SHOW_MODAL_ALL during interaction

Campbell Barton noreply at git.blender.org
Wed Sep 15 09:54:41 CEST 2021


Commit: fb27a9bb983ce74b8d8f5f871cf0706dd1e25051
Author: Campbell Barton
Date:   Wed Sep 15 17:44:35 2021 +1000
Branches: master
https://developer.blender.org/rBfb27a9bb983ce74b8d8f5f871cf0706dd1e25051

Gizmo: show groups flagged with SHOW_MODAL_ALL during interaction

Follow up to fix for T73684,
which allowed some modal gizmos to hide all others.

Also resolve an issue from 917a972b56af103aee406dfffe1f42745b5ad360
where shear the shear gizmo would be visible during interaction.

Internally there are some changes to gizmo behavior

- The gizmo with modal interaction wont draw if it's poll function fails.
- The WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL flag now causes these gizmo
  groups to draw when another group is being interacted with.

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

M	source/blender/makesrna/intern/rna_wm_gizmo.c
M	source/blender/windowmanager/gizmo/WM_gizmo_types.h
M	source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c

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

diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c
index febb0e14e07..43848ce78e2 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo.c
@@ -1401,7 +1401,7 @@ static void rna_def_gizmogroup(BlenderRNA *brna)
        "SHOW_MODAL_ALL",
        0,
        "Show Modal All",
-       "Show all while interacting"},
+       "Show all while interacting, as well as this group when another is being interacted with"},
       {WM_GIZMOGROUPTYPE_TOOL_INIT,
        "TOOL_INIT",
        0,
diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_types.h b/source/blender/windowmanager/gizmo/WM_gizmo_types.h
index eab62ffce4c..b0dd7be4572 100644
--- a/source/blender/windowmanager/gizmo/WM_gizmo_types.h
+++ b/source/blender/windowmanager/gizmo/WM_gizmo_types.h
@@ -115,7 +115,10 @@ typedef enum eWM_GizmoFlagGroupTypeFlag {
   WM_GIZMOGROUPTYPE_SELECT = (1 << 3),
   /** The gizmo group is to be kept (not removed on loading a new file for eg). */
   WM_GIZMOGROUPTYPE_PERSISTENT = (1 << 4),
-  /** Show all other gizmos when interacting. */
+  /**
+   * Show all other gizmos when interacting.
+   * Also show this group when another group is being interacted with.
+   */
   WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL = (1 << 5),
   /**
    * When used with tool, only run when activating the tool,
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
index 6f6a2402d89..1144cd072e0 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
@@ -381,20 +381,6 @@ static void gizmomap_prepare_drawing(wmGizmoMap *gzmap,
 
   wmGizmo *gz_modal = gzmap->gzmap_context.modal;
 
-  /* only active gizmo needs updating */
-  if (gz_modal) {
-    if ((gz_modal->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL) == 0) {
-      if ((gz_modal->parent_gzgroup->hide.any == 0) &&
-          wm_gizmogroup_is_visible_in_drawstep(gz_modal->parent_gzgroup, drawstep)) {
-        if (gizmo_prepare_drawing(gzmap, gz_modal, C, draw_gizmos, drawstep)) {
-          gzmap->update_flag[drawstep] &= ~GIZMOMAP_IS_PREPARE_DRAW;
-        }
-      }
-      /* don't draw any other gizmos */
-      return;
-    }
-  }
-
   /* Allow refresh functions to ask to be refreshed again, clear before the loop below. */
   const bool do_refresh = gzmap->update_flag[drawstep] & GIZMOMAP_IS_REFRESH_CALLBACK;
   gzmap->update_flag[drawstep] &= ~GIZMOMAP_IS_REFRESH_CALLBACK;
@@ -406,6 +392,13 @@ static void gizmomap_prepare_drawing(wmGizmoMap *gzmap,
       continue;
     }
 
+    /* When modal only show other gizmo groups tagged with #WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL. */
+    if (gz_modal && (gzgroup != gz_modal->parent_gzgroup)) {
+      if ((gzgroup->type->flag & WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL) == 0) {
+        continue;
+      }
+    }
+
     /* Needs to be initialized on first draw. */
     /* XXX weak: Gizmo-group may skip refreshing if it's invisible
      * (map gets untagged nevertheless). */



More information about the Bf-blender-cvs mailing list