diff options
author | Jacques Lucke <jacques@blender.org> | 2020-06-09 13:08:32 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-06-09 13:08:32 +0300 |
commit | 5620a09e0d5e929271c4faa2a763b647758072d8 (patch) | |
tree | 948c4e7c615ed22707e4c8185da3ddcf6515c355 /source | |
parent | f7c0f1b8b83ac475755b633abf59cf9f447b2d49 (diff) |
Cleanup: move hashing of OperationIDKey to member function
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/depsgraph/intern/node/deg_node_component.cc | 11 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/node/deg_node_component.h | 18 |
2 files changed, 12 insertions, 17 deletions
diff --git a/source/blender/depsgraph/intern/node/deg_node_component.cc b/source/blender/depsgraph/intern/node/deg_node_component.cc index f4d042fecf9..e75b5a96480 100644 --- a/source/blender/depsgraph/intern/node/deg_node_component.cc +++ b/source/blender/depsgraph/intern/node/deg_node_component.cc @@ -26,6 +26,8 @@ #include <cstring> /* required for STREQ later on. */ #include <stdio.h> +#include "BLI_ghash.h" +#include "BLI_hash.hh" #include "BLI_utildefines.h" #include "DNA_object_types.h" @@ -69,6 +71,15 @@ bool ComponentNode::OperationIDKey::operator==(const OperationIDKey &other) cons return (opcode == other.opcode) && (STREQ(name, other.name)) && (name_tag == other.name_tag); } +uint32_t ComponentNode::OperationIDKey::hash() const +{ + const int opcode_as_int = static_cast<int>(opcode); + return BLI_ghashutil_combine_hash( + name_tag, + BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(opcode_as_int), + BLI_ghashutil_strhash_p(name))); +} + ComponentNode::ComponentNode() : entry_operation(nullptr), exit_operation(nullptr), affects_directly_visible(false) { diff --git a/source/blender/depsgraph/intern/node/deg_node_component.h b/source/blender/depsgraph/intern/node/deg_node_component.h index 2d13300d69f..727551127a5 100644 --- a/source/blender/depsgraph/intern/node/deg_node_component.h +++ b/source/blender/depsgraph/intern/node/deg_node_component.h @@ -26,8 +26,6 @@ #include "intern/node/deg_node.h" #include "intern/node/deg_node_operation.h" -#include "BLI_ghash.h" -#include "BLI_hash.hh" #include "BLI_string.h" #include "BLI_utildefines.h" @@ -55,6 +53,7 @@ struct ComponentNode : public Node { string identifier() const; bool operator==(const OperationIDKey &other) const; + uint32_t hash() const; }; /* Typedef for container of operations */ @@ -205,18 +204,3 @@ struct BoneComponentNode : public ComponentNode { void deg_register_component_depsnodes(); } // namespace DEG - -namespace blender { - -template<> struct DefaultHash<DEG::ComponentNode::OperationIDKey> { - uint32_t operator()(const DEG::ComponentNode::OperationIDKey &key) const - { - const int opcode_as_int = static_cast<int>(key.opcode); - return BLI_ghashutil_combine_hash( - key.name_tag, - BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(opcode_as_int), - BLI_ghashutil_strhash_p(key.name))); - } -}; - -} // namespace blender |