From 46e13cf8a529577fba6654c96e097a0f513f673c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 18 Feb 2023 16:38:36 +1100 Subject: [PATCH] Fix #104817: Camera lens gizmo out of sync when navigating via gizmos Regression in [0] which caused interacting with 2D gizmos not to update 3D gizmos once the gizmo finished it's modal interaction. This caused the cameras lens gizmo not to update when navigating using the viewport navigation buttons. Resolve by detecting this case and flagging other draw steps to be updated. [0]: fb27a9bb983ce74b8d8f5f871cf0706dd1e25051 --- .../windowmanager/gizmo/intern/wm_gizmo_map.c | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c index 03fb91c95d8..7a9e0d4b117 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c @@ -1119,9 +1119,28 @@ void wm_gizmomap_modal_set( } if (do_refresh) { + const int update_flag = GIZMOMAP_IS_REFRESH_CALLBACK; const eWM_GizmoFlagMapDrawStep step = WM_gizmomap_drawstep_from_gizmo_group( gz->parent_gzgroup); - gzmap->update_flag[step] |= GIZMOMAP_IS_REFRESH_CALLBACK; + gzmap->update_flag[step] |= update_flag; + + /* Ensure the update flag is set for gizmos that were hidden while modal, see #104817. */ + for (int i = 0; i < WM_GIZMOMAP_DRAWSTEP_MAX; i++) { + const eWM_GizmoFlagMapDrawStep step_iter = (eWM_GizmoFlagMapDrawStep)i; + if (step_iter == step) { + continue; + } + if ((gzmap->update_flag[i] & update_flag) == update_flag) { + continue; + } + LISTBASE_FOREACH (wmGizmoGroup *, gzgroup, &gzmap->groups) { + if (((gzgroup->type->flag & WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL) == 0) && + wm_gizmogroup_is_visible_in_drawstep(gzgroup, step_iter)) { + gzmap->update_flag[i] |= update_flag; + break; + } + } + } } }