diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-18 18:19:07 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-18 19:19:27 +0300 |
commit | 383c4ba3d83fa706319888c39731a52b3f319ffd (patch) | |
tree | 6e6b7725607c1f73c872c3a5e611805a7773321f /source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c | |
parent | 3e230cecf0c5059a9c3db16231b4ad7b10300e92 (diff) |
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
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c index 4aa9dc8a295..4ac3209d5a9 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c @@ -178,11 +178,12 @@ void PAINT_OT_weight_from_bones(wmOperatorType *ot) /* note: we cant sample frontbuf, weight colors are interpolated too unpredictable */ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *event) { + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); ViewContext vc; Mesh *me; bool changed = false; - ED_view3d_viewcontext_init(C, &vc); + ED_view3d_viewcontext_init(C, &vc, depsgraph); me = BKE_mesh_from_object(vc.obact); if (me && me->dvert && vc.v3d && vc.rv3d && (vc.obact->actdef != 0)) { @@ -308,10 +309,11 @@ static const EnumPropertyItem *weight_paint_sample_enum_itemf(bContext *C, if (C) { wmWindow *win = CTX_wm_window(C); if (win && win->eventstate) { + Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); ViewContext vc; Mesh *me; - ED_view3d_viewcontext_init(C, &vc); + ED_view3d_viewcontext_init(C, &vc, depsgraph); me = BKE_mesh_from_object(vc.obact); if (me && me->dvert && vc.v3d && vc.rv3d && vc.obact->defbase.first) { @@ -379,8 +381,9 @@ static const EnumPropertyItem *weight_paint_sample_enum_itemf(bContext *C, static int weight_sample_group_exec(bContext *C, wmOperator *op) { int type = RNA_enum_get(op->ptr, "group"); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); ViewContext vc; - ED_view3d_viewcontext_init(C, &vc); + ED_view3d_viewcontext_init(C, &vc, depsgraph); BLI_assert(type + 1 >= 0); vc.obact->actdef = type + 1; |