diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-04-21 04:29:32 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-04-22 09:36:53 +0300 |
commit | 19e5540ff7712a45ab4ced4a4a02b12ce02637a9 (patch) | |
tree | b43be4638a05372d802dc71580099e53f54545bc /source/blender/editors/armature | |
parent | 8dcdde52b17228601c95fed04f5bca03484d27ac (diff) |
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.
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/editarmature_sketch.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 87d75aa8fad..b62714700fa 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -1086,9 +1086,23 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S mval[1] = dd->mval[1]; /* try to snap to closer object */ - found = snapObjectsContext( - C, mval, SNAP_NOT_SELECTED, - vec, no, &dist_px); + { + struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d( + CTX_data_main(C), CTX_data_scene(C), 0, + CTX_wm_region(C), CTX_wm_view3d(C)); + + found = ED_transform_snap_object_project_view3d_mixed( + snap_context, + &(const struct SnapObjectParams){ + .snap_select = SNAP_NOT_SELECTED, + .snap_to_flag = SCE_SELECT_FACE, + }, + mval, &dist_px, true, + vec, no); + + ED_transform_snap_object_context_destroy(snap_context); + } + if (found == 1) { pt->type = dd->type; pt->mode = PT_SNAP; |