Three fixes, thanks to irc reporting of Basse & Sten;
- Bone points for B-Bone drawing were not adjusted for size of Bone, now they draw same size as for other bone type - Deleting bones in editmode didn't check for constraints in Pose, causing weird collapsed poses or even crashes - ALT+S scaling on B-Bones in editmode didn't correct for the Object scale.
This commit is contained in:
@@ -332,7 +332,7 @@ static void draw_bone_solid_octahedral(void)
|
|||||||
/* *************** Armature drawing, bones ******************* */
|
/* *************** Armature drawing, bones ******************* */
|
||||||
|
|
||||||
|
|
||||||
static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id, float length)
|
static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id)
|
||||||
{
|
{
|
||||||
/* Draw root point if we have no IK parent */
|
/* Draw root point if we have no IK parent */
|
||||||
if (!(boneflag & BONE_IK_TOPARENT)){
|
if (!(boneflag & BONE_IK_TOPARENT)){
|
||||||
@@ -366,12 +366,11 @@ static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id,
|
|||||||
BIF_ThemeColor(TH_BONE_SOLID);
|
BIF_ThemeColor(TH_BONE_SOLID);
|
||||||
}
|
}
|
||||||
|
|
||||||
glTranslatef(0.0, length, 0.0);
|
glTranslatef(0.0, 1.0, 0.0);
|
||||||
if(dt>OB_WIRE) draw_bonevert_solid();
|
if(dt>OB_WIRE) draw_bonevert_solid();
|
||||||
else draw_bonevert();
|
else draw_bonevert();
|
||||||
glTranslatef(0.0, -length, 0.0);
|
glTranslatef(0.0, -1.0, 0.0);
|
||||||
|
|
||||||
if(length > 0.05f) length-= 0.05f; // make vertices visible
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_b_bone_boxes(int dt, bPoseChannel *pchan, float xwidth, float length, float zwidth)
|
static void draw_b_bone_boxes(int dt, bPoseChannel *pchan, float xwidth, float length, float zwidth)
|
||||||
@@ -418,7 +417,12 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign
|
|||||||
|
|
||||||
/* draw points only if... */
|
/* draw points only if... */
|
||||||
if(armflag & ARM_EDITMODE) {
|
if(armflag & ARM_EDITMODE) {
|
||||||
draw_bone_points(dt, armflag, boneflag, id, length);
|
/* move to unitspace */
|
||||||
|
glPushMatrix();
|
||||||
|
glScalef(length, length, length);
|
||||||
|
draw_bone_points(dt, armflag, boneflag, id);
|
||||||
|
glPopMatrix();
|
||||||
|
length*= 0.95f; // make vertices visible
|
||||||
}
|
}
|
||||||
|
|
||||||
/* colors for modes */
|
/* colors for modes */
|
||||||
@@ -507,7 +511,7 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
draw_bone_points(dt, armflag, boneflag, id, 1.0);
|
draw_bone_points(dt, armflag, boneflag, id);
|
||||||
|
|
||||||
/* now draw the bone itself */
|
/* now draw the bone itself */
|
||||||
|
|
||||||
|
|||||||
@@ -795,7 +795,6 @@ static EditBone * get_nearest_editbonepoint (int findunsel, int *selmask)
|
|||||||
static void delete_bone(EditBone* exBone)
|
static void delete_bone(EditBone* exBone)
|
||||||
{
|
{
|
||||||
EditBone *curBone;
|
EditBone *curBone;
|
||||||
bPoseChannel *chan;
|
|
||||||
|
|
||||||
/* Find any bones that refer to this bone */
|
/* Find any bones that refer to this bone */
|
||||||
for (curBone=G.edbo.first;curBone;curBone=curBone->next){
|
for (curBone=G.edbo.first;curBone;curBone=curBone->next){
|
||||||
@@ -805,27 +804,47 @@ static void delete_bone(EditBone* exBone)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Erase any associated pose channel */
|
|
||||||
if (G.obedit->pose){
|
|
||||||
for (chan=G.obedit->pose->chanbase.first; chan; chan=chan->next){
|
|
||||||
if (!strcmp (chan->name, exBone->name)){
|
|
||||||
free_constraints(&chan->constraints);
|
|
||||||
BLI_freelinkN (&G.obedit->pose->chanbase, chan);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BLI_freelinkN (&G.edbo,exBone);
|
BLI_freelinkN (&G.edbo,exBone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static EditBone *editbone_name_exists (char *name); // proto for below
|
||||||
|
|
||||||
/* only editmode! */
|
/* only editmode! */
|
||||||
void delete_armature(void)
|
void delete_armature(void)
|
||||||
{
|
{
|
||||||
EditBone *curBone, *next;
|
EditBone *curBone, *next;
|
||||||
|
bConstraint *con;
|
||||||
|
|
||||||
TEST_EDITARMATURE;
|
TEST_EDITARMATURE;
|
||||||
if(okee("Erase selected bone(s)")==0) return;
|
if(okee("Erase selected bone(s)")==0) return;
|
||||||
|
|
||||||
|
/* First rase any associated pose channel */
|
||||||
|
if (G.obedit->pose){
|
||||||
|
bPoseChannel *chan, *next;
|
||||||
|
for (chan=G.obedit->pose->chanbase.first; chan; chan=next) {
|
||||||
|
next= chan->next;
|
||||||
|
curBone = editbone_name_exists (chan->name);
|
||||||
|
|
||||||
|
if (curBone && (curBone->flag&BONE_SELECTED)) {
|
||||||
|
free_constraints(&chan->constraints);
|
||||||
|
BLI_freelinkN (&G.obedit->pose->chanbase, chan);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for(con= chan->constraints.first; con; con= con->next) {
|
||||||
|
char *subtarget = get_con_subtarget_name(con, G.obedit);
|
||||||
|
if (subtarget) {
|
||||||
|
curBone = editbone_name_exists (subtarget);
|
||||||
|
if (curBone && (curBone->flag&BONE_SELECTED)) {
|
||||||
|
con->flag |= CONSTRAINT_DISABLE;
|
||||||
|
subtarget[0]= 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (curBone=G.edbo.first;curBone;curBone=next){
|
for (curBone=G.edbo.first;curBone;curBone=next){
|
||||||
next=curBone->next;
|
next=curBone->next;
|
||||||
if (curBone->flag&BONE_SELECTED)
|
if (curBone->flag&BONE_SELECTED)
|
||||||
|
|||||||
@@ -2227,7 +2227,7 @@ static void ElementBoneSize(TransInfo *t, TransData *td, float mat[3][3])
|
|||||||
/* we've tucked the scale in loc */
|
/* we've tucked the scale in loc */
|
||||||
oldy= td->iloc[1];
|
oldy= td->iloc[1];
|
||||||
SizeToMat3(td->iloc, sizemat);
|
SizeToMat3(td->iloc, sizemat);
|
||||||
Mat3MulMat3(tmat, smat, sizemat);
|
Mat3MulMat3(tmat, tmat, sizemat);
|
||||||
Mat3ToSize(tmat, td->loc);
|
Mat3ToSize(tmat, td->loc);
|
||||||
td->loc[1]= oldy;
|
td->loc[1]= oldy;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user