From b777df8080f221a99a6a87c0937868cd21bf5a2b Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 13 Sep 2021 13:08:58 +0200 Subject: 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. --- source/blender/functions/FN_field.hh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source/blender/functions') 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 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 -- cgit v1.2.3