[Bf-blender-cvs] [04ee6063831] blender2.8: Depsgraph: use human readable node type for graphviz debug output

Sergey Sharybin noreply at git.blender.org
Tue May 1 10:24:34 CEST 2018


Commit: 04ee606383107458717ed8f4197c07ca085c8668
Author: Sergey Sharybin
Date:   Mon Apr 30 17:27:30 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB04ee606383107458717ed8f4197c07ca085c8668

Depsgraph: use human readable node type for graphviz debug output

===================================================================

M	source/blender/depsgraph/intern/depsgraph_type_defines.cc
M	source/blender/depsgraph/intern/depsgraph_types.h
M	source/blender/depsgraph/intern/nodes/deg_node.cc

===================================================================

diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cc b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
index 5412573b936..6484d1f21ad 100644
--- a/source/blender/depsgraph/intern/depsgraph_type_defines.cc
+++ b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
@@ -71,6 +71,43 @@ DepsNodeFactory *deg_type_get_factory(const eDepsNode_Type type)
 	return depsnode_typeinfo_registry[type];
 }
 
+/* Stringified node types ---------------------------------- */
+
+const char* nodeTypeAsString(eDepsNode_Type type)
+{
+	switch (type) {
+#define STRINGIFY_TYPE(name) case DEG_NODE_TYPE_##name: return #name
+
+		STRINGIFY_TYPE(UNDEFINED);
+		STRINGIFY_TYPE(OPERATION);
+		/* **** Generic Types **** */
+		STRINGIFY_TYPE(TIMESOURCE);
+		STRINGIFY_TYPE(ID_REF);
+		/* **** Outer Types **** */
+		STRINGIFY_TYPE(PARAMETERS);
+		STRINGIFY_TYPE(PROXY);
+		STRINGIFY_TYPE(ANIMATION);
+		STRINGIFY_TYPE(TRANSFORM);
+		STRINGIFY_TYPE(GEOMETRY);
+		STRINGIFY_TYPE(SEQUENCER);
+		STRINGIFY_TYPE(LAYER_COLLECTIONS);
+		STRINGIFY_TYPE(COPY_ON_WRITE);
+		/* **** Evaluation-Related Outer Types (with Subdata) **** */
+		STRINGIFY_TYPE(EVAL_POSE);
+		STRINGIFY_TYPE(BONE);
+		STRINGIFY_TYPE(EVAL_PARTICLES);
+		STRINGIFY_TYPE(SHADING);
+		STRINGIFY_TYPE(SHADING_PARAMETERS);
+		STRINGIFY_TYPE(CACHE);
+		STRINGIFY_TYPE(BATCH_CACHE);
+
+		/* Total number of meaningful node types. */
+		case NUM_DEG_NODE_TYPES: return "SpecialCase";
+#undef STRINGIFY_TYPE
+	}
+	return "UNKNOWN";
+}
+
 /* Stringified opcodes ------------------------------------- */
 
 const char* operationCodeAsString(eDepsOperation_Code opcode)
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
index 1d3318a2988..766f02c0d26 100644
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ b/source/blender/depsgraph/intern/depsgraph_types.h
@@ -155,6 +155,8 @@ typedef enum eDepsNode_Type {
 	NUM_DEG_NODE_TYPES,
 } eDepsNode_Type;
 
+const char* nodeTypeAsString(eDepsNode_Type type);
+
 /* Identifiers for common operations (as an enum). */
 typedef enum eDepsOperation_Code {
 	/* Generic Operations. ------------------------------ */
diff --git a/source/blender/depsgraph/intern/nodes/deg_node.cc b/source/blender/depsgraph/intern/nodes/deg_node.cc
index fdcfc129073..e09ba8c4f05 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node.cc
+++ b/source/blender/depsgraph/intern/nodes/deg_node.cc
@@ -103,10 +103,7 @@ DepsNode::~DepsNode()
 /* Generic identifier for Depsgraph Nodes. */
 string DepsNode::identifier() const
 {
-	char typebuf[7];
-	sprintf(typebuf, "(%d)", type);
-
-	return string(typebuf) + " : " + name;
+	return string(nodeTypeAsString(type)) + " : " + name;
 }
 
 eDepsNode_Class DepsNode::get_class() const {



More information about the Bf-blender-cvs mailing list