diff options
author | Ton Roosendaal <ton@blender.org> | 2006-07-19 15:28:48 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-07-19 15:28:48 +0400 |
commit | f4737af50435b4f1dc0532a21b1f440994ca47b0 (patch) | |
tree | 04da09688beb147acc16d1a964d7d2124ad68260 /source/blender/src/view.c | |
parent | fe43c5e6f02660189094ef144e112e668b340eb6 (diff) |
Bugfix #4724
Actually a bug since dark ages... the code that tries to find the view
correction (zoom) factor for grabbing stored result in a global. With
multiple 3d windows open, with different views, that could result in
wrong correction. Just made the factor a local property in View3D.
Diffstat (limited to 'source/blender/src/view.c')
-rw-r--r-- | source/blender/src/view.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/src/view.c b/source/blender/src/view.c index 00325dbbe5c..34888dd8e18 100644 --- a/source/blender/src/view.c +++ b/source/blender/src/view.c @@ -138,17 +138,15 @@ void persp(int a) } -float zfac=1.0; - void initgrabz(float x, float y, float z) { - if(G.vd==0) return; - zfac= G.vd->persmat[0][3]*x+ G.vd->persmat[1][3]*y+ G.vd->persmat[2][3]*z+ G.vd->persmat[3][3]; + if(G.vd==NULL) return; + G.vd->zfac= G.vd->persmat[0][3]*x+ G.vd->persmat[1][3]*y+ G.vd->persmat[2][3]*z+ G.vd->persmat[3][3]; /* if x,y,z is exactly the viewport offset, zfac is 0 and we don't want that * (accounting for near zero values) * */ - if (zfac < 1.e-6f && zfac > -1.e-6f) zfac = 1.0f; + if (G.vd->zfac < 1.e-6f && G.vd->zfac > -1.e-6f) G.vd->zfac = 1.0f; } void window_to_3d(float *vec, short mx, short my) @@ -156,8 +154,8 @@ void window_to_3d(float *vec, short mx, short my) /* always call initgrabz */ float dx, dy; - dx= 2.0f*mx*zfac/curarea->winx; - dy= 2.0f*my*zfac/curarea->winy; + dx= 2.0f*mx*G.vd->zfac/curarea->winx; + dy= 2.0f*my*G.vd->zfac/curarea->winy; vec[0]= (G.vd->persinv[0][0]*dx + G.vd->persinv[1][0]*dy); vec[1]= (G.vd->persinv[0][1]*dx + G.vd->persinv[1][1]*dy); |