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/space_view3d/view3d_snap.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/space_view3d/view3d_snap.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_snap.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 1df29201bf6..970fb5f5b9d 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -69,17 +69,15 @@ static bool snap_calc_active_center(bContext *C, const bool select_only, float r static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) { + Depsgraph *depsgraph = CTX_data_depsgraph(C); Object *obedit = CTX_data_edit_object(C); Scene *scene = CTX_data_scene(C); RegionView3D *rv3d = CTX_wm_region_data(C); TransVertStore tvs = {NULL}; TransVert *tv; - EvaluationContext eval_ctx; float gridf, imat[3][3], bmat[3][3], vec[3]; int a; - CTX_data_eval_ctx(C, &eval_ctx); - gridf = rv3d->gridview; if (obedit) { @@ -166,7 +164,7 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) if (ob->parent) { float originmat[3][3]; - BKE_object_where_is_calc_ex(&eval_ctx, scene, NULL, ob, originmat); + BKE_object_where_is_calc_ex(depsgraph, scene, NULL, ob, originmat); invert_m3_m3(imat, originmat); mul_m3_v3(imat, vec); @@ -211,20 +209,18 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot) static int snap_selected_to_location(bContext *C, const float snap_target_global[3], const bool use_offset) { + Depsgraph *depsgraph = CTX_data_depsgraph(C); Scene *scene = CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); Object *obact = CTX_data_active_object(C); View3D *v3d = CTX_wm_view3d(C); TransVertStore tvs = {NULL}; TransVert *tv; - EvaluationContext eval_ctx; float imat[3][3], bmat[3][3]; float center_global[3]; float offset_global[3]; int a; - CTX_data_eval_ctx(C, &eval_ctx); - if (use_offset) { if ((v3d && v3d->around == V3D_AROUND_ACTIVE) && snap_calc_active_center(C, true, center_global)) @@ -377,7 +373,7 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global if (ob->parent) { float originmat[3][3]; - BKE_object_where_is_calc_ex(&eval_ctx, scene, NULL, ob, originmat); + BKE_object_where_is_calc_ex(depsgraph, scene, NULL, ob, originmat); invert_m3_m3(imat, originmat); mul_m3_v3(imat, cursor_parent); |