[Bf-blender-cvs] [96876305e18] master: Geometry Nodes: Make attribute capture work on instances

Hans Goudey noreply at git.blender.org
Wed Oct 13 18:26:36 CEST 2021


Commit: 96876305e18a9206a1d266b11e3a7d61c32be41f
Author: Hans Goudey
Date:   Wed Oct 13 11:26:23 2021 -0500
Branches: master
https://developer.blender.org/rB96876305e18a9206a1d266b11e3a7d61c32be41f

Geometry Nodes: Make attribute capture work on instances

Previously the attribute capture node only worked on realized geometry,
which was very confusing when other nodes worked on each individual
instance. The realize instances node is the way to explicitly change
between the two behaviors. Addresses T92155.

Differential Revision: https://developer.blender.org/D12841

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

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

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

diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc
index 8cb7d81f432..7f12b816023 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc
@@ -149,12 +149,14 @@ static void geo_node_attribute_capture_exec(GeoNodeExecParams params)
 
   static const Array<GeometryComponentType> types = {
       GEO_COMPONENT_TYPE_MESH, GEO_COMPONENT_TYPE_POINT_CLOUD, GEO_COMPONENT_TYPE_CURVE};
-  for (const GeometryComponentType type : types) {
-    if (geometry_set.has(type)) {
-      GeometryComponent &component = geometry_set.get_component_for_write(type);
-      try_capture_field_on_geometry(component, anonymous_id.get(), domain, field);
+  geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) {
+    for (const GeometryComponentType type : types) {
+      if (geometry_set.has(type)) {
+        GeometryComponent &component = geometry_set.get_component_for_write(type);
+        try_capture_field_on_geometry(component, anonymous_id.get(), domain, field);
+      }
     }
-  }
+  });
 
   GField output_field{
       std::make_shared<bke::AnonymousAttributeFieldInput>(std::move(anonymous_id), type)};



More information about the Bf-blender-cvs mailing list