From 49dbf781de57307037e020cfa54505d9b494dfb0 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Fri, 13 May 2005 09:22:37 +0000 Subject: [PATCH] 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. --- source/blender/src/drawview.c | 12 +++++------ source/blender/src/editscreen.c | 10 +++++----- source/blender/src/transform_constraints.c | 23 +++++++++++++++++----- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index 4d8b0fa5fd7..2092293211b 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -1347,9 +1347,9 @@ static void v3d_posearmature_buts(uiBlock *block, Object *ob, float lim) uiDefButF(block, NUM, B_ARMATUREPANEL2, "LocY:", 10, 50, 140, 19, bone->loc+1, -lim, lim, 100, 3, ""); uiDefButF(block, NUM, B_ARMATUREPANEL2, "locZ:", 10, 30, 140, 19, bone->loc+2, -lim, lim, 100, 3, ""); uiBlockBeginAlign(block); - uiDefButF(block, NUM, B_ARMATUREPANEL2, "SizeX:", 160, 70, 140, 19, bone->size, -lim, lim, 100, 3, ""); - uiDefButF(block, NUM, B_ARMATUREPANEL2, "SizeY:", 160, 50, 140, 19, bone->size+1, -lim, lim, 100, 3, ""); - uiDefButF(block, NUM, B_ARMATUREPANEL2, "SizeZ:", 160, 30, 140, 19, bone->size+2, -lim, lim, 100, 3, ""); + uiDefButF(block, NUM, B_ARMATUREPANEL2, "SizeX:", 160, 70, 140, 19, bone->size, -lim, lim, 10, 3, ""); + uiDefButF(block, NUM, B_ARMATUREPANEL2, "SizeY:", 160, 50, 140, 19, bone->size+1, -lim, lim, 10, 3, ""); + uiDefButF(block, NUM, B_ARMATUREPANEL2, "SizeZ:", 160, 30, 140, 19, bone->size+2, -lim, lim, 10, 3, ""); uiBlockEndAlign(block); } @@ -1607,9 +1607,9 @@ static void view3d_panel_object(short cntrl) // VIEW3D_HANDLER_OBJECT uiDefButF(block, NUM, B_OBJECTPANELROT, "RotY:", 10, 50, 140, 19, &(ob_eul[1]), -lim, lim, 1000, 3, ""); uiDefButF(block, NUM, B_OBJECTPANELROT, "RotZ:", 10, 30, 140, 19, &(ob_eul[2]), -lim, lim, 1000, 3, ""); uiBlockBeginAlign(block); - uiDefButF(block, NUM, REDRAWVIEW3D, "SizeX:", 160, 70, 140, 19, &(ob->size[0]), -lim, lim, 100, 3, ""); - uiDefButF(block, NUM, REDRAWVIEW3D, "SizeY:", 160, 50, 140, 19, &(ob->size[1]), -lim, lim, 100, 3, ""); - uiDefButF(block, NUM, REDRAWVIEW3D, "SizeZ:", 160, 30, 140, 19, &(ob->size[2]), -lim, lim, 100, 3, ""); + uiDefButF(block, NUM, REDRAWVIEW3D, "SizeX:", 160, 70, 140, 19, &(ob->size[0]), -lim, lim, 10, 3, ""); + uiDefButF(block, NUM, REDRAWVIEW3D, "SizeY:", 160, 50, 140, 19, &(ob->size[1]), -lim, lim, 10, 3, ""); + uiDefButF(block, NUM, REDRAWVIEW3D, "SizeZ:", 160, 30, 140, 19, &(ob->size[2]), -lim, lim, 10, 3, ""); uiBlockEndAlign(block); } uiClearButLock(); diff --git a/source/blender/src/editscreen.c b/source/blender/src/editscreen.c index ece796f90fd..dcdce19418f 100644 --- a/source/blender/src/editscreen.c +++ b/source/blender/src/editscreen.c @@ -3020,12 +3020,12 @@ static void moveareas(ScrEdge *edge) if((dir=='h') && v1->vec.y>0 && v1->vec.ysizey-1) { v1->vec.y+= delta; - /* with these lines commented out you can pull the top bar exact to the screen border. */ - /* if(delta != bigger && delta != -smaller) { */ - v1->vec.y+= AREAGRID-1; - v1->vec.y-= (v1->vec.y % AREAGRID); + v1->vec.y+= AREAGRID-1; + v1->vec.y-= (v1->vec.y % AREAGRID); - /* } */ + /* prevent too small top header */ + if(v1->vec.y > G.curscreen->sizey-HEADERY) + v1->vec.y= G.curscreen->sizey-HEADERY; } } v1->flag= 0; 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;