Quick added; editmode bone subdivision (Wkey only). Doesn't do mirrored

yet. Need commit so I can access it on the compu in Orange studio :)
This commit is contained in:
Ton Roosendaal
2005-09-06 09:47:30 +00:00
parent 167d2ebc12
commit 63cd6b2179
3 changed files with 41 additions and 8 deletions

View File

@@ -83,6 +83,8 @@ void deselectall_armature(int toggle);
void deselectall_posearmature (struct Object *ob, int test);
void draw_armature(struct Base *base, int dt);
void extrude_armature(int forked);
void subdivide_armature(void);
void free_editArmature(void);
struct Bone *get_indexed_bone (struct Object *ob, int index);

View File

@@ -1173,13 +1173,13 @@ static EditBone *add_editbone(void)
bone->flag |= BONE_TIPSEL;
bone->weight= 1.0F;
bone->dist= 0.5F;
bone->dist= 0.25F;
bone->xwidth= 0.1;
bone->zwidth= 0.1;
bone->ease1= 1.0;
bone->ease2= 1.0;
bone->rad_head= 0.25;
bone->rad_tail= 0.1;
bone->rad_head= 0.10;
bone->rad_tail= 0.05;
bone->segments= 1;
return bone;
@@ -1292,8 +1292,8 @@ void addvert_armature(void)
Mat3MulVecfl(imat, newbone->tail);
newbone->length= VecLenf(newbone->head, newbone->tail);
newbone->rad_tail= newbone->length*0.1f;
newbone->dist= newbone->length*0.25f;
newbone->rad_tail= newbone->length*0.05f;
newbone->dist= newbone->length*0.1f;
countall();
@@ -1726,6 +1726,36 @@ void extrude_armature(int forked)
allqueue(REDRAWOOPS, 0);
}
/* context; editmode armature */
void subdivide_armature(void)
{
EditBone *ebone, *newbone, *tbone;
for (ebone = G.edbo.last; ebone; ebone=ebone->prev){
if(ebone->flag & BONE_SELECTED) {
newbone= MEM_mallocN(sizeof(EditBone), "ebone subdiv");
*newbone = *ebone;
BLI_addtail(&G.edbo, newbone);
VecMidf(newbone->head, ebone->head, ebone->tail);
VECCOPY(newbone->tail, ebone->tail);
VECCOPY(ebone->tail, newbone->head);
newbone->rad_head= 0.5*(ebone->rad_head+ebone->rad_tail);
ebone->rad_tail= newbone->rad_head;
newbone->flag |= BONE_CONNECTED;
/* correct parent bones */
for (tbone = G.edbo.first; tbone; tbone=tbone->next){
if(tbone->parent==ebone)
tbone->parent= newbone;
}
newbone->parent= ebone;
}
}
}
/* ***************** Pose tools ********************* */
void clear_armature(Object *ob, char mode)

View File

@@ -2109,10 +2109,11 @@ void special_editmenu(void)
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
}
else if(G.obedit->type==OB_ARMATURE) {
nr= pupmenu("Specials%t|Flip Left-Right Names%x1");
if(nr==1) {
nr= pupmenu("Specials%t|Subdivide %x1|Flip Left-Right Names%x2");
if(nr==1)
subdivide_armature();
else if(nr==2)
armature_flip_names();
}
}
countall();