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
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-04-30 18:20:42 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-05-01 10:17:17 +0300
commit2daab407171479aed012d539a546e99ee095d318 (patch)
treee4862f383b26020819e9f659d72dda41616d7a7c /source
parent2a89ef3da70f22da34da090efde3a18c87ad87d7 (diff)
Depsgraph: Cleanup, simplify operation code stringification
Diffstat (limited to 'source')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc2
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc2
-rw-r--r--source/blender/depsgraph/intern/depsgraph_type_defines.cc20
-rw-r--r--source/blender/depsgraph/intern/depsgraph_types.h12
-rw-r--r--source/blender/depsgraph/intern/nodes/deg_node_operation.cc2
5 files changed, 5 insertions, 33 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index f1869fdd916..201df94b691 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -211,7 +211,7 @@ OperationDepsNode *DepsgraphRelationBuilder::get_node(
OperationDepsNode *op_node = find_node(key);
if (op_node == NULL) {
fprintf(stderr, "find_node_operation: Failed for (%s, '%s')\n",
- DEG_OPNAMES[key.opcode], key.name);
+ operationCodeAsString(key.opcode), key.name);
}
return op_node;
}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
index 4b8e4faae3f..a965d890496 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
@@ -179,7 +179,7 @@ string OperationKey::identifier() const
return string("OperationKey(") +
"t: " + typebuf +
", cn: '" + component_name +
- "', c: " + DEG_OPNAMES[opcode] +
+ "', c: " + operationCodeAsString(opcode) +
", n: '" + name + "')";
}
diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cc b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
index c4fc9591611..5412573b936 100644
--- a/source/blender/depsgraph/intern/depsgraph_type_defines.cc
+++ b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
@@ -73,9 +73,7 @@ DepsNodeFactory *deg_type_get_factory(const eDepsNode_Type type)
/* Stringified opcodes ------------------------------------- */
-DepsOperationStringifier DEG_OPNAMES;
-
-static const char *stringify_opcode(eDepsOperation_Code opcode)
+const char* operationCodeAsString(eDepsOperation_Code opcode)
{
switch (opcode) {
#define STRINGIFY_OPCODE(name) case DEG_OPCODE_##name: return #name
@@ -143,22 +141,6 @@ static const char *stringify_opcode(eDepsOperation_Code opcode)
return "UNKNOWN";
}
-DepsOperationStringifier::DepsOperationStringifier()
-{
- for (int i = 0; i < DEG_NUM_OPCODES; ++i) {
- names_[i] = stringify_opcode((eDepsOperation_Code)i);
- }
-}
-
-const char *DepsOperationStringifier::operator[](eDepsOperation_Code opcode)
-{
- BLI_assert((opcode >= 0) && (opcode < DEG_NUM_OPCODES));
- if (opcode >= 0 && opcode < DEG_NUM_OPCODES) {
- return names_[opcode];
- }
- return "UnknownOpcode";
-}
-
} // namespace DEG
/* Register all node types */
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
index 6d328b399e0..1d3318a2988 100644
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ b/source/blender/depsgraph/intern/depsgraph_types.h
@@ -268,16 +268,6 @@ typedef enum eDepsOperation_Code {
DEG_NUM_OPCODES,
} eDepsOperation_Code;
-/* Some magic to stringify operation codes. */
-class DepsOperationStringifier {
-public:
- DepsOperationStringifier();
- const char *operator[](eDepsOperation_Code opcodex);
-protected:
- const char *names_[DEG_NUM_OPCODES];
-};
-
-/* String defines for these opcodes, defined in depsgraph_type_defines.cpp */
-extern DepsOperationStringifier DEG_OPNAMES;
+const char* operationCodeAsString(eDepsOperation_Code opcode);
} // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_operation.cc b/source/blender/depsgraph/intern/nodes/deg_node_operation.cc
index cbc0fbb4241..e82bbbc0e8a 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_operation.cc
+++ b/source/blender/depsgraph/intern/nodes/deg_node_operation.cc
@@ -56,7 +56,7 @@ OperationDepsNode::~OperationDepsNode()
string OperationDepsNode::identifier() const
{
- return string(DEG_OPNAMES[opcode]) + "(" + name + ")";
+ return string(operationCodeAsString(opcode)) + "(" + name + ")";
}
/* Full node identifier, including owner name.