Fix T72900: Mouse-move causes redraw when gizmos are hidden
Move redraw tagging to the gesture modal operator
to make sure this only runs when it's needed.
Caused by d591c8a350
, which tagged the region to redraw when the
gizmos were tagged to refresh, however they wont redraw when hidden.
Thanks to @jbakker for finding the root cause.
This commit is contained in:
parent
99c798b8a6
commit
830aa758b4
Notes:
blender-bot
2023-02-14 10:32:59 +01:00
Referenced by issue #72900, Viewport: When Show Gizmos is disable every mouse move would redraw the viewport
|
@ -285,7 +285,8 @@ eWM_GizmoFlagMapDrawStep WM_gizmomap_drawstep_from_gizmo_group(const struct wmGi
|
|||
void WM_gizmomap_tag_refresh_drawstep(struct wmGizmoMap *gzmap,
|
||||
const eWM_GizmoFlagMapDrawStep drawstep);
|
||||
void WM_gizmomap_tag_refresh(struct wmGizmoMap *gzmap);
|
||||
bool WM_gizmomap_tag_refresh_check(struct wmGizmoMap *gzmap);
|
||||
|
||||
bool WM_gizmomap_tag_delay_refresh_for_tweak_check(struct wmGizmoMap *gzmap);
|
||||
|
||||
void WM_gizmomap_draw(struct wmGizmoMap *gzmap,
|
||||
const struct bContext *C,
|
||||
|
|
|
@ -333,13 +333,11 @@ void WM_gizmomap_tag_refresh(wmGizmoMap *gzmap)
|
|||
}
|
||||
}
|
||||
|
||||
bool WM_gizmomap_tag_refresh_check(wmGizmoMap *gzmap)
|
||||
bool WM_gizmomap_tag_delay_refresh_for_tweak_check(wmGizmoMap *gzmap)
|
||||
{
|
||||
if (gzmap) {
|
||||
for (int i = 0; i < WM_GIZMOMAP_DRAWSTEP_MAX; i++) {
|
||||
if (gzmap->update_flag[i] & (GIZMOMAP_IS_PREPARE_DRAW | GIZMOMAP_IS_REFRESH_CALLBACK)) {
|
||||
return true;
|
||||
}
|
||||
for (wmGizmoGroup *gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) {
|
||||
if (gzgroup->hide.delay_refresh_for_tweak) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -2811,12 +2811,6 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
|
|||
BLI_assert(gzmap != NULL);
|
||||
wmGizmo *gz = wm_gizmomap_highlight_get(gzmap);
|
||||
|
||||
/* Special case, needed so postponed refresh can respond to events,
|
||||
* see #WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK for details. */
|
||||
if (WM_gizmomap_tag_refresh_check(gzmap)) {
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
|
||||
if (region->gizmo_map != handler->gizmo_map) {
|
||||
WM_gizmomap_tag_refresh(handler->gizmo_map);
|
||||
}
|
||||
|
|
|
@ -528,6 +528,15 @@ static void gesture_tweak_modal(bContext *C, const wmEvent *event)
|
|||
if (gesture_end) {
|
||||
/* Frees gesture itself, and unregisters from window. */
|
||||
WM_gesture_end(C, gesture);
|
||||
|
||||
/* This isn't very nice but needed to redraw gizmos which are hidden while tweaking,
|
||||
* See #WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK for details. */
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
if ((ar != NULL) && (ar->gizmo_map != NULL)) {
|
||||
if (WM_gizmomap_tag_delay_refresh_for_tweak_check(ar->gizmo_map)) {
|
||||
ED_region_tag_redraw(ar);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue