[Bf-blender-cvs] [e785048ef31] blender2.8: Fix snap with occlusion.

Germano noreply at git.blender.org
Fri May 18 22:26:41 CEST 2018


Commit: e785048ef31fda682f7aeb457aeaaa3621a28d4a
Author: Germano
Date:   Fri May 18 17:26:22 2018 -0300
Branches: blender2.8
https://developer.blender.org/rBe785048ef31fda682f7aeb457aeaaa3621a28d4a

Fix snap with occlusion.

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

M	source/blender/editors/transform/transform_snap_object.c

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

diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index e5397790cf8..fb49396132a 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -2452,6 +2452,7 @@ static short transform_snap_context_project_view3d_mixed_impl(
 	BLI_assert((snap_to_flag & ~(1 | 2 | 4)) == 0);
 
 	short retval = 0;
+	bool has_hit = false;
 	int index = -1;
 
 	float loc[3], no[3], obmat[4][4];
@@ -2473,11 +2474,15 @@ static short transform_snap_context_project_view3d_mixed_impl(
 
 		float dummy_ray_depth = BVH_RAYCAST_DIST_MAX;
 
-		retval = raycastObjects(
+		has_hit = raycastObjects(
 		        sctx, params,
 		        ray_start, ray_normal,
 		        &dummy_ray_depth, loc, no,
-		        &index, &ob, obmat, NULL) ? SCE_SELECT_FACE : 0;
+		        &index, &ob, obmat, NULL);
+
+		if (has_hit && (snap_to_flag & SCE_SELECT_FACE)) {
+			retval = SCE_SELECT_FACE;
+		}
 	}
 
 	if (snap_to_flag & (SCE_SELECT_VERTEX | SCE_SELECT_EDGE)) {
@@ -2499,7 +2504,7 @@ static short transform_snap_context_project_view3d_mixed_impl(
 
 		snapdata.clip_plane_len = 2;
 
-		if (retval == SCE_SELECT_FACE) {
+		if (has_hit) {
 			/* Compute the new clip_pane but do not add it yet. */
 			float new_clipplane[4];
 			plane_from_point_normal_v3(new_clipplane, loc, no);



More information about the Bf-blender-cvs mailing list