Fix: CTRL+Click adding bones didn't attach them to the parent!

This commit is contained in:
Ton Roosendaal 2005-07-19 19:25:17 +00:00
parent 2801c8b20a
commit f1763b2f08
1 changed files with 13 additions and 2 deletions

View File

@ -1198,14 +1198,15 @@ void add_primitiveArmature(int type)
/* the ctrl-click method */
void addvert_armature(void)
{
EditBone *ebone, *newbone;
EditBone *ebone, *newbone, *partest;
float *curs, mat[3][3],imat[3][3];
TEST_EDITARMATURE;
/* find the active or selected bone */
for (ebone = G.edbo.first; ebone; ebone=ebone->next)
if(ebone->flag & BONE_ACTIVE) break;
if(ebone->flag & (BONE_ACTIVE|BONE_TIPSEL)) break;
if(ebone==NULL) return;
deselectall_armature(0);
@ -1214,6 +1215,16 @@ void addvert_armature(void)
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;
curs= give_cursor();
VECCOPY(newbone->tail, curs);
VecSubf(newbone->tail, newbone->tail, G.obedit->obmat[3]);