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:
authorMartin Poirier <theeth@yahoo.com>2005-05-19 08:33:38 +0400
committerMartin Poirier <theeth@yahoo.com>2005-05-19 08:33:38 +0400
commit78a395d3d5bac72faa6eab4c82c1ebdfcf881b22 (patch)
treef420a34a415d1ef5efd08e0384e71c81bc02017d
parent615c2f40a1537c0c9432f41020ecd80f62fd2c2b (diff)
Fix MMB code again. (I'm near the "set an accronym for that so it's shorter to time next time" phase...)
This time, probably for good since I've really tested it through and the z factor used there never gives overflow and is correctly calibrated with both the real zfac and the zoom level.
-rwxr-xr-xsource/blender/src/transform_constraints.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/src/transform_constraints.c b/source/blender/src/transform_constraints.c
index e60d6c962e2..edb43aeb883 100755
--- a/source/blender/src/transform_constraints.c
+++ b/source/blender/src/transform_constraints.c
@@ -841,12 +841,14 @@ void setNearestAxis(TransInfo *t)
/* we need to correct axis length for the current zoomlevel of view,
- this to prevent projected values to be clipped behind the camera.
- code is actually a copy of initgrabz() in view.c.
- Vector is made 30 pixels long, which is fine for accurate axis choosing. (ton)
+ this to prevent projected values to be clipped behind the camera
+ and to overflow the short integers.
+ The formula used is a bit stupid, just a simplification of the substraction
+ of two 2D points 30 pixels apart (that's the last factor in the formula) after
+ projecting them with window_to_3d and then get the length of that vector.
*/
zfac= G.vd->persmat[0][3]*t->center[0]+ G.vd->persmat[1][3]*t->center[1]+ G.vd->persmat[2][3]*t->center[2]+ G.vd->persmat[3][3];
- zfac= (float)curarea->winx/30.0f*zfac;
+ zfac = VecLength(G.vd->persinv[0]) * 2.0f/curarea->winx * zfac * 30.0f;
for (i = 0; i<3; i++) {
VECCOPY(axis, t->con.mtx[i]);