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
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-09-13 14:08:58 +0300
committerJacques Lucke <jacques@blender.org>2021-09-13 14:09:18 +0300
commitb777df8080f221a99a6a87c0937868cd21bf5a2b (patch)
tree5030c1d5a3849efbe1335c7567d4af56c3571700
parent410dc76177af4258f3813d623c3cdaaddf1f0300 (diff)
Fix: fix equality operator for fields
Instead of comparing the referenced field node by pointer, compare the nodes directly instead. This is important because different field nodes might be the same semantically.
-rw-r--r--source/blender/functions/FN_field.hh6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/functions/FN_field.hh b/source/blender/functions/FN_field.hh
index 730a8046646..d6259bce435 100644
--- a/source/blender/functions/FN_field.hh
+++ b/source/blender/functions/FN_field.hh
@@ -151,12 +151,14 @@ template<typename NodePtr> class GFieldBase {
friend bool operator==(const GFieldBase &a, const GFieldBase &b)
{
- return &*a.node_ == &*b.node_ && a.node_output_index_ == b.node_output_index_;
+ /* Two nodes can compare equal even when their pointer is not the same. For example, two
+ * "Position" nodes are the same. */
+ return *a.node_ == *b.node_ && a.node_output_index_ == b.node_output_index_;
}
uint64_t hash() const
{
- return get_default_hash_2(node_, node_output_index_);
+ return get_default_hash_2(*node_, node_output_index_);
}
const fn::CPPType &cpp_type() const