33 switch (handle_type_legacy) {
96 const Nurb &src_curve = *src_curves[i];
105 curves.update_curve_types();
107 if (
curves.curves_num() == 0) {
117 auto create_poly = [&](
IndexMask selection) {
119 for (const int curve_i : selection.slice(range)) {
120 const Nurb &src_curve = *src_curves[curve_i];
121 const Span<BPoint> src_points(src_curve.bp, src_curve.pntsu);
122 const IndexRange points = curves.points_for_curve(curve_i);
124 for (const int i : src_points.index_range()) {
125 const BPoint &bp = src_points[i];
126 positions[points[i]] = bp.vec;
127 radii[points[i]] = bp.radius;
128 tilts[points[i]] = bp.tilt;
138 auto create_bezier = [&](
IndexMask selection) {
146 for (const int curve_i : selection.slice(range)) {
147 const Nurb &src_curve = *src_curves[curve_i];
148 const Span<BezTriple> src_points(src_curve.bezt, src_curve.pntsu);
149 const IndexRange points = curves.points_for_curve(curve_i);
151 resolutions[curve_i] = src_curve.resolu;
153 for (const int i : src_points.index_range()) {
154 const BezTriple &point = src_points[i];
155 positions[points[i]] = point.vec[1];
156 handle_positions_l[points[i]] = point.vec[0];
157 handle_types_l[points[i]] = handle_type_from_legacy(point.h1);
158 handle_positions_r[points[i]] = point.vec[2];
159 handle_types_r[points[i]] = handle_type_from_legacy(point.h2);
160 radii[points[i]] = point.radius;
161 tilts[points[i]] = point.tilt;
167 auto create_nurbs = [&](IndexMask selection) {
168 MutableSpan<int> resolutions =
curves.resolution_for_write();
169 MutableSpan<float> nurbs_weights =
curves.nurbs_weights_for_write();
170 MutableSpan<int8_t> nurbs_orders =
curves.nurbs_orders_for_write();
171 MutableSpan<int8_t> nurbs_knots_modes =
curves.nurbs_knots_modes_for_write();
174 for (const int curve_i : selection.slice(range)) {
175 const Nurb &src_curve = *src_curves[curve_i];
176 const Span src_points(src_curve.bp, src_curve.pntsu);
177 const IndexRange points = curves.points_for_curve(curve_i);
179 resolutions[curve_i] = src_curve.resolu;
180 nurbs_orders[curve_i] = src_curve.orderu;
181 nurbs_knots_modes[curve_i] = knots_mode_from_legacy(src_curve.flagu);
183 for (const int i : src_points.index_range()) {
184 const BPoint &bp = src_points[i];
185 positions[points[i]] = bp.vec;
186 radii[points[i]] = bp.radius;
187 tilts[points[i]] = bp.tilt;
188 nurbs_weights[points[i]] = bp.vec[3];
196 curves.curve_type_counts(),
198 [&](IndexMask ) { BLI_assert_unreachable(); },
205 radius_attribute.finish();
const ListBase * BKE_curve_nurbs_get_for_read(const struct Curve *cu)
Low-level operations for curves.
Low-level operations for curves.
#define BLI_assert_unreachable()
@ NORMAL_MODE_MINIMUM_TWIST
@ NURBS_KNOT_MODE_ENDPOINT
@ NURBS_KNOT_MODE_ENDPOINT_BEZIER
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to curves
constexpr T & last(const int64_t n=0) const
IndexRange index_range() const
static CurvesGeometry & wrap(::CurvesGeometry &dna_struct)
GSpanAttributeWriter lookup_or_add_for_write_only_span(const AttributeIDRef &attribute_id, const eAttrDomain domain, const eCustomDataType data_type)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void foreach_curve_by_type(const VArray< int8_t > &types, const std::array< int, CURVE_TYPES_NUM > &type_counts, 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 KnotsMode knots_mode_from_legacy(const short flag)
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)
Curves * curves_new_nomain(int points_num, int curves_num)
void parallel_for(IndexRange range, int64_t grain_size, const Function &function)
MutableSpan< float3 > positions
MutableSpan< float > radii
MutableVArraySpan< T > span