Depsgraph: Make all print messages to respect per-depsgraph debug flags

This commit is contained in:
Sergey Sharybin 2018-05-02 11:52:49 +02:00
parent 65e6654c85
commit bb75c4cbe9
6 changed files with 22 additions and 8 deletions

View File

@ -251,7 +251,8 @@ DepsRelation *DepsgraphRelationBuilder::add_time_relation(
return graph_->add_new_relation(timesrc, node_to, description, check_unique);
}
else {
DEG_DEBUG_PRINTF(BUILD, "add_time_relation(%p = %s, %p = %s, %s) Failed\n",
DEG_DEBUG_PRINTF((::Depsgraph *)graph_,
BUILD, "add_time_relation(%p = %s, %p = %s, %s) Failed\n",
timesrc, (timesrc) ? timesrc->identifier().c_str() : "<None>",
node_to, (node_to) ? node_to->identifier().c_str() : "<None>",
description);
@ -272,7 +273,8 @@ DepsRelation *DepsgraphRelationBuilder::add_operation_relation(
check_unique);
}
else {
DEG_DEBUG_PRINTF(BUILD, "add_operation_relation(%p = %s, %p = %s, %s) Failed\n",
DEG_DEBUG_PRINTF((::Depsgraph *)graph_,
BUILD, "add_operation_relation(%p = %s, %p = %s, %s) Failed\n",
node_from, (node_from) ? node_from->identifier().c_str() : "<None>",
node_to, (node_to) ? node_to->identifier().c_str() : "<None>",
description);

View File

@ -176,7 +176,8 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
}
}
DEG_DEBUG_PRINTF(BUILD, "\nStarting IK Build: pchan = %s, target = (%s, %s), segcount = %d\n",
DEG_DEBUG_PRINTF((::Depsgraph *)graph_,
BUILD, "\nStarting IK Build: pchan = %s, target = (%s, %s), segcount = %d\n",
pchan->name, data->tar->id.name, data->subtarget, data->rootbone);
bPoseChannel *parchan = pchan;
@ -219,7 +220,7 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
root_map->add_bone(parchan->name, rootchan->name);
/* continue up chain, until we reach target number of items... */
DEG_DEBUG_PRINTF(BUILD, " %d = %s\n", segcount, parchan->name);
DEG_DEBUG_PRINTF((::Depsgraph *)graph_, BUILD, " %d = %s\n", segcount, parchan->name);
segcount++;
if ((segcount == data->rootbone) || (segcount > 255)) break; /* 255 is weak */

View File

@ -117,7 +117,7 @@ void deg_graph_transitive_reduction(Depsgraph *graph)
}
}
}
DEG_DEBUG_PRINTF(BUILD, "Removed %d relations\n", num_removed_relations);
DEG_DEBUG_PRINTF((::Depsgraph *)graph, BUILD, "Removed %d relations\n", num_removed_relations);
}
} // namespace DEG

View File

@ -276,6 +276,7 @@ void DEG_graph_build_from_view_layer(Depsgraph *graph,
/* Tag graph relations for update. */
void DEG_graph_tag_relations_update(Depsgraph *graph)
{
DEG_DEBUG_PRINTF(graph, TAG, "%s: Tagging relations for update.\n", __func__);
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
deg_graph->need_update = true;
/* NOTE: When relations are updated, it's quite possible that
@ -310,7 +311,7 @@ void DEG_graph_relations_update(Depsgraph *graph,
/* Tag all relations for update. */
void DEG_relations_tag_update(Main *bmain)
{
DEG_DEBUG_PRINTF(TAG, "%s: Tagging relations for update.\n", __func__);
DEG_GLOBAL_DEBUG_PRINTF(TAG, "%s: Tagging relations for update.\n", __func__);
LISTBASE_FOREACH (Scene *, scene, &bmain->scene) {
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
Depsgraph *depsgraph =

View File

@ -46,6 +46,8 @@ extern "C" {
#include "intern/nodes/deg_node_operation.h"
#include "intern/depsgraph.h"
#include "DEG_depsgraph_debug.h"
struct DEGEditorUpdateContext;
struct Group;
struct Main;
@ -112,7 +114,14 @@ void deg_editors_id_update(const DEGEditorUpdateContext *update_ctx,
void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx,
bool updated);
#define DEG_DEBUG_PRINTF(type, ...) \
#define DEG_DEBUG_PRINTF(depsgraph, type, ...) \
do { \
if (DEG_get_debug_flags(depsgraph) & G_DEBUG_DEPSGRAPH_ ## type) { \
fprintf(stderr, __VA_ARGS__); \
} \
} while (0)
#define DEG_GLOBAL_DEBUG_PRINTF(type, ...) \
do { \
if (G.debug & G_DEBUG_DEPSGRAPH_ ## type) { \
fprintf(stderr, __VA_ARGS__); \

View File

@ -239,7 +239,8 @@ void flush_editors_id_update(Main *bmain,
id_cow->recalc |= factory->id_recalc_tag();
}
GHASH_FOREACH_END();
DEG_DEBUG_PRINTF(EVAL, "Accumulated recalc bits for %s: %u\n",
DEG_DEBUG_PRINTF((::Depsgraph *)graph,
EVAL, "Accumulated recalc bits for %s: %u\n",
id_orig->name, (unsigned int)id_cow->recalc);
/* Inform editors. */
if (deg_copy_on_write_is_expanded(id_cow)) {