Cleanup: Simplify geometry nodes attribute API usage

Getting an "ouput" attribute is equivalent to creating an attribute and
then getting a write attribute. Replace the latter with the former for
consistency with other code, and to decrease the used surface area
of the attribute API to hopefully facilitate future cleanup.
This commit is contained in:
Hans Goudey 2021-02-13 21:27:39 -06:00
parent 237175e747
commit 0bc281a6dd
Notes: blender-bot 2023-02-14 06:37:09 +01:00
Referenced by issue #85674, Crash seems to be connected with wireframe mode
1 changed files with 3 additions and 3 deletions

View File

@ -201,8 +201,8 @@ static void join_attributes(Span<const GeometryComponent *> src_components,
AttributeDomain domain;
determine_final_data_type_and_domain(src_components, attribute_name, &data_type, &domain);
result.attribute_try_create(attribute_name, domain, data_type);
WriteAttributePtr write_attribute = result.attribute_try_get_for_write(attribute_name);
OutputAttributePtr write_attribute = result.attribute_try_get_for_output(
attribute_name, domain, data_type);
if (!write_attribute ||
&write_attribute->cpp_type() != bke::custom_data_type_to_cpp_type(data_type) ||
write_attribute->domain() != domain) {
@ -210,7 +210,7 @@ static void join_attributes(Span<const GeometryComponent *> src_components,
}
fn::GMutableSpan dst_span = write_attribute->get_span_for_write_only();
fill_new_attribute(src_components, attribute_name, data_type, domain, dst_span);
write_attribute->apply_span();
write_attribute.apply_span_and_save();
}
}