Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-09-15 15:34:21 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-09-15 15:34:21 +0300
commit5c6cc931b2203d97aa9d570ff3b353c2a3dfebed (patch)
tree458f4ec5ad8cc2c32be83d21c1a557aa0c5ee1f2 /source/blender/windowmanager/gizmo
parent1bd28a5e0ca6d16c21b6365b389c9c1830635a58 (diff)
Gizmo: add flag to hide the gizmo group during interaction
This allows a hack to be removed that temporarily overwrote the 3D views gizmo display flag. Also reverse change from fb27a9bb983ce74b8d8f5f871cf0706dd1e25051 that runs poll on modal gizmo groups as there is some risk that the poll function unlinks the gizmo.
Diffstat (limited to 'source/blender/windowmanager/gizmo')
-rw-r--r--source/blender/windowmanager/gizmo/WM_gizmo_types.h12
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c17
2 files changed, 20 insertions, 9 deletions
diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_types.h b/source/blender/windowmanager/gizmo/WM_gizmo_types.h
index b0dd7be4572..a1edc4196dc 100644
--- a/source/blender/windowmanager/gizmo/WM_gizmo_types.h
+++ b/source/blender/windowmanager/gizmo/WM_gizmo_types.h
@@ -120,6 +120,10 @@ typedef enum eWM_GizmoFlagGroupTypeFlag {
* Also show this group when another group is being interacted with.
*/
WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL = (1 << 5),
+
+ /** Don't draw this gizmo group when it is modal. */
+ WM_GIZMOGROUPTYPE_DRAW_MODAL_EXCLUDE = (1 << 6),
+
/**
* When used with tool, only run when activating the tool,
* instead of linking the gizmo while the tool is active.
@@ -130,7 +134,7 @@ typedef enum eWM_GizmoFlagGroupTypeFlag {
* when a tool can activate multiple operators based on the key-map.
* We could even move the options into the key-map item.
* ~ campbell. */
- WM_GIZMOGROUPTYPE_TOOL_INIT = (1 << 6),
+ WM_GIZMOGROUPTYPE_TOOL_INIT = (1 << 7),
/**
* This gizmo type supports using the fallback tools keymap.
@@ -138,7 +142,7 @@ typedef enum eWM_GizmoFlagGroupTypeFlag {
*
* Often useful in combination with #WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK
*/
- WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP = (1 << 7),
+ WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP = (1 << 8),
/**
* Use this from a gizmos refresh callback so we can postpone the refresh operation
@@ -149,14 +153,14 @@ typedef enum eWM_GizmoFlagGroupTypeFlag {
* for selection operations. This means gizmos that use this check don't interfere
* with click drag events by popping up under the cursor and catching the tweak event.
*/
- WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK = (1 << 8),
+ WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK = (1 << 9),
/**
* Cause continuous redraws, i.e. set the region redraw flag on every main loop iteration. This
* should really be avoided by using proper region redraw tagging, notifiers and the message-bus,
* however for VR it's sometimes needed.
*/
- WM_GIZMOGROUPTYPE_VR_REDRAWS = (1 << 9),
+ WM_GIZMOGROUPTYPE_VR_REDRAWS = (1 << 10),
} eWM_GizmoFlagGroupTypeFlag;
/**
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
index 1144cd072e0..295196c701b 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
@@ -387,14 +387,21 @@ static void gizmomap_prepare_drawing(wmGizmoMap *gzmap,
LISTBASE_FOREACH (wmGizmoGroup *, gzgroup, &gzmap->groups) {
/* check group visibility - drawstep first to avoid unnecessary call of group poll callback */
- if (!wm_gizmogroup_is_visible_in_drawstep(gzgroup, drawstep) ||
- !WM_gizmo_group_type_poll(C, gzgroup->type)) {
+ if (!wm_gizmogroup_is_visible_in_drawstep(gzgroup, drawstep)) {
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) {
+ if (gz_modal && (gzgroup == gz_modal->parent_gzgroup)) {
+ if (gzgroup->type->flag & WM_GIZMOGROUPTYPE_DRAW_MODAL_EXCLUDE) {
+ continue;
+ }
+ }
+ else { /* Don't poll modal gizmo since some poll functions unlink. */
+ if (!WM_gizmo_group_type_poll(C, gzgroup->type)) {
+ continue;
+ }
+ /* When modal only show other gizmo groups tagged with #WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL. */
+ if (gz_modal && ((gzgroup->type->flag & WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL) == 0)) {
continue;
}
}