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
This commit is contained in:
Hans Goudey 2021-10-13 11:26:23 -05:00
parent 78445ebd5f
commit 96876305e1
Notes: blender-bot 2023-02-14 00:13:36 +01:00
Referenced by issue #92155, Update attribute capture node to work with instances
1 changed files with 7 additions and 5 deletions

View File

@ -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)};