Text3d: selection in editmode now follows rotated text along path
This commit is contained in:
parent
42bd5d7c80
commit
99d050f88b
|
@ -55,6 +55,7 @@ struct CharTrans {
|
|||
|
||||
typedef struct SelBox {
|
||||
float x, y, w, h;
|
||||
float rot;
|
||||
} SelBox;
|
||||
|
||||
typedef struct EditFont {
|
||||
|
|
|
@ -926,6 +926,12 @@ makebreak:
|
|||
|
||||
ct->xof = vec[0] + si * yof;
|
||||
ct->yof = vec[1] + co * yof;
|
||||
|
||||
if (cu->selboxes && (i >= selstart) && (i <= selend)) {
|
||||
SelBox *sb;
|
||||
sb = &(cu->selboxes[i - selstart]);
|
||||
sb->rot = -ct->rot;
|
||||
}
|
||||
|
||||
}
|
||||
cucu->flag = oldflag;
|
||||
|
|
|
@ -91,6 +91,7 @@ void mul_m4_v3(float M[4][4], float r[3]);
|
|||
void mul_v3_m4v3(float r[3], float M[4][4], const float v[3]);
|
||||
void mul_v2_m4v3(float r[2], float M[4][4], const float v[3]);
|
||||
void mul_v2_m2v2(float r[2], float M[2][2], const float v[2]);
|
||||
void mul_m2v2(float M[2][2], float v[2]);
|
||||
void mul_mat3_m4_v3(float M[4][4], float r[3]);
|
||||
void mul_m4_v4(float M[4][4], float r[4]);
|
||||
void mul_v4_m4v4(float r[4], float M[4][4], const float v[4]);
|
||||
|
|
|
@ -398,6 +398,11 @@ void mul_v2_m2v2(float r[2], float mat[2][2], const float vec[2])
|
|||
r[1] = mat[0][1] * x + mat[1][1] * vec[1];
|
||||
}
|
||||
|
||||
void mul_m2v2(float mat[2][2], float vec[2])
|
||||
{
|
||||
mul_v2_m2v2(vec, mat, vec);
|
||||
}
|
||||
|
||||
/* same as mul_m4_v3() but doesnt apply translation component */
|
||||
void mul_mat3_m4_v3(float mat[4][4], float vec[3])
|
||||
{
|
||||
|
|
|
@ -6873,6 +6873,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
|
|||
set_inverted_drawing(1);
|
||||
for (i = 0; i <= (selend - selstart); i++) {
|
||||
SelBox *sb = &(cu->selboxes[i]);
|
||||
float tvec[3];
|
||||
|
||||
if (i < (selend - selstart)) {
|
||||
if (cu->selboxes[i + 1].y == sb->y)
|
||||
|
@ -6883,11 +6884,49 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
|
|||
else {
|
||||
selboxw = sb->w;
|
||||
}
|
||||
|
||||
/* fill in xy below */
|
||||
tvec[2] = 0.001;
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glVertex3f(sb->x, sb->y, 0.001);
|
||||
glVertex3f(sb->x + selboxw, sb->y, 0.001);
|
||||
glVertex3f(sb->x + selboxw, sb->y + sb->h, 0.001);
|
||||
glVertex3f(sb->x, sb->y + sb->h, 0.001);
|
||||
|
||||
if (sb->rot == 0.0f) {
|
||||
copy_v2_fl2(tvec, sb->x, sb->y);
|
||||
glVertex3fv(tvec);
|
||||
|
||||
copy_v2_fl2(tvec, sb->x + selboxw, sb->y);
|
||||
glVertex3fv(tvec);
|
||||
|
||||
copy_v2_fl2(tvec, sb->x + selboxw, sb->y + sb->h);
|
||||
glVertex3fv(tvec);
|
||||
|
||||
copy_v2_fl2(tvec, sb->x, sb->y + sb->h);
|
||||
glVertex3fv(tvec);
|
||||
}
|
||||
else {
|
||||
float mat[2][2];
|
||||
|
||||
angle_to_mat2(mat, sb->rot);
|
||||
|
||||
copy_v2_fl2(tvec, sb->x, sb->y);
|
||||
glVertex3fv(tvec);
|
||||
|
||||
copy_v2_fl2(tvec, selboxw, 0.0f);
|
||||
mul_m2v2(mat, tvec);
|
||||
add_v2_v2(tvec, &sb->x);
|
||||
glVertex3fv(tvec);
|
||||
|
||||
copy_v2_fl2(tvec, selboxw, sb->h);
|
||||
mul_m2v2(mat, tvec);
|
||||
add_v2_v2(tvec, &sb->x);
|
||||
glVertex3fv(tvec);
|
||||
|
||||
copy_v2_fl2(tvec, 0.0f, sb->h);
|
||||
mul_m2v2(mat, tvec);
|
||||
add_v2_v2(tvec, &sb->x);
|
||||
glVertex3fv(tvec);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
}
|
||||
set_inverted_drawing(0);
|
||||
|
|
|
@ -493,7 +493,7 @@ static void p_chart_uv_transform(PChart *chart, float mat[2][2])
|
|||
PVert *v;
|
||||
|
||||
for (v = chart->verts; v; v = v->nextlink) {
|
||||
mul_v2_m2v2(v->uv, mat, v->uv);
|
||||
mul_m2v2(mat, v->uv);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue