More snapping fixes (this is ridiculous).
I hope this time we are done!
This commit is contained in:
parent
0e1c1b6196
commit
1e096ee816
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue