[Bf-blender-cvs] [401e710] master: Correct armature-sketch snap context use

Campbell Barton noreply at git.blender.org
Tue May 10 08:42:47 CEST 2016


Commit: 401e7108075c46808bcc5e008e11767dcd09c04e
Author: Campbell Barton
Date:   Tue May 10 16:36:46 2016 +1000
Branches: master
https://developer.blender.org/rB401e7108075c46808bcc5e008e11767dcd09c04e

Correct armature-sketch snap context use

Use scene snap mode.
Also allow passing NULL ray-depth which falls back to BVH_RAYCAST_DIST_MAX.

===================================================================

M	source/blender/editors/armature/editarmature_sketch.c
M	source/blender/editors/transform/transform_snap.c
M	source/blender/editors/transform/transform_snap_object.c

===================================================================

diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 7401a21..508bbca 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -1092,13 +1092,13 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
 			        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(
+			found = ED_transform_snap_object_project_view3d(
 			        snap_context,
 			        &(const struct SnapObjectParams){
 			            .snap_select = SNAP_NOT_SELECTED,
-			            .snap_to_flag = SCE_SELECT_FACE,
+			            .snap_to = ts->snap_mode,
 			        },
-			        mval, &dist_px, true,
+			        mval, &dist_px, NULL,
 			        vec, no);
 
 			ED_transform_snap_object_context_destroy(snap_context);
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index bde140a..eb601db 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1287,8 +1287,6 @@ bool snapObjectsTransform(
         float *dist_px,
         float r_loc[3], float r_no[3])
 {
-	float ray_dist = BVH_RAYCAST_DIST_MAX;
-
 	return ED_transform_snap_object_project_view3d_ex(
 	        t->tsnap.object_context,
 	        &(const struct SnapObjectParams){
@@ -1297,8 +1295,7 @@ bool snapObjectsTransform(
 	            .use_object_edit = (t->flag & T_EDIT) != 0,
 	            .use_object_active = (t->options & CTX_GPENCIL_STROKES) == 0,
 	        },
-	        mval, dist_px,
-	        &ray_dist,
+	        mval, dist_px, NULL,
 	        r_loc, r_no, NULL);
 }
 
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index dd7b4df..57352f3 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -1449,6 +1449,12 @@ bool ED_transform_snap_object_project_view3d_ex(
 {
 	float ray_start[3], ray_normal[3], ray_orgigin[3];
 
+	float ray_depth_fallback;
+	if (ray_depth == NULL) {
+		ray_depth_fallback = BVH_RAYCAST_DIST_MAX;
+		ray_depth = &ray_depth_fallback;
+	}
+
 	if (!ED_view3d_win_to_ray_ex(
 	        sctx->v3d_data.ar, sctx->v3d_data.v3d,
 	        mval, ray_orgigin, ray_normal, ray_start, true))




More information about the Bf-blender-cvs mailing list