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-09-24 22:00:32 +0400
committerMartin Poirier <theeth@yahoo.com>2005-09-24 22:00:32 +0400
commit6e94b02616ec4d4b3be748e8470993c9ab528f90 (patch)
tree4d9a7d11d9f2dec9b9919ddd9392fb93a6236e57 /source/blender/src/view.c
parent8b7c690a0bbd053bc734309b1a82792cdfda8733 (diff)
Various Transform bugfixes.
- Trackball rotate was missing the NoConstraints flag - Zooming didn't recalculate the 2D center correctly - Zooming in transform was sending event to the 3D window even when working on UVs. (disabled when working on UVs for now, will need to send events to a 2D window handler eventually) - In camera mode, when the selection was exactly on the camera, initgrabz was barfing, fallback to 1.0 now, which gives ok results.
Diffstat (limited to 'source/blender/src/view.c')
-rw-r--r--source/blender/src/view.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index aef0171bad6..6e43018c9c6 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -145,24 +145,18 @@ 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 x,y,z is exactly the viewport offset, zfac is 0 and we don't want that */
+ if (zfac==0.0f) zfac = 1.0f;
}
void window_to_3d(float *vec, short mx, short my)
{
/* always call initzgrab */
float dx, dy;
- float fmx, fmy, winx, winy;
-
- /* stupid! */
- winx= curarea->winx;
- winy= curarea->winy;
- fmx= mx;
- fmy= my;
-
- dx= (2.0*fmx)/winx;
- dx*= zfac;
- dy= (2.0*fmy)/winy;
- dy*= zfac;
+
+ dx= 2.0f*mx*zfac/curarea->winx;
+ dy= 2.0f*my*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);