diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-06 13:07:27 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-16 20:55:33 +0300 |
commit | 34ab90f546f097cada951b2c9ca22bf271996980 (patch) | |
tree | ebcdb3d37120ac1d8fb16462b9104badd1800329 /source/blender/editors/sculpt_paint/sculpt_undo.c | |
parent | 0c495005dd83913864acb510c1d4194a2275dbb0 (diff) |
Depsgraph: remove EvaluationContext, pass Depsgraph instead.
The depsgraph was always created within a fixed evaluation context. Passing
both risks the depsgraph and evaluation context not matching, and it
complicates the Python API where we'd have to expose both which is not so
easy to understand.
This also removes the global evaluation context in main, which assumed there
to be a single active scene and view layer.
Differential Revision: https://developer.blender.org/D3152
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_undo.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_undo.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index e12ef2df4ab..3feb8e105e6 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -142,12 +142,10 @@ static bool sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoN Scene *scene = CTX_data_scene(C); Sculpt *sd = CTX_data_tool_settings(C)->sculpt; Object *ob = CTX_data_active_object(C); - EvaluationContext eval_ctx; + Depsgraph *depsgraph = CTX_data_depsgraph(C); SculptSession *ss = ob->sculpt; MVert *mvert; int *index; - - CTX_data_eval_ctx(C, &eval_ctx); if (unode->maxvert) { /* regular mesh restore */ @@ -161,7 +159,7 @@ static bool sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoN if (kb) { ob->shapenr = BLI_findindex(&key->block, kb) + 1; - BKE_sculpt_update_mesh_elements(&eval_ctx, scene, sd, ob, 0, false); + BKE_sculpt_update_mesh_elements(depsgraph, scene, sd, ob, 0, false); WM_event_add_notifier(C, NC_OBJECT | ND_DATA, ob); } else { @@ -477,7 +475,7 @@ static void sculpt_undo_restore_list(bContext *C, ListBase *lb) Scene *scene = CTX_data_scene(C); Sculpt *sd = CTX_data_tool_settings(C)->sculpt; Object *ob = CTX_data_active_object(C); - EvaluationContext eval_ctx; + Depsgraph *depsgraph = CTX_data_depsgraph(C); DerivedMesh *dm; SculptSession *ss = ob->sculpt; SculptUndoNode *unode; @@ -485,8 +483,6 @@ static void sculpt_undo_restore_list(bContext *C, ListBase *lb) bool need_mask = false; bool partial_update = true; - CTX_data_eval_ctx(C, &eval_ctx); - for (unode = lb->first; unode; unode = unode->next) { if (STREQ(unode->idname, ob->id.name)) { if (unode->type == SCULPT_UNDO_MASK) { @@ -498,10 +494,10 @@ static void sculpt_undo_restore_list(bContext *C, ListBase *lb) } } - BKE_sculpt_update_mesh_elements(&eval_ctx, scene, sd, ob, 0, need_mask); + BKE_sculpt_update_mesh_elements(depsgraph, scene, sd, ob, 0, need_mask); /* call _after_ sculpt_update_mesh_elements() which may update 'ob->derivedFinal' */ - dm = mesh_get_derived_final(&eval_ctx, scene, ob, 0); + dm = mesh_get_derived_final(depsgraph, scene, ob, 0); if (lb->first && sculpt_undo_bmesh_restore(C, lb->first, ob, ss)) return; |