diff --git a/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc index b3f04186c63..f14329c96da 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc @@ -22,16 +22,6 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output(N_("Points")); } -template -static void copy_attribute_to_points(const VArray &src, - const IndexMask mask, - MutableSpan dst) -{ - for (const int i : mask.index_range()) { - dst[i] = src[mask[i]]; - } -} - static void convert_instances_to_points(GeometrySet &geometry_set, Field position_field, Field radius_field, @@ -65,8 +55,8 @@ static void convert_instances_to_points(GeometrySet &geometry_set, bke::SpanAttributeWriter point_radii = point_attributes.lookup_or_add_for_write_only_span("radius", ATTR_DOMAIN_POINT); - copy_attribute_to_points(positions, selection, point_positions.span); - copy_attribute_to_points(radii, selection, point_radii.span); + positions.materialize_compressed_to_uninitialized(selection, point_positions.span); + radii.materialize_compressed_to_uninitialized(selection, point_radii.span); point_positions.finish(); point_radii.finish(); @@ -90,10 +80,7 @@ static void convert_instances_to_points(GeometrySet &geometry_set, attribute_id, ATTR_DOMAIN_POINT, attribute_kind.data_type); BLI_assert(dst); - attribute_math::convert_to_static_type(attribute_kind.data_type, [&](auto dummy) { - using T = decltype(dummy); - copy_attribute_to_points(src.typed(), selection, dst.span.typed()); - }); + src.materialize_compressed_to_uninitialized(selection, dst.span.data()); dst.finish(); } } diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc b/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc index 9cc64d4bc44..74fff8efeee 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc @@ -18,14 +18,6 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output(N_("Mesh")); } -template -static void copy_attribute_to_vertices(const Span src, const IndexMask mask, MutableSpan dst) -{ - for (const int i : mask.index_range()) { - dst[i] = src[mask[i]]; - } -} - /* One improvement would be to move the attribute arrays directly to the mesh when possible. */ static void geometry_set_points_to_vertices(GeometrySet &geometry_set, Field &selection_field) @@ -66,12 +58,7 @@ static void geometry_set_points_to_vertices(GeometrySet &geometry_set, mesh_component.attributes_for_write()->lookup_or_add_for_write_only_span( attribute_id, ATTR_DOMAIN_POINT, data_type); if (dst && src) { - attribute_math::convert_to_static_type(data_type, [&](auto dummy) { - using T = decltype(dummy); - VArray src_typed = src.typed(); - VArraySpan src_typed_span{src_typed}; - copy_attribute_to_vertices(src_typed_span, selection, dst.span.typed()); - }); + src.materialize_compressed_to_uninitialized(selection, dst.span.data()); dst.finish(); } }