[Bf-blender-cvs] [9628ef41351] master: Fix: wrong field input deduplication with Material Selection node

Jacques Lucke noreply at git.blender.org
Thu Sep 30 13:04:00 CEST 2021


Commit: 9628ef413518e5ddda9c1c8106ce4fecbd1ae7c1
Author: Jacques Lucke
Date:   Thu Sep 30 12:51:09 2021 +0200
Branches: master
https://developer.blender.org/rB9628ef413518e5ddda9c1c8106ce4fecbd1ae7c1

Fix: wrong field input deduplication with Material Selection node

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

M	source/blender/nodes/geometry/nodes/node_geo_material_selection.cc

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

diff --git a/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc
index 337bd88c6e6..9d4533b9bda 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc
@@ -100,13 +100,16 @@ class MaterialSelectionFieldInput final : public fn::FieldInput {
 
   uint64_t hash() const override
   {
-    /* Some random constant hash. */
-    return 91619626;
+    return get_default_hash(material_);
   }
 
   bool is_equal_to(const fn::FieldNode &other) const override
   {
-    return dynamic_cast<const MaterialSelectionFieldInput *>(&other) != nullptr;
+    if (const MaterialSelectionFieldInput *other_material_selection =
+            dynamic_cast<const MaterialSelectionFieldInput *>(&other)) {
+      return material_ == other_material_selection->material_;
+    }
+    return false;
   }
 };



More information about the Bf-blender-cvs mailing list