diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-04-30 18:27:30 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-05-01 10:17:17 +0300 |
commit | 04ee606383107458717ed8f4197c07ca085c8668 (patch) | |
tree | 0784277d687e9bc55d69065b357d45db57b3b35a /source/blender | |
parent | 2daab407171479aed012d539a546e99ee095d318 (diff) |
Depsgraph: use human readable node type for graphviz debug output
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_type_defines.cc | 37 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_types.h | 2 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/nodes/deg_node.cc | 5 |
3 files changed, 40 insertions, 4 deletions
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 { |