[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46352] trunk/blender/source/blender/ blenkernel/intern: style cleanup: BKE_*. c files which deal with library functions

Campbell Barton ideasman42 at gmail.com
Sun May 6 17:15:33 CEST 2012


Revision: 46352
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46352
Author:   campbellbarton
Date:     2012-05-06 15:15:33 +0000 (Sun, 06 May 2012)
Log Message:
-----------
style cleanup: BKE_*.c files which deal with library functions

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/action.c
    trunk/blender/source/blender/blenkernel/intern/armature.c
    trunk/blender/source/blender/blenkernel/intern/brush.c
    trunk/blender/source/blender/blenkernel/intern/camera.c
    trunk/blender/source/blender/blenkernel/intern/curve.c
    trunk/blender/source/blender/blenkernel/intern/font.c
    trunk/blender/source/blender/blenkernel/intern/gpencil.c
    trunk/blender/source/blender/blenkernel/intern/group.c
    trunk/blender/source/blender/blenkernel/intern/image.c
    trunk/blender/source/blender/blenkernel/intern/ipo.c
    trunk/blender/source/blender/blenkernel/intern/lamp.c
    trunk/blender/source/blender/blenkernel/intern/lattice.c
    trunk/blender/source/blender/blenkernel/intern/material.c
    trunk/blender/source/blender/blenkernel/intern/mball.c
    trunk/blender/source/blender/blenkernel/intern/mesh.c
    trunk/blender/source/blender/blenkernel/intern/movieclip.c
    trunk/blender/source/blender/blenkernel/intern/object.c
    trunk/blender/source/blender/blenkernel/intern/particle.c
    trunk/blender/source/blender/blenkernel/intern/scene.c
    trunk/blender/source/blender/blenkernel/intern/screen.c
    trunk/blender/source/blender/blenkernel/intern/sound.c
    trunk/blender/source/blender/blenkernel/intern/speaker.c
    trunk/blender/source/blender/blenkernel/intern/text.c
    trunk/blender/source/blender/blenkernel/intern/texture.c
    trunk/blender/source/blender/blenkernel/intern/world.c

Modified: trunk/blender/source/blender/blenkernel/intern/action.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/action.c	2012-05-06 15:03:31 UTC (rev 46351)
+++ trunk/blender/source/blender/blenkernel/intern/action.c	2012-05-06 15:15:33 UTC (rev 46352)
@@ -83,7 +83,7 @@
 {
 	bAction *act;
 	
-	act= BKE_libblock_alloc(&G.main->action, ID_AC, name);
+	act = BKE_libblock_alloc(&G.main->action, ID_AC, name);
 	
 	return act;
 }	
@@ -105,8 +105,8 @@
 	tMakeLocalActionContext *mlac = (tMakeLocalActionContext *)mlac_ptr;
 	
 	if (adt->action == mlac->act) {
-		if (id->lib) mlac->is_lib= TRUE;
-		else mlac->is_local= TRUE;
+		if (id->lib) mlac->is_lib = TRUE;
+		else mlac->is_local = TRUE;
 	}
 }
 
@@ -129,25 +129,25 @@
 void BKE_action_make_local(bAction *act)
 {
 	tMakeLocalActionContext mlac = {act, NULL, FALSE, FALSE};
-	Main *bmain= G.main;
+	Main *bmain = G.main;
 	
-	if (act->id.lib==NULL) 
+	if (act->id.lib == NULL)
 		return;
 	
 	// XXX: double-check this; it used to be just single-user check, but that was when fake-users were still default
-	if ((act->id.flag & LIB_FAKEUSER) && (act->id.us<=1)) {
+	if ((act->id.flag & LIB_FAKEUSER) && (act->id.us <= 1)) {
 		id_clear_lib_data(bmain, &act->id);
 		return;
 	}
 	
 	BKE_animdata_main_cb(bmain, make_localact_init_cb, &mlac);
 	
-	if (mlac.is_local && mlac.is_lib==FALSE) {
+	if (mlac.is_local && mlac.is_lib == FALSE) {
 		id_clear_lib_data(bmain, &act->id);
 	}
 	else if (mlac.is_local && mlac.is_lib) {
-		mlac.act_new= BKE_action_copy(act);
-		mlac.act_new->id.us= 0;
+		mlac.act_new = BKE_action_copy(act);
+		mlac.act_new->id.us = 0;
 
 		BKE_id_lib_local_paths(bmain, act->id.lib, &mlac.act_new->id);
 
@@ -177,7 +177,7 @@
 
 /* .................................. */
 
-bAction *BKE_action_copy (bAction *src)
+bAction *BKE_action_copy(bAction *src)
 {
 	bAction *dst = NULL;
 	bActionGroup *dgrp, *sgrp;
@@ -185,29 +185,29 @@
 	
 	if (src == NULL) 
 		return NULL;
-	dst= BKE_libblock_copy(&src->id);
+	dst = BKE_libblock_copy(&src->id);
 	
 	/* duplicate the lists of groups and markers */
 	BLI_duplicatelist(&dst->groups, &src->groups);
 	BLI_duplicatelist(&dst->markers, &src->markers);
 	
 	/* copy F-Curves, fixing up the links as we go */
-	dst->curves.first= dst->curves.last= NULL;
+	dst->curves.first = dst->curves.last = NULL;
 	
-	for (sfcu= src->curves.first; sfcu; sfcu= sfcu->next) {
+	for (sfcu = src->curves.first; sfcu; sfcu = sfcu->next) {
 		/* duplicate F-Curve */
-		dfcu= copy_fcurve(sfcu);
+		dfcu = copy_fcurve(sfcu);
 		BLI_addtail(&dst->curves, dfcu);
 		
 		/* fix group links (kindof bad list-in-list search, but this is the most reliable way) */
-		for (dgrp=dst->groups.first, sgrp=src->groups.first; dgrp && sgrp; dgrp=dgrp->next, sgrp=sgrp->next) {
+		for (dgrp = dst->groups.first, sgrp = src->groups.first; dgrp && sgrp; dgrp = dgrp->next, sgrp = sgrp->next) {
 			if (sfcu->grp == sgrp) {
-				dfcu->grp= dgrp;
+				dfcu->grp = dgrp;
 				
 				if (dgrp->channels.first == sfcu)
-					dgrp->channels.first= dfcu;
+					dgrp->channels.first = dfcu;
 				if (dgrp->channels.last == sfcu)
-					dgrp->channels.last= dfcu;
+					dgrp->channels.last = dfcu;
 					
 				break;
 			}
@@ -220,12 +220,12 @@
 /* *************** Action Groups *************** */
 
 /* Get the active action-group for an Action */
-bActionGroup *get_active_actiongroup (bAction *act)
+bActionGroup *get_active_actiongroup(bAction *act)
 {
-	bActionGroup *agrp= NULL;
+	bActionGroup *agrp = NULL;
 	
 	if (act && act->groups.first) {	
-		for (agrp= act->groups.first; agrp; agrp= agrp->next) {
+		for (agrp = act->groups.first; agrp; agrp = agrp->next) {
 			if (agrp->flag & AGRP_ACTIVE)
 				break;
 		}
@@ -244,8 +244,8 @@
 		return;
 	
 	/* Deactive all others */
-	for (grp= act->groups.first; grp; grp= grp->next) {
-		if ((grp==agrp) && (select))
+	for (grp = act->groups.first; grp; grp = grp->next) {
+		if ((grp == agrp) && (select))
 			grp->flag |= AGRP_ACTIVE;
 		else	
 			grp->flag &= ~AGRP_ACTIVE;
@@ -253,7 +253,7 @@
 }
 
 /* Add a new action group with the given name to the action */
-bActionGroup *action_groups_add_new (bAction *act, const char name[])
+bActionGroup *action_groups_add_new(bAction *act, const char name[])
 {
 	bActionGroup *agrp;
 	
@@ -303,7 +303,7 @@
 		 * the lists will be in sync after linking
 		 */
 		if (agrp->channels.last == act->curves.last)
-			act->curves.last= fcurve;
+			act->curves.last = fcurve;
 			
 		/* link in the given F-Curve after the last F-Curve in the group,
 		 * which means that it should be able to fit in with the rest of the
@@ -320,7 +320,7 @@
 		agrp->channels.first = agrp->channels.last = fcurve;
 		
 		/* step through the groups preceding this one, finding the F-Curve there to attach this one after */
-		for (grp= agrp->prev; grp; grp= grp->prev) {
+		for (grp = agrp->prev; grp; grp = grp->prev) {
 			/* if this group has F-Curves, we want weave the given one in right after the last channel there,
 			 * but via the Action's list not this group's list
 			 *	- this is so that the F-Curve is in the right place in the Action,
@@ -342,7 +342,7 @@
 	}
 	
 	/* set the F-Curve's new group */
-	fcurve->grp= agrp;
+	fcurve->grp = agrp;
 }	
 
 /* Remove the given channel from all groups */
@@ -354,28 +354,28 @@
 	
 	/* check if any group used this directly */
 	if (fcu->grp) {
-		bActionGroup *agrp= fcu->grp;
+		bActionGroup *agrp = fcu->grp;
 		
 		if (agrp->channels.first == agrp->channels.last) {
 			if (agrp->channels.first == fcu) {
-				agrp->channels.first= NULL;
-				agrp->channels.last= NULL;
+				agrp->channels.first = NULL;
+				agrp->channels.last = NULL;
 			}
 		}
 		else if (agrp->channels.first == fcu) {
-			if ((fcu->next) && (fcu->next->grp==agrp))
-				agrp->channels.first= fcu->next;
+			if ((fcu->next) && (fcu->next->grp == agrp))
+				agrp->channels.first = fcu->next;
 			else
-				agrp->channels.first= NULL;
+				agrp->channels.first = NULL;
 		}
 		else if (agrp->channels.last == fcu) {
-			if ((fcu->prev) && (fcu->prev->grp==agrp))
-				agrp->channels.last= fcu->prev;
+			if ((fcu->prev) && (fcu->prev->grp == agrp))
+				agrp->channels.last = fcu->prev;
 			else
-				agrp->channels.last= NULL;
+				agrp->channels.last = NULL;
 		}
 		
-		fcu->grp= NULL;
+		fcu->grp = NULL;
 	}
 	
 	/* now just remove from list */
@@ -383,7 +383,7 @@
 }
 
 /* Find a group with the given name */
-bActionGroup *BKE_action_group_find_name (bAction *act, const char name[])
+bActionGroup *BKE_action_group_find_name(bAction *act, const char name[])
 {
 	/* sanity checks */
 	if (ELEM3(NULL, act, act->groups.first, name) || (name[0] == 0))
@@ -431,7 +431,7 @@
 		return NULL;
 	
 	/* See if this channel exists */
-	chan= BLI_findstring(&pose->chanbase, name, offsetof(bPoseChannel, name));
+	chan = BLI_findstring(&pose->chanbase, name, offsetof(bPoseChannel, name));
 	if (chan) {
 		return chan;
 	}
@@ -445,13 +445,13 @@
 	unit_axis_angle(chan->rotAxis, &chan->rotAngle);
 	chan->size[0] = chan->size[1] = chan->size[2] = 1.0f;
 	
-	chan->limitmin[0]= chan->limitmin[1]= chan->limitmin[2]= -180.0f;
-	chan->limitmax[0]= chan->limitmax[1]= chan->limitmax[2]= 180.0f;
-	chan->stiffness[0]= chan->stiffness[1]= chan->stiffness[2]= 0.0f;
+	chan->limitmin[0] = chan->limitmin[1] = chan->limitmin[2] = -180.0f;
+	chan->limitmax[0] = chan->limitmax[1] = chan->limitmax[2] = 180.0f;
+	chan->stiffness[0] = chan->stiffness[1] = chan->stiffness[2] = 0.0f;
 	chan->ikrotweight = chan->iklinweight = 0.0f;
 	unit_m4(chan->constinv);
 	
-	chan->protectflag = OB_LOCK_ROT4D;	/* lock by components by default */
+	chan->protectflag = OB_LOCK_ROT4D;  /* lock by components by default */
 	
 	BLI_addtail(&pose->chanbase, chan);
 	BKE_pose_channels_hash_free(pose);
@@ -460,9 +460,9 @@
 }
 
 /* Find the active posechannel for an object (we can't just use pose, as layer info is in armature) */
-bPoseChannel *BKE_pose_channel_active (Object *ob)
+bPoseChannel *BKE_pose_channel_active(Object *ob)
 {
-	bArmature *arm= (ob) ? ob->data : NULL;
+	bArmature *arm = (ob) ? ob->data : NULL;
 	bPoseChannel *pchan;
 
 	if (ELEM3(NULL, ob, ob->pose, arm)) {
@@ -470,7 +470,7 @@
 	}
 
 	/* find active */
-	for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+	for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
 		if ((pchan->bone) && (pchan->bone == arm->act_bone) && (pchan->bone->layer & arm->layer))
 			return pchan;
 	}
@@ -482,10 +482,10 @@
 {
 	if (pose) {
 		switch (pose->iksolver) {
-		case IKSOLVER_LEGACY:
-			return NULL;
-		case IKSOLVER_ITASC:
-			return "bItasc";
+			case IKSOLVER_LEGACY:
+				return NULL;
+			case IKSOLVER_ITASC:
+				return "bItasc";
 		}
 	}
 	return NULL;
@@ -498,17 +498,17 @@
 	ListBase listb;
 	
 	if (!src) {
-		*dst=NULL;
+		*dst = NULL;
 		return;
 	}
 	
-	if (*dst==src) {
+	if (*dst == src) {
 		printf("BKE_pose_copy_data source and target are the same\n");
-		*dst=NULL;
+		*dst = NULL;
 		return;
 	}
 	
-	outPose= MEM_callocN(sizeof(bPose), "pose");
+	outPose = MEM_callocN(sizeof(bPose), "pose");
 	
 	BLI_duplicatelist(&outPose->chanbase, &src->chanbase);
 	
@@ -516,16 +516,16 @@
 	outPose->ikdata = NULL;
 	outPose->ikparam = MEM_dupallocN(src->ikparam);
 	
-	for (pchan=outPose->chanbase.first; pchan; pchan=pchan->next) {
+	for (pchan = outPose->chanbase.first; pchan; pchan = pchan->next) {
 		// TODO: rename this argument...
 		if (copycon) {
 			copy_constraints(&listb, &pchan->constraints, TRUE);  // copy_constraints NULLs listb
-			pchan->constraints= listb;
-			pchan->mpath= NULL; /* motion paths should not get copied yet... */
+			pchan->constraints = listb;
+			pchan->mpath = NULL; /* motion paths should not get copied yet... */
 		}
 		
 		if (pchan->prop) {
-			pchan->prop= IDP_CopyProperty(pchan->prop);
+			pchan->prop = IDP_CopyProperty(pchan->prop);
 		}
 	}
 
@@ -533,7 +533,7 @@
 	if (copycon)
 		BLI_duplicatelist(&outPose->agroups, &src->agroups);
 	
-	*dst=outPose;
+	*dst = outPose;
 }
 
 void BKE_pose_itasc_init(bItasc *itasc)
@@ -545,7 +545,7 @@
 		itasc->numiter = 100;
 		itasc->numstep = 4;
 		itasc->precision = 0.005f;
-		itasc->flag = ITASC_AUTO_STEP|ITASC_INITIAL_REITERATION;
+		itasc->flag = ITASC_AUTO_STEP | ITASC_INITIAL_REITERATION;
 		itasc->feedback = 20.0f;
 		itasc->maxvel = 50.0f;
 		itasc->solver = ITASC_SOLVER_SDLS;
@@ -557,15 +557,15 @@
 {
 	bItasc *itasc;
 	switch (pose->iksolver) {
-	case IKSOLVER_ITASC:
-		itasc = MEM_callocN(sizeof(bItasc), "itasc");
-		BKE_pose_itasc_init(itasc);

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list