diff options
-rw-r--r-- | source/blender/include/BIF_editarmature.h | 2 | ||||
-rw-r--r-- | source/blender/src/editarmature.c | 40 | ||||
-rw-r--r-- | source/blender/src/editobject.c | 7 |
3 files changed, 41 insertions, 8 deletions
diff --git a/source/blender/include/BIF_editarmature.h b/source/blender/include/BIF_editarmature.h index d5594567886..02ad26b8878 100644 --- a/source/blender/include/BIF_editarmature.h +++ b/source/blender/include/BIF_editarmature.h @@ -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); diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c index 7546158d887..939f66d122b 100644 --- a/source/blender/src/editarmature.c +++ b/source/blender/src/editarmature.c @@ -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) diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index e70a2fcb6e7..88e257e075a 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -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(); |