Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph.cc')
-rw-r--r--source/blender/depsgraph/intern/depsgraph.cc70
1 files changed, 61 insertions, 9 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index a05e422d602..a2e6993e442 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -35,6 +35,8 @@
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
+#include "BLI_console.h"
+#include "BLI_hash.h"
#include "BLI_ghash.h"
#include "BLI_listbase.h"
@@ -526,6 +528,31 @@ void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx,
}
}
+bool deg_terminal_do_color(void)
+{
+ return (G.debug & G_DEBUG_DEPSGRAPH_PRETTY) != 0;
+}
+
+string deg_color_for_pointer(const void *pointer)
+{
+ if (!deg_terminal_do_color()) {
+ return "";
+ }
+ int r, g, b;
+ BLI_hash_pointer_to_color(pointer, &r, &g, &b);
+ char buffer[64];
+ BLI_snprintf(buffer, sizeof(buffer), TRUECOLOR_ANSI_COLOR_FORMAT, r, g, b);
+ return string(buffer);
+}
+
+string deg_color_end(void)
+{
+ if (!deg_terminal_do_color()) {
+ return "";
+ }
+ return string(TRUECOLOR_ANSI_COLOR_FINISH);
+}
+
} // namespace DEG
/* **************** */
@@ -554,6 +581,8 @@ void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func,
DEG::deg_editor_update_scene_cb = scene_func;
}
+/* Evaluation and debug */
+
void DEG_debug_print_eval(const char *function_name,
const char *object_name,
const void *object_address)
@@ -561,7 +590,12 @@ void DEG_debug_print_eval(const char *function_name,
if ((G.debug & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
return;
}
- printf("%s on %s (%p)\n", function_name, object_name, object_address);
+ printf("%s on %s %s(%p)%s\n",
+ function_name,
+ object_name,
+ DEG::deg_color_for_pointer(object_address).c_str(),
+ object_address,
+ DEG::deg_color_end().c_str());
}
void DEG_debug_print_eval_subdata(const char *function_name,
@@ -574,11 +608,17 @@ void DEG_debug_print_eval_subdata(const char *function_name,
if ((G.debug & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
return;
}
- printf("%s on %s (%p) %s %s (%p)\n",
+ printf("%s on %s %s(%p)%s %s %s %s(%p)%s\n",
function_name,
- object_name, object_address,
+ object_name,
+ DEG::deg_color_for_pointer(object_address).c_str(),
+ object_address,
+ DEG::deg_color_end().c_str(),
subdata_comment,
- subdata_name, subdata_address);
+ subdata_name,
+ DEG::deg_color_for_pointer(subdata_address).c_str(),
+ subdata_address,
+ DEG::deg_color_end().c_str());
}
void DEG_debug_print_eval_subdata_index(const char *function_name,
@@ -592,11 +632,18 @@ void DEG_debug_print_eval_subdata_index(const char *function_name,
if ((G.debug & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
return;
}
- printf("%s on %s (%p) %s %s[%d] (%p)\n",
+ printf("%s on %s %s(%p)^%s %s %s[%d] %s(%p)%s\n",
function_name,
- object_name, object_address,
+ object_name,
+ DEG::deg_color_for_pointer(object_address).c_str(),
+ object_address,
+ DEG::deg_color_end().c_str(),
subdata_comment,
- subdata_name, subdata_index, subdata_address);
+ subdata_name,
+ subdata_index,
+ DEG::deg_color_for_pointer(subdata_address).c_str(),
+ subdata_address,
+ DEG::deg_color_end().c_str());
}
void DEG_debug_print_eval_time(const char *function_name,
@@ -607,6 +654,11 @@ void DEG_debug_print_eval_time(const char *function_name,
if ((G.debug & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
return;
}
- printf("%s on %s (%p) at time %f\n",
- function_name, object_name, object_address, time);
+ printf("%s on %s %s(%p)%s at time %f\n",
+ function_name,
+ object_name,
+ DEG::deg_color_for_pointer(object_address).c_str(),
+ object_address,
+ DEG::deg_color_end().c_str(),
+ time);
}