diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-29 00:37:16 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-29 16:27:37 +0300 |
commit | 1ca105ebdccc386aa0a49e5d323be65123881243 (patch) | |
tree | 8ee8995f06630328e4db9c72af515db8ff123644 /source/blender/editors/sculpt_paint | |
parent | c31a849a1474ef1d96805b67ad12c9be2173e003 (diff) |
Sculpt: disable workbench anti-aliasing during stroke painting
This mostly happens automatically anyway since there is usually not enough
time left over for it. But when it does it happen it breaks partial redraw,
and may also have a negative impact on responsiveness.
Ref T70295
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_stroke.c | 10 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 20 |
2 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 137d7bd9d6c..d8be345cc84 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -862,6 +862,7 @@ PaintStroke *paint_stroke_new(bContext *C, UnifiedPaintSettings *ups = &toolsettings->unified_paint_settings; Paint *p = BKE_paint_get_active_from_context(C); Brush *br = stroke->brush = BKE_paint_brush(p); + RegionView3D *rv3d = CTX_wm_region_view3d(C); float zoomx, zoomy; ED_view3d_viewcontext_init(C, &stroke->vc, depsgraph); @@ -887,6 +888,10 @@ PaintStroke *paint_stroke_new(bContext *C, ups->overlap_factor = 1.0; ups->stroke_active = true; + if (rv3d) { + rv3d->rflag |= RV3D_PAINTING; + } + zero_v3(ups->average_stroke_accum); ups->average_stroke_counter = 0; @@ -903,12 +908,17 @@ PaintStroke *paint_stroke_new(bContext *C, void paint_stroke_free(bContext *C, wmOperator *op) { + RegionView3D *rv3d = CTX_wm_region_view3d(C); PaintStroke *stroke = op->customdata; UnifiedPaintSettings *ups = stroke->ups; ups->draw_anchored = false; ups->stroke_active = false; + if (rv3d) { + rv3d->rflag &= ~RV3D_PAINTING; + } + if (stroke->timer) { WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), stroke->timer); } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 51ca0ec3403..9e5660fc6fe 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -6741,6 +6741,12 @@ static void sculpt_flush_update_step(bContext *C) ARegion *ar = CTX_wm_region(C); MultiresModifierData *mmd = ss->multires; View3D *v3d = CTX_wm_view3d(C); + RegionView3D *rv3d = CTX_wm_region_view3d(C); + + if (rv3d) { + /* Mark for faster 3D viewport redraws. */ + rv3d->rflag |= RV3D_PAINTING; + } if (mmd != NULL) { multires_mark_as_modified(depsgraph, ob, MULTIRES_COORDS_MODIFIED); @@ -6791,10 +6797,15 @@ static void sculpt_flush_update_done(const bContext *C, Object *ob) * expensive depsgraph tag to update geometry. */ wmWindowManager *wm = CTX_wm_manager(C); View3D *current_v3d = CTX_wm_view3d(C); + RegionView3D *rv3d = CTX_wm_region_view3d(C); SculptSession *ss = ob->sculpt; Mesh *mesh = ob->data; bool need_tag = (mesh->id.us > 1); /* Always needed for linked duplicates. */ + if (rv3d) { + rv3d->rflag &= ~RV3D_PAINTING; + } + for (wmWindow *win = wm->windows.first; win; win = win->next) { bScreen *screen = WM_window_get_active_screen(win); for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { @@ -6804,6 +6815,15 @@ static void sculpt_flush_update_done(const bContext *C, Object *ob) if (v3d != current_v3d) { need_tag |= !BKE_sculptsession_use_pbvh_draw(ob, v3d); } + + /* Tag all 3D viewports for redraw now that we are done. Others + * viewports did not get a full redraw, and anti-aliasing for the + * current viewport was deactivated. */ + for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { + if (ar->regiontype == RGN_TYPE_WINDOW) { + ED_region_tag_redraw(ar); + } + } } } } |