72 this->
runtime = MEM_new<CurvesGeometryRuntime>(__func__);
131 this->
runtime = MEM_new<CurvesGeometryRuntime>(
158 if (
this == &other) {
161 std::destroy_at(
this);
169 other.curve_offsets =
nullptr;
172 other.custom_knots =
nullptr;
175 other.custom_knot_num = 0;
190 other.vertex_group_names.clear_no_delete();
193 other.vertex_group_active_index = 0;
196 other.attributes_active_index = -1;
199 other.runtime =
nullptr;
204 if (
this == &other) {
207 std::destroy_at(
this);
258 attr->assign_data(std::move(
data));
272 if (selection.
size() == this->curves_num()) {
276 if (std::optional<int8_t> single_type = this->
curve_types().get_if_single()) {
277 if (single_type == type) {
296 if (
const std::optional<int8_t> single = types.
get_if_single()) {
308 for (
const int64_t curve_index : curves_range) {
315 [](
const bool &a,
const bool &
b) {
return a &&
b; });
321 for (
int8_t &type : types) {
331 using CountsType = std::array<int, CURVE_TYPES_NUM>;
335 if (
const std::optional<int8_t> single = types.
get_if_single()) {
336 counts[*single] = types.
size();
346 CountsType result = init;
347 for (const int curve_index : curves_range) {
348 result[types_span[curve_index]]++;
352 [](
const CountsType &a,
const CountsType &
b) {
613 for (
const int curve : range) {
634 const int knots_num = knots_by_curve.
total_size();
638 this->custom_knot_num,
648 this->custom_knot_num,
658 if (dverts ==
nullptr) {
668 if (dvert !=
nullptr) {
687 offset += count_fn(i);
689 offsets.
last() = offset;
705 handle_types_left =
curves.handle_types_left();
706 handle_types_right =
curves.handle_types_right();
715 const IndexRange points = points_by_curve[curve_index];
716 switch (types[curve_index]) {
719 points.
size(), cyclic[curve_index], resolution[curve_index]);
721 return points.
size();
725 handle_types_right.
slice(points),
727 resolution[curve_index],
728 all_bezier_offsets.
slice(offsets));
729 return all_bezier_offsets[offsets.
last()];
732 const bool is_cyclic = cyclic[curve_index];
733 const int8_t order = nurbs_orders[curve_index];
735 const IndexRange custom_knots_range = custom_knots_by_curve[curve_index];
739 all_custom_knots.
slice(custom_knots_range) :
742 points.
size(), order, is_cyclic, resolution[curve_index], knots_mode, custom_knots);
807void CurvesGeometry::ensure_nurbs_basis_cache()
const
833 for (
const int curve_index : segment) {
837 const int8_t order = orders[curve_index];
838 const int resolution = resolutions[curve_index];
839 const bool is_cyclic =
cyclic[curve_index];
845 r_data[curve_index].invalid =
true;
854 custom_knots_by_curve[curve_index],
859 evaluated_points.
size(),
865 r_data[curve_index]);
880 this->ensure_nurbs_basis_cache();
890 auto evaluate_catmull = [&](
const IndexMask &selection) {
893 selection.foreach_index(
894 [&](
const int curve_index) {
905 auto evaluate_poly = [&](
const IndexMask &selection) {
909 auto evaluate_bezier = [&](
const IndexMask &selection) {
918 selection.foreach_index(
919 [&](
const int curve_index) {
932 auto evaluate_nurbs = [&](
const IndexMask &selection) {
933 this->ensure_nurbs_basis_cache();
935 const std::optional<Span<float>>
nurbs_weights = this->nurbs_weights();
937 selection.foreach_index(
938 [&](
const int curve_index) {
978 tangents.
slice(evaluated_points));
994 [&](
const int curve_index) {
995 if (
cyclic[curve_index]) {
1001 const float epsilon = 1e-6f;
1012 handles_left[points.
last()]);
1026 const float3 axis = axes[i];
1036 for (
const int i :
data.index_range()) {
1054 const int curve_index,
1059 switch (eval_data.
types[curve_index]) {
1062 src, eval_data.
cyclic[curve_index], eval_data.
resolution[curve_index], dst);
1087 this->ensure_nurbs_basis_cache();
1116 custom_normal_span = custom_normal;
1139 if (custom_normal_span.
is_empty()) {
1160 tilt_span.
slice(points));
1166 tilt_span.
slice(points),
1185 this->points_by_curve(),
1194 BLI_assert(src.
size() == this->points_by_curve()[curve_index].size());
1195 BLI_assert(dst.
size() == this->evaluated_points_by_curve()[curve_index].size());
1221 eval_data, curve_index, src.
slice(points), dst.
slice(evaluated_points));
1234 r_data.
resize(total_num);
1243 const bool cyclic = curves_cyclic[curve_index];
1245 const IndexRange lengths_range = this->lengths_range_for_curve(curve_index,
cyclic);
1248 evaluated_lengths.
slice(lengths_range));
1256 this->evaluated_points_by_curve();
1257 this->ensure_nurbs_basis_cache();
1278 this->curve_num == 0 ? 0 : (this->curve_num + 1),
1325 for (float3 &position : positions.slice(range)) {
1326 position += translation;
1349 for (
const int i_curve : range) {
1353 types_left.
slice(points),
1354 types_right.
slice(points),
1356 positions_left.
slice(points),
1357 positions_right.
slice(points));
1381 bezier_points, memory, [&](
const int64_t i) {
1386 selection,
positions, positions_left, positions_right, positions_left, positions_right);
1395 std::optional<Bounds<float3>>
bounds;
1410 bounds->min += translation;
1411 bounds->max += translation;
1433 return std::nullopt;
1438 if (
const std::optional radius_single =
radius.get_if_single()) {
1440 r_bounds.
pad(*radius_single);
1443 const Span radius_span =
radius.get_internal_span();
1470 if (r_max_material_index.has_value()) {
1471 r_max_material_index = std::clamp(*r_max_material_index, 0,
MAXMAT);
1481 this->nurbs_custom_knots().size_in_bytes());
1496 const IndexMask custom_knot_curves =
curves.nurbs_custom_knot_curves(memory);
1498 points_by_curve, custom_knot_curves, memory);
1500 points_to_copy, custom_knot_points, memory);
1502 int dst_knot_count = 0;
1505 curve_point_counts[curve], orders[curve], cyclic[curve]);
1511 new_knots.
reserve(dst_knot_count);
1514 custom_knot_points_to_copy,
1517 const IndexRange src_range = src_knots_by_curve[curve];
1518 const int order = orders[curve];
1519 const int leading_spans = order / 2;
1520 const int point_to_knot = -points.
start() + src_range.
start();
1521 const int point_to_span = point_to_knot + leading_spans;
1523 const int first_knot = ranges_to_copy.
first().start() + point_to_knot;
1526 float last_knot = new_knots.
last();
1528 for (
const int spans_left_knot : range.shift(point_to_span)) {
1529 last_knot += src_knots[spans_left_knot + 1] - src_knots[spans_left_knot];
1530 new_knots.
append(last_knot);
1533 const int last_spans_left_knot = ranges_to_copy.last().last() + point_to_span + 1;
1534 last_knot += src_knots[last_spans_left_knot + 1] - src_knots[last_spans_left_knot];
1535 new_knots.
append(last_knot);
1549 [&](
const int64_t point_i) { curve_point_counts[point_to_curve_map[point_i]]++; });
1553 curves.curves_range(), memory, [&](
const int64_t i) { return curve_point_counts[i] > 0; });
1562 if (curves_to_copy.is_empty()) {
1567 curve_point_counts.
as_span(), curves_to_copy, new_curve_offsets.drop_back(1));
1576 dst_curves.attributes_for_write());
1582 dst_curves.attributes_for_write());
1585 if (
curves.nurbs_has_custom_knots()) {
1589 if (dst_curves.curves_num() ==
curves.curves_num()) {
1590 dst_curves.runtime->type_counts =
curves.runtime->type_counts;
1593 dst_curves.remove_attributes_based_on_types();
1605 if (points_to_delete.
size() == this->points_num()) {
1620 const IndexMask custom_knot_curves =
curves.nurbs_custom_knot_curves(memory);
1622 curves_to_copy, custom_knot_curves, memory);
1624 Array<int> dst_knot_offsets_data(custom_knot_curves_to_copy.
size() + 1, 0);
1628 src_knots_by_curve, custom_knot_curves_to_copy, dst_knot_offsets_data);
1633 custom_knot_curves_to_copy,
1634 curves.nurbs_custom_knots(),
1659 dst_points_by_curve,
1670 if (
curves.nurbs_has_custom_knots()) {
1685 if (curves_to_delete.
size() == this->curves_num()) {
1697 const float last = custom_knots.
last();
1699 for (
float &knot_value : custom_knots) {
1700 knot_value = last - knot_value;
1711 [&](
const int curve_i) {
data.slice(points_by_curve[curve_i]).reverse(); },
1723 [&](
const int curve_i) {
1724 const IndexRange points = points_by_curve[curve_i];
1728 const int end_index = points.
size() - 1 - i;
1729 std::swap(a[end_index],
b[i]);
1730 std::swap(
b[end_index], a[i]);
1732 if (points.
size() % 2) {
1734 std::swap(a[middle_index],
b[middle_index]);
1765 reverse_curve_point_data<T>(*this, curves_to_reverse, attribute.span.typed<T>());
1776 const IndexRange curve_knots = custom_knots_by_curve[curve];
1829 curves.point_num = point_num;
1830 curves.attribute_storage.wrap().remove(
"position");
1856 for (const int i_curve : range) {
1857 for (const int i_point : points_by_curve[i_curve]) {
1858 mixer.mix_in(i_curve, old_values[i_point]);
1861 mixer.finalize(range);
1878 r_values.
fill(
true);
1880 for (
const int i_point : points_by_curve[i_curve]) {
1881 if (!old_values[i_point]) {
1882 r_values[i_curve] =
false;
1895 if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
1896 Array<T> values(curves.curves_num());
1897 adapt_curve_domain_point_to_curve_impl<T>(curves, varray.typed<T>(), values);
1898 new_varray = VArray<T>::from_container(std::move(values));
1969 this->runtime = MEM_new<bke::CurvesGeometryRuntime>(__func__);
1990 &reader, &this->custom_knots, [&]() {
2000 if (types.
size() != this->curve_num) {
2007 bool any_invalid =
false;
2049 const bool use_5_0_compatibility)
2054 use_5_0_compatibility,
2055 [&](
const AttrDomain domain) { return this->attributes().domain_size(domain); },
2083 [&]() { writer.write_int32_array(this->curve_num + 1, this->curve_offsets); });
2093 [&]() { writer.write_float_array(this->custom_knot_num, this->custom_knots); });
Low-level operations for curves.
Low-level operations for curves.
CustomData interface, see also DNA_customdata_types.h.
#define BUFFER_FOR_CPP_TYPE_VALUE(type, variable_name)
#define BLO_read_struct_list(reader, struct_name, list)
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define PRF_scope_with_name(ui_name, category)
#define PRF_scope(category)
#define BLI_assert_unreachable()
#define CD_MASK_MDEFORMVERT
Span< T > as_span() const
MutableSpan< T > as_mutable_span()
static const CPPType & get()
void copy_from(GSpan values)
GMutableSpan slice(const int64_t start, int64_t size) const
GSpan slice(const int64_t start, int64_t size) const
const CPPType & type() const
void get_internal_single(void *r_value) const
static GVArray from_garray(GArray<> array)
static GVArray from_single(const CPPType &type, int64_t size, const void *value)
static IndexMask from_predicate(const IndexMask &universe, LinearAllocator<> &memory, Fn &&predicate, exec_mode::Mode mode=exec_mode::parallel)
static IndexMask from_intersection(const IndexMask &mask_a, const IndexMask &mask_b, LinearAllocator<> &memory)
constexpr int64_t first() const
constexpr int64_t last(const int64_t n=0) const
constexpr int64_t size() const
constexpr bool is_empty() const
constexpr IndexRange()=default
static constexpr IndexRange from_begin_size(const int64_t begin, const int64_t size)
constexpr int64_t start() const
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
constexpr bool is_empty() const
constexpr MutableSpan drop_back(const int64_t n) const
constexpr void fill(const T &value) const
constexpr void reverse() const
constexpr IndexRange index_range() const
constexpr T & last(const int64_t n=0) const
bool contains(const Key &key) const
void ensure(FunctionRef< void(T &data)> compute_cache)
constexpr Span slice(int64_t start, int64_t size) const
constexpr const T & first() const
constexpr IndexRange index_range() const
constexpr bool is_empty() const
std::optional< T > get_if_single() const
IndexRange index_range() const
T get_internal_single() const
Span< T > get_internal_span() const
static VArray from_span(Span< T > values)
void append(const T &value)
const T & last(const int64_t n=0) const
void resize(const int64_t new_size)
MutableSpan< T > as_mutable_span()
void reserve(const int64_t min_capacity)
void extend(Span< T > array)
void reinitialize(const int64_t new_size)
Span< T > as_span() const
void foreach_attribute(const FunctionRef< void(const AttributeIter &)> fn) const
bool contains(StringRef name) const
GAttributeReader lookup(const StringRef name) const
AttributeAccessor(const void *owner, const AttributeAccessorFunctions &fn)
std::optional< AttrStorageType > storage_type
bool remove(StringRef name)
void blend_read(BlendDataReader &reader)
void resize(AttrDomain domain, int64_t new_size)
Attribute * lookup(StringRef name)
void blend_write(BlendWriter &writer, const BlendWriteData &write_data)
void count_memory(MemoryCounter &memory) const
Attribute & add(std::string name, bke::AttrDomain domain, bke::AttrType data_type, Attribute::DataVariant data)
SharedCache< Vector< curves::nurbs::BasisCache > > nurbs_basis_cache
SharedCache< Vector< float > > evaluated_length_cache
SharedCache< Bounds< float3 > > bounds_with_radius_cache
SharedCache< Vector< int > > custom_knot_offsets_cache
SharedCache< Vector< float3 > > evaluated_tangent_cache
SharedCache< EvaluatedOffsets > evaluated_offsets_cache
SharedCache< Vector< float3 > > evaluated_normal_cache
std::unique_ptr< bake::BakeMaterialsList > bake_materials
const ImplicitSharingInfo * custom_knots_sharing_info
SharedCache< std::optional< int > > max_material_index_cache
SharedCache< Bounds< float3 > > bounds_cache
SharedCache< Vector< float3 > > evaluated_position_cache
const ImplicitSharingInfo * curve_offsets_sharing_info
SharedCache< bool > has_cyclic_curve_cache
std::array< int, CURVE_TYPES_NUM > type_counts
Span< float3 > evaluated_tangents() const
MutableSpan< MDeformVert > deform_verts_for_write()
MutableSpan< int8_t > handle_types_left_for_write()
VArray< int8_t > curve_types() const
void ensure_can_interpolate_to_evaluated() const
void update_curve_types()
VArray< int8_t > nurbs_orders() const
std::optional< Span< float > > nurbs_weights() const
void calculate_bezier_auto_handles()
int evaluated_points_num() const
MutableSpan< int8_t > nurbs_orders_for_write()
void blend_write(BlendWriter &writer, ID &id, const BlendWriteData &write_data)
Span< float > nurbs_custom_knots() const
std::optional< int > material_index_max() const
bool has_cyclic_curve() const
MutableSpan< float3 > positions_for_write()
MutableSpan< int8_t > handle_types_right_for_write()
std::optional< Bounds< float3 > > bounds_min_max(bool use_radius=true) const
void blend_read(BlendDataReader &reader)
void remove_points(const IndexMask &points_to_delete, const AttributeFilter &attribute_filter)
void transform(const float4x4 &matrix)
std::optional< Span< float3 > > handle_positions_right() const
MutableSpan< int8_t > normal_mode_for_write()
void resize(int points_num, int curves_num)
MutableSpan< float > tilt_for_write()
VArray< bool > cyclic() const
OffsetIndices< int > nurbs_custom_knots_by_curve() const
AttributeAccessor attributes() const
MutableSpan< float > nurbs_custom_knots_for_write()
Span< float3 > positions() const
bool is_single_type(CurveType type) const
void interpolate_to_evaluated(int curve_index, GSpan src, GMutableSpan dst) const
void tag_topology_changed()
MutableSpan< float3 > handle_positions_right_for_write()
MutableSpan< float2 > surface_uv_coords_for_write()
void remove_attributes_based_on_types()
bool nurbs_has_custom_knots() const
std::optional< Span< float3 > > handle_positions_left() const
void calculate_bezier_aligned_handles()
IndexRange curves_range() const
std::optional< Span< float2 > > surface_uv_coords() const
Span< MDeformVert > deform_verts() const
MutableSpan< int > resolution_for_write()
void blend_write_prepare(BlendWriteData &write_data, bool use_5_0_compatibility)
void tag_normals_changed()
VArray< int8_t > normal_mode() const
IndexMask nurbs_custom_knot_curves(IndexMaskMemory &memory) const
VArray< int8_t > nurbs_knots_modes() const
MutableSpan< int8_t > curve_types_for_write()
IndexMask indices_for_curve_type(CurveType type, IndexMaskMemory &memory) const
CurvesGeometry & operator=(const CurvesGeometry &other)
MutableSpan< int8_t > nurbs_knots_modes_for_write()
VArray< int8_t > handle_types_left() const
void ensure_evaluated_lengths() const
OffsetIndices< int > evaluated_points_by_curve() const
MutableSpan< float3 > handle_positions_left_for_write()
Span< int > offsets() const
bool has_curve_with_type(CurveType type) const
MutableSpan< int > offsets_for_write()
IndexRange points_range() const
void fill_curve_types(CurveType type)
const std::array< int, CURVE_TYPES_NUM > & curve_type_counts() const
Span< float3 > evaluated_positions() const
VArray< int > resolution() const
void tag_positions_changed()
MutableSpan< float > radius_for_write()
MutableSpan< float > nurbs_weights_for_write()
VArray< int8_t > handle_types_right() const
VArray< float > tilt() const
VArray< float > radius() const
GVArray adapt_domain(const GVArray &varray, AttrDomain from, AttrDomain to) const
MutableSpan< bool > cyclic_for_write()
void count_memory(MemoryCounter &memory) const
void nurbs_custom_knots_resize(int knots_num)
void remove_curves(const IndexMask &curves_to_delete, const AttributeFilter &attribute_filter)
void tag_material_index_changed()
OffsetIndices< int > points_by_curve() const
Span< float3 > evaluated_normals() const
Array< int > point_to_curve_map() const
MutableAttributeAccessor attributes_for_write()
void reverse_curves(const IndexMask &curves_to_reverse)
void translate(const float3 &translation)
void nurbs_custom_knots_update_size()
bool add(const StringRef name, const AttrDomain domain, const AttrType data_type, const AttributeInit &initializer)
bool remove(const StringRef name)
MutableAttributeAccessor(void *owner, const AttributeAccessorFunctions &fn)
GSpanAttributeWriter lookup_for_write_span(StringRef name)
constexpr bool is_empty() const
constexpr Span slice(int64_t start, int64_t size) const
void foreach_index_optimized(Fn &&fn, Mode mode=exec_mode::serial) const
void foreach_segment(Fn &&fn, Mode mode=exec_mode::serial) const
void foreach_index(Fn &&fn, Mode mode=exec_mode::serial) const
IndexMask complement(const IndexMask &universe, LinearAllocator<> &memory) const
void add_shared(const ImplicitSharingInfo *sharing_info, const FunctionRef< void(MemoryCounter &shared_memory)> count_fn)
void gather(const GVArray &src, const IndexMask &indices, GMutableSpan dst, exec_mode::Mode mode=exec_mode::parallel)
void copy_group_to_group(OffsetIndices< int > src_offsets, OffsetIndices< int > dst_offsets, const IndexMask &selection, GSpan src, GMutableSpan dst)
void gather_group_to_group(const OffsetIndices< int > src_offsets, const OffsetIndices< int > dst_offsets, const IndexMask &selection, const Span< T > src, MutableSpan< T > dst)
bool contains(const VArray< bool > &varray, const IndexMask &indices_to_check, bool value)
void gather_to_groups(OffsetIndices< int > dst_offsets, const IndexMask &src_selection, GSpan src, GMutableSpan dst)
typename DefaultMixerStruct< T >::type DefaultMixer
void to_static_type(const CPPType &cpp_type, Fn &&fn)
void calculate_aligned_handles(const IndexMask &selection, Span< float3 > positions, Span< float3 > handles_left, Span< float3 > handles_right, MutableSpan< float3 > align_handles_left, MutableSpan< float3 > align_handles_right)
void calculate_auto_handles(bool cyclic, Span< int8_t > types_left, Span< int8_t > types_right, Span< float3 > positions, MutableSpan< float3 > positions_left, MutableSpan< float3 > positions_right)
void calculate_evaluated_offsets(Span< int8_t > handle_types_left, Span< int8_t > handle_types_right, bool cyclic, int resolution, MutableSpan< int > evaluated_offsets)
void calculate_evaluated_positions(Span< float3 > positions, Span< float3 > handles_left, Span< float3 > handles_right, OffsetIndices< int > evaluated_offsets, MutableSpan< float3 > evaluated_positions)
void interpolate_to_evaluated(GSpan src, OffsetIndices< int > evaluated_offsets, GMutableSpan dst)
int calculate_evaluated_num(int points_num, bool cyclic, int resolution)
void interpolate_to_evaluated(GSpan src, bool cyclic, int resolution, GMutableSpan dst)
int calculate_evaluated_num(int points_num, int8_t order, bool cyclic, int resolution, KnotsMode knots_mode, Span< float > knots)
void calculate_basis_cache(int points_num, int evaluated_num, int8_t order, int resolution, bool cyclic, KnotsMode knots_mode, Span< float > knots, BasisCache &basis_cache)
bool check_valid_eval_params(int points_num, int8_t order, bool cyclic, KnotsMode knots_mode, int resolution)
int knots_num(int points_num, int8_t order, bool cyclic)
void load_curve_knots(KnotsMode mode, int points_num, int8_t order, bool cyclic, IndexRange curve_knots, Span< float > custom_knots, MutableSpan< float > knots)
void interpolate_to_evaluated(const BasisCache &basis_cache, int8_t order, Span< float > control_weights, GSpan src, GMutableSpan dst)
void calculate_normals_z_up(Span< float3 > tangents, MutableSpan< float3 > normals)
void calculate_normals_minimum(Span< float3 > tangents, bool cyclic, MutableSpan< float3 > normals)
void calculate_tangents(Span< float3 > positions, bool is_cyclic, MutableSpan< float3 > tangents)
IndexMask curve_type_point_selection(const bke::CurvesGeometry &curves, CurveType curve_type, LinearAllocator<> &memory)
void foreach_selected_point_ranges_per_curve(const IndexMask &mask, OffsetIndices< int > points_by_curve, SelectedCallback selected_fn)
IndexMask indices_for_type(const VArray< int8_t > &types, const std::array< int, CURVE_TYPES_NUM > &type_counts, const CurveType type, const IndexMask &selection, LinearAllocator<> &memory)
IndexRange per_curve_point_offsets_range(const IndexRange points, const int curve_index)
const AttributeAccessorFunctions & get_attribute_accessor_functions()
void fill_points(OffsetIndices< int > points_by_curve, const IndexMask &curve_selection, GPointer value, GMutableSpan dst)
IndexMask curve_to_point_selection(OffsetIndices< int > points_by_curve, const IndexMask &curve_selection, LinearAllocator<> &memory)
void foreach_curve_by_type(const VArray< int8_t > &types, const std::array< int, CURVE_TYPES_NUM > &type_counts, const IndexMask &selection, FunctionRef< void(IndexMask)> catmull_rom_fn, FunctionRef< void(IndexMask)> poly_fn, FunctionRef< void(IndexMask)> bezier_fn, FunctionRef< void(IndexMask)> nurbs_fn)
static void normalize_span(MutableSpan< float3 > data)
static void translate_positions(MutableSpan< float3 > positions, const float3 &translation)
CurvesGeometry curves_copy_curve_selection(const CurvesGeometry &curves, const IndexMask &curves_to_copy, const AttributeFilter &attribute_filter)
CurvesGeometry curves_copy_point_selection(const CurvesGeometry &curves, const IndexMask &points_to_copy, const AttributeFilter &attribute_filter)
constexpr StringRef ATTR_RADIUS
constexpr StringRef ATTR_RESOLUTION
GMutableSpan get_mutable_attribute(AttributeStorage &storage, const AttrDomain domain, const CPPType &cpp_type, const StringRef name, const int64_t domain_size, const void *custom_default_value)
static void copy_point_selection_custom_knots(const CurvesGeometry &curves, const IndexMask &points_to_copy, const Span< int > curve_point_counts, CurvesGeometry &dst_curves)
std::optional< GSpan > get_span_attribute(const AttributeStorage &storage, const AttrDomain domain, const CPPType &cpp_type, const StringRef name, const int64_t domain_size)
constexpr StringRef ATTR_CURVE_TYPE
static bool is_valid_curve_type(const int8_t type)
static GVArray adapt_curve_domain_point_to_curve(const CurvesGeometry &curves, const GVArray &varray)
constexpr StringRef ATTR_CYCLIC
void gather_attributes(AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, const IndexMask &selection, MutableAttributeAccessor dst_attributes)
CurvesGeometry curves_new_no_attributes(int point_num, int curve_num)
constexpr StringRef ATTR_SURFACE_UV_COORDINATE
constexpr StringRef ATTR_HANDLE_POSITION_RIGHT
std::array< int, CURVE_TYPES_NUM > calculate_type_counts(const VArray< int8_t > &types)
static void evaluate_generic_data_for_curve(const EvalData &eval_data, const int curve_index, const GSpan src, GMutableSpan dst)
GVArray get_varray_attribute(const AttributeStorage &storage, AttrDomain domain, const CPPType &cpp_type, StringRef name, int64_t domain_size, const void *default_value)
static void reverse_custom_knots(MutableSpan< float > custom_knots)
constexpr StringRef ATTR_NORMAL_MODE
constexpr StringRef ATTR_TILT
constexpr StringRef ATTR_HANDLE_POSITION_LEFT
void transform_custom_normal_attribute(const float4x4 &transform, MutableAttributeAccessor &attributes)
void attribute_storage_blend_write_prepare(AttributeStorage &data, bool use_5_0_compatibility, FunctionRef< int(AttrDomain)> get_domain_size, AttributeStorage::BlendWriteData &write_data)
void build_offsets(MutableSpan< int > offsets, const CountFn &count_fn)
static void reverse_curve_point_data(const CurvesGeometry &curves, const IndexMask &curve_selection, MutableSpan< T > data)
constexpr StringRef ATTR_HANDLE_TYPE_LEFT
void gather_attributes_group_to_group(AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, OffsetIndices< int > src_offsets, OffsetIndices< int > dst_offsets, const IndexMask &selection, MutableAttributeAccessor dst_attributes)
static void reverse_swap_curve_point_data(const CurvesGeometry &curves, const IndexMask &curve_selection, MutableSpan< T > data_a, MutableSpan< T > data_b)
constexpr StringRef ATTR_NURBS_KNOTS_MODE
static bool curve_types_are_valid(const VArray< int8_t > &types)
constexpr StringRef ATTR_POSITION
static GVArray adapt_curve_domain_curve_to_point(const CurvesGeometry &curves, const GVArray &varray)
constexpr StringRef ATTR_NURBS_ORDER
static void sanitize_curve_types(MutableSpan< int8_t > types)
constexpr StringRef ATTR_NURBS_WEIGHT
constexpr StringRef ATTR_HANDLE_TYPE_RIGHT
static void rotate_directions_around_axes(MutableSpan< float3 > directions, const Span< float3 > axes, const Span< float > angles)
static void copy_curve_selection_custom_knots(const CurvesGeometry &curves, const IndexMask &curves_to_copy, CurvesGeometry &dst_curves)
static void calculate_evaluated_offsets(const CurvesGeometry &curves, MutableSpan< int > offsets, MutableSpan< int > all_bezier_offsets)
static void adapt_curve_domain_point_to_curve_impl(const CurvesGeometry &curves, const VArray< T > &old_values, MutableSpan< T > r_values)
std::optional< Bounds< T > > min_max_with_radii(const Span< T > values, const Span< RadiusT > radii)
std::optional< Bounds< T > > min_max(const std::optional< Bounds< T > > &a, const T &b)
std::optional< T > max(const VArray< T > &values)
constexpr ParallelGrainSize grain_size(int grain_size)
void resize_trivial_array(T **data, const ImplicitSharingInfo **sharing_info, int64_t old_size, int64_t new_size)
void free_shared_data(T **data, const ImplicitSharingInfo **sharing_info)
const ImplicitSharingInfo * info_for_mem_free(T *data)
void make_trivial_data_mutable(T **data, const ImplicitSharingInfo **sharing_info, const int64_t size)
void masked_fill(MutableSpan< T > data, const T &value, const IndexMask &mask)
void accumulate_lengths(const Span< T > values, const bool cyclic, MutableSpan< float > lengths)
float3 rotate_direction_around_axis(const float3 &direction, const float3 &axis, float angle)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
bool almost_equal_relative(const VecBase< T, Size > &a, const VecBase< T, Size > &b, const T &epsilon_factor)
void transform_points(const float4x4 &transform, MutableSpan< float3 > points, bool use_threading=true)
void build_reverse_map(OffsetIndices< int > offsets, MutableSpan< int > r_map)
OffsetIndices< int > accumulate_counts_to_offsets(MutableSpan< int > counts_to_offsets, int start_offset=0)
OffsetIndices< int > gather_selected_offsets(OffsetIndices< int > src_offsets, const IndexMask &selection, int start_offset, MutableSpan< int > dst_offsets)
void parallel_invoke(Functions &&...functions)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
Value parallel_reduce(IndexRange range, int64_t grain_size, const Value &identity, const Function &function, const Reduction &reduction)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
const ImplicitSharingInfo * BLO_read_shared(BlendDataReader *reader, T **data_ptr, FunctionRef< const ImplicitSharingInfo *()> read_fn)
void BKE_defbase_blend_write(BlendWriter *writer, const ListBaseT< bDeformGroup > *defbase)
BlendFileReadReport * BLO_read_data_reports(BlendDataReader *reader)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void CustomData_realloc(CustomData *data, int old_size, int new_size, eCDAllocType alloctype=CD_CONSTRUCT)
void BLO_read_data_invalidate(BlendDataReader *reader, const char *message)
MatBase< float, 4, 4 > float4x4
const void * CustomData_get_layer_named(const CustomData *data, eCustomDataType type, StringRef name)
void CustomData_reset(CustomData *data)
void CustomData_blend_write(BlendWriter *writer, CustomData *data, Span< CustomDataLayer > layers_to_write, int count, eCustomDataMask cddata_mask, ID *id)
BMesh const char void * data
void CustomData_blend_write_prepare(CustomData &data, Vector< CustomDataLayer, 16 > &layers_to_write)
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
void BLO_reportf_wrap(BlendFileReadReport *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
bool BLO_read_array(BlendDataReader *reader, T **ptr_p, const SizeT array_size, const int elems=1)
void BLO_read_array_and_validate_size(BlendDataReader *reader, T **ptr_p, SizeT *array_size, const int elems=1)
void CustomData_count_memory(const CustomData &data, int totelem, MemoryCounter &memory)
void CustomData_free(CustomData *data)
void * CustomData_get_layer_named_for_write(CustomData *data, eCustomDataType type, StringRef name, int totelem)
void BKE_defgroup_copy_list(ListBaseT< bDeformGroup > *outbase, const ListBaseT< bDeformGroup > *inbase)
void * CustomData_get_layer_for_write(CustomData *data, eCustomDataType type, int totelem)
VecBase< float, 3 > float3
@ NORMAL_MODE_MINIMUM_TWIST
void CustomData_init_from(const CustomData *source, CustomData *dest, eCustomDataMask mask, int totelem)
void * CustomData_add_layer(CustomData *data, eCustomDataType type, eCDAllocType alloctype, int totelem)
void CustomData_blend_read(BlendDataReader *reader, CustomData *data, int count)
struct Attribute * dna_attributes
void write_shared(const void *data, size_t approximate_size_in_bytes, const ImplicitSharingInfo *sharing_info, FunctionRef< void()> write_fn)
void generated_pointer_tag(const void *data)
void pad(const PaddingT &padding)
bke::CurvesGeometryRuntime * runtime
struct AttributeStorage attribute_storage
int vertex_group_active_index
int attributes_active_index
CustomData curve_data_legacy
ListBaseT< struct bDeformGroup > vertex_group_names
Vector< blender::Attribute, 16 > & attributes
static SingleData from_value(const GPointer &value)
Vector< int > all_bezier_offsets
Vector< int > evaluated_offsets
Vector< CustomDataLayer, 16 > & curve_layers
BlendWriteData(BlendWriter *writer, ResourceScope &scope)
Vector< CustomDataLayer, 16 > & point_layers
AttributeStorage::BlendWriteData attribute_data
const VArray< bool > & cyclic
const Span< int > all_bezier_evaluated_offsets
const VArray< int > & resolution
const Span< curves::nurbs::BasisCache > nurbs_basis_cache
const VArray< int8_t > & nurbs_orders
const VArray< int8_t > & types
const OffsetIndices< int > points_by_curve
const std::optional< Span< float > > nurbs_weights