[Bf-blender-cvs] [769c7521b58] temp-geometry-nodes-fields: fix attribute field source deduplication

Jacques Lucke noreply at git.blender.org
Thu Sep 2 13:01:59 CEST 2021


Commit: 769c7521b58193e9fbb3f4b11bdd33f59d4c0be3
Author: Jacques Lucke
Date:   Thu Sep 2 13:00:59 2021 +0200
Branches: temp-geometry-nodes-fields
https://developer.blender.org/rB769c7521b58193e9fbb3f4b11bdd33f59d4c0be3

fix attribute field source deduplication

===================================================================

M	source/blender/blenkernel/BKE_geometry_set.hh
M	source/blender/blenkernel/intern/attribute_access.cc

===================================================================

diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh
index da758669659..a7e04a814b1 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -621,6 +621,9 @@ class AttributeContextFieldSource : public fn::ContextFieldSource {
   const GVArray *try_get_varray_for_context(const fn::FieldContext &context,
                                             IndexMask mask,
                                             ResourceScope &scope) const override;
+
+  uint64_t hash() const override;
+  bool is_equal_to(const fn::FieldSource &other) const override;
 };
 
 }  // namespace blender::bke
diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc
index bf3756b7bcf..9d07afc2e63 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -1317,4 +1317,18 @@ const GVArray *AttributeContextFieldSource::try_get_varray_for_context(
   return nullptr;
 }
 
+uint64_t AttributeContextFieldSource::hash() const
+{
+  return get_default_hash_2(name_, type_);
+}
+
+bool AttributeContextFieldSource::is_equal_to(const fn::FieldSource &other) const
+{
+  if (const AttributeContextFieldSource *other_typed =
+          dynamic_cast<const AttributeContextFieldSource *>(&other)) {
+    return name_ == other_typed->name_ && type_ == other_typed->type_;
+  }
+  return false;
+}
+
 }  // namespace blender::bke



More information about the Bf-blender-cvs mailing list