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:
authorTon Roosendaal <ton@blender.org>2005-05-13 13:22:37 +0400
committerTon Roosendaal <ton@blender.org>2005-05-13 13:22:37 +0400
commit49dbf781de57307037e020cfa54505d9b494dfb0 (patch)
treec94e8fd840feaef778d3839ac0bf1b2025b7dc3b /source/blender/src/transform_constraints.c
parentd4b2824b24df9c3d00b96c4941188a78f2d95423 (diff)
Three fixes in 1 commit. :)
- Bug #2530 The MMB Transform constraint 'chooser' used projection code that didnt work when zoomed in extreme. Needed a correction to scale projected coordinate according zoomlevel. - NKEY panel for objects: click on left/right side of scale button now goes with increments of 0.1 (was 1.0) - Moving window edges in Screen: prevented top header from becoming too small due to grid-snapping. Was visible now with using Texture Font.
Diffstat (limited to 'source/blender/src/transform_constraints.c')
-rwxr-xr-xsource/blender/src/transform_constraints.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/source/blender/src/transform_constraints.c b/source/blender/src/transform_constraints.c
index 9ffce8f3544..d8bc064679e 100755
--- a/source/blender/src/transform_constraints.c
+++ b/source/blender/src/transform_constraints.c
@@ -824,24 +824,37 @@ void postSelectConstraint(TransInfo *t)
void setNearestAxis(TransInfo *t)
{
- short coord[2];
+ float zfac, coord[2];
float mvec[3], axis[3], proj[3];
float len[3];
+ short mval[2];
int i;
t->con.mode &= ~CON_AXIS0;
t->con.mode &= ~CON_AXIS1;
t->con.mode &= ~CON_AXIS2;
- getmouseco_areawin(coord);
- mvec[0] = (float)(coord[0] - t->con.imval[0]);
- mvec[1] = (float)(coord[1] - t->con.imval[1]);
+ getmouseco_areawin(mval);
+ mvec[0] = (float)(mval[0] - t->con.imval[0]);
+ mvec[1] = (float)(mval[1] - t->con.imval[1]);
mvec[2] = 0.0f;
for (i = 0; i<3; i++) {
VECCOPY(axis, t->con.mtx[i]);
+
+ /* 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)
+ */
+ zfac= G.vd->persmat[0][3]*axis[0]+ G.vd->persmat[1][3]*axis[1]+ G.vd->persmat[2][3]*axis[2]+ G.vd->persmat[3][3];
+ zfac= 30.0*zfac/(float)curarea->winx;
+ VecMulf(axis, zfac);
+
+ /* now we can project to get window coordinate */
VecAddf(axis, axis, t->con.center);
- project_short_noclip(axis, coord);
+ project_float(axis, coord);
+
axis[0] = (float)(coord[0] - t->center2d[0]);
axis[1] = (float)(coord[1] - t->center2d[1]);
axis[2] = 0.0f;