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
This commit is contained in:
Campbell Barton 2023-02-18 16:38:36 +11:00
parent 5cd2be7d54
commit 46e13cf8a5

@ -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;
}
}
}
}
}