diff options
author | Ton Roosendaal <ton@blender.org> | 2005-08-19 20:15:51 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-08-19 20:15:51 +0400 |
commit | 91e39a0ec3b8a468b1dbe11550416c2a09adce94 (patch) | |
tree | 97ee6efc9a6a32574ae29494f05c801b12d85083 /source/blender/src/editarmature.c | |
parent | c8a5887daa21e74f56bee472790d66997a961f18 (diff) |
CTRL+click now also allows Root-point extrude of Bones.
Diffstat (limited to 'source/blender/src/editarmature.c')
-rw-r--r-- | source/blender/src/editarmature.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c index 16b7a52937c..c66f0760e8b 100644 --- a/source/blender/src/editarmature.c +++ b/source/blender/src/editarmature.c @@ -1251,6 +1251,7 @@ void addvert_armature(void) { EditBone *ebone, *newbone, *partest; float *curs, mat[3][3],imat[3][3]; + int to_root= 0; TEST_EDITARMATURE; @@ -1258,23 +1259,38 @@ void addvert_armature(void) for (ebone = G.edbo.first; ebone; ebone=ebone->next) if(ebone->flag & (BONE_ACTIVE|BONE_TIPSEL)) break; - if(ebone==NULL) return; + if(ebone==NULL) { + for (ebone = G.edbo.first; ebone; ebone=ebone->next) + if(ebone->flag & (BONE_ACTIVE|BONE_ROOTSEL)) break; + + if(ebone==NULL) + return; + to_root= 1; + } deselectall_armature(0); newbone= add_editbone(); newbone->flag |= BONE_ACTIVE; - VECCOPY(newbone->head, ebone->tail); - - /* See if there are any ik children of the parent */ - for (partest = G.edbo.first; partest; partest= partest->next){ - if ((partest->parent == ebone) && (partest->flag & BONE_IK_TOPARENT)) - break; + if(to_root) { + VECCOPY(newbone->head, ebone->head); + + newbone->parent= ebone->parent; + } + else { + VECCOPY(newbone->head, ebone->tail); + + + /* See if there are any ik children of the parent */ + for (partest = G.edbo.first; partest; partest= partest->next){ + if ((partest->parent == ebone) && (partest->flag & BONE_IK_TOPARENT)) + break; + } + if(!partest) + newbone->flag |= BONE_IK_TOPARENT; + + newbone->parent= ebone; } - if(!partest) - newbone->flag |= BONE_IK_TOPARENT; - - newbone->parent= ebone; curs= give_cursor(); VECCOPY(newbone->tail, curs); |