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
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2014-01-30 21:48:49 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-01-30 21:50:12 +0400
commit1e096ee816289fe8e7f4286e98b3203336bc3924 (patch)
tree9854fac45663232c4e47e043776eaa9f7c6a47cb
parent0e1c1b61960ba520cc624ed7bd769aa524ecc1db (diff)
More snapping fixes (this is ridiculous).
I hope this time we are done!
-rw-r--r--source/blender/blenkernel/intern/object.c4
-rw-r--r--source/blender/editors/transform/transform_snap.c11
2 files changed, 7 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index d8170af30c3..bd614392a63 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -3144,7 +3144,7 @@ bool BKE_boundbox_ray_hit_check(struct BoundBox *bb, const float ray_start[3], c
bool result = false;
int i;
-
+
for (i = 0; i < 12 && (!result || r_lambda); i++) {
float lambda;
int v1, v2, v3;
@@ -3160,7 +3160,7 @@ bool BKE_boundbox_ray_hit_check(struct BoundBox *bb, const float ray_start[3], c
}
}
}
-
+
return result;
}
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index a51ed85913e..4a6f4c31a90 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1514,7 +1514,7 @@ static bool snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMes
BoundBox *bb;
float imat[4][4];
float timat[3][3]; /* transpose inverse matrix for normals */
- float ray_start_local[3], ray_normal_local[3], len_diff = TRANSFORM_DIST_MAX_RAY;
+ float ray_start_local[3], ray_normal_local[3], local_scale, len_diff = TRANSFORM_DIST_MAX_RAY;
invert_m4_m4(imat, obmat);
copy_m3_m4(timat, imat);
@@ -1526,6 +1526,9 @@ static bool snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMes
mul_m4_v3(imat, ray_start_local);
mul_mat3_m4_v3(imat, ray_normal_local);
+ /* local scale in normal direction */
+ local_scale = normalize_v3(ray_normal_local);
+
bb = BKE_object_boundbox_get(ob);
if (!BKE_boundbox_ray_hit_check(bb, ray_start_local, ray_normal_local, &len_diff)) {
return retval;
@@ -1536,10 +1539,6 @@ static bool snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMes
{
BVHTreeRayHit hit;
BVHTreeFromMesh treeData;
- float local_scale;
-
- /* local scale in normal direction */
- local_scale = normalize_v3(ray_normal_local);
/* Only use closer ray_start in case of ortho view! In perspective one, ray_start may already
* been *inside* boundbox, leading to snap failures (see T38409).
@@ -1555,7 +1554,7 @@ static bool snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMes
*/
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_v3v3(ray_start_local, ray_org_local) - len_diff);
+ len_diff - len_v3v3(ray_start_local, ray_org_local));
}
else {
len_diff = 0.0f;