From 383c4ba3d83fa706319888c39731a52b3f319ffd Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 18 Sep 2019 17:19:07 +0200 Subject: Fix excessive dependency graph evaluation while painting strokes Particularly noticeable when vertex painting with a subsurf modifier. In some cases every sculpt or paint stroke step would evaluate the dependency graph. This should only happen for redraws. Now more selectively choose if the dependency graph should be evaluated to initialize the view context. Doing it in the view context evaluation is somewhat hidden, now it's more explicit. Differential Revision: https://developer.blender.org/D5844 --- source/blender/editors/sculpt_paint/paint_hide.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/sculpt_paint/paint_hide.c') diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index 5852012891d..fbeb0ea3095 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -299,13 +299,16 @@ static void rect_from_props(rcti *rect, PointerRNA *ptr) rect->ymax = RNA_int_get(ptr, "ymax"); } -static void clip_planes_from_rect(bContext *C, float clip_planes[4][4], const rcti *rect) +static void clip_planes_from_rect(bContext *C, + Depsgraph *depsgraph, + float clip_planes[4][4], + const rcti *rect) { ViewContext vc; BoundBox bb; view3d_operator_needs_opengl(C); - ED_view3d_viewcontext_init(C, &vc); + ED_view3d_viewcontext_init(C, &vc, depsgraph); ED_view3d_clipping_calc(&bb, clip_planes, vc.ar, vc.obact, rect); negate_m4(clip_planes); } @@ -355,7 +358,7 @@ static int hide_show_exec(bContext *C, wmOperator *op) area = RNA_enum_get(op->ptr, "area"); rect_from_props(&rect, op->ptr); - clip_planes_from_rect(C, clip_planes, &rect); + clip_planes_from_rect(C, depsgraph, clip_planes, &rect); pbvh = BKE_sculpt_object_pbvh_ensure(depsgraph, ob); BLI_assert(ob->sculpt->pbvh == pbvh); -- cgit v1.2.3