Fix #119364: Capturing attributes on output object instances lose object visibility settings #119370
@ -739,16 +739,22 @@ static void store_computed_output_attributes(
|
||||
static void store_output_attributes(bke::GeometrySet &geometry,
|
||||
const bNodeTree &tree,
|
||||
const IDProperty *properties,
|
||||
Span<GMutablePointer> output_values,
|
||||
const bool do_instances)
|
||||
Span<GMutablePointer> output_values)
|
||||
{
|
||||
/* All new attribute values have to be computed before the geometry is actually changed. This is
|
||||
* necessary because some fields might depend on attributes that are overwritten. */
|
||||
MultiValueMap<bke::AttrDomain, OutputAttributeInfo> outputs_by_domain =
|
||||
find_output_attributes_to_store(tree, properties, output_values);
|
||||
Vector<OutputAttributeToStore> attributes_to_store = compute_attributes_to_store(
|
||||
geometry, outputs_by_domain, do_instances);
|
||||
store_computed_output_attributes(geometry, attributes_to_store);
|
||||
if (outputs_by_domain.size() == 0) {
|
||||
return;
|
||||
}
|
||||
geometry.modify_geometry_sets([&](bke::GeometrySet &instance_geometry) {
|
||||
/* Instance attributes should only be created for the top-level geometry. */
|
||||
const bool do_instances = &geometry == &instance_geometry;
|
||||
Vector<OutputAttributeToStore> attributes_to_store = compute_attributes_to_store(
|
||||
instance_geometry, outputs_by_domain, do_instances);
|
||||
store_computed_output_attributes(instance_geometry, attributes_to_store);
|
||||
});
|
||||
}
|
||||
|
||||
bke::GeometrySet execute_geometry_nodes_on_geometry(const bNodeTree &btree,
|
||||
@ -844,11 +850,7 @@ bke::GeometrySet execute_geometry_nodes_on_geometry(const bNodeTree &btree,
|
||||
}
|
||||
|
||||
bke::GeometrySet output_geometry = std::move(*param_outputs[0].get<bke::GeometrySet>());
|
||||
output_geometry.modify_geometry_sets([&](bke::GeometrySet &geometry) {
|
||||
/* Instance attributes should only be created for the top-level geometry. */
|
||||
const bool do_instances = &output_geometry == &geometry;
|
||||
store_output_attributes(geometry, btree, properties, param_outputs, do_instances);
|
||||
});
|
||||
store_output_attributes(output_geometry, btree, properties, param_outputs);
|
||||
|
||||
for (const int i : IndexRange(num_outputs)) {
|
||||
if (param_set_outputs[i]) {
|
||||
|
Loading…
Reference in New Issue
Block a user