diff options
author | Germano <germano.costa@ig.com.br> | 2018-05-18 23:26:22 +0300 |
---|---|---|
committer | Germano <germano.costa@ig.com.br> | 2018-05-18 23:26:22 +0300 |
commit | e785048ef31fda682f7aeb457aeaaa3621a28d4a (patch) | |
tree | 60fbc32b07221331144b81aa57d664b060d487fd /source/blender/editors/transform | |
parent | 4df99bd60134066c04911c6865c72b262783bc10 (diff) |
Fix snap with occlusion.
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r-- | source/blender/editors/transform/transform_snap_object.c | 11 |
1 files changed, 8 insertions, 3 deletions
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); |