- Armature editmode now supports lasso. Please be aware that in editmode,

armatures actually only consists of points, flushing bone selection
  based on points that are selected.

Renamed the "Lines" drawmode for bones to "Sticks". Thanks Basse! :)

- Fix; crash in selecting in editmode armature (commit 1 hour ago)
- Fix; in editmode, bones didn't transform (same commit)
- Fix; in drawmode "Sticks", names could go weird in editmode (commit
  two days ago)
This commit is contained in:
2005-07-23 20:56:40 +00:00
parent e331e68b57
commit 1516381df1
4 changed files with 47 additions and 9 deletions

View File

@@ -1791,7 +1791,7 @@ static void editing_panel_armature_type(Object *ob, bArmature *arm)
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefButI(block, ROW, REDRAWVIEW3D, "Octahedron", 10, 140,100,20, &arm->drawtype, 0, ARM_OCTA, 0, 0, "Draw bone as octahedra"); uiDefButI(block, ROW, REDRAWVIEW3D, "Octahedron", 10, 140,100,20, &arm->drawtype, 0, ARM_OCTA, 0, 0, "Draw bone as octahedra");
uiDefButI(block, ROW, REDRAWVIEW3D, "Lines", 110, 140,100,20, &arm->drawtype, 0, ARM_LINE, 0, 0, "Draw bone as simple 2d lines with dots"); uiDefButI(block, ROW, REDRAWVIEW3D, "Sticks", 110, 140,100,20, &arm->drawtype, 0, ARM_LINE, 0, 0, "Draw bone as simple 2d lines with dots");
uiDefButI(block, ROW, REDRAWVIEW3D, "B-Bones", 210, 140,100,20, &arm->drawtype, 0, ARM_B_BONE, 0, 0, "Draw bone as boxes, showing subdivision and b-splines"); uiDefButI(block, ROW, REDRAWVIEW3D, "B-Bones", 210, 140,100,20, &arm->drawtype, 0, ARM_B_BONE, 0, 0, "Draw bone as boxes, showing subdivision and b-splines");
uiBlockBeginAlign(block); uiBlockBeginAlign(block);

View File

@@ -915,7 +915,7 @@ static void draw_ebones(Object *ob, int dt)
/* offset to parent */ /* offset to parent */
if (eBone->parent) { if (eBone->parent) {
BIF_ThemeColor(TH_WIRE); BIF_ThemeColor(TH_WIRE);
glLoadName (index & 0xFFFF); // object tag, for bordersel optim glLoadName (-1); // -1 here is OK!
setlinestyle(3); setlinestyle(3);
glBegin(GL_LINES); glBegin(GL_LINES);
@@ -929,7 +929,8 @@ static void draw_ebones(Object *ob, int dt)
} }
/* restore */ /* restore */
if (dt>OB_WIRE) bglPolygonOffset(0.0); if(arm->drawtype==ARM_LINE);
else if (dt>OB_WIRE) bglPolygonOffset(0.0);
/* finally names */ /* finally names */
if(arm->flag & ARM_DRAWNAMES) { if(arm->flag & ARM_DRAWNAMES) {

View File

@@ -234,7 +234,7 @@ static int lasso_inside_edge(short mcords[][2], short moves, short *v1, short *v
/* warning; lasso select with backbuffer-check draws in backbuf with persp(PERSP_WIN) /* warning; lasso select with backbuffer-check draws in backbuf with persp(PERSP_WIN)
and returns with persp(PERSP_VIEW). After lasso select backbuf is not OK and returns with persp(PERSP_VIEW). After lasso select backbuf is not OK
*/ */
void do_lasso_select_pose(Object *ob, short mcords[][2], short moves, short select) static void do_lasso_select_pose(Object *ob, short mcords[][2], short moves, short select)
{ {
bPoseChannel *pchan; bPoseChannel *pchan;
float vec[3]; float vec[3];
@@ -459,6 +459,40 @@ static void do_lasso_select_lattice(short mcords[][2], short moves, short select
} }
} }
static void do_lasso_select_armature(short mcords[][2], short moves, short select)
{
EditBone *ebone;
float vec[3];
short sco1[2], sco2[2], didpoint;
for (ebone=G.edbo.first; ebone; ebone=ebone->next) {
VECCOPY(vec, ebone->head);
Mat4MulVecfl(G.obedit->obmat, vec);
project_short(vec, sco1);
VECCOPY(vec, ebone->tail);
Mat4MulVecfl(G.obedit->obmat, vec);
project_short(vec, sco2);
didpoint= 0;
if(lasso_inside(mcords, moves, sco1[0], sco1[1])) {
if(select) ebone->flag |= BONE_ROOTSEL;
else ebone->flag &= ~BONE_ROOTSEL;
didpoint= 1;
}
if(lasso_inside(mcords, moves, sco2[0], sco2[1])) {
if(select) ebone->flag |= BONE_TIPSEL;
else ebone->flag &= ~BONE_TIPSEL;
didpoint= 1;
}
/* if one of points selected, we skip the bone itself */
if(didpoint==0 && lasso_inside_edge(mcords, moves, sco1, sco2)) {
if(select) ebone->flag |= BONE_TIPSEL|BONE_ROOTSEL|BONE_SELECTED;
else ebone->flag &= ~(BONE_ACTIVE|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
}
}
countall(); // abused for flushing selection
}
static void do_lasso_select_facemode(short mcords[][2], short moves, short select) static void do_lasso_select_facemode(short mcords[][2], short moves, short select)
{ {
@@ -506,6 +540,8 @@ static void do_lasso_select(short mcords[][2], short moves, short select)
do_lasso_select_curve(mcords, moves, select); do_lasso_select_curve(mcords, moves, select);
else if(G.obedit->type==OB_LATTICE) else if(G.obedit->type==OB_LATTICE)
do_lasso_select_lattice(mcords, moves, select); do_lasso_select_lattice(mcords, moves, select);
else if(G.obedit->type==OB_ARMATURE)
do_lasso_select_armature(mcords, moves, select);
BIF_undo_push("Lasso select"); BIF_undo_push("Lasso select");

View File

@@ -1349,7 +1349,8 @@ void special_aftertrans_update(short cancelled)
Base *base; Base *base;
int redrawipo=0; int redrawipo=0;
if (ob && (ob->flag & OB_POSEMODE)) { if(G.obedit); // nothing
else if (ob && (ob->flag & OB_POSEMODE)) {
bArmature *arm= ob->data; bArmature *arm= ob->data;
bAction *act; bAction *act;
bPose *pose; bPose *pose;
@@ -1583,10 +1584,6 @@ void createTransData(TransInfo *t)
sort_trans_data_dist(t); sort_trans_data_dist(t);
} }
} }
else if (ob && (ob->flag & OB_POSEMODE)) {
t->flag |= T_POSE;
createTransPose(t);
}
else if (G.obedit) { else if (G.obedit) {
t->ext = NULL; t->ext = NULL;
if (G.obedit->type == OB_MESH) { if (G.obedit->type == OB_MESH) {
@@ -1628,6 +1625,10 @@ void createTransData(TransInfo *t)
t->flag |= T_POSE; t->flag |= T_POSE;
} }
} }
else if (ob && (ob->flag & OB_POSEMODE)) {
t->flag |= T_POSE;
createTransPose(t);
}
else { else {
createTransObject(t); createTransObject(t);
t->flag |= T_OBJECT; t->flag |= T_OBJECT;