=== Transform Snap ===

The circle drawn around the snap point is now truely constant regardless of zoom and size of the window. That size if linearly proportional to the vertex size (bigger vertex -> bigger circle).
This commit is contained in:
Martin Poirier 2006-12-21 20:45:57 +00:00
parent 120ac48728
commit 39c0f6dd83
3 changed files with 21 additions and 4 deletions

@ -323,8 +323,10 @@ int clipUVTransform(TransInfo *t, float *vec, int resize);
/*********************** exported from transform_manipulator.c ********** */
struct ScrArea;
struct View3d;
void draw_manipulator_ext(struct ScrArea *sa, int type, char axis, int col, float vec[3], float mat[][3]);
int calc_manipulator_stats(struct ScrArea *sa);
float get_drawsize(struct View3D *v3d);
/*********************** TransData Creation and General Handling *********** */
void createTransData(TransInfo *t);

@ -1328,9 +1328,9 @@ static void draw_manipulator_rotate_cyl(float mat[][4], int moving, int drawflag
/* ********************************************* */
static float get_manipulator_drawsize(ScrArea *sa)
float get_drawsize(View3D *v3d)
{
View3D *v3d= sa->spacedata.first;
ScrArea *sa = v3d->area;
float size, vec[3], len1, len2;
/* size calculus, depending ortho/persp settings, like initgrabz() */
@ -1341,7 +1341,7 @@ static float get_manipulator_drawsize(ScrArea *sa)
VECCOPY(vec, v3d->persinv[1]);
len2= Normalise(vec);
size*= (0.01f*(float)U.tw_size)*(len1>len2?len1:len2);
size*= 0.01f*(len1>len2?len1:len2);
/* correct for window size to make widgets appear fixed size */
if(sa->winx > sa->winy) size*= 1000.0f/(float)sa->winx;
@ -1350,6 +1350,16 @@ static float get_manipulator_drawsize(ScrArea *sa)
return size;
}
static float get_manipulator_drawsize(ScrArea *sa)
{
View3D *v3d= sa->spacedata.first;
float size = get_drawsize(v3d);
size*= (float)U.tw_size;
return size;
}
/* exported to transform_constraints.c */
/* mat, vec = default orientation and location */
/* type = transform type */

@ -82,8 +82,13 @@ void drawSnapping(TransInfo *t)
if ((t->tsnap.status & (SNAP_ON|POINT_INIT|TARGET_INIT)) == (SNAP_ON|POINT_INIT|TARGET_INIT) &&
(G.qual & LR_CTRLKEY)) {
float unitmat[4][4];
float size;
char col[4];
size = get_drawsize(G.vd);
size *= 0.5f * BIF_GetThemeValuef(TH_VERTEX_SIZE);
BIF_GetThemeColor3ubv(TH_TRANSFORM, col);
glColor4ub(col[0], col[1], col[2], 128);
@ -95,7 +100,7 @@ void drawSnapping(TransInfo *t)
glRotatef( -360.0f*saacos(G.vd->viewquat[0])/(float)M_PI, G.vd->viewquat[1], G.vd->viewquat[2], G.vd->viewquat[3]);
Mat4One(unitmat);
drawcircball(GL_LINE_LOOP, unitmat[3], 0.1f, unitmat);
drawcircball(GL_LINE_LOOP, unitmat[3], size, unitmat);
glPopMatrix();
}
}