From 19e5540ff7712a45ab4ced4a4a02b12ce02637a9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Apr 2016 11:29:32 +1000 Subject: Transform Snap: initial snap context refactor This introduces a snap-context that can be re-used for casting rays into the scene (by operators such as walk-mode, ruler and transform code). This can be used to cache data between calls too. --- source/blender/editors/curve/editcurve.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/curve') diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 9df611b3216..395da2cd2f1 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -4993,11 +4993,22 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event) if (use_proj) { const float mval[2] = {UNPACK2(event->mval)}; - float no_dummy[3]; - float dist_px_dummy; - snapObjectsContext( - C, mval, SNAP_NOT_OBEDIT, - location, no_dummy, &dist_px_dummy); + + struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d( + CTX_data_main(C), vc.scene, 0, + vc.ar, vc.v3d); + + ED_transform_snap_object_project_view3d_mixed( + snap_context, + &(const struct SnapObjectParams){ + .snap_select = SNAP_NOT_OBEDIT, + .snap_to_flag = SCE_SELECT_FACE, + }, + mval, NULL, true, + location, NULL); + + + ED_transform_snap_object_context_destroy(snap_context); } if ((cu->flag & CU_3D) == 0) { -- cgit v1.2.3