Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-04-21 04:29:32 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-04-22 09:36:53 +0300
commit19e5540ff7712a45ab4ced4a4a02b12ce02637a9 (patch)
treeb43be4638a05372d802dc71580099e53f54545bc /source/blender/editors/mesh
parent8dcdde52b17228601c95fed04f5bca03484d27ac (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/mesh')
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index ee33f5f1655..c06bf7ba68e 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -301,20 +301,30 @@ void EMBM_project_snap_verts(bContext *C, ARegion *ar, BMEditMesh *em)
ED_view3d_init_mats_rv3d(obedit, ar->regiondata);
+ struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d(
+ CTX_data_main(C), CTX_data_scene(C), SNAP_OBJECT_USE_CACHE,
+ ar, CTX_wm_view3d(C));
+
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
- float mval[2], co_proj[3], no_dummy[3];
- float dist_px_dummy;
+ float mval[2], co_proj[3];
if (ED_view3d_project_float_object(ar, eve->co, mval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
- if (snapObjectsContext(
- C, mval, SNAP_NOT_OBEDIT,
- co_proj, no_dummy, &dist_px_dummy))
+ if (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,
+ co_proj, NULL))
{
mul_v3_m4v3(eve->co, obedit->imat, co_proj);
}
}
}
}
+
+ ED_transform_snap_object_context_destroy(snap_context);
}