[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14314] trunk/blender/source/blender/src/ editarmature.c: Whitespace commit for editarmature. c while I try to find the cause of some bugs here.

Joshua Leung aligorith at gmail.com
Wed Apr 2 06:31:44 CEST 2008


Revision: 14314
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14314
Author:   aligorith
Date:     2008-04-02 06:31:41 +0200 (Wed, 02 Apr 2008)

Log Message:
-----------
Whitespace commit for editarmature.c while I try to find the cause of some bugs here.

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

Modified: trunk/blender/source/blender/src/editarmature.c
===================================================================
--- trunk/blender/source/blender/src/editarmature.c	2008-04-02 03:17:52 UTC (rev 14313)
+++ trunk/blender/source/blender/src/editarmature.c	2008-04-02 04:31:41 UTC (rev 14314)
@@ -135,14 +135,14 @@
 		eBone= MEM_callocN(sizeof(EditBone), "make_editbone");
 		
 		/*	Copy relevant data from bone to eBone */
-		eBone->parent=parent;
-		BLI_strncpy (eBone->name, curBone->name, 32);
+		eBone->parent= parent;
+		BLI_strncpy(eBone->name, curBone->name, 32);
 		eBone->flag = curBone->flag;
 		
 		/* fix selection flags */
 		if (eBone->flag & BONE_SELECTED) {
 			eBone->flag |= BONE_TIPSEL;
-			if(eBone->parent && (eBone->flag & BONE_CONNECTED))
+			if (eBone->parent && (eBone->flag & BONE_CONNECTED))
 				eBone->parent->flag |= BONE_TIPSEL;
 			else 
 				eBone->flag |= BONE_ROOTSEL;
@@ -156,7 +156,7 @@
 		eBone->roll= 0.0;
 		
 		/* roll fixing */
-		VecSubf (delta, eBone->tail, eBone->head);
+		VecSubf(delta, eBone->tail, eBone->head);
 		vec_roll_to_mat3(delta, 0.0, postmat);
 		
 		Mat3CpyMat4(premat, curBone->arm_mat);
@@ -215,7 +215,7 @@
 			
 			/* Get the bone postmat */
 			Mat3CpyMat4(postmat, curBone->arm_mat);
-
+			
 			Mat3Inv(imat, premat);
 			Mat3MulMat3(difmat, imat, postmat);
 #if 0
@@ -262,16 +262,16 @@
 					fBone->parent= eBone->parent;
 			}
 			printf("Warning: removed zero sized bone: %s\n", eBone->name);
-			BLI_freelinkN (list, eBone);
+			BLI_freelinkN(list, eBone);
 		}
 	}
 	
 	/*	Copy the bones from the editData into the armature */
 	for (eBone=list->first; eBone; eBone=eBone->next) {
-		newBone= MEM_callocN (sizeof(Bone), "bone");
+		newBone= MEM_callocN(sizeof(Bone), "bone");
 		eBone->temp= newBone;	/* Associate the real Bones with the EditBones */
 		
-		BLI_strncpy (newBone->name, eBone->name, 32);
+		BLI_strncpy(newBone->name, eBone->name, 32);
 		memcpy(newBone->head, eBone->head, sizeof(float)*3);
 		memcpy(newBone->tail, eBone->tail, sizeof(float)*3);
 		newBone->flag= eBone->flag;
@@ -297,8 +297,8 @@
 	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->parent= (Bone *)eBone->parent->temp;
+			BLI_addtail(&newBone->parent->childbase, newBone);
 			
 			{
 				float M_boneRest[3][3];
@@ -307,11 +307,11 @@
 				float	delta[3];
 				
 				/* Get the parent's  matrix (rotation only) */
-				VecSubf (delta, eBone->parent->tail, eBone->parent->head);
+				VecSubf(delta, eBone->parent->tail, eBone->parent->head);
 				vec_roll_to_mat3(delta, eBone->parent->roll, M_parentRest);
 				
 				/* Get this bone's  matrix (rotation only) */
-				VecSubf (delta, eBone->tail, eBone->head);
+				VecSubf(delta, eBone->tail, eBone->head);
 				vec_roll_to_mat3(delta, eBone->roll, M_boneRest);
 				
 				/* Invert the parent matrix */
@@ -327,7 +327,7 @@
 		}
 		/*	...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 */
@@ -336,7 +336,7 @@
 	
 	/* so all users of this armature should get rebuilt */
 	for (obt= G.main->object.first; obt; obt= obt->id.next) {
-		if(obt->data==arm)
+		if (obt->data==arm)
 			armature_rebuild_pose(obt, arm);
 	}
 	
@@ -558,7 +558,7 @@
 	/* if(G.obedit) return; */ /* Alredy checked in join_menu() */
 	
 	ob= OBACT;
-	if(ob->type!=OB_ARMATURE) return 0;
+	if (ob->type!=OB_ARMATURE) return 0;
 	if (object_data_is_libdata(ob)) {
 		error_libdata();
 		return 0;
@@ -573,10 +573,10 @@
 	for (base=FIRSTBASE; base; base=nextbase) {
 		nextbase = base->next;
 		if (TESTBASE(base)){
-			if ((base->object->type==OB_ARMATURE) && (base->object!=ob)){
+			if ((base->object->type==OB_ARMATURE) && (base->object!=ob)) {
 				/* Make a list of editbones in current armature */
 				eblist.first=eblist.last= NULL;
-				make_boneList (&eblist, &((bArmature*)base->object->data)->bonebase,NULL);
+				make_boneList(&eblist, &((bArmature *)base->object->data)->bonebase, NULL);
 				
 				/* Get Pose of current armature */
 				opose= base->object->pose;
@@ -591,7 +591,7 @@
 					curbone= editbone_name_exists(&eblist, pchan->name);
 					
 					/* Get new name */
-					unique_editbone_name (&ebbase, curbone->name);
+					unique_editbone_name(&ebbase, curbone->name);
 					
 					/* Transform the bone */
 					{
@@ -1818,13 +1818,13 @@
 	float		obmat[3][3], curs[3], viewmat[3][3], totmat[3][3], imat[3][3];
 	EditBone	*bone;
 	
-	VECCOPY (curs, give_cursor());	
+	VECCOPY(curs, give_cursor());	
 
 	/* Get inverse point for head and orientation for tail */
 	Mat4Invert(G.obedit->imat, G.obedit->obmat);
 	Mat4MulVecfl(G.obedit->imat, curs);
 
-	if ( !(newob) || U.flag & USER_ADD_VIEWALIGNED) Mat3CpyMat4(obmat, G.vd->viewmat);
+	if ( !(newob) || (U.flag & USER_ADD_VIEWALIGNED) ) Mat3CpyMat4(obmat, G.vd->viewmat);
 	else Mat3One(obmat);
 	
 	Mat3CpyMat4(viewmat, G.obedit->obmat);
@@ -1838,7 +1838,7 @@
 
 	VECCOPY(bone->head, curs);
 	
-	if ( !(newob) || U.flag & USER_ADD_VIEWALIGNED)
+	if ( !(newob) || (U.flag & USER_ADD_VIEWALIGNED) )
 		VecAddf(bone->tail, bone->head, imat[1]);	// bone with unit length 1
 	else
 		VecAddf(bone->tail, bone->head, imat[2]);	// bone with unit length 1, pointing up Z
@@ -1853,7 +1853,7 @@
 	
 	/* this function also comes from an info window */
 	if ELEM(curarea->spacetype, SPACE_VIEW3D, SPACE_INFO); else return;
-	if(G.vd==NULL) return;
+	if (G.vd==NULL) return;
 	
 	G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT);
 	setcursor_space(SPACE_VIEW3D, CURSOR_STD);
@@ -1861,7 +1861,7 @@
 	check_editmode(OB_ARMATURE);
 	
 	/* If we're not the "obedit", make a new object and enter editmode */
-	if(G.obedit==NULL) {
+	if (G.obedit==NULL) {
 		add_object(OB_ARMATURE);
 		base_init_from_view3d(BASACT, G.vd);
 		G.obedit= BASACT->object;
@@ -1878,7 +1878,7 @@
 	
 	countall(); // flushes selection!
 
-	if ( (newob) && !(U.flag & USER_ADD_EDITMODE)) {
+	if ((newob) && !(U.flag & USER_ADD_EDITMODE)) {
 		exit_editmode(2);
 	}
 	
@@ -1897,17 +1897,23 @@
 	TEST_EDITARMATURE;
 	
 	/* find the active or selected bone */
-	for (ebone = G.edbo.first; ebone; ebone=ebone->next)
-		if(arm->layer & ebone->layer)
-			if(ebone->flag & (BONE_ACTIVE|BONE_TIPSEL)) break;
+	for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
+		if (arm->layer & ebone->layer) {
+			if (ebone->flag & (BONE_ACTIVE|BONE_TIPSEL)) 
+				break;
+		}
+	}
 	
-	if(ebone==NULL) {
-		for (ebone = G.edbo.first; ebone; ebone=ebone->next)
-			if(arm->layer & ebone->layer)
-				if(ebone->flag & (BONE_ACTIVE|BONE_ROOTSEL)) break;
+	if (ebone==NULL) {
+		for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
+			if (arm->layer & ebone->layer) {
+				if (ebone->flag & (BONE_ACTIVE|BONE_ROOTSEL)) 
+					break;
+			}
+		}
+		if (ebone == NULL) 
+			return;
 		
-		if(ebone==NULL) 
-			return;
 		to_root= 1;
 	}
 	
@@ -1915,12 +1921,12 @@
 	
 	/* we re-use code for mirror editing... */
 	flipbone= NULL;
-	if(arm->flag & ARM_MIRROR_EDIT)
+	if (arm->flag & ARM_MIRROR_EDIT)
 		flipbone= armature_bone_get_mirrored(ebone);
 
-	for(a=0; a<2; a++) {
-		if(a==1) {
-			if(flipbone==NULL)
+	for (a=0; a<2; a++) {
+		if (a==1) {
+			if (flipbone==NULL)
 				break;
 			else {
 				SWAP(EditBone *, flipbone, ebone);
@@ -1930,7 +1936,7 @@
 		newbone= add_editbone(ebone->name);
 		newbone->flag |= BONE_ACTIVE;
 		
-		if(to_root) {
+		if (to_root) {
 			VECCOPY(newbone->head, ebone->head);
 			newbone->rad_head= ebone->rad_tail;
 			newbone->parent= ebone->parent;
@@ -1946,7 +1952,7 @@
 		VECCOPY(newbone->tail, curs);
 		VecSubf(newbone->tail, newbone->tail, G.obedit->obmat[3]);
 		
-		if(a==1) 
+		if (a==1) 
 			newbone->tail[0]= -newbone->tail[0];
 		
 		Mat3CpyMat4(mat, G.obedit->obmat);
@@ -1959,13 +1965,10 @@
 		
 	}
 	
-	
 	countall();
 	
 	BIF_undo_push("Add Bone");
 	allqueue(REDRAWVIEW3D, 0);
-	
-	while(get_mbut()&R_MOUSE);
 }
 
 /* adds an EditBone between the nominated locations (should be in the right space) */
@@ -1987,8 +1990,8 @@
 	EditBone  *eBone;
 
 	if (name)
-		for (eBone=G.edbo.first; eBone; eBone=eBone->next){
-			if (!strcmp (name, eBone->name))
+		for (eBone=G.edbo.first; eBone; eBone=eBone->next) {
+			if (!strcmp(name, eBone->name))
 				return eBone;
 		}
 
@@ -2005,8 +2008,7 @@
 	bPoseChannel *chan;
 	bConstraint  *curcon;
 	ListBase     *conlist;
-
-
+	
 	if ( (chan = verify_pose_channel(OBACT->pose, dupBone->name)) ) {
 		if ( (conlist = &chan->constraints) ) {
 			for (curcon = conlist->first; curcon; curcon=curcon->next) {
@@ -2068,10 +2070,9 @@
 	}
 	
 	/*	Find the selected bones and duplicate them as needed */
-	for (curBone=G.edbo.first; curBone && curBone!=firstDup; curBone=curBone->next){
+	for (curBone=G.edbo.first; curBone && curBone!=firstDup; curBone=curBone->next) {
 		if (arm->layer & curBone->layer) {
 			if (curBone->flag & BONE_SELECTED) {
-				
 				eBone=MEM_callocN(sizeof(EditBone), "addup_editbone");
 				eBone->flag |= BONE_SELECTED;
 				
@@ -2081,8 +2082,8 @@
 				curBone->temp = eBone;
 				eBone->temp = curBone;
 				
-				unique_editbone_name (&G.edbo, eBone->name);
-				BLI_addtail (&G.edbo, eBone);
+				unique_editbone_name(&G.edbo, eBone->name);
+				BLI_addtail(&G.edbo, eBone);
 				if (!firstDup)
 					firstDup=eBone;
 				
@@ -2092,7 +2093,7 @@
 				if (OBACT->pose) {
 					bPoseChannel *chanold, *channew;
 					ListBase     *listold, *listnew;
-
+					
 					chanold = verify_pose_channel (OBACT->pose, curBone->name);
 					if (chanold) {
 						listold = &chanold->constraints;
@@ -2125,23 +2126,21 @@
 	}
 
 	/*	Run though the list and fix the pointers */
-	for (curBone=G.edbo.first; curBone && curBone!=firstDup; curBone=curBone->next){
-		if(arm->layer & curBone->layer) {
-			if (curBone->flag & BONE_SELECTED){
+	for (curBone=G.edbo.first; curBone && curBone!=firstDup; curBone=curBone->next) {
+		if (arm->layer & curBone->layer) {
+			if (curBone->flag & BONE_SELECTED) {
 				eBone=(EditBone*) curBone->temp;
 				
 				/*	If this bone has no parent,
 				Set the duplicate->parent to NULL
 				*/
-				if (!curBone->parent){
+				if (!curBone->parent)
 					eBone->parent = NULL;
-				}
 				/*	If this bone has a parent that IS selected,
 					Set the duplicate->parent to the curBone->parent->duplicate
 					*/
-				else if (curBone->parent->flag & BONE_SELECTED){

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list