[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13495] trunk/blender/source/blender/src: Bugfix for Join Armatures:

Joshua Leung aligorith at gmail.com
Thu Jan 31 11:43:21 CET 2008


Revision: 13495
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13495
Author:   aligorith
Date:     2008-01-31 11:43:21 +0100 (Thu, 31 Jan 2008)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/src/editarmature.c
    trunk/blender/source/blender/src/header_view3d.c

Modified: trunk/blender/source/blender/src/editarmature.c
===================================================================
--- trunk/blender/source/blender/src/editarmature.c	2008-01-31 09:59:05 UTC (rev 13494)
+++ trunk/blender/source/blender/src/editarmature.c	2008-01-31 10:43:21 UTC (rev 13495)
@@ -253,7 +253,7 @@
 	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 @@
 	}
 	
 	/*	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 @@
 		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 @@
 		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 @@
 				/* 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 */

Modified: trunk/blender/source/blender/src/header_view3d.c
===================================================================
--- trunk/blender/source/blender/src/header_view3d.c	2008-01-31 09:59:05 UTC (rev 13494)
+++ trunk/blender/source/blender/src/header_view3d.c	2008-01-31 10:43:21 UTC (rev 13495)
@@ -2396,15 +2396,17 @@
 
 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;
+	
+	base= BASACT;
+	if (base) ob= base->object;
 #endif
 
-	base= BASACT;
-	if (base) ob= base->object;
 	
 	switch(event) {
 	 





More information about the Bf-blender-cvs mailing list