[Bf-blender-cvs] [5620a09e0d5] master: Cleanup: move hashing of OperationIDKey to member function
Jacques Lucke
noreply at git.blender.org
Tue Jun 9 12:08:39 CEST 2020
Commit: 5620a09e0d5e929271c4faa2a763b647758072d8
Author: Jacques Lucke
Date: Tue Jun 9 12:08:32 2020 +0200
Branches: master
https://developer.blender.org/rB5620a09e0d5e929271c4faa2a763b647758072d8
Cleanup: move hashing of OperationIDKey to member function
===================================================================
M source/blender/depsgraph/intern/node/deg_node_component.cc
M source/blender/depsgraph/intern/node/deg_node_component.h
===================================================================
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
More information about the Bf-blender-cvs
mailing list