diff options
author | Hans Goudey <h.goudey@me.com> | 2022-09-21 20:19:04 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-21 21:10:03 +0300 |
commit | 600c069e0ef5334575164e5c4d758efe7324b0c7 (patch) | |
tree | a01f0f656b67b01dc46278394a7df61a0b95498f /source/blender | |
parent | a82e52102b0f7ddfe3741fccdaa9de5f480c59fe (diff) |
Attributes: Correct implementation of typed "write_only" method
The typed "lookup_or_add_for_write_only" function is meant to do the
same thing as the non-typed version of the function. Instead, it still
initialized values of new attribute arrays, which isn't meant to happen.
Missed in 4c91c24bc7cbe2c4f97be373.
I also had to correct one place that used the "write_only"
function but didn't intialize all values.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_attribute.hh | 4 | ||||
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_attribute.hh b/source/blender/blenkernel/BKE_attribute.hh index b1f4039f788..97a8a91d0e4 100644 --- a/source/blender/blenkernel/BKE_attribute.hh +++ b/source/blender/blenkernel/BKE_attribute.hh @@ -706,7 +706,9 @@ class MutableAttributeAccessor : public AttributeAccessor { SpanAttributeWriter<T> lookup_or_add_for_write_only_span(const AttributeIDRef &attribute_id, const eAttrDomain domain) { - AttributeWriter<T> attribute = this->lookup_or_add_for_write<T>(attribute_id, domain); + AttributeWriter<T> attribute = this->lookup_or_add_for_write<T>( + attribute_id, domain, AttributeInitConstruct()); + if (attribute) { return SpanAttributeWriter<T>{std::move(attribute), false}; } diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc index edf14f664c5..1f9ad9f6ea2 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc @@ -485,7 +485,7 @@ static void calculate_selection_outputs(Mesh *mesh, /* Populate "Top" selection output. */ if (attribute_outputs.top_id) { const bool face = !config.top_is_point && config.fill_type != GEO_NODE_MESH_CIRCLE_FILL_NONE; - SpanAttributeWriter<bool> selection = attributes.lookup_or_add_for_write_only_span<bool>( + SpanAttributeWriter<bool> selection = attributes.lookup_or_add_for_write_span<bool>( attribute_outputs.top_id.get(), face ? ATTR_DOMAIN_FACE : ATTR_DOMAIN_POINT); if (config.top_is_point) { @@ -501,7 +501,7 @@ static void calculate_selection_outputs(Mesh *mesh, if (attribute_outputs.bottom_id) { const bool face = !config.bottom_is_point && config.fill_type != GEO_NODE_MESH_CIRCLE_FILL_NONE; - SpanAttributeWriter<bool> selection = attributes.lookup_or_add_for_write_only_span<bool>( + SpanAttributeWriter<bool> selection = attributes.lookup_or_add_for_write_span<bool>( attribute_outputs.bottom_id.get(), face ? ATTR_DOMAIN_FACE : ATTR_DOMAIN_POINT); if (config.bottom_is_point) { @@ -518,7 +518,7 @@ static void calculate_selection_outputs(Mesh *mesh, /* Populate "Side" selection output. */ if (attribute_outputs.side_id) { - SpanAttributeWriter<bool> selection = attributes.lookup_or_add_for_write_only_span<bool>( + SpanAttributeWriter<bool> selection = attributes.lookup_or_add_for_write_span<bool>( attribute_outputs.side_id.get(), ATTR_DOMAIN_FACE); selection.span.slice(config.side_faces_start, config.side_faces_len).fill(true); |