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.

This commit is contained in:
Joshua Leung
2009-01-29 23:27:24 +00:00
parent e109310ad7
commit e7d62464b7
5 changed files with 42 additions and 33 deletions

View File

@@ -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 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i
/* 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 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
{
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) \

View File

@@ -1882,8 +1882,8 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
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) {

View File

@@ -109,7 +109,8 @@ void free_ipo (Ipo *ipo)
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 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
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 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
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 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
}
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 @@ static void icu_to_fcurves (ListBase *list, IpoCurve *icu, char *actname, char *
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 @@ static void ipo_to_animato (Ipo *ipo, char actname[], char constname[], ListBase
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 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[])
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 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[])
/* 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 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[])
/* 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 @@ static void action_to_animdata (ID *id, bAction *act)
/* 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 @@ void do_versions_ipos_to_animato(Main *main)
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 @@ void do_versions_ipos_to_animato(Main *main)
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 @@ void do_versions_ipos_to_animato(Main *main)
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 @@ void do_versions_ipos_to_animato(Main *main)
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 @@ void do_versions_ipos_to_animato(Main *main)
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 @@ void do_versions_ipos_to_animato(Main *main)
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 @@ void do_versions_ipos_to_animato(Main *main)
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 @@ void do_versions_ipos_to_animato(Main *main)
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) {

View File

@@ -1346,7 +1346,7 @@ int do_ob_key(Scene *scene, Object *ob)
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 @@ int do_ob_key(Scene *scene, Object *ob)
#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);

View File

@@ -2273,8 +2273,9 @@ void object_handle_update(Scene *scene, Object *ob)
if(ob->recalc & OB_RECALC) {
if(ob->recalc & OB_RECALC_OB) {
printf("recalcob %s\n", ob->id.name+2);
if (G.f & G_DEBUG)
printf("recalcob %s\n", ob->id.name+2);
/* handle proxy copy for target */
if(ob->id.lib && ob->proxy_from) {
@@ -2296,7 +2297,8 @@ void object_handle_update(Scene *scene, Object *ob)
if(ob->recalc & OB_RECALC_DATA) {
printf("recalcdata %s\n", ob->id.name+2);
if (G.f & G_DEBUG)
printf("recalcdata %s\n", ob->id.name+2);
/* includes all keys and modifiers */
if(ob->type==OB_MESH) {