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
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2014-01-30 14:51:34 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-01-30 14:54:55 +0400
commit810c6d1880b9cb2944ab2bcb5eb60d8dedd97a64 (patch)
treee6bdac06fff43836594d30a0b48da8c44689b371 /source
parent1f64371ec036c2f6ab450e37ad5a9c1120f1c54f (diff)
Fix T38358: typo in own rB77089a3bf203.
Also allowed me to fine another potential issue, hit.dist was no more initialized correctly - and I had forgotten to take into account Brecht's remark about normalize_v3() also returning the vector's previous length.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/transform/transform_snap.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 694b2931e19..91f8da1d2ae 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1542,21 +1542,24 @@ static bool snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMes
mul_m4_v3(imat, ray_org_local);
/* local scale in normal direction */
- local_scale = len_v3(ray_normal_local);
- normalize_v3(ray_normal_local);
+ local_scale = normalize_v3(ray_normal_local);
/* We pass a temp ray_start, set from object's boundbox, to avoid precision issues with very far
* away ray_start values (as returned in case of ortho view3d), see T38358.
*/
len_diff -= local_scale; /* make temp start point a bit away from bbox hit point. */
madd_v3_v3v3fl(ray_start_local, ray_org_local, ray_normal_local,
- len_diff - len_v3v3(ray_start_local, ray_org_local));
+ len_v3v3(ray_start_local, ray_org_local) - len_diff);
treeData.em_evil = em;
bvhtree_from_mesh_faces(&treeData, dm, 0.0f, 4, 6);
hit.index = -1;
- hit.dist = *r_depth * (*r_depth == TRANSFORM_DIST_MAX_RAY ? 1.0f : local_scale);
+ hit.dist = *r_depth;
+ if (hit.dist != TRANSFORM_DIST_MAX_RAY) {
+ hit.dist *= local_scale;
+ hit.dist -= len_diff;
+ }
if (treeData.tree &&
BLI_bvhtree_ray_cast(treeData.tree, ray_start_local, ray_normal_local, 0.0f,