diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2020-02-14 17:36:12 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2020-02-14 17:59:30 +0300 |
commit | c4b9cb0af0ae50c5bdb4246b30aceadb12ec97d9 (patch) | |
tree | 362f9b837c596cff681a145695999ac6a5e556d4 /source/blender/editors/screen/area.c | |
parent | 8645b73cd8c0c9768b1de332bfeeac3a80388e28 (diff) |
UI: Allow gizmo-only redraw tagging
NOTE: This change shouldn't have any visible effect. It's just the
first (easiest) step towards decoupling gizmo redraws from viewport
redraws.
We currently redraw the entire region whenever a gizmo needs redrawing,
which would be nice to avoid in the future, see T73198. The first step
towards this would be having a separate tag for them, which is what
this patch implements.
The term "editor-overlays" was chosen because for the forseeable future,
we'll also have to redraw non-gizmo overlays in-between drawing 3D and
2D gizmos. Namely annotations.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D6838
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r-- | source/blender/editors/screen/area.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 26c48dda4f4..01e0ae812cc 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -629,7 +629,7 @@ void ED_region_tag_redraw(ARegion *ar) * but python scripts can cause this to happen indirectly */ if (ar && !(ar->do_draw & RGN_DRAWING)) { /* zero region means full region redraw */ - ar->do_draw &= ~(RGN_DRAW_PARTIAL | RGN_DRAW_NO_REBUILD); + ar->do_draw &= ~(RGN_DRAW_PARTIAL | RGN_DRAW_NO_REBUILD | RGN_DRAW_EDITOR_OVERLAYS); ar->do_draw |= RGN_DRAW; memset(&ar->drawrct, 0, sizeof(ar->drawrct)); } @@ -645,7 +645,7 @@ void ED_region_tag_redraw_overlay(ARegion *ar) void ED_region_tag_redraw_no_rebuild(ARegion *ar) { if (ar && !(ar->do_draw & (RGN_DRAWING | RGN_DRAW))) { - ar->do_draw &= ~RGN_DRAW_PARTIAL; + ar->do_draw &= ~(RGN_DRAW_PARTIAL | RGN_DRAW_EDITOR_OVERLAYS); ar->do_draw |= RGN_DRAW_NO_REBUILD; memset(&ar->drawrct, 0, sizeof(ar->drawrct)); } @@ -658,6 +658,22 @@ void ED_region_tag_refresh_ui(ARegion *ar) } } +/** + * Tag editor overlays to be redrawn. If in doubt about which parts need to be redrawn (partial + * clipping rectangle set), redraw everything. + */ +void ED_region_tag_redraw_editor_overlays(struct ARegion *ar) +{ + if (ar && !(ar->do_draw & (RGN_DRAWING | RGN_DRAW))) { + if (ar->do_draw & RGN_DRAW_PARTIAL) { + ED_region_tag_redraw(ar); + } + else { + ar->do_draw |= RGN_DRAW_EDITOR_OVERLAYS; + } + } +} + void ED_region_tag_redraw_partial(ARegion *ar, const rcti *rct, bool rebuild) { if (ar && !(ar->do_draw & RGN_DRAWING)) { |