[Bf-blender-cvs] [b777df8080f] master: Fix: fix equality operator for fields
Jacques Lucke
noreply at git.blender.org
Mon Sep 13 13:09:33 CEST 2021
Commit: b777df8080f221a99a6a87c0937868cd21bf5a2b
Author: Jacques Lucke
Date: Mon Sep 13 13:08:58 2021 +0200
Branches: master
https://developer.blender.org/rBb777df8080f221a99a6a87c0937868cd21bf5a2b
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.
===================================================================
M source/blender/functions/FN_field.hh
===================================================================
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
More information about the Bf-blender-cvs
mailing list