BKE: Utilities to create curves and point clouds without attributes #120368

Open
Iliya Katushenock wants to merge 16 commits from mod_moder/blender:more_no_att_constructors into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 3 additions and 18 deletions
Showing only changes of commit bc98db752e - Show all commits

View File

@ -1398,9 +1398,8 @@ void CurvesGeometry::remove_attributes_based_on_types()
CurvesGeometry curves_new_no_attributes(int point_num, int curve_num)
{
CurvesGeometry curves(0, 0);
CurvesGeometry curves(0, curve_num);
curves.point_num = point_num;
curves.curve_num = curve_num;
CustomData_free_layer_named(&curves.point_data, "position", 0);

View File

@ -42,14 +42,6 @@ components_supported_reordering()
return supported_types_and_domains;
}
static void remove_attributes(const Span<StringRef> names,
bke::MutableAttributeAccessor attributes)
{
for (const StringRef name : names) {
attributes.remove(name);
}
}
static void reorder_attributes_group_to_group(
const bke::AttributeAccessor src_attributes,
const bke::AttrDomain domain,
@ -106,8 +98,6 @@ static void copy_and_reorder_mesh_verts(
const bke::AttributeAccessor src_attributes = src_mesh.attributes();
bke::MutableAttributeAccessor dst_attributes = dst_mesh.attributes_for_write();
remove_attributes({"position", ".edge_verts", ".corner_vert", ".corner_edge"}, dst_attributes);
bke::copy_attributes(
src_attributes, bke::AttrDomain::Edge, propagation_info, {}, dst_attributes);
bke::copy_attributes(
@ -144,8 +134,6 @@ static void copy_and_reorder_mesh_edges(
const bke::AttributeAccessor src_attributes = src_mesh.attributes();
bke::MutableAttributeAccessor dst_attributes = dst_mesh.attributes_for_write();
remove_attributes({"position", ".edge_verts", ".corner_vert", ".corner_edge"}, dst_attributes);
bke::copy_attributes(
src_attributes, bke::AttrDomain::Point, propagation_info, {}, dst_attributes);
bke::copy_attributes(
@ -175,8 +163,6 @@ static void copy_and_reorder_mesh_faces(
const bke::AttributeAccessor src_attributes = src_mesh.attributes();
bke::MutableAttributeAccessor dst_attributes = dst_mesh.attributes_for_write();
remove_attributes({"position", ".edge_verts", ".corner_vert", ".corner_edge"}, dst_attributes);
bke::copy_attributes(
src_attributes, bke::AttrDomain::Point, propagation_info, {}, dst_attributes);
bke::copy_attributes(
@ -315,8 +301,8 @@ bke::CurvesGeometry reorder_curves_geometry(
const Span<int> old_by_new_map,
const bke::AnonymousAttributePropagationInfo &propagation_info)
{
bke::CurvesGeometry dst_curves = bke::CurvesGeometry(src_curves.points_num(),
src_curves.curves_num());
bke::CurvesGeometry dst_curves = bke::curves_new_no_attributes(src_curves.points_num(),
src_curves.curves_num());
copy_and_reorder_curves(src_curves, old_by_new_map, propagation_info, dst_curves);
return dst_curves;
}