From 538d93eb865c64166ae62e081a2a15347d712a54 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 31 Jan 2008 10:43:21 +0000 Subject: [PATCH] Bugfix for Join Armatures: When Join Armatures was called from the menu (Object -> Join Objects) problems were being cause by the use of BASEACT, causing some armatures to disappear and not be joined. --- source/blender/src/editarmature.c | 20 ++++++++++---------- source/blender/src/header_view3d.c | 10 ++++++---- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c index 763d9744064..a2f784f996e 100644 --- a/source/blender/src/editarmature.c +++ b/source/blender/src/editarmature.c @@ -253,7 +253,7 @@ void editbones_to_armature (ListBase *list, Object *ob) for (eBone=list->first; eBone; eBone= neBone) { float len= VecLenf(eBone->head, eBone->tail); neBone= eBone->next; - if(len <= FLT_EPSILON) { + if (len <= FLT_EPSILON) { EditBone *fBone; /* Find any bones that refer to this bone */ @@ -267,7 +267,7 @@ void editbones_to_armature (ListBase *list, Object *ob) } /* Copy the bones from the editData into the armature */ - for (eBone=list->first; eBone; eBone=eBone->next){ + for (eBone=list->first; eBone; eBone=eBone->next) { newBone= MEM_callocN (sizeof(Bone), "bone"); eBone->temp= newBone; /* Associate the real Bones with the EditBones */ @@ -275,7 +275,8 @@ void editbones_to_armature (ListBase *list, Object *ob) memcpy (newBone->head, eBone->head, sizeof(float)*3); memcpy (newBone->tail, eBone->tail, sizeof(float)*3); newBone->flag= eBone->flag; - if(eBone->flag & BONE_ACTIVE) newBone->flag |= BONE_SELECTED; /* important, editbones can be active with only 1 point selected */ + if (eBone->flag & BONE_ACTIVE) + newBone->flag |= BONE_SELECTED; /* important, editbones can be active with only 1 point selected */ newBone->roll = 0.0f; newBone->weight = eBone->weight; @@ -289,16 +290,15 @@ void editbones_to_armature (ListBase *list, Object *ob) newBone->rad_tail= eBone->rad_tail; newBone->segments= eBone->segments; newBone->layer = eBone->layer; - } /* Fix parenting in a separate pass to ensure ebone->bone connections are valid at this point */ for (eBone=list->first;eBone;eBone=eBone->next) { - newBone= (Bone*) eBone->temp; - if (eBone->parent){ - newBone->parent=(Bone*) eBone->parent->temp; - BLI_addtail (&newBone->parent->childbase,newBone); + newBone= (Bone *)eBone->temp; + if (eBone->parent) { + newBone->parent=(Bone *)eBone->parent->temp; + BLI_addtail(&newBone->parent->childbase,newBone); { float M_boneRest[3][3]; @@ -320,14 +320,14 @@ void editbones_to_armature (ListBase *list, Object *ob) /* Get the new head and tail */ VecSubf (newBone->head, eBone->head, eBone->parent->tail); VecSubf (newBone->tail, eBone->tail, eBone->parent->tail); - + Mat3MulVecfl(iM_parentRest, newBone->head); Mat3MulVecfl(iM_parentRest, newBone->tail); } } /* ...otherwise add this bone to the armature's bonebase */ else - BLI_addtail (&arm->bonebase,newBone); + BLI_addtail(&arm->bonebase,newBone); } /* Make a pass through the new armature to fix rolling */ diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index 67da3f3d0c8..5d35d44f9c1 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -2396,15 +2396,17 @@ extern ListBase session_list; static void do_view3d_edit_objectmenu(void *arg, int event) { +#ifdef WITH_VERSE + struct VerseSession *session=NULL; + /* needed to check for valid selected objects */ Base *base=NULL; Object *ob=NULL; -#ifdef WITH_VERSE - struct VerseSession *session=NULL; -#endif - + base= BASACT; if (base) ob= base->object; +#endif + switch(event) {