BKE: Utilities to create curves and point clouds without attributes

Same as #118297.

Pull Request: https://projects.blender.org/blender/blender/pulls/120368
This commit is contained in:
Iliya Katueshenock
2024-09-10 21:48:59 +02:00
committed by Hans Goudey
parent a4b42daf80
commit 0b7090ca37
4 changed files with 24 additions and 0 deletions

View File

@@ -859,6 +859,8 @@ CurvesGeometry curves_copy_curve_selection(const CurvesGeometry &curves,
const IndexMask &curves_to_copy,
const AttributeFilter &attribute_filter);
CurvesGeometry curves_new_no_attributes(int point_num, int curve_num);
std::array<int, CURVE_TYPES_NUM> calculate_type_counts(const VArray<int8_t> &types);
/* -------------------------------------------------------------------- */

View File

@@ -46,6 +46,8 @@ struct PointCloudRuntime {
MEM_CXX_CLASS_ALLOC_FUNCS("PointCloudRuntime");
};
PointCloud *pointcloud_new_no_attributes(int totpoint);
} // namespace blender::bke
void *BKE_pointcloud_add(Main *bmain, const char *name);

View File

@@ -1430,6 +1430,14 @@ void CurvesGeometry::remove_attributes_based_on_types()
}
}
CurvesGeometry curves_new_no_attributes(int point_num, int curve_num)
{
CurvesGeometry curves(0, curve_num);
curves.point_num = point_num;
CustomData_free_layer_named(&curves.point_data, "position", 0);
return curves;
}
/** \} */
/* -------------------------------------------------------------------- */

View File

@@ -403,3 +403,15 @@ void BKE_pointcloud_batch_cache_free(PointCloud *pointcloud)
BKE_pointcloud_batch_cache_free_cb(pointcloud);
}
}
namespace blender::bke {
PointCloud *pointcloud_new_no_attributes(int totpoint)
{
PointCloud *pointcloud = BKE_pointcloud_new_nomain(0);
pointcloud->totpoint = totpoint;
CustomData_free_layer_named(&pointcloud->pdata, "position", 0);
return pointcloud;
}
} // namespace blender::bke