diff options
author | Janne Karhu <jhkarh@gmail.com> | 2010-10-07 14:57:21 +0400 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2010-10-07 14:57:21 +0400 |
commit | 97576cd51b2fd5cca4de8003be0665f8d79fe2d3 (patch) | |
tree | c3cf852bc53ba020a66cc35e987744c509072a6e /source/blender/editors/transform | |
parent | 8a4fe62843f8aa311226f543d14bd3e5440ffe7d (diff) |
Fix for [#22250] Retopo projects to the wrong object when multiple objects are behind.
* Scaling of objects wasn't properly taken into account when projecting the verts.
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r-- | source/blender/editors/transform/transform_snap.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 5b7bcac65f2..09c04168a71 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -1301,15 +1301,18 @@ int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, E BVHTreeRayHit hit; BVHTreeFromMesh treeData; + /* local scale in normal direction */ + float local_scale = len_v3(ray_normal_local); + bvhtree_from_mesh_faces(&treeData, dm, 0.0f, 4, 6); hit.index = -1; - hit.dist = *depth; + hit.dist = *depth * (*depth == FLT_MAX ? 1.0f : local_scale); if(treeData.tree && BLI_bvhtree_ray_cast(treeData.tree, ray_start_local, ray_normal_local, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1) { - if(hit.dist<=*depth) { - *depth= hit.dist; + if(hit.dist/local_scale <= *depth) { + *depth= hit.dist/local_scale; copy_v3_v3(loc, hit.co); copy_v3_v3(no, hit.no); |