[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31378] branches/soc-2010-aligorith-2/ source/blender/blenkernel/intern/rigidbody.c: Bullet SoC - Hiding debug prints behind -d debugging option

Joshua Leung aligorith at gmail.com
Mon Aug 16 15:47:13 CEST 2010


Revision: 31378
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31378
Author:   aligorith
Date:     2010-08-16 15:47:12 +0200 (Mon, 16 Aug 2010)

Log Message:
-----------
Bullet SoC - Hiding debug prints behind -d debugging option

I might reenable this again later if need be, but this should give a little bit of a performance boost, especially for testers of the new wall builder.

Modified Paths:
--------------
    branches/soc-2010-aligorith-2/source/blender/blenkernel/intern/rigidbody.c

Modified: branches/soc-2010-aligorith-2/source/blender/blenkernel/intern/rigidbody.c
===================================================================
--- branches/soc-2010-aligorith-2/source/blender/blenkernel/intern/rigidbody.c	2010-08-16 13:24:49 UTC (rev 31377)
+++ branches/soc-2010-aligorith-2/source/blender/blenkernel/intern/rigidbody.c	2010-08-16 13:47:12 UTC (rev 31378)
@@ -623,10 +623,11 @@
 			 *	- we use 'central force' since apply force requires a "relative position" which we don't have...
 			 */
 			pdDoEffectors(effectors, NULL, effector_weights, &epoint, force, NULL);
-			printf("\tapplying force (%f,%f,%f) to '%s'\n", force[0],force[1],force[2],ob->id.name+2);
+			if (G.f & G_DEBUG)
+				printf("\tapplying force (%f,%f,%f) to '%s'\n", force[0],force[1],force[2],ob->id.name+2);
 			rbBodyApplyCentralForce(rbo->physics_object, force);
 		}
-		else
+		else if (G.f & G_DEBUG)
 			printf("\tno forces to apply to '%s'\n", ob->id.name+2);
 		
 		/* cleanup */
@@ -704,19 +705,19 @@
 	
 	/* sanity checks */
 	if ELEM3(NULL, scene, rbw, rbw->group) {
-		//if (G.f & G_DEBUG)
+		if (G.f & G_DEBUG)
 			printf("BKE_rigidbody_do_sim() - no valid sim world data \n");
 		return;
 	}
 	
 	/* debug print */
-	//if (G.f & G_DEBUG) 
+	if (G.f & G_DEBUG) 
 		printf("BKE_rigidbody_do_sim() - eval on %f \n", ctime);
 	
 	/* skip world calculations if muted? */
 	// TODO: should we still update last time?
 	if (rbw->flag & RBW_FLAG_MUTED) {
-		//if (G.f & G_DEBUG)
+		if (G.f & G_DEBUG)
 			printf("BKE_rigidbody_do_sim() - sim muted (%s) \n", rbw->group->id.name+2);
 		return;
 	}
@@ -724,7 +725,7 @@
 #if 0
 	/* can only continue if we have something to update... */
 	if (rbw->recalc == 0) {
-		//if (G.f & G_DEBUG)
+		if (G.f & G_DEBUG)
 			printf("BKE_rigidbody_do_sim() - no recalc flags set (%s) \n", rbw->group->id.name+2);
 		return;
 	}
@@ -734,7 +735,7 @@
 	 * but don't do it again if last frame already needed reset
 	 */
 	if ((ctime <= rbw->sframe) && (rbw->ltime > rbw->sframe)) {
-		//if (G.f & G_DEBUG)
+		if (G.f & G_DEBUG)
 			printf("Need to reset sim\n");
 		
 		rbw->recalc |= RBW_RECALC_RESET;
@@ -810,8 +811,10 @@
 	 *	- we need frames delta from last time this was evaluated...
 	 */
 	timestep = 1.0/FPS * (ctime - rbw->ltime);
-	printf("\ttimestep = %f \n", timestep);
-	printf("\n");
+	if (G.f & G_DEBUG) {
+		printf("\ttimestep = %f \n", timestep);
+		printf("\n");
+	}
 	
 	
 	/* perform appropriate updates */
@@ -836,9 +839,10 @@
 					rigidbody_update_blender_ob(scene, rbw, ob, rbo);
 				
 				// DEBUG
-				printf("\t%s: new pos - %f %f %f \n", ob->id.name+2, ob->obmat[3][0], ob->obmat[3][1], ob->obmat[3][2]);
+				if (G.f & G_DEBUG)
+					printf("\t%s: new pos - %f %f %f \n", ob->id.name+2, ob->obmat[3][0], ob->obmat[3][1], ob->obmat[3][2]);
 			}
-			else
+			else if (G.f & G_DEBUG)
 				printf("\tgroup object invalid %p \n", go->ob);
 		}
 		





More information about the Bf-blender-cvs mailing list