Commit: 3fd224f2c8a93a93c3e65a2b22373b08a0338ae3
Author: Joshua Leung
Date:   Tue Jan 20 16:32:47 2015 +1300
Branches: depsgraph_refactor
https://developer.blender.org/rB3fd224f2c8a93a93c3e65a2b22373b08a0338ae3

Depsgraph: Report opcodes using their string identifiers instead of numbers

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

M       source/blender/depsgraph/intern/depsgraph_build.cpp
M       source/blender/depsgraph/intern/depsgraph_build.h
M       source/blender/depsgraph/intern/depsgraph_types.h
M       source/blender/depsgraph/intern/depsnode_operation.cpp

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

diff --git a/source/blender/depsgraph/intern/depsgraph_build.cpp 
b/source/blender/depsgraph/intern/depsgraph_build.cpp
index e2682f0..7877666 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build.cpp
@@ -337,7 +337,7 @@ OperationDepsNode 
*DepsgraphRelationBuilder::find_node(const OperationKey &key)
        
        OperationDepsNode *op_node = comp_node->find_operation(key.opcode, 
key.name);
        if (!op_node) {
-               fprintf(stderr, "find_node_operation: Failed for (%d, '%s')\n", 
key.opcode, key.name.c_str());
+               fprintf(stderr, "find_node_operation: Failed for (%s, '%s')\n", 
DEG_OPNAMES[key.opcode], key.name.c_str());
        }
        return op_node;
 }
diff --git a/source/blender/depsgraph/intern/depsgraph_build.h 
b/source/blender/depsgraph/intern/depsgraph_build.h
index 50405fc..961103c 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.h
+++ b/source/blender/depsgraph/intern/depsgraph_build.h
@@ -179,12 +179,10 @@ struct OperationKey
        
        string identifier() const
        {
-               char typebuf[5], codebuf[5];
-               
+               char typebuf[5];
                sprintf(typebuf, "%d", component_type);
-               sprintf(codebuf, "%d", opcode); // XXX: use the string defs 
instead
                
-               return string("OperationKey(") + "t: " + typebuf + ", cn: '" + 
component_name + "', c: " + codebuf + ", n: '" + name + "')";
+               return string("OperationKey(") + "t: " + typebuf + ", cn: '" + 
component_name + "', c: " + DEG_OPNAMES[opcode] + ", n: '" + name + "')";
        }
        
        
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h 
b/source/blender/depsgraph/intern/depsgraph_types.h
index cd2ff00..bbcb3e3 100644
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ b/source/blender/depsgraph/intern/depsgraph_types.h
@@ -99,6 +99,9 @@ typedef enum eDepsOperation_Code {
        #undef DEF_DEG_OPCODE
 } eDepsOperation_Code;
 
+/* String defines for these opcodes, defined in depsnode_operation.cpp */
+extern const char *DEG_OPNAMES[];
+
 
 /* Type of operation */
 typedef enum eDepsOperation_Type {
diff --git a/source/blender/depsgraph/intern/depsnode_operation.cpp 
b/source/blender/depsgraph/intern/depsnode_operation.cpp
index 3700e74..e921cd1 100644
--- a/source/blender/depsgraph/intern/depsnode_operation.cpp
+++ b/source/blender/depsgraph/intern/depsnode_operation.cpp
@@ -40,6 +40,18 @@ extern "C" {
 #include "stubs.h" // XXX: THIS MUST BE REMOVED WHEN THE DEPSGRAPH REFACTOR IS 
DONE
 
 /* ******************************************************** */
+/* OpNode Identifiers Array - Exported to other depsgraph files too... */
+
+/* identifiers for operations */
+const char *DEG_OPNAMES[] = {
+       #define DEF_DEG_OPCODE(label) #label,
+       #include "depsnode_opcodes.h"
+       #undef DEF_DEG_OPCODE
+       
+       "<Invalid>"
+};
+
+/* ******************************************************** */
 /* Inner Nodes */
 
 OperationDepsNode::OperationDepsNode() :
@@ -53,15 +65,6 @@ OperationDepsNode::~OperationDepsNode()
 
 string OperationDepsNode::identifier() const
 {
-       /* identifiers for operations */
-       const char *DEG_OPNAMES[] = {
-               #define DEF_DEG_OPCODE(label) #label,
-               #include "depsnode_opcodes.h"
-               #undef DEF_DEG_OPCODE
-               
-               "<Invalid>"
-       };
-       
        BLI_assert((opcode > 0) && (opcode < ARRAY_SIZE(DEG_OPNAMES)));
        return string(DEG_OPNAMES[opcode]) + "(" + name + ")";
 }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to