Bug fix, irc report:

When camera is the pivot of 3d window, and you go to camera view, moving out of
view with MMB drag causes zooming to stop working. Zooms depend on view3d "dist"
value, which then became zero.

This fix just makes dist "1.0" then, arbitrary but keeps things at least work.
(Tried restoring to previous 'dist', but this fails in cases too)
This commit is contained in:
2012-12-11 14:45:38 +00:00
parent 8d4bd2cf3b
commit cb116b42f4

View File

@@ -3977,16 +3977,25 @@ int ED_view3d_autodist_depth_seg(ARegion *ar, const int mval_sta[2], const int m
return (*depth == FLT_MAX) ? 0 : 1;
}
float ED_view3d_offset_distance(float mat[4][4], float ofs[3]) {
float ED_view3d_offset_distance(float mat[4][4], float ofs[3])
{
float pos[4] = {0.0f, 0.0f, 0.0f, 1.0f};
float dir[4] = {0.0f, 0.0f, 1.0f, 0.0f};
float dist;
mul_m4_v4(mat, pos);
add_v3_v3(pos, ofs);
mul_m4_v4(mat, dir);
normalize_v3(dir);
return dot_v3v3(pos, dir);
dist = dot_v3v3(pos, dir);
/* problem - ofs[3] can be on same location as camera itself.
Blender needs proper dist value for zoom */
if ( fabs(dist) <= FLT_EPSILON) {
return 1.0f;
}
return dist;
}
/**