36 switch (handle_type_legacy) {
108 const Nurb &src_curve = *src_curves[i];
112 offset += src_curve.
pntsu;
114 offsets.
last() = offset;
126 auto create_poly = [&](
const IndexMask &selection) {
127 selection.foreach_index(
GrainSize(256), [&](
const int curve_i) {
128 const Nurb &src_curve = *src_curves[curve_i];
130 const IndexRange points = points_by_curve[curve_i];
133 const BPoint &bp = src_points[i];
134 positions[points[i]] = bp.
vec;
135 radii[points[i]] = bp.
radius;
136 tilts[points[i]] = bp.
tilt;
145 auto create_bezier = [&](
const IndexMask &selection) {
152 selection.foreach_index(
GrainSize(256), [&](
const int curve_i) {
153 const Nurb &src_curve = *src_curves[curve_i];
155 const IndexRange points = points_by_curve[curve_i];
157 resolutions[curve_i] = src_curve.
resolu;
161 positions[points[i]] = point.
vec[1];
162 handle_positions_l[points[i]] = point.
vec[0];
164 handle_positions_r[points[i]] = point.
vec[2];
166 radii[points[i]] = point.
radius;
167 tilts[points[i]] = point.
tilt;
172 auto create_nurbs = [&](
const IndexMask &selection) {
178 selection.foreach_index(
GrainSize(256), [&](
const int curve_i) {
179 const Nurb &src_curve = *src_curves[curve_i];
180 const Span src_points(src_curve.
bp, src_curve.
pntsu);
181 const IndexRange points = points_by_curve[curve_i];
183 resolutions[curve_i] = src_curve.
resolu;
184 nurbs_orders[curve_i] = src_curve.
orderu;
188 const BPoint &bp = src_points[i];
189 positions[points[i]] = bp.
vec;
190 radii[points[i]] = bp.
radius;
191 tilts[points[i]] = bp.
tilt;
192 nurbs_weights[points[i]] = bp.
vec[3];
203 selection.foreach_index([&](
const int curve_i) {
205 const Nurb &src_curve = *src_curves[curve_i];
206 const IndexRange knots = knots_by_curve[curve_i];
216 [&](
const IndexMask & ) { BLI_assert_unreachable(); },
223 radius_attribute.
finish();
const ListBase * BKE_curve_nurbs_get_for_read(const Curve *cu)
Low-level operations for curves.
Low-level operations for curves.
#define BLI_assert_unreachable()
#define LISTBASE_FOREACH(type, var, list)
@ NORMAL_MODE_MINIMUM_TWIST
@ NURBS_KNOT_MODE_ENDPOINT
@ NURBS_KNOT_MODE_ENDPOINT_BEZIER
constexpr int64_t size() const
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
constexpr void copy_from(Span< T > values) const
constexpr T & last(const int64_t n=0) const
constexpr const T & last(const int64_t n=0) const
constexpr IndexRange index_range() const
void append(const T &value)
IndexRange index_range() const
MutableSpan< float3 > positions_for_write()
MutableSpan< float > nurbs_custom_knots_for_write()
OffsetIndices< int > points_by_curve() const
MutableSpan< int8_t > handle_types_right_for_write()
IndexRange curves_range() const
void update_curve_types()
MutableSpan< int8_t > curve_types_for_write()
MutableSpan< int > resolution_for_write()
const std::array< int, CURVE_TYPES_NUM > & curve_type_counts() const
MutableSpan< float3 > handle_positions_left_for_write()
MutableAttributeAccessor attributes_for_write()
MutableSpan< float3 > handle_positions_right_for_write()
MutableSpan< int8_t > nurbs_knots_modes_for_write()
MutableSpan< float > tilt_for_write()
MutableSpan< int8_t > nurbs_orders_for_write()
void nurbs_custom_knots_update_size()
Span< int > offsets() const
MutableSpan< float > nurbs_weights_for_write()
void resize(int points_num, int curves_num)
MutableSpan< int8_t > normal_mode_for_write()
MutableSpan< int > offsets_for_write()
bool nurbs_has_custom_knots() const
OffsetIndices< int > nurbs_custom_knots_by_curve() const
VArray< int8_t > curve_types() const
MutableSpan< bool > cyclic_for_write()
MutableSpan< int8_t > handle_types_left_for_write()
GSpanAttributeWriter lookup_or_add_for_write_only_span(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type)
void * MEM_dupallocN(const void *vmemh)
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)
Curves * curve_legacy_to_curves(const Curve &curve_legacy)
static CurveType curve_type_from_legacy(const short type)
static NormalMode normal_mode_from_legacy(const short twist_mode)
static HandleType handle_type_from_legacy(const uint8_t handle_type_legacy)
KnotsMode knots_mode_from_legacy(short flag)
Curves * curves_new_nomain(int points_num, int curves_num)
MutableVArraySpan< T > span