[Bf-blender-cvs] [0bc281a6dd1] master: Cleanup: Simplify geometry nodes attribute API usage
Hans Goudey
noreply at git.blender.org
Sun Feb 14 04:29:15 CET 2021
Commit: 0bc281a6dd12308f17b3d41bdc4cc1104a3e6f18
Author: Hans Goudey
Date: Sat Feb 13 21:27:39 2021 -0600
Branches: master
https://developer.blender.org/rB0bc281a6dd12308f17b3d41bdc4cc1104a3e6f18
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.
===================================================================
M source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
===================================================================
diff --git a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
index 4fec14ec9c9..ed99fc95018 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
@@ -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();
}
}
More information about the Bf-blender-cvs
mailing list