[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18741] branches/blender2.5/blender/source /blender/blenkernel/intern: Animato: Hiding all debug prints behind -d flag , as they were causing too many slowdowns on complex rigs with Action Constraints .

Joshua Leung aligorith at gmail.com
Fri Jan 30 00:27:24 CET 2009


Revision: 18741
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18741
Author:   aligorith
Date:     2009-01-30 00:27:24 +0100 (Fri, 30 Jan 2009)

Log Message:
-----------
Animato: Hiding all debug prints behind -d flag, as they were causing too many slowdowns on complex rigs with Action Constraints. Many of these prints should eventually be removed, though some of them will still be useful.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/constraint.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/key.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/object.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c	2009-01-29 22:45:59 UTC (rev 18740)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c	2009-01-29 23:27:24 UTC (rev 18741)
@@ -14,6 +14,7 @@
 #include "BKE_animsys.h"
 #include "BKE_action.h"
 #include "BKE_fcurve.h"
+#include "BKE_global.h"
 #include "BKE_main.h"
 #include "BKE_utildefines.h"
 
@@ -231,9 +232,11 @@
 		/* failed to get path */
 		// XXX don't tag as failed yet though, as there are some legit situations (Action Constraint) 
 		// where some channels will not exist, but shouldn't lock up Action
-		printf("Animato: Invalid path. ID = '%s',  '%s [%d]' \n", 
-			(ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "<No ID>", 
-			path, array_index);
+		if (G.f & G_DEBUG) {
+			printf("Animato: Invalid path. ID = '%s',  '%s [%d]' \n", 
+				(ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "<No ID>", 
+				path, array_index);
+		}
 		return 0;
 	}
 }
@@ -632,7 +635,8 @@
 {
 	ID *id;
 	
-	printf("Evaluate all animation - %f \n", ctime);
+	if (G.f & G_DEBUG)
+		printf("Evaluate all animation - %f \n", ctime);
 
 	/* macro for less typing */
 #define EVAL_ANIM_IDS(first) \

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/constraint.c	2009-01-29 22:45:59 UTC (rev 18740)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/constraint.c	2009-01-29 23:27:24 UTC (rev 18741)
@@ -1882,8 +1882,8 @@
 		CLAMP(s, 0, 1);
 		t = ( s * (data->end-data->start)) + data->start;
 		
-		// xxx temp debugging string
-		printf("do Action Constraint %s - Ob %s Pchan %s \n", con->name, cob->ob->id.name+2, (cob->pchan)?cob->pchan->name:NULL);
+		if (G.f & G_DEBUG)
+			printf("do Action Constraint %s - Ob %s Pchan %s \n", con->name, cob->ob->id.name+2, (cob->pchan)?cob->pchan->name:NULL);
 		
 		/* Get the appropriate information from the action */
 		if (cob->type == CONSTRAINT_OBTYPE_BONE) {

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c	2009-01-29 22:45:59 UTC (rev 18740)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c	2009-01-29 23:27:24 UTC (rev 18741)
@@ -109,7 +109,8 @@
 		BLI_freelinkN(&ipo->curve, icu);
 	}
 	
-	printf("Freed %d (Unconverted) Ipo-Curves from IPO '%s' \n", n, ipo->id.name+2);
+	if (G.f & G_DEBUG)
+		printf("Freed %d (Unconverted) Ipo-Curves from IPO '%s' \n", n, ipo->id.name+2);
 }
 
 /* *************************************************** */
@@ -778,7 +779,7 @@
 		if (idriver->blocktype == ID_AR) {
 			/* ID_PO */
 			if (idriver->adrcode == OB_ROT_DIFF) {
-				printf("idriver_to_cdriver - rotdiff %p \n", idriver->ob);
+				if (G.f & G_DEBUG) printf("idriver_to_cdriver - rotdiff %p \n", idriver->ob);
 				/* Rotational Difference is a special type of driver now... */
 				cdriver->type= DRIVER_TYPE_ROTDIFF;
 				
@@ -796,7 +797,7 @@
 				cdriver->rna_path2= get_rna_access(-1, -1, idriver->name+DRIVER_NAME_OFFS, NULL, NULL);
 			}
 			else {
-				printf("idriver_to_cdriver - arm  %p \n", idriver->ob);
+				if (G.f & G_DEBUG) printf("idriver_to_cdriver - arm  %p \n", idriver->ob);
 				/* 'standard' driver */
 				cdriver->type= DRIVER_TYPE_CHANNEL;
 				cdriver->id= (ID *)idriver->ob;
@@ -837,14 +838,14 @@
 		}
 		else {
 			/* ID_OB */
-			printf("idriver_to_cdriver  - ob %p \n", idriver->ob);
+			if (G.f & G_DEBUG) printf("idriver_to_cdriver  - ob %p \n", idriver->ob);
 			cdriver->type= DRIVER_TYPE_CHANNEL;
 			cdriver->id= (ID *)idriver->ob;
 			cdriver->rna_path= get_rna_access(ID_OB, idriver->adrcode, NULL, NULL, &cdriver->array_index);
 		}
 	}
 	
-	printf("\tcdriver -> id = %p \n", cdriver->id);
+	if (G.f & G_DEBUG) printf("\tcdriver -> id = %p \n", cdriver->id);
 	
 	/* free old driver */
 	MEM_freeN(idriver);
@@ -917,7 +918,7 @@
 		FCurve *fcurve;
 		int b;
 		
-		printf("\tconvert bitflag ipocurve, totbits = %d \n", totbits);
+		if (G.f & G_DEBUG) printf("\tconvert bitflag ipocurve, totbits = %d \n", totbits);
 		
 		/* add the 'only int values' flag */
 		fcu->flag |= FCURVE_INT_VALUES;		
@@ -1048,7 +1049,7 @@
 	if (ELEM3(NULL, ipo, anim, drivers))
 		return;
 		
-	printf("ipo_to_animato \n");
+	if (G.f & G_DEBUG) printf("ipo_to_animato \n");
 		
 	/* validate actname and constname 
 	 *	- clear actname if it was one of the generic <builtin> ones (i.e. 'Object', or 'Shapes')
@@ -1154,9 +1155,11 @@
 		return;
 	}
 	
-	printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s  curves:%d \n", 
-		id->name+2, ipo->id.name+2, (actname)?actname:"<None>", (constname)?constname:"<None>", 
-		BLI_countlist(&ipo->curve));
+	if (G.f & G_DEBUG) {
+		printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s  curves:%d \n", 
+			id->name+2, ipo->id.name+2, (actname)?actname:"<None>", (constname)?constname:"<None>", 
+			BLI_countlist(&ipo->curve));
+	}
 	
 	/* Convert curves to animato system (separated into separate lists of F-Curves for animation and drivers),
 	 * and the try to put these lists in the right places, but do not free the lists here
@@ -1165,11 +1168,11 @@
 	
 	/* deal with animation first */
 	if (anim.first) {
-		printf("\thas anim \n");
+		if (G.f & G_DEBUG) printf("\thas anim \n");
 		/* try to get action */
 		if (adt->action == NULL) {
 			adt->action= add_empty_action("ConvData_Action"); // XXX we need a better name for this
-			printf("\t\tadded new action \n");
+			if (G.f & G_DEBUG) printf("\t\tadded new action \n");
 		}
 		
 		/* add F-Curves to action */
@@ -1178,7 +1181,7 @@
 	
 	/* deal with drivers */
 	if (drivers.first) {
-		printf("\thas drivers \n");
+		if (G.f & G_DEBUG) printf("\thas drivers \n");
 		/* add drivers to end of driver stack */
 		addlisttolist(&adt->drivers, &drivers);
 	}
@@ -1198,7 +1201,7 @@
 	/* check if we need to set this Action as the AnimData's action */
 	if (adt->action == NULL) {
 		/* set this Action as AnimData's Action */
-		printf("act_to_adt - set adt action to act \n");
+		if (G.f & G_DEBUG) printf("act_to_adt - set adt action to act \n");
 		adt->action= act;
 	}
 	
@@ -1249,7 +1252,7 @@
 		bConstraint *con;
 		bConstraintChannel *conchan, *conchann;
 		
-		printf("\tconverting ob %s \n", id->name+2);
+		if (G.f & G_DEBUG) printf("\tconverting ob %s \n", id->name+2);
 		
 		/* check if object has any animation data */
 		if ((ob->ipo) || (ob->action) || (ob->nlastrips.first)) {
@@ -1336,7 +1339,7 @@
 	for (id= main->key.first; id; id= id->next) {
 		Key *key= (Key *)id;
 		
-		printf("\tconverting key %s \n", id->name+2);
+		if (G.f & G_DEBUG) printf("\tconverting key %s \n", id->name+2);
 		
 		/* we're only interested in the IPO 
 		 * NOTE: for later, it might be good to port these over to Object instead, as many of these
@@ -1357,7 +1360,7 @@
 	for (id= main->mat.first; id; id= id->next) {
 		Material *ma= (Material *)id;
 		
-		printf("\tconverting material %s \n", id->name+2);
+		if (G.f & G_DEBUG) printf("\tconverting material %s \n", id->name+2);
 		
 		/* we're only interested in the IPO */
 		if (ma->ipo) {
@@ -1375,7 +1378,7 @@
 	for (id= main->tex.first; id; id= id->next) {
 		Tex *te= (Tex *)id;
 		
-		printf("\tconverting texture %s \n", id->name+2);
+		if (G.f & G_DEBUG) printf("\tconverting texture %s \n", id->name+2);
 		
 		/* we're only interested in the IPO */
 		if (te->ipo) {
@@ -1393,7 +1396,7 @@
 	for (id= main->camera.first; id; id= id->next) {
 		Camera *ca= (Camera *)id;
 		
-		printf("\tconverting camera %s \n", id->name+2);
+		if (G.f & G_DEBUG) printf("\tconverting camera %s \n", id->name+2);
 		
 		/* we're only interested in the IPO */
 		if (ca->ipo) {
@@ -1411,7 +1414,7 @@
 	for (id= main->lamp.first; id; id= id->next) {
 		Lamp *la= (Lamp *)id;
 		
-		printf("\tconverting lamp %s \n", id->name+2);
+		if (G.f & G_DEBUG) printf("\tconverting lamp %s \n", id->name+2);
 		
 		/* we're only interested in the IPO */
 		if (la->ipo) {
@@ -1440,7 +1443,7 @@
 	for (id= main->action.first; id; id= id->next) {
 		bAction *act= (bAction *)id;
 		
-		printf("\tconverting action %s \n", id->name+2);
+		if (G.f & G_DEBUG) printf("\tconverting action %s \n", id->name+2);
 		
 		/* be careful! some of the actions we encounter will be converted ones... */
 		action_to_animato(act, &act->curves, &drivers);
@@ -1450,7 +1453,7 @@
 	for (id= main->ipo.first; id; id= id->next) {
 		Ipo *ipo= (Ipo *)id;
 		
-		printf("\tconverting ipo %s \n", id->name+2);
+		if (G.f & G_DEBUG) printf("\tconverting ipo %s \n", id->name+2);
 		
 		/* most likely this IPO has already been processed, so check if any curves left to convert */
 		if (ipo->curve.first) {

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/key.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/key.c	2009-01-29 22:45:59 UTC (rev 18740)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/key.c	2009-01-29 23:27:24 UTC (rev 18741)
@@ -1346,7 +1346,7 @@
 	if(ob->shapeflag & (OB_SHAPE_LOCK|OB_SHAPE_TEMPLOCK)) {
 		KeyBlock *kb= BLI_findlink(&key->block, ob->shapenr-1);
 		
-		printf("ob %s, key %s locked \n", ob->id.name+2, key->id.name+2);
+		if (G.f & G_DEBUG) printf("ob %s, key %s locked \n", ob->id.name+2, key->id.name+2);
 		
 		if(kb && (kb->flag & KEYBLOCK_MUTE))
 			kb= key->refkey;
@@ -1393,7 +1393,7 @@
 #endif // XXX old animation system
 		/* do shapekey local drivers */
 		float ctime= (float)scene->r.cfra; // XXX this needs to be checked
-		printf("ob %s - do shapekey (%s) drivers \n", ob->id.name+2, key->id.name+2);
+		if (G.f & G_DEBUG) printf("ob %s - do shapekey (%s) drivers \n", ob->id.name+2, key->id.name+2);
 		BKE_animsys_evaluate_animdata(&key->id, key->adt, ctime, ADT_RECALC_DRIVERS);
 		
 		if(ob->type==OB_MESH) return do_mesh_key(scene, ob, ob->data);

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/object.c
===================================================================

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list