Code Cleanup: avoid using G_PICKSEL for transform manipulator
This commit is contained in:
parent
4c2ba8e936
commit
9f16790840
|
@ -914,9 +914,9 @@ static void draw_manipulator_axes(View3D *v3d, RegionView3D *rv3d, int colcode,
|
|||
}
|
||||
}
|
||||
|
||||
static void preOrthoFront(int ortho, float twmat[4][4], int axis)
|
||||
static void preOrthoFront(const bool ortho, float twmat[4][4], int axis)
|
||||
{
|
||||
if (ortho == 0) {
|
||||
if (ortho == false) {
|
||||
float omat[4][4];
|
||||
copy_m4_m4(omat, twmat);
|
||||
orthogonalize_m4(omat, axis);
|
||||
|
@ -926,14 +926,16 @@ static void preOrthoFront(int ortho, float twmat[4][4], int axis)
|
|||
}
|
||||
}
|
||||
|
||||
static void postOrtho(int ortho)
|
||||
static void postOrtho(const bool ortho)
|
||||
{
|
||||
if (ortho == 0) {
|
||||
if (ortho == false) {
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, int drawflags, int combo)
|
||||
static void draw_manipulator_rotate(
|
||||
View3D *v3d, RegionView3D *rv3d, const int drawflags, const int combo,
|
||||
const bool is_moving, const bool is_picksel)
|
||||
{
|
||||
double plane[4];
|
||||
float matt[4][4];
|
||||
|
@ -941,11 +943,8 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
float cywid = 0.33f * 0.01f * (float)U.tw_handlesize;
|
||||
float cusize = cywid * 0.65f;
|
||||
int arcs = (G.debug_value != 2);
|
||||
int colcode;
|
||||
int ortho;
|
||||
|
||||
if (moving) colcode = MAN_MOVECOL;
|
||||
else colcode = MAN_RGB;
|
||||
const int colcode = (is_moving) ? MAN_MOVECOL : MAN_RGB;
|
||||
bool ortho;
|
||||
|
||||
/* when called while moving in mixed mode, do not draw when... */
|
||||
if ((drawflags & MAN_ROT_C) == 0) return;
|
||||
|
@ -970,7 +969,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
|
||||
/* Screen aligned help circle */
|
||||
if (arcs) {
|
||||
if ((G.f & G_PICKSEL) == 0) {
|
||||
if (is_picksel == false) {
|
||||
UI_ThemeColorShade(TH_BACK, -30);
|
||||
drawcircball(GL_LINE_LOOP, unitmat[3], size, unitmat);
|
||||
}
|
||||
|
@ -978,7 +977,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
|
||||
/* Screen aligned trackball rot circle */
|
||||
if (drawflags & MAN_ROT_T) {
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_ROT_T);
|
||||
if (is_picksel) glLoadName(MAN_ROT_T);
|
||||
|
||||
UI_ThemeColor(TH_TRANSFORM);
|
||||
drawcircball(GL_LINE_LOOP, unitmat[3], 0.2f * size, unitmat);
|
||||
|
@ -986,11 +985,11 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
|
||||
/* Screen aligned view rot circle */
|
||||
if (drawflags & MAN_ROT_V) {
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
|
||||
if (is_picksel) glLoadName(MAN_ROT_V);
|
||||
UI_ThemeColor(TH_TRANSFORM);
|
||||
drawcircball(GL_LINE_LOOP, unitmat[3], 1.2f * size, unitmat);
|
||||
|
||||
if (moving) {
|
||||
if (is_moving) {
|
||||
float vec[3];
|
||||
vec[0] = 0; // XXX (float)(t->imval[0] - t->center2d[0]);
|
||||
vec[1] = 0; // XXX (float)(t->imval[1] - t->center2d[1]);
|
||||
|
@ -1009,7 +1008,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
ortho = is_orthogonal_m4(rv3d->twmat);
|
||||
|
||||
/* apply the transform delta */
|
||||
if (moving) {
|
||||
if (is_moving) {
|
||||
copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
|
||||
// XXX mul_m4_m3m4(matt, t->mat, rv3d->twmat);
|
||||
if (ortho) {
|
||||
|
@ -1026,10 +1025,10 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
|
||||
/* axes */
|
||||
if (arcs == 0) {
|
||||
if (!(G.f & G_PICKSEL)) {
|
||||
if (!is_picksel) {
|
||||
if ((combo & V3D_MANIP_SCALE) == 0) {
|
||||
/* axis */
|
||||
if ((drawflags & MAN_ROT_X) || (moving && (drawflags & MAN_ROT_Z))) {
|
||||
if ((drawflags & MAN_ROT_X) || (is_moving && (drawflags & MAN_ROT_Z))) {
|
||||
preOrthoFront(ortho, rv3d->twmat, 2);
|
||||
manipulator_setcolor(v3d, 'X', colcode, 255);
|
||||
glBegin(GL_LINES);
|
||||
|
@ -1038,7 +1037,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
glEnd();
|
||||
postOrtho(ortho);
|
||||
}
|
||||
if ((drawflags & MAN_ROT_Y) || (moving && (drawflags & MAN_ROT_X))) {
|
||||
if ((drawflags & MAN_ROT_Y) || (is_moving && (drawflags & MAN_ROT_X))) {
|
||||
preOrthoFront(ortho, rv3d->twmat, 0);
|
||||
manipulator_setcolor(v3d, 'Y', colcode, 255);
|
||||
glBegin(GL_LINES);
|
||||
|
@ -1047,7 +1046,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
glEnd();
|
||||
postOrtho(ortho);
|
||||
}
|
||||
if ((drawflags & MAN_ROT_Z) || (moving && (drawflags & MAN_ROT_Y))) {
|
||||
if ((drawflags & MAN_ROT_Z) || (is_moving && (drawflags & MAN_ROT_Y))) {
|
||||
preOrthoFront(ortho, rv3d->twmat, 1);
|
||||
manipulator_setcolor(v3d, 'Z', colcode, 255);
|
||||
glBegin(GL_LINES);
|
||||
|
@ -1060,12 +1059,12 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
}
|
||||
}
|
||||
|
||||
if (arcs == 0 && moving) {
|
||||
if (arcs == 0 && is_moving) {
|
||||
|
||||
/* Z circle */
|
||||
if (drawflags & MAN_ROT_Z) {
|
||||
preOrthoFront(ortho, matt, 2);
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
|
||||
if (is_picksel) glLoadName(MAN_ROT_Z);
|
||||
manipulator_setcolor(v3d, 'Z', colcode, 255);
|
||||
drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
|
||||
postOrtho(ortho);
|
||||
|
@ -1073,7 +1072,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
/* X circle */
|
||||
if (drawflags & MAN_ROT_X) {
|
||||
preOrthoFront(ortho, matt, 0);
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
|
||||
if (is_picksel) glLoadName(MAN_ROT_X);
|
||||
glRotatef(90.0, 0.0, 1.0, 0.0);
|
||||
manipulator_setcolor(v3d, 'X', colcode, 255);
|
||||
drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
|
||||
|
@ -1083,7 +1082,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
/* Y circle */
|
||||
if (drawflags & MAN_ROT_Y) {
|
||||
preOrthoFront(ortho, matt, 1);
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
|
||||
if (is_picksel) glLoadName(MAN_ROT_Y);
|
||||
glRotatef(-90.0, 1.0, 0.0, 0.0);
|
||||
manipulator_setcolor(v3d, 'Y', colcode, 255);
|
||||
drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
|
||||
|
@ -1100,7 +1099,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
/* Z circle */
|
||||
if (drawflags & MAN_ROT_Z) {
|
||||
preOrthoFront(ortho, rv3d->twmat, 2);
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
|
||||
if (is_picksel) glLoadName(MAN_ROT_Z);
|
||||
manipulator_setcolor(v3d, 'Z', colcode, 255);
|
||||
partial_doughnut(cusize / 4.0f, 1.0f, 0, 48, 8, 48);
|
||||
postOrtho(ortho);
|
||||
|
@ -1108,7 +1107,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
/* X circle */
|
||||
if (drawflags & MAN_ROT_X) {
|
||||
preOrthoFront(ortho, rv3d->twmat, 0);
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
|
||||
if (is_picksel) glLoadName(MAN_ROT_X);
|
||||
glRotatef(90.0, 0.0, 1.0, 0.0);
|
||||
manipulator_setcolor(v3d, 'X', colcode, 255);
|
||||
partial_doughnut(cusize / 4.0f, 1.0f, 0, 48, 8, 48);
|
||||
|
@ -1118,7 +1117,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
/* Y circle */
|
||||
if (drawflags & MAN_ROT_Y) {
|
||||
preOrthoFront(ortho, rv3d->twmat, 1);
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
|
||||
if (is_picksel) glLoadName(MAN_ROT_Y);
|
||||
glRotatef(-90.0, 1.0, 0.0, 0.0);
|
||||
manipulator_setcolor(v3d, 'Y', colcode, 255);
|
||||
partial_doughnut(cusize / 4.0f, 1.0f, 0, 48, 8, 48);
|
||||
|
@ -1135,7 +1134,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
if (drawflags & MAN_ROT_Z) {
|
||||
preOrthoFront(ortho, rv3d->twmat, 2);
|
||||
glPushMatrix();
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
|
||||
if (is_picksel) glLoadName(MAN_ROT_Z);
|
||||
manipulator_setcolor(v3d, 'Z', colcode, 255);
|
||||
|
||||
partial_doughnut(0.7f * cusize, 1.0f, 31, 33, 8, 64);
|
||||
|
@ -1148,7 +1147,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
if (drawflags & MAN_ROT_Y) {
|
||||
preOrthoFront(ortho, rv3d->twmat, 1);
|
||||
glPushMatrix();
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
|
||||
if (is_picksel) glLoadName(MAN_ROT_Y);
|
||||
manipulator_setcolor(v3d, 'Y', colcode, 255);
|
||||
|
||||
glRotatef(90.0, 1.0, 0.0, 0.0);
|
||||
|
@ -1163,7 +1162,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
if (drawflags & MAN_ROT_X) {
|
||||
preOrthoFront(ortho, rv3d->twmat, 0);
|
||||
glPushMatrix();
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
|
||||
if (is_picksel) glLoadName(MAN_ROT_X);
|
||||
manipulator_setcolor(v3d, 'X', colcode, 255);
|
||||
|
||||
glRotatef(-90.0, 0.0, 1.0, 0.0);
|
||||
|
@ -1244,7 +1243,9 @@ static void drawsolidcube(float size)
|
|||
}
|
||||
|
||||
|
||||
static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving, int drawflags, int combo, int colcode)
|
||||
static void draw_manipulator_scale(
|
||||
View3D *v3d, RegionView3D *rv3d, const int drawflags, const int combo, const int colcode,
|
||||
const bool is_moving, const bool is_picksel)
|
||||
{
|
||||
float cywid = 0.25f * 0.01f * (float)U.tw_handlesize;
|
||||
float cusize = cywid * 0.75f, dz;
|
||||
|
@ -1264,7 +1265,7 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
int shift = 0; // XXX
|
||||
|
||||
/* center circle, do not add to selection when shift is pressed (planar constraint) */
|
||||
if ((G.f & G_PICKSEL) && shift == 0) glLoadName(MAN_SCALE_C);
|
||||
if (is_picksel && shift == 0) glLoadName(MAN_SCALE_C);
|
||||
|
||||
manipulator_setcolor(v3d, 'C', colcode, 255);
|
||||
glPushMatrix();
|
||||
|
@ -1279,7 +1280,7 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
dz = 1.0f - 4.0f * cusize;
|
||||
}
|
||||
|
||||
if (moving) {
|
||||
if (is_moving) {
|
||||
float matt[4][4];
|
||||
|
||||
copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
|
||||
|
@ -1305,7 +1306,7 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
case 0: /* X cube */
|
||||
if (drawflags & MAN_SCALE_X) {
|
||||
glTranslatef(dz, 0.0, 0.0);
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_SCALE_X);
|
||||
if (is_picksel) glLoadName(MAN_SCALE_X);
|
||||
manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->twangle[0]));
|
||||
drawsolidcube(cusize);
|
||||
glTranslatef(-dz, 0.0, 0.0);
|
||||
|
@ -1314,7 +1315,7 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
case 1: /* Y cube */
|
||||
if (drawflags & MAN_SCALE_Y) {
|
||||
glTranslatef(0.0, dz, 0.0);
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_SCALE_Y);
|
||||
if (is_picksel) glLoadName(MAN_SCALE_Y);
|
||||
manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->twangle[1]));
|
||||
drawsolidcube(cusize);
|
||||
glTranslatef(0.0, -dz, 0.0);
|
||||
|
@ -1323,7 +1324,7 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
case 2: /* Z cube */
|
||||
if (drawflags & MAN_SCALE_Z) {
|
||||
glTranslatef(0.0, 0.0, dz);
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_SCALE_Z);
|
||||
if (is_picksel) glLoadName(MAN_SCALE_Z);
|
||||
manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->twangle[2]));
|
||||
drawsolidcube(cusize);
|
||||
glTranslatef(0.0, 0.0, -dz);
|
||||
|
@ -1333,7 +1334,7 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
|
|||
}
|
||||
|
||||
/* if shiftkey, center point as last, for selectbuffer order */
|
||||
if (G.f & G_PICKSEL) {
|
||||
if (is_picksel) {
|
||||
int shift = 0; // XXX
|
||||
|
||||
if (shift) {
|
||||
|
@ -1379,7 +1380,9 @@ static void draw_cylinder(GLUquadricObj *qobj, float len, float width)
|
|||
}
|
||||
|
||||
|
||||
static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUSED(moving), int drawflags, int combo, int colcode)
|
||||
static void draw_manipulator_translate(
|
||||
View3D *v3d, RegionView3D *rv3d, int drawflags, int combo, int colcode,
|
||||
const bool UNUSED(is_moving), const bool is_picksel)
|
||||
{
|
||||
GLUquadricObj *qobj;
|
||||
float cylen = 0.01f * (float)U.tw_handlesize;
|
||||
|
@ -1398,7 +1401,7 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
|
|||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
/* center circle, do not add to selection when shift is pressed (planar constraint) */
|
||||
if ((G.f & G_PICKSEL) && shift == 0) glLoadName(MAN_TRANS_C);
|
||||
if (is_picksel && shift == 0) glLoadName(MAN_TRANS_C);
|
||||
|
||||
manipulator_setcolor(v3d, 'C', colcode, 255);
|
||||
glPushMatrix();
|
||||
|
@ -1434,7 +1437,7 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
|
|||
case 0: /* Z Cone */
|
||||
if (drawflags & MAN_TRANS_Z) {
|
||||
glTranslatef(0.0, 0.0, dz);
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_TRANS_Z);
|
||||
if (is_picksel) glLoadName(MAN_TRANS_Z);
|
||||
manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->twangle[2]));
|
||||
draw_cone(qobj, cylen, cywid);
|
||||
glTranslatef(0.0, 0.0, -dz);
|
||||
|
@ -1443,7 +1446,7 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
|
|||
case 1: /* X Cone */
|
||||
if (drawflags & MAN_TRANS_X) {
|
||||
glTranslatef(dz, 0.0, 0.0);
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_TRANS_X);
|
||||
if (is_picksel) glLoadName(MAN_TRANS_X);
|
||||
glRotatef(90.0, 0.0, 1.0, 0.0);
|
||||
manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->twangle[0]));
|
||||
draw_cone(qobj, cylen, cywid);
|
||||
|
@ -1454,7 +1457,7 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
|
|||
case 2: /* Y Cone */
|
||||
if (drawflags & MAN_TRANS_Y) {
|
||||
glTranslatef(0.0, dz, 0.0);
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_TRANS_Y);
|
||||
if (is_picksel) glLoadName(MAN_TRANS_Y);
|
||||
glRotatef(-90.0, 1.0, 0.0, 0.0);
|
||||
manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->twangle[1]));
|
||||
draw_cone(qobj, cylen, cywid);
|
||||
|
@ -1472,7 +1475,9 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
|
|||
|
||||
}
|
||||
|
||||
static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int moving, int drawflags, int combo, int colcode)
|
||||
static void draw_manipulator_rotate_cyl(
|
||||
View3D *v3d, RegionView3D *rv3d, int drawflags, const int combo, const int colcode,
|
||||
const bool is_moving, const bool is_picksel)
|
||||
{
|
||||
GLUquadricObj *qobj;
|
||||
float size;
|
||||
|
@ -1480,6 +1485,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
|
|||
float cywid = 0.25f * cylen;
|
||||
int axis_order[3] = {2, 0, 1};
|
||||
int i;
|
||||
|
||||
/* when called while moving in mixed mode, do not draw when... */
|
||||
if ((drawflags & MAN_ROT_C) == 0) return;
|
||||
|
||||
|
@ -1497,11 +1503,11 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
|
|||
if (drawflags & MAN_ROT_V) {
|
||||
float unitmat[4][4] = MAT4_UNITY;
|
||||
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
|
||||
if (is_picksel) glLoadName(MAN_ROT_V);
|
||||
UI_ThemeColor(TH_TRANSFORM);
|
||||
drawcircball(GL_LINE_LOOP, unitmat[3], 1.2f * size, unitmat);
|
||||
|
||||
if (moving) {
|
||||
if (is_moving) {
|
||||
float vec[3];
|
||||
vec[0] = 0; // XXX (float)(t->imval[0] - t->center2d[0]);
|
||||
vec[1] = 0; // XXX (float)(t->imval[1] - t->center2d[1]);
|
||||
|
@ -1517,7 +1523,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
|
|||
glPopMatrix();
|
||||
|
||||
/* apply the transform delta */
|
||||
if (moving) {
|
||||
if (is_moving) {
|
||||
float matt[4][4];
|
||||
copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
|
||||
// XXX if (t->flag & T_USES_MANIPULATOR) {
|
||||
|
@ -1532,7 +1538,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
|
|||
glFrontFace(is_negative_m4(rv3d->twmat) ? GL_CW : GL_CCW);
|
||||
|
||||
/* axis */
|
||||
if ((G.f & G_PICKSEL) == 0) {
|
||||
if (is_picksel == false) {
|
||||
|
||||
// only draw axis when combo didn't draw scale axes
|
||||
if ((combo & V3D_MANIP_SCALE) == 0) {
|
||||
|
@ -1550,7 +1556,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
|
|||
case 0: /* X cylinder */
|
||||
if (drawflags & MAN_ROT_X) {
|
||||
glTranslatef(1.0, 0.0, 0.0);
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
|
||||
if (is_picksel) glLoadName(MAN_ROT_X);
|
||||
glRotatef(90.0, 0.0, 1.0, 0.0);
|
||||
manipulator_setcolor(v3d, 'X', colcode, 255);
|
||||
draw_cylinder(qobj, cylen, cywid);
|
||||
|
@ -1561,7 +1567,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
|
|||
case 1: /* Y cylinder */
|
||||
if (drawflags & MAN_ROT_Y) {
|
||||
glTranslatef(0.0, 1.0, 0.0);
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
|
||||
if (is_picksel) glLoadName(MAN_ROT_Y);
|
||||
glRotatef(-90.0, 1.0, 0.0, 0.0);
|
||||
manipulator_setcolor(v3d, 'Y', colcode, 255);
|
||||
draw_cylinder(qobj, cylen, cywid);
|
||||
|
@ -1572,7 +1578,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
|
|||
case 2: /* Z cylinder */
|
||||
if (drawflags & MAN_ROT_Z) {
|
||||
glTranslatef(0.0, 0.0, 1.0);
|
||||
if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
|
||||
if (is_picksel) glLoadName(MAN_ROT_Z);
|
||||
manipulator_setcolor(v3d, 'Z', colcode, 255);
|
||||
draw_cylinder(qobj, cylen, cywid);
|
||||
glTranslatef(0.0, 0.0, -1.0);
|
||||
|
@ -1605,6 +1611,8 @@ void BIF_draw_manipulator(const bContext *C)
|
|||
RegionView3D *rv3d = ar->regiondata;
|
||||
int totsel;
|
||||
|
||||
const bool is_picksel = false;
|
||||
|
||||
if (!(v3d->twflag & V3D_USE_MANIPULATOR)) return;
|
||||
|
||||
{
|
||||
|
@ -1659,18 +1667,19 @@ void BIF_draw_manipulator(const bContext *C)
|
|||
|
||||
if (G.debug_value == 3) {
|
||||
if (G.moving & (G_TRANSFORM_OBJ | G_TRANSFORM_EDIT))
|
||||
draw_manipulator_rotate_cyl(v3d, rv3d, 1, drawflags, v3d->twtype, MAN_MOVECOL);
|
||||
draw_manipulator_rotate_cyl(v3d, rv3d, drawflags, v3d->twtype, MAN_MOVECOL, true, is_picksel);
|
||||
else
|
||||
draw_manipulator_rotate_cyl(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB);
|
||||
draw_manipulator_rotate_cyl(v3d, rv3d, drawflags, v3d->twtype, MAN_RGB, false, is_picksel);
|
||||
}
|
||||
else {
|
||||
draw_manipulator_rotate(v3d, rv3d, drawflags, v3d->twtype, false, is_picksel);
|
||||
}
|
||||
else
|
||||
draw_manipulator_rotate(v3d, rv3d, 0, drawflags, v3d->twtype);
|
||||
}
|
||||
if (v3d->twtype & V3D_MANIP_SCALE) {
|
||||
draw_manipulator_scale(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB);
|
||||
draw_manipulator_scale(v3d, rv3d, drawflags, v3d->twtype, MAN_RGB, false, is_picksel);
|
||||
}
|
||||
if (v3d->twtype & V3D_MANIP_TRANSLATE) {
|
||||
draw_manipulator_translate(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB);
|
||||
draw_manipulator_translate(v3d, rv3d, drawflags, v3d->twtype, MAN_RGB, false, is_picksel);
|
||||
}
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
|
@ -1684,6 +1693,8 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl
|
|||
rctf rect;
|
||||
GLuint buffer[64]; // max 4 items per select, so large enuf
|
||||
short hits;
|
||||
const bool is_picksel = true;
|
||||
|
||||
extern void setwinmatrixview3d(ARegion *, View3D *, rctf *); // XXX check a bit later on this... (ton)
|
||||
|
||||
/* when looking through a selected camera, the manipulator can be at the
|
||||
|
@ -1691,8 +1702,6 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl
|
|||
if (fabsf(mat4_to_scale(rv3d->twmat)) < 1e-7f)
|
||||
return 0;
|
||||
|
||||
G.f |= G_PICKSEL;
|
||||
|
||||
rect.xmin = mval[0] - hotspot;
|
||||
rect.xmax = mval[0] + hotspot;
|
||||
rect.ymin = mval[1] - hotspot;
|
||||
|
@ -1708,18 +1717,17 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl
|
|||
|
||||
/* do the drawing */
|
||||
if (v3d->twtype & V3D_MANIP_ROTATE) {
|
||||
if (G.debug_value == 3) draw_manipulator_rotate_cyl(v3d, rv3d, 0, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB);
|
||||
else draw_manipulator_rotate(v3d, rv3d, 0, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype);
|
||||
if (G.debug_value == 3) draw_manipulator_rotate_cyl(v3d, rv3d, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB, false, is_picksel);
|
||||
else draw_manipulator_rotate(v3d, rv3d, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, false, is_picksel);
|
||||
}
|
||||
if (v3d->twtype & V3D_MANIP_SCALE)
|
||||
draw_manipulator_scale(v3d, rv3d, 0, MAN_SCALE_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB);
|
||||
draw_manipulator_scale(v3d, rv3d, MAN_SCALE_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB, false, is_picksel);
|
||||
if (v3d->twtype & V3D_MANIP_TRANSLATE)
|
||||
draw_manipulator_translate(v3d, rv3d, 0, MAN_TRANS_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB);
|
||||
draw_manipulator_translate(v3d, rv3d, MAN_TRANS_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB, false, is_picksel);
|
||||
|
||||
glPopName();
|
||||
hits = glRenderMode(GL_RENDER);
|
||||
|
||||
G.f &= ~G_PICKSEL;
|
||||
setwinmatrixview3d(ar, v3d, NULL);
|
||||
mul_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
|
||||
|
||||
|
|
Loading…
Reference in New Issue