27 {0,
nullptr, 0,
nullptr,
nullptr},
35 "The handle can be moved anywhere, and doesn't influence the point's other handle"},
40 "The location is automatically calculated to be smooth"},
45 "The location is calculated to point to the next/previous control point"},
50 "The location is constrained to point in the opposite direction as the other handleW"},
51 {0,
nullptr, 0,
nullptr,
nullptr},
59 "Calculate normals with the smallest twist around the curve tangent across the whole curve"},
64 "Calculate normals perpendicular to the Z axis and the curve tangent. If a series of points "
65 "is vertical, the X axis is used."},
70 "Use the stored custom normal attribute as the final normals"},
71 {0,
nullptr, 0,
nullptr,
nullptr},
76# include <fmt/format.h>
97static int rna_Curves_curve_offset_data_length(
PointerRNA *
ptr)
100 return curves->geometry.curve_num + 1;
107 curves->geometry.wrap().offsets_for_write().data(),
109 curves->geometry.curve_num + 1,
117 if (index < 0 || index >= curves->geometry.curve_num + 1) {
121 r_ptr->
type = &RNA_IntAttributeValue;
122 r_ptr->
data = &curves->geometry.wrap().offsets_for_write()[index];
128 return reinterpret_cast<float(*)[3]
>(curves.geometry.wrap().positions_for_write().data());
131static const float (*get_curves_positions(
const Curves &curves))[3]
133 return reinterpret_cast<const float(*)[3]
>(curves.geometry.wrap().positions().data());
136static int rna_CurvePoint_index_get_const(
const PointerRNA *
ptr)
139 const float(*co)[3] =
static_cast<float(*)[3]
>(
ptr->
data);
140 const float(*positions)[3] = get_curves_positions(*curves);
141 return int(co - positions);
148 curves->geometry.wrap().offsets_for_write().data(),
150 curves->geometry.curve_num,
158 return curves->geometry.curve_num;
164 if (index < 0 || index >= curves->geometry.curve_num) {
168 r_ptr->
type = &RNA_CurveSlice;
169 r_ptr->
data = &curves->geometry.wrap().offsets_for_write()[index];
176 return curves->geometry.point_num;
182 if (index < 0 || index >= curves->geometry.point_num) {
186 r_ptr->
type = &RNA_FloatVectorAttributeValue;
197 curves->geometry.point_num,
204 return rna_CurvePoint_index_get_const(
ptr);
207static void rna_CurvePoint_location_get(
PointerRNA *
ptr,
float value[3])
212static void rna_CurvePoint_location_set(
PointerRNA *
ptr,
const float value[3])
222 const VArray radii = *attributes.lookup_or_default<
float>(
223 "radius", bke::AttrDomain::Point, 0.0f);
224 return radii[rna_CurvePoint_index_get_const(
ptr)];
227static void rna_CurvePoint_radius_set(
PointerRNA *
ptr,
float value)
233 bke::AttrDomain::Point);
237 radii.
varray.set(rna_CurvePoint_index_get_const(
ptr), value);
240static std::optional<std::string> rna_CurvePoint_path(
const PointerRNA *
ptr)
242 return fmt::format(
"points[{}]", rna_CurvePoint_index_get_const(
ptr));
248 if (index < 0 || index >= curves->geometry.point_num) {
252 r_ptr->
type = &RNA_CurvePoint;
257static int rna_CurveSlice_index_get_const(
const PointerRNA *
ptr)
260 return int(
static_cast<int *
>(
ptr->
data) - curves->geometry.curve_offsets);
265 return rna_CurveSlice_index_get_const(
ptr);
268static std::optional<std::string> rna_CurveSlice_path(
const PointerRNA *
ptr)
270 return fmt::format(
"curves[{}]", rna_CurveSlice_index_get_const(
ptr));
273static int rna_CurveSlice_first_point_index_get(
PointerRNA *
ptr)
275 const int *offset_ptr =
static_cast<int *
>(
ptr->
data);
281 const int *offset_ptr =
static_cast<int *
>(
ptr->
data);
282 const int offset = *offset_ptr;
283 return *(offset_ptr + 1) - offset;
289 const int offset = rna_CurveSlice_first_point_index_get(
ptr);
290 const int size = rna_CurveSlice_points_length_get(
ptr);
292 float(*co)[3] = positions + offset;
300 const int size = curves->geometry.point_num;
337 prop,
"rna_CurvePoint_location_get",
"rna_CurvePoint_location_set",
nullptr);
343 prop,
"rna_CurvePoint_radius_get",
"rna_CurvePoint_radius_set",
nullptr);
381 "rna_CurveSlice_points_begin",
382 "rna_iterator_array_next",
383 "rna_iterator_array_end",
384 "rna_iterator_array_get",
385 "rna_CurveSlice_points_length_get",
394 prop,
"First Point Index",
"The index of this curve's first control point");
421 "rna_Curves_curves_begin",
422 "rna_iterator_array_next",
423 "rna_iterator_array_end",
424 "rna_iterator_array_get",
425 "rna_Curves_curves_length",
426 "rna_Curves_curves_lookup_int",
436 "rna_Curves_position_data_begin",
437 "rna_iterator_array_next",
438 "rna_iterator_array_end",
439 "rna_iterator_array_get",
440 "rna_Curves_position_data_length",
441 "rna_Curves_points_lookup_int",
451 "rna_Curves_position_data_begin",
452 "rna_iterator_array_next",
453 "rna_iterator_array_end",
454 "rna_iterator_array_get",
455 "rna_Curves_position_data_length",
456 "rna_Curves_position_data_lookup_int",
466 "rna_Curves_curve_offset_data_begin",
467 "rna_iterator_array_next",
468 "rna_iterator_array_end",
469 "rna_iterator_array_get",
470 "rna_Curves_curve_offset_data_length",
471 "rna_Curves_curve_offset_data_lookup_int",
484 "rna_Curves_normals_begin",
485 "rna_iterator_array_next",
486 "rna_iterator_array_end",
487 "rna_iterator_array_get",
488 "rna_Curves_position_data_length",
493 prop,
"Normals",
"The curve normal value at each of the curve's control points");
509 "rna_IDMaterials_assign_int");
522 "The name of the attribute on the surface mesh used to define the "
523 "attachment of each curve");
551 prop,
"Use Sculpt Collision",
"Enable collision with the surface while sculpting");
Generic geometry attributes built on CustomData.
Low-level operations for curves.
MINLINE void copy_v3_v3(float r[3], const float a[3])
void DEG_id_tag_update(ID *id, unsigned int flags)
@ NORMAL_MODE_MINIMUM_TWIST
@ CV_SCULPT_COLLISION_ENABLED
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
float(* point_normals_array_create(const Curves *curves_id))[3]
Vector< MutableSpan< float3 > > get_curves_positions_for_write(bke::CurvesGeometry &curves)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, bool free_ptr, IteratorSkipFunc skip)
void rna_def_animdata_common(StructRNA *srna)
const EnumPropertyItem rna_enum_attribute_curves_domain_items[]
void rna_def_attributes_common(StructRNA *srna, const AttributeOwnerType type)
const EnumPropertyItem rna_enum_curve_normal_mode_items[]
static void rna_def_curves_point(BlenderRNA *brna)
void RNA_def_curves(BlenderRNA *brna)
static void rna_def_curves(BlenderRNA *brna)
const EnumPropertyItem rna_enum_curves_handle_type_items[]
static void rna_def_read_only_float_vector(BlenderRNA *brna)
static void rna_def_curves_curve(BlenderRNA *brna)
const EnumPropertyItem rna_enum_curves_type_items[]
void RNA_api_curves(StructRNA *srna)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
VMutableArray< T > varray
void WM_main_add_notifier(uint type, void *reference)