Blender V5.3
rna_curve.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10
11#include "DNA_curve_types.h"
12#include "DNA_key_types.h"
13#include "DNA_scene_types.h"
14
16
17#include "BLT_translation.hh"
18
19#include "RNA_define.hh"
20#include "RNA_enum_types.hh"
21
22#include "rna_internal.hh"
23
24#include "WM_types.hh"
25
26namespace blender {
27
28#ifndef RNA_RUNTIME
30 {HD_FREE, "FREE", 0, "Free", ""},
31 {HD_VECT, "VECTOR", 0, "Vector", ""},
32 {HD_ALIGN, "ALIGNED", 0, "Aligned", ""},
33 {HD_AUTO, "AUTO", 0, "Auto", ""},
34 {0, nullptr, 0, nullptr, nullptr},
35};
36#endif
37
39 {HD_FREE, "FREE", ICON_HANDLE_FREE, "Free", "Completely independent manually set handle"},
40 {HD_ALIGN,
41 "ALIGNED",
42 ICON_HANDLE_ALIGNED,
43 "Aligned",
44 "Manually set handle with rotation locked together with its pair"},
45 {HD_VECT,
46 "VECTOR",
47 ICON_HANDLE_VECTOR,
48 "Vector",
49 "Automatic handles that create straight lines"},
50 {HD_AUTO,
51 "AUTO",
52 ICON_HANDLE_AUTO,
53 "Automatic",
54 "Automatic handles that create smooth curves"},
56 "AUTO_CLAMPED",
57 ICON_HANDLE_AUTOCLAMPED,
58 "Auto Clamped",
59 "Automatic handles that create smooth curves which only change direction at keyframes"},
60 {0, nullptr, 0, nullptr, nullptr},
61};
62
63/* NOTE: this is a near exact duplicate of `gpencil_interpolation_type_items`,
64 * Changes here will likely apply there too. */
65
67 /* Interpolation. */
69 N_("Standard transitions between keyframes")),
71 "CONSTANT",
72 ICON_IPO_CONSTANT,
73 "Constant",
74 "No interpolation, value of A gets held until B is encountered"},
76 "LINEAR",
77 ICON_IPO_LINEAR,
78 "Linear",
79 "Straight-line interpolation between A and B (i.e. no ease in/out)"},
81 "BEZIER",
82 ICON_IPO_BEZIER,
83 "Bézier",
84 "Smooth interpolation between A and B, with some control over curve shape"},
85
86 /* Easing. */
88 N_("Predefined inertial transitions, useful for motion graphics "
89 "(from least to most \"dramatic\")")),
91 "SINE",
92 ICON_IPO_SINE,
93 "Sinusoidal",
94 "Sinusoidal easing (weakest, almost linear but with a slight curvature)"},
95 {BEZT_IPO_QUAD, "QUAD", ICON_IPO_QUAD, "Quadratic", "Quadratic easing"},
96 {BEZT_IPO_CUBIC, "CUBIC", ICON_IPO_CUBIC, "Cubic", "Cubic easing"},
97 {BEZT_IPO_QUART, "QUART", ICON_IPO_QUART, "Quartic", "Quartic easing"},
98 {BEZT_IPO_QUINT, "QUINT", ICON_IPO_QUINT, "Quintic", "Quintic easing"},
99 {BEZT_IPO_EXPO, "EXPO", ICON_IPO_EXPO, "Exponential", "Exponential easing (dramatic)"},
101 "CIRC",
102 ICON_IPO_CIRC,
103 "Circular",
104 "Circular easing (strongest and most dynamic)"},
105
107 N_("Simple physics-inspired easing effects")),
108 {BEZT_IPO_BACK, "BACK", ICON_IPO_BACK, "Back", "Cubic easing with overshoot and settle"},
110 "BOUNCE",
111 ICON_IPO_BOUNCE,
112 "Bounce",
113 "Exponentially decaying parabolic bounce, like when objects collide"},
115 "ELASTIC",
116 ICON_IPO_ELASTIC,
117 "Elastic",
118 "Exponentially decaying sine wave, like an elastic band"},
119
120 {0, nullptr, 0, nullptr, nullptr},
121};
122
123#ifndef RNA_RUNTIME
125 {CU_POLY, "POLY", 0, "Poly", ""},
126 {CU_BEZIER, "BEZIER", 0, "Bézier", ""},
127 {CU_NURBS, "NURBS", 0, "Ease", ""},
128 {0, nullptr, 0, nullptr, nullptr},
129};
130#endif
131
133 {0, "FULL", 0, "Full", ""},
134 {CU_BACK, "BACK", 0, "Back", ""},
135 {CU_FRONT, "FRONT", 0, "Front", ""},
136 {CU_FRONT | CU_BACK, "HALF", 0, "Half", ""},
137 {0, nullptr, 0, nullptr, nullptr},
138};
139
142 "SWEEP_LINE",
143 0,
144 "Sweep Line",
145 "Fast without support for self-intersection"},
147 "CDT",
148 0,
149 "Delaunay",
150 "Constrained Delaunay Triangulation (CDT), robust with support for self-intersections"},
151 {0, nullptr, 0, nullptr, nullptr},
152};
153
156 "EVEN_ODD",
157 0,
158 "Even-Odd",
159 "Alternate inside/outside based on crossing count"},
161 "NONZERO",
162 0,
163 "Non-Zero",
164 "Overlapping curves with the same winding direction are filled as a union"},
165 {0, nullptr, 0, nullptr, nullptr},
166};
167
168#ifdef RNA_RUNTIME
169static const EnumPropertyItem curve2d_fill_mode_items[] = {
170 {0, "NONE", 0, "None", ""},
171 {CU_BACK, "BACK", 0, "Back", ""},
172 {CU_FRONT, "FRONT", 0, "Front", ""},
173 {CU_FRONT | CU_BACK, "BOTH", 0, "Both", ""},
174 {0, nullptr, 0, nullptr, nullptr},
175};
176#endif
177
178} // namespace blender
179
180#ifdef RNA_RUNTIME
181
182# include <fmt/format.h>
183
184# include "DNA_object_types.h"
185
186# include "BLI_listbase.hh"
187# include "BLI_math_vector_c.hh"
188# include "BLI_string_utf8.hh"
189
190# include "BKE_curve.hh"
191# include "BKE_curveprofile.h"
192# include "BKE_lib_id.hh"
193# include "BKE_main.hh"
194# include "BKE_vfont.hh"
195
196# include "DEG_depsgraph.hh"
197# include "DEG_depsgraph_build.hh"
198
199# include "WM_api.hh"
200
201# include "MEM_guardedalloc.h"
202
203# include "ED_curve.hh" /* for BKE_curve_nurbs_get */
204
205namespace blender {
206
207/* highly irritating but from RNA we can't know this */
208static Nurb *curve_nurb_from_point(Curve *cu, const void *point, int *nu_index, int *pt_index)
209{
210 ListBaseT<Nurb> *nurbs = BKE_curve_nurbs_get(cu);
211 Nurb *nu;
212 int i = 0;
213
214 for (nu = nurbs->first(); nu; nu = nu->next, i++) {
215 if (nu->type == CU_BEZIER) {
216 if (point >= static_cast<void *>(nu->bezt) &&
217 point < static_cast<void *>(nu->bezt + nu->pntsu))
218 {
219 break;
220 }
221 }
222 else {
223 if (point >= static_cast<void *>(nu->bp) &&
224 point < static_cast<void *>(nu->bp + (nu->pntsu * nu->pntsv)))
225 {
226 break;
227 }
228 }
229 }
230
231 if (nu) {
232 if (nu_index) {
233 *nu_index = i;
234 }
235
236 if (pt_index) {
237 if (nu->type == CU_BEZIER) {
238 *pt_index = int(static_cast<const BezTriple *>(point) - nu->bezt);
239 }
240 else {
241 *pt_index = int(static_cast<const BPoint *>(point) - nu->bp);
242 }
243 }
244 }
245
246 return nu;
247}
248
249static StructRNA *rna_Curve_refine(PointerRNA *ptr)
250{
251 const Curve *cu = static_cast<Curve *>(ptr->data);
252 switch (cu->ob_type) {
253 case OB_FONT: {
254 return RNA_TextCurve;
255 }
256 case OB_SURF: {
257 return RNA_SurfaceCurve;
258 }
259 default: {
260 return RNA_Curve;
261 }
262 }
263}
264
265static void rna_BezTriple_handle1_get(PointerRNA *ptr, float *values)
266{
267 BezTriple *bezt = static_cast<BezTriple *>(ptr->data);
268 copy_v3_v3(values, bezt->vec[0]);
269}
270
271static void rna_BezTriple_handle1_set(PointerRNA *ptr, const float *values)
272{
273 BezTriple *bezt = static_cast<BezTriple *>(ptr->data);
274 copy_v3_v3(bezt->vec[0], values);
275}
276
277static void rna_BezTriple_handle2_get(PointerRNA *ptr, float *values)
278{
279 BezTriple *bezt = static_cast<BezTriple *>(ptr->data);
280 copy_v3_v3(values, bezt->vec[2]);
281}
282
283static void rna_BezTriple_handle2_set(PointerRNA *ptr, const float *values)
284{
285 BezTriple *bezt = static_cast<BezTriple *>(ptr->data);
286 copy_v3_v3(bezt->vec[2], values);
287}
288
289static void rna_BezTriple_ctrlpoint_get(PointerRNA *ptr, float *values)
290{
291 BezTriple *bezt = static_cast<BezTriple *>(ptr->data);
292 copy_v3_v3(values, bezt->vec[1]);
293}
294
295static void rna_BezTriple_ctrlpoint_set(PointerRNA *ptr, const float *values)
296{
297 BezTriple *bezt = static_cast<BezTriple *>(ptr->data);
298 copy_v3_v3(bezt->vec[1], values);
299}
300
301static void rna_Curve_texspace_set(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
302{
303 Curve *cu = static_cast<Curve *>(ptr->data);
304
305 if (cu->texspace_flag & CU_TEXSPACE_FLAG_AUTO) {
307 }
308}
309
310static int rna_Curve_texspace_editable(const PointerRNA *ptr, const char ** /*r_info*/)
311{
312 Curve *cu = static_cast<Curve *>(ptr->data);
313 return (cu->texspace_flag & CU_TEXSPACE_FLAG_AUTO) ? PropertyFlag(0) : PROP_EDITABLE;
314}
315
316static void rna_Curve_texspace_location_get(PointerRNA *ptr, float *values)
317{
318 Curve *cu = static_cast<Curve *>(ptr->data);
319
321
322 copy_v3_v3(values, cu->texspace_location);
323}
324
325static void rna_Curve_texspace_location_set(PointerRNA *ptr, const float *values)
326{
327 Curve *cu = static_cast<Curve *>(ptr->data);
328
329 copy_v3_v3(cu->texspace_location, values);
330}
331
332static void rna_Curve_texspace_size_get(PointerRNA *ptr, float *values)
333{
334 Curve *cu = static_cast<Curve *>(ptr->data);
335
337
338 copy_v3_v3(values, cu->texspace_size);
339}
340
341static void rna_Curve_texspace_size_set(PointerRNA *ptr, const float *values)
342{
343 Curve *cu = static_cast<Curve *>(ptr->data);
344
345 copy_v3_v3(cu->texspace_size, values);
346}
347
348static void rna_Curve_material_index_range(
349 PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
350{
351 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
352 *min = 0;
353 *max = max_ii(0, cu->totcol - 1);
354}
355
356/* simply offset by don't expose -1 */
357static int rna_ChariInfo_material_index_get(PointerRNA *ptr)
358{
359 CharInfo *info = static_cast<CharInfo *>(ptr->data);
360 return info->mat_nr ? info->mat_nr : 0;
361}
362
363static void rna_ChariInfo_material_index_set(PointerRNA *ptr, int value)
364{
365 CharInfo *info = static_cast<CharInfo *>(ptr->data);
366 info->mat_nr = value;
367}
368
369static void rna_Curve_active_textbox_index_range(
370 PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
371{
372 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
373 *min = 0;
374 *max = max_ii(0, cu->totbox - 1);
375}
376
377static void rna_Curve_dimension_set(PointerRNA *ptr, int value)
378{
379 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
380 if (value == CU_3D) {
381 cu->flag |= CU_3D;
382 }
383 else {
384 cu->flag &= ~CU_3D;
386 }
387}
388
389static const EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext * /*C*/,
390 PointerRNA *ptr,
391 PropertyRNA * /*prop*/,
392 bool * /*r_free*/)
393{
394 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
395
396 /* cast to quiet warning it IS a const still */
397 return static_cast<const EnumPropertyItem *>((cu->flag & CU_3D) ? curve3d_fill_mode_items :
398 curve2d_fill_mode_items);
399}
400
401static int rna_Nurb_length(PointerRNA *ptr)
402{
403 Nurb *nu = static_cast<Nurb *>(ptr->data);
404 if (nu->type == CU_BEZIER) {
405 return 0;
406 }
407 return nu->pntsv > 0 ? nu->pntsu * nu->pntsv : nu->pntsu;
408}
409
410static void rna_Nurb_type_set(PointerRNA *ptr, int value)
411{
412 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
413 Nurb *nu = static_cast<Nurb *>(ptr->data);
414 const int pntsu_prev = nu->pntsu;
415
416 if (BKE_nurb_type_convert(nu, eNurbType(value), true, nullptr)) {
417 if (nu->pntsu != pntsu_prev) {
418 cu->actvert = CU_ACT_NONE;
419 }
420 }
421}
422
423static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
424{
425 Nurb *nu = static_cast<Nurb *>(ptr->data);
427 ptr,
428 static_cast<void *>(nu->bp),
429 sizeof(BPoint),
430 nu->pntsv > 0 ? nu->pntsu * nu->pntsv : nu->pntsu,
431 0,
432 nullptr);
433}
434
435static void rna_Curve_update_data_id(Main * /*bmain*/, Scene * /*scene*/, ID *id)
436{
437 DEG_id_tag_update(id, 0);
439}
440
441static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
442{
443 rna_Curve_update_data_id(bmain, scene, ptr->owner_id);
444}
445
446static void rna_Curve_update_deps(Main *bmain, Scene *scene, PointerRNA *ptr)
447{
449 rna_Curve_update_data(bmain, scene, ptr);
450}
451
452static void rna_Curve_update_points(Main *bmain, Scene *scene, PointerRNA *ptr)
453{
454 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
455 Nurb *nu = curve_nurb_from_point(cu, ptr->data, nullptr, nullptr);
456
457 if (nu) {
459 }
460
461 rna_Curve_update_data(bmain, scene, ptr);
462}
463
464static PointerRNA rna_Curve_bevelObject_get(PointerRNA *ptr)
465{
466 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
467 Object *ob = cu->bevobj;
468
469 if (ob) {
470 return RNA_id_pointer_create(reinterpret_cast<ID *>(ob));
471 }
472
473 return {};
474}
475
476static void rna_Curve_bevelObject_set(PointerRNA *ptr, PointerRNA value, ReportList * /*reports*/)
477{
478 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
479 Object *ob = static_cast<Object *>(value.data);
480
481 if (ob) {
482 /* If bevel object has got the save curve, as object, for which it's set as bevobj,
483 * there could be an infinite loop in curve evaluation. */
484 if (ob->type == OB_CURVES_LEGACY && ob->data != id_cast<ID *>(cu)) {
485 cu->bevobj = ob;
486 id_lib_extern(&ob->id);
487 }
488 }
489 else {
490 cu->bevobj = nullptr;
491 }
492}
493
498static void rna_Curve_bevel_resolution_update(Main *bmain, Scene *scene, PointerRNA *ptr)
499{
500 Curve *cu = static_cast<Curve *>(ptr->data);
501
502 if (cu->bevel_mode == CU_BEV_MODE_CURVE_PROFILE) {
503 BKE_curveprofile_init(cu->bevel_profile, cu->bevresol + 1);
504 }
505
506 rna_Curve_update_data(bmain, scene, ptr);
507}
508
509static void rna_Curve_bevel_mode_set(PointerRNA *ptr, int value)
510{
511 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
512
513 if (value == CU_BEV_MODE_CURVE_PROFILE) {
514 if (cu->bevel_profile == nullptr) {
515 cu->bevel_profile = BKE_curveprofile_add(PROF_PRESET_LINE);
516 BKE_curveprofile_init(cu->bevel_profile, cu->bevresol + 1);
517 }
518 }
519
520 cu->bevel_mode = eCurveBevelMode(value);
521}
522
523static bool rna_Curve_otherObject_poll(PointerRNA *ptr, PointerRNA value)
524{
525 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
526 Object *ob = static_cast<Object *>(value.data);
527
528 if (ob) {
529 if (ob->type == OB_CURVES_LEGACY && ob->data != id_cast<ID *>(cu)) {
530 return 1;
531 }
532 }
533
534 return 0;
535}
536
537static PointerRNA rna_Curve_taperObject_get(PointerRNA *ptr)
538{
539 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
540 Object *ob = cu->taperobj;
541
542 if (ob) {
543 return RNA_id_pointer_create(reinterpret_cast<ID *>(ob));
544 }
545
546 return {};
547}
548
549static void rna_Curve_taperObject_set(PointerRNA *ptr, PointerRNA value, ReportList * /*reports*/)
550{
551 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
552 Object *ob = static_cast<Object *>(value.data);
553
554 if (ob) {
555 /* If taper object has got the save curve, as object, for which it's set as bevobj,
556 * there could be an infinite loop in curve evaluation. */
557 if (ob->type == OB_CURVES_LEGACY && ob->data != id_cast<ID *>(cu)) {
558 cu->taperobj = ob;
559 id_lib_extern(&ob->id);
560 }
561 }
562 else {
563 cu->taperobj = nullptr;
564 }
565}
566
567static void rna_Curve_resolution_u_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
568{
569 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
570 ListBaseT<Nurb> *nurbs = BKE_curve_nurbs_get(cu);
571
572 for (Nurb &nu : *nurbs) {
573 nu.resolu = cu->resolu;
574 }
575
576 rna_Curve_update_data(bmain, scene, ptr);
577}
578
579static void rna_Curve_resolution_v_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
580{
581 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
582 ListBaseT<Nurb> *nurbs = BKE_curve_nurbs_get(cu);
583
584 for (Nurb &nu : *nurbs) {
585 nu.resolv = cu->resolv;
586 }
587
588 rna_Curve_update_data(bmain, scene, ptr);
589}
590
591static float rna_Curve_offset_get(PointerRNA *ptr)
592{
593 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
594 return cu->offset - 1.0f;
595}
596
597static void rna_Curve_offset_set(PointerRNA *ptr, float value)
598{
599 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
600 cu->offset = 1.0f + value;
601}
602
603static int rna_Curve_body_length(PointerRNA *ptr);
604static void rna_Curve_body_get(PointerRNA *ptr, char *value)
605{
606 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
607 memcpy(value, cu->str, rna_Curve_body_length(ptr) + 1);
608}
609
610static int rna_Curve_body_length(PointerRNA *ptr)
611{
612 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
613 return cu->len;
614}
615
616/* TODO: how to handle editmode? */
617static void rna_Curve_body_set(PointerRNA *ptr, const char *value)
618{
619 size_t len_bytes;
620 size_t len_chars = BLI_strlen_utf8_ex(value, &len_bytes);
621
622 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
623
624 cu->len_char32 = len_chars;
625 cu->len = len_bytes;
626 cu->pos = len_chars;
627
628 if (cu->str) {
629 MEM_delete(cu->str);
630 }
631 if (cu->strinfo) {
632 MEM_delete(cu->strinfo);
633 }
634
635 cu->str = MEM_new_array_uninitialized<char>(len_bytes + sizeof(char32_t), "str");
636 memcpy(cu->str, value, len_bytes + 1);
637
638 cu->strinfo = MEM_new_array<CharInfo>((len_chars + 4), "strinfo");
639}
640
641static void rna_Nurb_update_cyclic_u(Main *bmain, Scene *scene, PointerRNA *ptr)
642{
643 Nurb *nu = static_cast<Nurb *>(ptr->data);
644
645 if (nu->type == CU_BEZIER) {
647 }
648 else {
650 }
651
652 rna_Curve_update_data(bmain, scene, ptr);
653}
654
655static void rna_Nurb_update_cyclic_v(Main *bmain, Scene *scene, PointerRNA *ptr)
656{
657 Nurb *nu = static_cast<Nurb *>(ptr->data);
658
660
661 rna_Curve_update_data(bmain, scene, ptr);
662}
663
664static void rna_Nurb_update_knot_u(Main *bmain, Scene *scene, PointerRNA *ptr)
665{
666 Nurb *nu = static_cast<Nurb *>(ptr->data);
667
670
671 rna_Curve_update_data(bmain, scene, ptr);
672}
673
674static void rna_Nurb_update_knot_v(Main *bmain, Scene *scene, PointerRNA *ptr)
675{
676 Nurb *nu = static_cast<Nurb *>(ptr->data);
677
680
681 rna_Curve_update_data(bmain, scene, ptr);
682}
683
684static void rna_Curve_spline_points_add(ID *id, Nurb *nu, ReportList *reports, int number)
685{
686 if (nu->type == CU_BEZIER) {
687 BKE_report(reports, RPT_ERROR, "Bézier spline cannot have points added");
688 }
689 else if (number == 0) {
690 /* do nothing */
691 }
692 else {
693
694 BKE_nurb_points_add(nu, number);
695
696 /* update */
698
699 rna_Curve_update_data_id(nullptr, nullptr, id);
700 }
701}
702
703static void rna_Curve_spline_bezpoints_add(ID *id, Nurb *nu, ReportList *reports, int number)
704{
705 if (nu->type != CU_BEZIER) {
706 BKE_report(reports, RPT_ERROR, "Only Bézier splines can be added");
707 }
708 else if (number == 0) {
709 /* do nothing */
710 }
711 else {
712 BKE_nurb_bezierPoints_add(nu, number);
713
714 /* update */
716
717 rna_Curve_update_data_id(nullptr, nullptr, id);
718 }
719}
720
721static Nurb *rna_Curve_spline_new(Curve *cu, int type_i)
722{
723 Nurb *nu = MEM_new<Nurb>("spline.new");
724 const eNurbType type = eNurbType(type_i);
725
726 if (type == CU_BEZIER) {
727 BezTriple *bezt = MEM_new_zeroed<BezTriple>("spline.new.bezt");
728 bezt->radius = 1.0;
729 nu->bezt = bezt;
730 }
731 else {
732 BPoint *bp = MEM_new_zeroed<BPoint>("spline.new.bp");
733 bp->radius = 1.0f;
734 nu->bp = bp;
735 }
736
737 nu->type = type;
738 nu->pntsu = 1;
739 nu->pntsv = 1;
740
741 nu->orderu = nu->orderv = 4;
742 nu->resolu = cu->resolu;
743 nu->resolv = cu->resolv;
744 nu->flag = CU_SMOOTH;
745
747
748 return nu;
749}
750
751static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, PointerRNA *nu_ptr)
752{
753 Nurb *nu = static_cast<Nurb *>(nu_ptr->data);
754 ListBaseT<Nurb> *nurbs = BKE_curve_nurbs_get(cu);
755
756 if (BLI_remlink_safe(nurbs, nu) == false) {
757 BKE_reportf(reports, RPT_ERROR, "Curve '%s' does not contain spline given", cu->id.name + 2);
758 return;
759 }
760
761 BKE_nurb_free(nu);
762 nu_ptr->invalidate();
763
766}
767
768static void rna_Curve_spline_clear(Curve *cu)
769{
770 ListBaseT<Nurb> *nurbs = BKE_curve_nurbs_get(cu);
771
772 BKE_nurbList_free(nurbs);
773
776}
777
778static PointerRNA rna_Curve_active_spline_get(PointerRNA *ptr)
779{
780 Curve *cu = static_cast<Curve *>(ptr->data);
781 Nurb *nu;
782 ListBaseT<Nurb> *nurbs = BKE_curve_nurbs_get(cu);
783
784 /* For curve outside editmode will set to -1,
785 * should be changed to be allowed outside of editmode. */
786 nu = static_cast<Nurb *>(BLI_findlink(nurbs, cu->actnu));
787
788 if (nu) {
789 return RNA_pointer_create_with_parent(*ptr, RNA_Spline, nu);
790 }
791
792 return {};
793}
794
795static void rna_Curve_active_spline_set(PointerRNA *ptr,
796 PointerRNA value,
797 ReportList * /*reports*/)
798{
799 Curve *cu = static_cast<Curve *>(ptr->data);
800 Nurb *nu = static_cast<Nurb *>(value.data);
801 ListBaseT<Nurb> *nubase = BKE_curve_nurbs_get(cu);
802
803 /* -1 is ok for an unset index */
804 if (nu == nullptr) {
805 cu->actnu = -1;
806 }
807 else {
808 cu->actnu = BLI_findindex(nubase, nu);
809 }
810}
811
812static std::optional<std::string> rna_Curve_spline_path(const PointerRNA *ptr)
813{
814 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
815 ListBaseT<Nurb> *nubase = BKE_curve_nurbs_get(cu);
816 Nurb *nu = static_cast<Nurb *>(ptr->data);
817 int index = BLI_findindex(nubase, nu);
818
819 if (index >= 0) {
820 return fmt::format("splines[{}]", index);
821 }
822 return "";
823}
824
825/* use for both bezier and nurbs */
826static std::optional<std::string> rna_Curve_spline_point_path(const PointerRNA *ptr)
827{
828 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
829 Nurb *nu;
830 void *point = ptr->data;
831 int nu_index, pt_index;
832
833 nu = curve_nurb_from_point(cu, point, &nu_index, &pt_index);
834
835 if (nu) {
836 if (nu->type == CU_BEZIER) {
837 return fmt::format("splines[{}].bezier_points[{}]", nu_index, pt_index);
838 }
839 return fmt::format("splines[{}].points[{}]", nu_index, pt_index);
840 }
841 return "";
842}
843
844static std::optional<std::string> rna_TextBox_path(const PointerRNA *ptr)
845{
846 const Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
847 const TextBox *tb = static_cast<TextBox *>(ptr->data);
848 int index = int(tb - cu->tb);
849
850 if (index >= 0 && index < cu->totbox) {
851 return fmt::format("text_boxes[{}]", index);
852 }
853 return "";
854}
855
856static void rna_Curve_splines_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
857{
858 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
859 rna_iterator_listbase_begin(iter, ptr, BKE_curve_nurbs_get(cu), nullptr);
860}
861
862static bool rna_Curve_is_editmode_get(PointerRNA *ptr)
863{
864 const Curve *cu = reinterpret_cast<const Curve *>(ptr->owner_id);
865 if (cu->ob_type == OB_FONT) {
866 return (cu->editfont != nullptr);
867 }
868 else {
869 return (cu->editnurb != nullptr);
870 }
871}
872
873static bool rna_TextCurve_is_select_bold_get(PointerRNA *ptr)
874{
875 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
876 if (cu->editfont != nullptr) {
877 return (cu->editfont->select_char_info_flag & CU_CHINFO_BOLD);
878 }
879 return false;
880}
881
882static bool rna_TextCurve_is_select_italic_get(PointerRNA *ptr)
883{
884 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
885 if (cu->editfont != nullptr) {
886 return (cu->editfont->select_char_info_flag & CU_CHINFO_ITALIC);
887 }
888 return false;
889}
890
891static bool rna_TextCurve_is_select_underline_get(PointerRNA *ptr)
892{
893 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
894 if (cu->editfont != nullptr) {
895 return (cu->editfont->select_char_info_flag & CU_CHINFO_UNDERLINE);
896 }
897 return false;
898}
899
900static bool rna_TextCurve_is_select_smallcaps_get(PointerRNA *ptr)
901{
902 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
903 if (cu->editfont != nullptr) {
904 return (cu->editfont->select_char_info_flag & CU_CHINFO_SMALLCAPS);
905 }
906 return false;
907}
908
909static bool rna_TextCurve_has_selection_get(PointerRNA *ptr)
910{
911 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
912 if (cu->editfont != nullptr) {
913 return (cu->editfont->selboxes != nullptr);
914 }
915 return false;
916}
917
918} // namespace blender
919
920#else
921
922namespace blender {
923
924static const float tilt_limit = DEG2RADF(21600.0f);
925
926static void rna_def_bpoint(BlenderRNA *brna)
927{
928 StructRNA *srna;
929 PropertyRNA *prop;
930
931 srna = RNA_def_struct(brna, "SplinePoint", nullptr);
932 RNA_def_struct_sdna(srna, "BPoint");
933 RNA_def_struct_ui_text(srna, "SplinePoint", "Spline point without handles");
934
935 /* Boolean values */
936 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
937 RNA_def_property_boolean_sdna(prop, nullptr, "f1", SELECT);
938 RNA_def_property_ui_text(prop, "Select", "Selection status");
939 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
940
941 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
942 RNA_def_property_boolean_sdna(prop, nullptr, "hide", 0);
943 RNA_def_property_ui_text(prop, "Hide", "Visibility status");
944 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
945
946 /* Vector value */
947 prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
948 RNA_def_property_array(prop, 3);
949 RNA_def_property_float_sdna(prop, nullptr, "vec");
950 RNA_def_property_ui_text(prop, "Point", "Point coordinates");
952 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
953
954 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
955 RNA_def_property_float_sdna(prop, nullptr, "vec[3]");
956 RNA_def_property_ui_text(prop, "Weight", "NURBS weight");
957 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
958
959 /* Number values */
960 prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
963 RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
964 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
965
966 prop = RNA_def_property(srna, "weight_softbody", PROP_FLOAT, PROP_NONE);
967 RNA_def_property_float_sdna(prop, nullptr, "weight");
968 RNA_def_property_range(prop, 0.01f, 100.0f);
969 RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
970 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
971
972 prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
973 RNA_def_property_float_sdna(prop, nullptr, "radius");
974 RNA_def_property_range(prop, 0.0f, FLT_MAX);
975 RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for beveling");
976 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
977
978 RNA_def_struct_path_func(srna, "rna_Curve_spline_point_path");
979}
980
982{
983 StructRNA *srna;
984 PropertyRNA *prop;
985
986 srna = RNA_def_struct(brna, "BezierSplinePoint", nullptr);
987 RNA_def_struct_sdna(srna, "BezTriple");
988 RNA_def_struct_ui_text(srna, "Bézier Curve Point", "Bézier curve point with two handles");
989
990 /* Boolean values */
991 prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
992 RNA_def_property_boolean_sdna(prop, nullptr, "f1", SELECT);
993 RNA_def_property_ui_text(prop, "Handle 1 selected", "Handle 1 selection status");
994 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
995
996 prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
997 RNA_def_property_boolean_sdna(prop, nullptr, "f3", SELECT);
998 RNA_def_property_ui_text(prop, "Handle 2 selected", "Handle 2 selection status");
999 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1000
1001 prop = RNA_def_property(srna, "select_control_point", PROP_BOOLEAN, PROP_NONE);
1002 RNA_def_property_boolean_sdna(prop, nullptr, "f2", SELECT);
1003 RNA_def_property_ui_text(prop, "Control Point selected", "Control point selection status");
1004 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1005
1006 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
1007 RNA_def_property_boolean_sdna(prop, nullptr, "hide", 0);
1008 RNA_def_property_ui_text(prop, "Hide", "Visibility status");
1009 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1010
1011 /* Enums */
1012 prop = RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
1013 RNA_def_property_enum_sdna(prop, nullptr, "h1");
1015 RNA_def_property_ui_text(prop, "Handle 1 Type", "Handle types");
1016 RNA_def_property_update(prop, 0, "rna_Curve_update_points");
1017
1018 prop = RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
1019 RNA_def_property_enum_sdna(prop, nullptr, "h2");
1021 RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle types");
1022 RNA_def_property_update(prop, 0, "rna_Curve_update_points");
1023
1024 /* Vector values */
1025 prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
1026 RNA_def_property_array(prop, 3);
1028 prop, "rna_BezTriple_handle1_get", "rna_BezTriple_handle1_set", nullptr);
1029 RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle");
1031 RNA_def_property_update(prop, 0, "rna_Curve_update_points");
1032
1033 prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
1034 RNA_def_property_array(prop, 3);
1036 prop, "rna_BezTriple_ctrlpoint_get", "rna_BezTriple_ctrlpoint_set", nullptr);
1037 RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
1039 RNA_def_property_update(prop, 0, "rna_Curve_update_points");
1040
1041 prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
1042 RNA_def_property_array(prop, 3);
1044 prop, "rna_BezTriple_handle2_get", "rna_BezTriple_handle2_set", nullptr);
1045 RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle");
1047 RNA_def_property_update(prop, 0, "rna_Curve_update_points");
1048
1049 /* Number values */
1050 prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
1053 RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
1054 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1055
1056 prop = RNA_def_property(srna, "weight_softbody", PROP_FLOAT, PROP_NONE);
1057 RNA_def_property_float_sdna(prop, nullptr, "weight");
1058 RNA_def_property_range(prop, 0.01f, 100.0f);
1059 RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
1060 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1061
1062 prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
1063 RNA_def_property_float_sdna(prop, nullptr, "radius");
1064 RNA_def_property_range(prop, 0.0f, FLT_MAX);
1065 RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for beveling");
1066 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1067
1068 RNA_def_struct_path_func(srna, "rna_Curve_spline_point_path");
1069}
1070
1071static void rna_def_path(BlenderRNA * /*brna*/, StructRNA *srna)
1072{
1073 PropertyRNA *prop;
1074
1075 /* number values */
1076 prop = RNA_def_property(srna, "path_duration", PROP_INT, PROP_TIME);
1077 RNA_def_property_int_sdna(prop, nullptr, "pathlen");
1080 "Path Duration",
1081 "The number of frames that are needed to traverse the path, "
1082 "defining the maximum value for the 'Evaluation Time' setting");
1083 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1084
1085 /* flags */
1086 prop = RNA_def_property(srna, "use_path", PROP_BOOLEAN, PROP_NONE);
1087 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_PATH);
1088 RNA_def_property_ui_text(prop, "Path", "Enable the curve to become a translation path");
1089 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1090
1091 prop = RNA_def_property(srna, "use_path_follow", PROP_BOOLEAN, PROP_NONE);
1092 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_FOLLOW);
1093 RNA_def_property_ui_text(prop, "Follow", "Make curve path children rotate along the path");
1094 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1095
1096 prop = RNA_def_property(srna, "use_path_clamp", PROP_BOOLEAN, PROP_NONE);
1097 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_PATH_CLAMP);
1099 prop,
1100 "Clamp",
1101 "Clamp the curve path children so they cannot travel past the start/end point of the curve");
1102 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1103
1104 prop = RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
1105 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_STRETCH);
1107 "Stretch",
1108 "Option for curve-deform: "
1109 "make deformed child stretch along entire path");
1110 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1111
1112 prop = RNA_def_property(srna, "use_deform_bounds", PROP_BOOLEAN, PROP_NONE);
1115 "Bounds Clamp",
1116 "Option for curve-deform: "
1117 "Use the mesh bounds to clamp the deformation");
1118 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1119
1120 prop = RNA_def_property(srna, "use_radius", PROP_BOOLEAN, PROP_NONE);
1121 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_PATH_RADIUS);
1123 "Radius",
1124 "Option for paths and curve-deform: "
1125 "apply the curve radius to objects following it "
1126 "and to deformed objects");
1127 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1128}
1129
1130static void rna_def_nurbs(BlenderRNA * /*brna*/, StructRNA * /*srna*/)
1131{
1132 /* Nothing. */
1133}
1134
1135static void rna_def_font(BlenderRNA * /*brna*/, StructRNA *srna)
1136{
1137 PropertyRNA *prop;
1138
1139 static const EnumPropertyItem prop_align_items[] = {
1140 {CU_ALIGN_X_LEFT, "LEFT", ICON_ALIGN_LEFT, "Left", "Align text to the left"},
1141 {CU_ALIGN_X_MIDDLE, "CENTER", ICON_ALIGN_CENTER, "Center", "Center text"},
1142 {CU_ALIGN_X_RIGHT, "RIGHT", ICON_ALIGN_RIGHT, "Right", "Align text to the right"},
1144 "JUSTIFY",
1145 ICON_ALIGN_JUSTIFY,
1146 "Justify",
1147 "Align to the left and the right"},
1149 "FLUSH",
1150 ICON_ALIGN_FLUSH,
1151 "Flush",
1152 "Align to the left and the right, with equal character spacing"},
1153 {0, nullptr, 0, nullptr, nullptr},
1154 };
1155
1156 static const EnumPropertyItem prop_align_y_items[] = {
1157 {CU_ALIGN_Y_TOP, "TOP", ICON_ALIGN_TOP, "Top", "Align text to the top"},
1159 "TOP_BASELINE",
1160 ICON_ALIGN_TOP,
1161 "Top Baseline",
1162 "Align text to the top line's baseline"},
1163 {CU_ALIGN_Y_CENTER, "CENTER", ICON_ALIGN_MIDDLE, "Middle", "Align text to the middle"},
1165 "BOTTOM_BASELINE",
1166 ICON_ALIGN_BOTTOM,
1167 "Bottom Baseline",
1168 "Align text to the bottom line's baseline"},
1169 {CU_ALIGN_Y_BOTTOM, "BOTTOM", ICON_ALIGN_BOTTOM, "Bottom", "Align text to the bottom"},
1170 {0, nullptr, 0, nullptr, nullptr},
1171 };
1172
1173 static const EnumPropertyItem prop_overflow_items[] = {
1174 {CU_OVERFLOW_NONE, "NONE", 0, "Overflow", "Let the text overflow outside the text boxes"},
1176 "SCALE",
1177 0,
1178 "Scale to Fit",
1179 "Scale down the text to fit inside the text boxes"},
1181 "TRUNCATE",
1182 0,
1183 "Truncate",
1184 "Truncate the text that would go outside the text boxes"},
1185 {0, nullptr, 0, nullptr, nullptr},
1186 };
1187
1188 /* Enums */
1189 prop = RNA_def_property(srna, "align_x", PROP_ENUM, PROP_NONE);
1190 RNA_def_property_enum_sdna(prop, nullptr, "spacemode");
1191 RNA_def_property_enum_items(prop, prop_align_items);
1193 "Horizontal Alignment",
1194 "Text horizontal alignment from the object or text box center");
1195 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1196
1197 prop = RNA_def_property(srna, "align_y", PROP_ENUM, PROP_NONE);
1198 RNA_def_property_enum_sdna(prop, nullptr, "align_y");
1199 RNA_def_property_enum_items(prop, prop_align_y_items);
1201 prop, "Vertical Alignment", "Text vertical alignment from the object center");
1202 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1203
1204 prop = RNA_def_property(srna, "overflow", PROP_ENUM, PROP_NONE);
1205 RNA_def_property_enum_sdna(prop, nullptr, "overflow");
1206 RNA_def_property_enum_items(prop, prop_overflow_items);
1209 prop, "TextBox Overflow", "Handle the text behavior when it does not fit in the text boxes");
1210 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1211
1212 /* number values */
1213 prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
1214 RNA_def_property_float_sdna(prop, nullptr, "fsize");
1215 RNA_def_property_range(prop, 0.0001f, 10000.0f);
1216 RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
1217 RNA_def_property_ui_text(prop, "Font Size", "");
1218 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1219
1220 prop = RNA_def_property(srna, "small_caps_scale", PROP_FLOAT, PROP_NONE);
1221 RNA_def_property_float_sdna(prop, nullptr, "smallcaps_scale");
1222 RNA_def_property_ui_range(prop, 0, 1.0, 1, 2);
1223 RNA_def_property_ui_text(prop, "Small Caps", "Scale of small capitals");
1224 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1225
1226 prop = RNA_def_property(srna, "space_line", PROP_FLOAT, PROP_NONE);
1227 RNA_def_property_float_sdna(prop, nullptr, "linedist");
1228 RNA_def_property_range(prop, 0.0f, 10.0f);
1229 RNA_def_property_ui_text(prop, "Distance between lines of text", "");
1230 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1231
1232 prop = RNA_def_property(srna, "space_word", PROP_FLOAT, PROP_NONE);
1233 RNA_def_property_float_sdna(prop, nullptr, "wordspace");
1234 RNA_def_property_range(prop, 0.0f, 10.0f);
1235 RNA_def_property_ui_text(prop, "Spacing between words", "");
1236 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1237
1238 prop = RNA_def_property(srna, "space_character", PROP_FLOAT, PROP_NONE);
1239 RNA_def_property_float_sdna(prop, nullptr, "spacing");
1240 RNA_def_property_range(prop, 0.0f, 10.0f);
1241 RNA_def_property_ui_text(prop, "Global spacing between characters", "");
1242 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1243
1244 prop = RNA_def_property(srna, "shear", PROP_FLOAT, PROP_NONE);
1245 RNA_def_property_float_sdna(prop, nullptr, "shear");
1246 RNA_def_property_range(prop, -1.0f, 1.0f);
1247 RNA_def_property_ui_text(prop, "Shear", "Italic angle of the characters");
1248 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1249
1250 prop = RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_DISTANCE);
1251 RNA_def_property_float_sdna(prop, nullptr, "xof");
1253 RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
1254 RNA_def_property_ui_text(prop, "X Offset", "Horizontal offset from the object origin");
1255 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1256
1257 prop = RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_DISTANCE);
1258 RNA_def_property_float_sdna(prop, nullptr, "yof");
1260 RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
1261 RNA_def_property_ui_text(prop, "Y Offset", "Vertical offset from the object origin");
1262 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1263
1264 prop = RNA_def_property(srna, "underline_position", PROP_FLOAT, PROP_NONE);
1265 RNA_def_property_float_sdna(prop, nullptr, "ulpos");
1266 RNA_def_property_range(prop, -0.2f, 0.8f);
1267 RNA_def_property_ui_text(prop, "Underline Position", "Vertical position of underline");
1268 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1269
1270 prop = RNA_def_property(srna, "underline_height", PROP_FLOAT, PROP_NONE);
1271 RNA_def_property_float_sdna(prop, nullptr, "ulheight");
1272 RNA_def_property_range(prop, 0.0f, 0.8f);
1273 RNA_def_property_ui_text(prop, "Underline Thickness", "");
1274 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1275
1276 prop = RNA_def_property(srna, "text_boxes", PROP_COLLECTION, PROP_NONE);
1277 RNA_def_property_collection_sdna(prop, nullptr, "tb", "totbox");
1278 RNA_def_property_struct_type(prop, "TextBox");
1279 RNA_def_property_ui_text(prop, "TextBoxes", "");
1280
1281 prop = RNA_def_property(srna, "active_textbox", PROP_INT, PROP_NONE);
1282 RNA_def_property_int_sdna(prop, nullptr, "actbox");
1283 RNA_def_property_ui_text(prop, "Active Text Box", "");
1284 RNA_def_property_int_funcs(prop, nullptr, nullptr, "rna_Curve_active_textbox_index_range");
1285
1286 /* strings */
1287 prop = RNA_def_property(srna, "family", PROP_STRING, PROP_NONE);
1290 prop,
1291 "Object Font",
1292 "Use objects as font characters (give font objects a common name "
1293 "followed by the character they represent, eg. 'family-a', 'family-b', etc, "
1294 "set this setting to 'family-', and turn on Vertex Instancing)");
1295 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1296
1297 prop = RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
1298 RNA_def_property_string_sdna(prop, nullptr, "str");
1299 RNA_def_property_ui_text(prop, "Body Text", "Content of this text object");
1301 prop, "rna_Curve_body_get", "rna_Curve_body_length", "rna_Curve_body_set");
1302 /* note that originally str did not have a limit! */
1304 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1305
1306 prop = RNA_def_property(srna, "body_format", PROP_COLLECTION, PROP_NONE);
1307 RNA_def_property_collection_sdna(prop, nullptr, "strinfo", "len_char32");
1308 RNA_def_property_struct_type(prop, "TextCharacterFormat");
1309 RNA_def_property_ui_text(prop, "Character Info", "Stores the style of each character");
1310
1311 /* pointers */
1312 prop = RNA_def_property(srna, "follow_curve", PROP_POINTER, PROP_NONE);
1313 RNA_def_property_pointer_sdna(prop, nullptr, "textoncurve");
1314 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, "rna_Curve_otherObject_poll");
1317 RNA_def_property_ui_text(prop, "Text on Curve", "Curve deforming text object");
1318 RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
1319
1320 prop = RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
1321 RNA_def_property_pointer_sdna(prop, nullptr, "vfont");
1322 RNA_def_property_ui_text(prop, "Font", "");
1325 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1326
1327 prop = RNA_def_property(srna, "font_bold", PROP_POINTER, PROP_NONE);
1328 RNA_def_property_pointer_sdna(prop, nullptr, "vfontb");
1329 RNA_def_property_ui_text(prop, "Font Bold", "");
1332 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1333
1334 prop = RNA_def_property(srna, "font_italic", PROP_POINTER, PROP_NONE);
1335 RNA_def_property_pointer_sdna(prop, nullptr, "vfonti");
1336 RNA_def_property_ui_text(prop, "Font Italic", "");
1339 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1340
1341 prop = RNA_def_property(srna, "font_bold_italic", PROP_POINTER, PROP_NONE);
1342 RNA_def_property_pointer_sdna(prop, nullptr, "vfontbi");
1343 RNA_def_property_ui_text(prop, "Font Bold Italic", "");
1346 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1347
1348 prop = RNA_def_property(srna, "edit_format", PROP_POINTER, PROP_NONE);
1349 RNA_def_property_pointer_sdna(prop, nullptr, "curinfo");
1350 RNA_def_property_ui_text(prop, "Edit Format", "Editing settings character formatting");
1351 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1352
1353 /* flags */
1354 prop = RNA_def_property(srna, "use_fast_edit", PROP_BOOLEAN, PROP_NONE);
1355 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_FAST);
1356 RNA_def_property_ui_text(prop, "Fast Editing", "Don't fill polygons while editing");
1357 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1358
1359 prop = RNA_def_property(srna, "is_select_bold", PROP_BOOLEAN, PROP_NONE);
1360 RNA_def_property_boolean_funcs(prop, "rna_TextCurve_is_select_bold_get", nullptr);
1361 RNA_def_property_ui_text(prop, "Selected Bold", "Whether the selected text is bold");
1363
1364 prop = RNA_def_property(srna, "is_select_italic", PROP_BOOLEAN, PROP_NONE);
1365 RNA_def_property_boolean_funcs(prop, "rna_TextCurve_is_select_italic_get", nullptr);
1366 RNA_def_property_ui_text(prop, "Selected Italic", "Whether the selected text is italics");
1368
1369 prop = RNA_def_property(srna, "is_select_underline", PROP_BOOLEAN, PROP_NONE);
1370 RNA_def_property_boolean_funcs(prop, "rna_TextCurve_is_select_underline_get", nullptr);
1371 RNA_def_property_ui_text(prop, "Selected Underline", "Whether the selected text is underlined");
1373
1374 prop = RNA_def_property(srna, "is_select_smallcaps", PROP_BOOLEAN, PROP_NONE);
1375 RNA_def_property_boolean_funcs(prop, "rna_TextCurve_is_select_smallcaps_get", nullptr);
1376 RNA_def_property_ui_text(prop, "Selected Small Caps", "Whether the selected text is small caps");
1378
1379 prop = RNA_def_property(srna, "has_selection", PROP_BOOLEAN, PROP_NONE);
1380 RNA_def_property_boolean_funcs(prop, "rna_TextCurve_has_selection_get", nullptr);
1381 RNA_def_property_ui_text(prop, "Text Selected", "Whether there is any text selected");
1383}
1384
1385static void rna_def_textbox(BlenderRNA *brna)
1386{
1387 StructRNA *srna;
1388 PropertyRNA *prop;
1389
1390 srna = RNA_def_struct(brna, "TextBox", nullptr);
1391 RNA_def_struct_ui_text(srna, "Text Box", "Text bounding box for layout");
1392
1393 /* number values */
1394 prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_DISTANCE);
1395 RNA_def_property_float_sdna(prop, nullptr, "x");
1397 RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
1398 RNA_def_property_ui_text(prop, "TextBox X Offset", "");
1399 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1400
1401 prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_DISTANCE);
1402 RNA_def_property_float_sdna(prop, nullptr, "y");
1404 RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
1405 RNA_def_property_ui_text(prop, "TextBox Y Offset", "");
1406 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1407
1408 prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
1409 RNA_def_property_float_sdna(prop, nullptr, "w");
1410 RNA_def_property_range(prop, 0.0f, FLT_MAX);
1411 RNA_def_property_ui_range(prop, 0.0f, 50.0f, 10, 3);
1412 RNA_def_property_ui_text(prop, "TextBox Width", "");
1413 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1414
1415 prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
1416 RNA_def_property_float_sdna(prop, nullptr, "h");
1417 RNA_def_property_range(prop, 0.0f, FLT_MAX);
1418 RNA_def_property_ui_range(prop, 0.0f, 50.0f, 10, 3);
1419 RNA_def_property_ui_text(prop, "TextBox Height", "");
1420 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1421
1422 RNA_def_struct_path_func(srna, "rna_TextBox_path");
1423}
1424
1426{
1427 StructRNA *srna;
1428 PropertyRNA *prop;
1429
1430 srna = RNA_def_struct(brna, "TextCharacterFormat", nullptr);
1431 RNA_def_struct_sdna(srna, "CharInfo");
1432 RNA_def_struct_ui_text(srna, "Text Character Format", "Text character formatting settings");
1433
1434 /* flags */
1435 prop = RNA_def_property(srna, "use_bold", PROP_BOOLEAN, PROP_NONE);
1436 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_CHINFO_BOLD);
1437 RNA_def_property_ui_text(prop, "Bold", "");
1438 RNA_def_property_ui_icon(prop, ICON_BOLD, 0);
1439 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1440
1441 prop = RNA_def_property(srna, "use_italic", PROP_BOOLEAN, PROP_NONE);
1442 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_CHINFO_ITALIC);
1443 RNA_def_property_ui_text(prop, "Italic", "");
1444 RNA_def_property_ui_icon(prop, ICON_ITALIC, 0);
1445 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1446
1447 prop = RNA_def_property(srna, "use_underline", PROP_BOOLEAN, PROP_NONE);
1448 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_CHINFO_UNDERLINE);
1449 RNA_def_property_ui_text(prop, "Underline", "");
1450 RNA_def_property_ui_icon(prop, ICON_UNDERLINE, 0);
1451 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1452
1453 prop = RNA_def_property(srna, "use_small_caps", PROP_BOOLEAN, PROP_NONE);
1454 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_CHINFO_SMALLCAPS);
1455 RNA_def_property_ui_text(prop, "Small Caps", "");
1456 RNA_def_property_ui_icon(prop, ICON_SMALL_CAPS, 0);
1457 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1458
1459 prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
1460 // RNA_def_property_int_sdna(prop, nullptr, "mat_nr");
1461 RNA_def_property_ui_text(prop, "Material Index", "Material slot index of this character");
1463 "rna_ChariInfo_material_index_get",
1464 "rna_ChariInfo_material_index_set",
1465 "rna_Curve_material_index_range");
1466 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1467
1468 prop = RNA_def_property(srna, "kerning", PROP_FLOAT, PROP_NONE);
1469 RNA_def_property_float_sdna(prop, nullptr, "kern");
1470 RNA_def_property_ui_text(prop, "Kerning", "Spacing between characters");
1471 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1472}
1473
1474static void rna_def_surface(BlenderRNA *brna)
1475{
1476 StructRNA *srna;
1477
1478 srna = RNA_def_struct(brna, "SurfaceCurve", "Curve");
1479 RNA_def_struct_sdna(srna, "Curve");
1480 RNA_def_struct_ui_text(srna, "Surface Curve", "Curve data-block used for storing surfaces");
1481 RNA_def_struct_ui_icon(srna, ICON_SURFACE_DATA);
1482
1483 rna_def_nurbs(brna, srna);
1484}
1485
1486static void rna_def_text(BlenderRNA *brna)
1487{
1488 StructRNA *srna;
1489
1490 srna = RNA_def_struct(brna, "TextCurve", "Curve");
1491 RNA_def_struct_sdna(srna, "Curve");
1492 RNA_def_struct_ui_text(srna, "Text Curve", "Curve data-block used for storing text");
1493 RNA_def_struct_ui_icon(srna, ICON_FONT_DATA);
1494
1495 rna_def_font(brna, srna);
1496 rna_def_nurbs(brna, srna);
1497}
1498
1499/* curve.splines[0].points */
1501{
1502 StructRNA *srna;
1503 // PropertyRNA *prop;
1504
1505 FunctionRNA *func;
1506 PropertyRNA *parm;
1507
1508 RNA_def_property_srna(cprop, "SplinePoints");
1509 srna = RNA_def_struct(brna, "SplinePoints", nullptr);
1510 RNA_def_struct_sdna(srna, "Nurb");
1511 RNA_def_struct_ui_text(srna, "Spline Points", "Collection of spline points");
1512
1513 func = RNA_def_function(srna, "add", "rna_Curve_spline_points_add");
1514 RNA_def_function_ui_description(func, "Add a number of points to this spline");
1516 parm = RNA_def_int(
1517 func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
1519
1520# if 0
1521 func = RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
1522 RNA_def_function_ui_description(func, "Remove a spline from a curve");
1524 parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
1527# endif
1528}
1529
1531{
1532 StructRNA *srna;
1533 // PropertyRNA *prop;
1534
1535 FunctionRNA *func;
1536 PropertyRNA *parm;
1537
1538 RNA_def_property_srna(cprop, "SplineBezierPoints");
1539 srna = RNA_def_struct(brna, "SplineBezierPoints", nullptr);
1540 RNA_def_struct_sdna(srna, "Nurb");
1541 RNA_def_struct_ui_text(srna, "Spline Bézier Points", "Collection of spline Bézier points");
1542
1543 func = RNA_def_function(srna, "add", "rna_Curve_spline_bezpoints_add");
1544 RNA_def_function_ui_description(func, "Add a number of points to this spline");
1546 parm = RNA_def_int(
1547 func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
1549
1550# if 0
1551 func = RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
1552 RNA_def_function_ui_description(func, "Remove a spline from a curve");
1554 parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
1557# endif
1558}
1559
1560/* curve.splines */
1562{
1563 StructRNA *srna;
1564 PropertyRNA *prop;
1565
1566 FunctionRNA *func;
1567 PropertyRNA *parm;
1568
1569 RNA_def_property_srna(cprop, "CurveSplines");
1570 srna = RNA_def_struct(brna, "CurveSplines", nullptr);
1571 RNA_def_struct_sdna(srna, "Curve");
1572 RNA_def_struct_ui_text(srna, "Curve Splines", "Collection of curve splines");
1573
1574 func = RNA_def_function(srna, "new", "rna_Curve_spline_new");
1575 RNA_def_function_ui_description(func, "Add a new spline to the curve");
1576 parm = RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline");
1578 parm = RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline");
1580 RNA_def_function_return(func, parm);
1581
1582 func = RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
1583 RNA_def_function_ui_description(func, "Remove a spline from a curve");
1585 parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
1588
1589 func = RNA_def_function(srna, "clear", "rna_Curve_spline_clear");
1590 RNA_def_function_ui_description(func, "Remove all splines from a curve");
1591
1592 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1593 RNA_def_property_struct_type(prop, "Spline");
1595 prop, "rna_Curve_active_spline_get", "rna_Curve_active_spline_set", nullptr, nullptr);
1597 RNA_def_property_ui_text(prop, "Active Spline", "Active curve spline");
1598}
1599
1600static void rna_def_curve(BlenderRNA *brna)
1601{
1602 StructRNA *srna;
1603 PropertyRNA *prop;
1604
1605 static const EnumPropertyItem curve_twist_mode_items[] = {
1607 "Z_UP",
1608 0,
1609 "Z-Up",
1610 "Use Z-Up axis to calculate the curve twist at each point"},
1611 {CU_TWIST_MINIMUM, "MINIMUM", 0, "Minimum", "Use the least twist over the entire curve"},
1612 {CU_TWIST_TANGENT, "TANGENT", 0, "Tangent", "Use the tangent to calculate twist"},
1613 {0, nullptr, 0, nullptr, nullptr},
1614 };
1615
1616 static const EnumPropertyItem curve_axis_items[] = {
1617 {0, "2D", 0, "2D", "Clamp the Z axis of the curve"},
1618 {CU_3D,
1619 "3D",
1620 0,
1621 "3D",
1622 "Allow editing on the Z axis of this curve, also allows tilt and curve radius to be used"},
1623 {0, nullptr, 0, nullptr, nullptr},
1624 };
1625
1626 static const EnumPropertyItem bevfac_mapping_items[] = {
1628 "RESOLUTION",
1629 0,
1630 "Resolution",
1631 "Map the geometry factor to the number of subdivisions of a spline (U resolution)"},
1633 "SEGMENTS",
1634 0,
1635 "Segments",
1636 "Map the geometry factor to the length of a segment and to the number of subdivisions of a "
1637 "segment"},
1639 "SPLINE",
1640 0,
1641 "Spline",
1642 "Map the geometry factor to the length of a spline"},
1643 {0, nullptr, 0, nullptr, nullptr},
1644 };
1645
1646 static const EnumPropertyItem bevel_mode_items[] = {
1648 "ROUND",
1649 0,
1650 "Round",
1651 "Use circle for the section of the curve's bevel geometry"},
1653 "OBJECT",
1654 0,
1655 "Object",
1656 "Use an object for the section of the curve's bevel geometry segment"},
1658 "PROFILE",
1659 0,
1660 "Profile",
1661 "Use a custom profile for each quarter of curve's bevel geometry"},
1662 {0, nullptr, 0, nullptr, nullptr},
1663 };
1664
1665 static const EnumPropertyItem curve_taper_radius_mode_items[] = {
1667 "OVERRIDE",
1668 0,
1669 "Override",
1670 "Override the radius of the spline point with the taper radius"},
1672 "MULTIPLY",
1673 0,
1674 "Multiply",
1675 "Multiply the radius of the spline point by the taper radius"},
1677 "ADD",
1678 0,
1679 "Add",
1680 "Add the radius of the bevel point to the taper radius"},
1681 {0, nullptr, 0, nullptr, nullptr},
1682 };
1683
1684 srna = RNA_def_struct(brna, "Curve", "ID");
1685 RNA_def_struct_ui_text(srna, "Curve", "Curve data-block storing curves, splines and NURBS");
1686 RNA_def_struct_ui_icon(srna, ICON_CURVE_DATA);
1687 RNA_def_struct_refine_func(srna, "rna_Curve_refine");
1688
1689 prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
1690 RNA_def_property_pointer_sdna(prop, nullptr, "key");
1693 RNA_def_property_ui_text(prop, "Shape Keys", "");
1694
1695 prop = RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE);
1696# if 0
1697 RNA_def_property_collection_sdna(prop, nullptr, "nurb", nullptr);
1698# else
1699 /* this way we get editmode nurbs too, keyframe in editmode */
1701 "rna_Curve_splines_begin",
1702 "rna_iterator_listbase_next",
1703 "rna_iterator_listbase_end",
1704 "rna_iterator_listbase_get",
1705 nullptr,
1706 nullptr,
1707 nullptr,
1708 nullptr);
1709# endif
1710 RNA_def_property_struct_type(prop, "Spline");
1711 RNA_def_property_ui_text(prop, "Splines", "Collection of splines in this curve data object");
1712 rna_def_curve_splines(brna, prop);
1713
1714 rna_def_path(brna, srna);
1715
1716 prop = RNA_def_property(srna, "bevel_mode", PROP_ENUM, PROP_NONE);
1717 RNA_def_property_enum_sdna(prop, nullptr, "bevel_mode");
1718 RNA_def_property_enum_items(prop, bevel_mode_items);
1720 prop, "Bevel Mode", "Determine how to build the curve's bevel geometry");
1721 RNA_def_property_enum_funcs(prop, nullptr, "rna_Curve_bevel_mode_set", nullptr);
1722 /* Use this update function so the curve profile is properly initialized when
1723 * switching back to "Profile" mode after changing the resolution. */
1724 RNA_def_property_update(prop, 0, "rna_Curve_bevel_resolution_update");
1725
1726 prop = RNA_def_property(srna, "bevel_profile", PROP_POINTER, PROP_NONE);
1727 RNA_def_property_struct_type(prop, "CurveProfile");
1728 RNA_def_property_pointer_sdna(prop, nullptr, "bevel_profile");
1729 RNA_def_property_ui_text(prop, "Custom Profile Path", "The path for the curve's custom profile");
1730 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1731
1732 /* Number values */
1733 prop = RNA_def_property(srna, "bevel_resolution", PROP_INT, PROP_NONE);
1734 RNA_def_property_int_sdna(prop, nullptr, "bevresol");
1735 RNA_def_property_range(prop, 0, 32);
1736 RNA_def_property_ui_range(prop, 0, 32, 1.0, -1);
1738 prop, "Bevel Resolution", "The number of segments in each quarter-circle of the bevel");
1739 RNA_def_property_update(prop, 0, "rna_Curve_bevel_resolution_update");
1740
1741 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
1742 RNA_def_property_float_sdna(prop, nullptr, "offset");
1743 RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3);
1744 RNA_def_property_float_funcs(prop, "rna_Curve_offset_get", "rna_Curve_offset_set", nullptr);
1745 RNA_def_property_ui_text(prop, "Offset", "Distance to move the curve parallel to its normals");
1746 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1747
1748 prop = RNA_def_property(srna, "extrude", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
1749 RNA_def_property_float_sdna(prop, nullptr, "extrude");
1750 RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 3);
1751 RNA_def_property_range(prop, 0.0, FLT_MAX);
1753 "Extrude",
1754 "Length of the depth added in the local Z direction along the curve, "
1755 "perpendicular to its normals");
1756 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1757
1758 prop = RNA_def_property(srna, "bevel_depth", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
1759 RNA_def_property_float_sdna(prop, nullptr, "bevel_radius");
1760 RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 3);
1762 prop, "Bevel Depth", "Radius of the bevel geometry, not including extrusion");
1763 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1764
1765 prop = RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE);
1766 RNA_def_property_int_sdna(prop, nullptr, "resolu");
1768 RNA_def_property_range(prop, 1, 1024);
1769 RNA_def_property_ui_range(prop, 1, 64, 1, -1);
1771 prop,
1772 "Resolution U",
1773 "Number of computed points in the U direction between every pair of control points");
1774 RNA_def_property_update(prop, 0, "rna_Curve_resolution_u_update_data");
1775
1776 prop = RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE);
1777 RNA_def_property_int_sdna(prop, nullptr, "resolv");
1779 RNA_def_property_ui_range(prop, 1, 64, 1, -1);
1780 RNA_def_property_range(prop, 1, 1024);
1782 prop,
1783 "Resolution V",
1784 "The number of computed points in the V direction between every pair of control points");
1785 RNA_def_property_update(prop, 0, "rna_Curve_resolution_v_update_data");
1786
1787 prop = RNA_def_property(srna, "render_resolution_u", PROP_INT, PROP_NONE);
1788 RNA_def_property_int_sdna(prop, nullptr, "resolu_ren");
1789 RNA_def_property_range(prop, 0, 1024);
1790 RNA_def_property_ui_range(prop, 0, 64, 1, -1);
1792 prop,
1793 "Render Resolution U",
1794 "Surface resolution in U direction used while rendering (zero uses preview resolution)");
1795
1796 prop = RNA_def_property(srna, "render_resolution_v", PROP_INT, PROP_NONE);
1797 RNA_def_property_int_sdna(prop, nullptr, "resolv_ren");
1798 RNA_def_property_ui_range(prop, 0, 64, 1, -1);
1799 RNA_def_property_range(prop, 0, 1024);
1801 prop,
1802 "Render Resolution V",
1803 "Surface resolution in V direction used while rendering (zero uses preview resolution)");
1804
1805 prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_TIME);
1806 RNA_def_property_float_sdna(prop, nullptr, "ctime");
1808 prop,
1809 "Evaluation Time",
1810 "Parametric position along the length of the curve that Objects 'following' it should be "
1811 "at (position is evaluated by dividing by the 'Path Length' value)");
1812 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1813
1814 /* pointers */
1815 prop = RNA_def_property(srna, "bevel_object", PROP_POINTER, PROP_NONE);
1816 RNA_def_property_struct_type(prop, "Object");
1817 RNA_def_property_pointer_sdna(prop, nullptr, "bevobj");
1821 prop, "Bevel Object", "The name of the Curve object that defines the bevel shape");
1822 RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
1824 "rna_Curve_bevelObject_get",
1825 "rna_Curve_bevelObject_set",
1826 nullptr,
1827 "rna_Curve_otherObject_poll");
1828
1829 prop = RNA_def_property(srna, "taper_object", PROP_POINTER, PROP_NONE);
1830 RNA_def_property_struct_type(prop, "Object");
1831 RNA_def_property_pointer_sdna(prop, nullptr, "taperobj");
1835 prop, "Taper Object", "Curve object name that defines the taper (width)");
1836 RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
1838 "rna_Curve_taperObject_get",
1839 "rna_Curve_taperObject_set",
1840 nullptr,
1841 "rna_Curve_otherObject_poll");
1842
1843 /* Flags */
1844
1845 prop = RNA_def_property(srna, "dimensions", PROP_ENUM, PROP_NONE); /* as an enum */
1846 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
1847 RNA_def_property_enum_items(prop, curve_axis_items);
1848 RNA_def_property_enum_funcs(prop, nullptr, "rna_Curve_dimension_set", nullptr);
1849 RNA_def_property_ui_text(prop, "Dimensions", "Select 2D or 3D curve type");
1850 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1851
1852 prop = RNA_def_property(srna, "fill_mode", PROP_ENUM, PROP_NONE);
1853 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
1855 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Curve_fill_mode_itemf");
1856 RNA_def_property_ui_text(prop, "Fill Mode", "Mode of filling curve");
1857 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1858
1859 prop = RNA_def_property(srna, "fill_solver", PROP_ENUM, PROP_NONE);
1860 RNA_def_property_enum_sdna(prop, nullptr, "fill_solver");
1862 RNA_def_property_ui_text(prop, "Fill Solver", "Triangulation solver for filling 2D curves");
1863 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1864
1865 prop = RNA_def_property(srna, "fill_rule", PROP_ENUM, PROP_NONE);
1866 RNA_def_property_enum_sdna(prop, nullptr, "fill_rule");
1868 RNA_def_property_ui_text(prop, "Fill Rule", "Fill rule for Delaunay fill solver");
1869 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1870
1871 prop = RNA_def_property(srna, "twist_mode", PROP_ENUM, PROP_NONE);
1872 RNA_def_property_enum_sdna(prop, nullptr, "twist_mode");
1873 RNA_def_property_enum_items(prop, curve_twist_mode_items);
1874 RNA_def_property_ui_text(prop, "Twist Method", "The type of tilt calculation for 3D Curves");
1875 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1876
1877 prop = RNA_def_property(srna, "taper_radius_mode", PROP_ENUM, PROP_NONE);
1878 RNA_def_property_enum_sdna(prop, nullptr, "taper_radius_mode");
1879 RNA_def_property_enum_items(prop, curve_taper_radius_mode_items);
1881 "Taper Radius",
1882 "Determine how the effective radius of the spline point is computed "
1883 "when a taper object is specified");
1884 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1885
1886 prop = RNA_def_property(srna, "bevel_factor_mapping_start", PROP_ENUM, PROP_NONE);
1887 RNA_def_property_enum_sdna(prop, nullptr, "bevfac1_mapping");
1888 RNA_def_property_enum_items(prop, bevfac_mapping_items);
1890 prop, "Start Mapping Type", "Determine how the geometry start factor is mapped to a spline");
1891 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1892
1893 prop = RNA_def_property(srna, "bevel_factor_mapping_end", PROP_ENUM, PROP_NONE);
1894 RNA_def_property_enum_sdna(prop, nullptr, "bevfac2_mapping");
1895 RNA_def_property_enum_items(prop, bevfac_mapping_items);
1897 prop, "End Mapping Type", "Determine how the geometry end factor is mapped to a spline");
1898 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1899
1900 /* XXX: would be nice to have a better way to do this, only add for testing. */
1901 prop = RNA_def_property(srna, "twist_smooth", PROP_FLOAT, PROP_NONE);
1902 RNA_def_property_float_sdna(prop, nullptr, "twist_smooth");
1903 RNA_def_property_ui_range(prop, 0, 100.0, 1, 2);
1904 RNA_def_property_ui_text(prop, "Twist Smooth", "Smoothing iteration for tangents");
1905 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1906
1907 prop = RNA_def_property(srna, "use_fill_caps", PROP_BOOLEAN, PROP_NONE);
1908 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_FILL_CAPS);
1909 RNA_def_property_ui_text(prop, "Fill Caps", "Fill caps for beveled curves");
1910 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1911
1912 prop = RNA_def_property(srna, "use_map_taper", PROP_BOOLEAN, PROP_NONE);
1913 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_MAP_TAPER);
1915 prop, "Map Taper", "Map effect of the taper object to the beveled part of the curve");
1916 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1917
1918 /* texture space */
1919 prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
1920 RNA_def_property_boolean_sdna(prop, nullptr, "texspace_flag", CU_TEXSPACE_FLAG_AUTO);
1922 prop,
1923 "Auto Texture Space",
1924 "Adjust active object's texture space automatically when transforming object");
1925 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Curve_texspace_set");
1926
1927 prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
1928 RNA_def_property_array(prop, 3);
1929 RNA_def_property_ui_text(prop, "Texture Space Location", "");
1931 RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable");
1933 prop, "rna_Curve_texspace_location_get", "rna_Curve_texspace_location_set", nullptr);
1934 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1935
1936 prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
1937 RNA_def_property_array(prop, 3);
1939 RNA_def_property_ui_text(prop, "Texture Space Size", "");
1940 RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable");
1942 prop, "rna_Curve_texspace_size_get", "rna_Curve_texspace_size_set", nullptr);
1943 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1944
1945 /* materials */
1946 prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
1947 RNA_def_property_collection_sdna(prop, nullptr, "mat", "totcol");
1948 RNA_def_property_struct_type(prop, "Material");
1949 RNA_def_property_ui_text(prop, "Materials", "");
1950 RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.cc */
1952 nullptr,
1953 nullptr,
1954 nullptr,
1955 nullptr,
1956 nullptr,
1957 nullptr,
1958 nullptr,
1959 "rna_IDMaterials_assign_int");
1960
1961 prop = RNA_def_property(srna, "bevel_factor_start", PROP_FLOAT, PROP_FACTOR);
1962 RNA_def_property_float_sdna(prop, nullptr, "bevfac1");
1963 RNA_def_property_range(prop, 0, 1.0);
1965 "Geometry Start Factor",
1966 "Define where along the spline the curve geometry starts (0 for the "
1967 "beginning, 1 for the end)");
1968 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1969
1970 prop = RNA_def_property(srna, "bevel_factor_end", PROP_FLOAT, PROP_FACTOR);
1971 RNA_def_property_float_sdna(prop, nullptr, "bevfac2");
1972 RNA_def_property_range(prop, 0, 1.0);
1974 "Geometry End Factor",
1975 "Define where along the spline the curve geometry ends (0 for the "
1976 "beginning, 1 for the end)");
1977 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1978
1979 prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
1980 RNA_def_property_boolean_funcs(prop, "rna_Curve_is_editmode_get", nullptr);
1982 RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
1983
1985
1986 RNA_api_curve(srna);
1987}
1988
1990{
1991 static const EnumPropertyItem spline_interpolation_items[] = {
1992 {KEY_LINEAR, "LINEAR", 0, "Linear", ""},
1993 {KEY_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
1994 {KEY_BSPLINE, "BSPLINE", 0, "BSpline", ""},
1995 /* TODO: define somewhere, not one of BEZT_IPO_*. */
1996 {KEY_CU_EASE, "EASE", 0, "Ease", ""},
1997 {0, nullptr, 0, nullptr, nullptr},
1998 };
1999
2000 StructRNA *srna;
2001 PropertyRNA *prop;
2002
2003 srna = RNA_def_struct(brna, "Spline", nullptr);
2004 RNA_def_struct_sdna(srna, "Nurb");
2006 srna,
2007 "Spline",
2008 "Element of a curve, either NURBS, Bézier or Polyline or a character with text objects");
2009
2010 prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
2011 RNA_def_property_collection_sdna(prop, nullptr, "bp", nullptr);
2012 RNA_def_property_struct_type(prop, "SplinePoint");
2014 "rna_BPoint_array_begin",
2015 "rna_iterator_array_next",
2016 "rna_iterator_array_end",
2017 "rna_iterator_array_get",
2018 "rna_Nurb_length",
2019 nullptr,
2020 nullptr,
2021 nullptr);
2023 prop, "Points", "Collection of points that make up this poly or nurbs spline");
2024 rna_def_curve_spline_points(brna, prop);
2025
2026 prop = RNA_def_property(srna, "bezier_points", PROP_COLLECTION, PROP_NONE);
2027 RNA_def_property_struct_type(prop, "BezierSplinePoint");
2028 RNA_def_property_collection_sdna(prop, nullptr, "bezt", "pntsu");
2029 RNA_def_property_ui_text(prop, "Bézier Points", "Collection of points for Bézier curves only");
2031
2032 prop = RNA_def_property(srna, "tilt_interpolation", PROP_ENUM, PROP_NONE);
2033 RNA_def_property_enum_sdna(prop, nullptr, "tilt_interp");
2034 RNA_def_property_enum_items(prop, spline_interpolation_items);
2036 prop, "Tilt Interpolation", "The type of tilt interpolation for 3D, Bézier curves");
2037 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2038
2039 prop = RNA_def_property(srna, "radius_interpolation", PROP_ENUM, PROP_NONE);
2040 RNA_def_property_enum_sdna(prop, nullptr, "radius_interp");
2041 RNA_def_property_enum_items(prop, spline_interpolation_items);
2043 prop, "Radius Interpolation", "The type of radius interpolation for Bézier curves");
2044 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2045
2046 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2048 RNA_def_property_enum_funcs(prop, nullptr, "rna_Nurb_type_set", nullptr);
2049 RNA_def_property_ui_text(prop, "Type", "The interpolation type for this curve element");
2050 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2051
2052 prop = RNA_def_property(srna, "point_count_u", PROP_INT, PROP_UNSIGNED);
2053 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* Editing this needs knot recalc. */
2054 RNA_def_property_int_sdna(prop, nullptr, "pntsu");
2056 prop, "Points U", "Total number points for the curve or surface in the U direction");
2057 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2058
2059 prop = RNA_def_property(srna, "point_count_v", PROP_INT, PROP_UNSIGNED);
2060 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* Editing this needs knot recalc. */
2061 RNA_def_property_int_sdna(prop, nullptr, "pntsv");
2063 prop, "Points V", "Total number points for the surface on the V direction");
2064 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2065
2066 prop = RNA_def_property(srna, "order_u", PROP_INT, PROP_NONE);
2067 RNA_def_property_int_sdna(prop, nullptr, "orderu");
2069 RNA_def_property_range(prop, 2, 64);
2070 RNA_def_property_ui_range(prop, 2, 6, 1, -1);
2072 "Order U",
2073 "NURBS order in the U direction. Higher values make each point "
2074 "influence a greater area, but have worse performance.");
2075 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
2076
2077 prop = RNA_def_property(srna, "order_v", PROP_INT, PROP_NONE);
2078 RNA_def_property_int_sdna(prop, nullptr, "orderv");
2080 RNA_def_property_range(prop, 2, 64);
2081 RNA_def_property_ui_range(prop, 2, 6, 1, -1);
2083 "Order V",
2084 "NURBS order in the V direction. Higher values make each point "
2085 "influence a greater area, but have worse performance.");
2086 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
2087
2088 prop = RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE);
2089 RNA_def_property_int_sdna(prop, nullptr, "resolu");
2091 RNA_def_property_range(prop, 1, 1024);
2092 RNA_def_property_ui_range(prop, 1, 64, 1, -1);
2093 RNA_def_property_ui_text(prop, "Resolution U", "Curve or Surface subdivisions per segment");
2094 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2095
2096 prop = RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE);
2097 RNA_def_property_int_sdna(prop, nullptr, "resolv");
2099 RNA_def_property_range(prop, 1, 1024);
2100 RNA_def_property_ui_range(prop, 1, 64, 1, -1);
2101 RNA_def_property_ui_text(prop, "Resolution V", "Surface subdivisions per segment");
2102 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2103
2104 prop = RNA_def_property(srna, "use_cyclic_u", PROP_BOOLEAN, PROP_NONE);
2105 RNA_def_property_boolean_sdna(prop, nullptr, "flagu", CU_NURB_CYCLIC);
2108 prop, "Cyclic U", "Make this curve or surface a closed loop in the U direction");
2109 RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_u");
2110
2111 prop = RNA_def_property(srna, "use_cyclic_v", PROP_BOOLEAN, PROP_NONE);
2112 RNA_def_property_boolean_sdna(prop, nullptr, "flagv", CU_NURB_CYCLIC);
2114 RNA_def_property_ui_text(prop, "Cyclic V", "Make this surface a closed loop in the V direction");
2115 RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_v");
2116
2117 prop = RNA_def_property(srna, "use_endpoint_u", PROP_BOOLEAN, PROP_NONE);
2118 RNA_def_property_boolean_sdna(prop, nullptr, "flagu", CU_NURB_ENDPOINT);
2121 prop,
2122 "Endpoint U",
2123 "Make this nurbs curve or surface meet the endpoints in the U direction");
2124 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
2125
2126 prop = RNA_def_property(srna, "use_endpoint_v", PROP_BOOLEAN, PROP_NONE);
2127 RNA_def_property_boolean_sdna(prop, nullptr, "flagv", CU_NURB_ENDPOINT);
2130 prop, "Endpoint V", "Make this nurbs surface meet the endpoints in the V direction");
2131 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
2132
2133 prop = RNA_def_property(srna, "use_bezier_u", PROP_BOOLEAN, PROP_NONE);
2134 RNA_def_property_boolean_sdna(prop, nullptr, "flagu", CU_NURB_BEZIER);
2137 prop,
2138 "Bézier U",
2139 "Make this nurbs curve or surface act like a Bézier spline in the U direction");
2140 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
2141
2142 prop = RNA_def_property(srna, "use_bezier_v", PROP_BOOLEAN, PROP_NONE);
2143 RNA_def_property_boolean_sdna(prop, nullptr, "flagv", CU_NURB_BEZIER);
2146 prop, "Bézier V", "Make this nurbs surface act like a Bézier spline in the V direction");
2147 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
2148
2149 prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
2150 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_SMOOTH);
2151 RNA_def_property_ui_text(prop, "Smooth", "Smooth the normals of the surface or beveled curve");
2152 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2153
2154 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
2155 RNA_def_property_boolean_sdna(prop, nullptr, "hide", 1);
2156 RNA_def_property_ui_text(prop, "Hide", "Hide this curve in Edit mode");
2157 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2158
2159 prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
2160 RNA_def_property_int_sdna(prop, nullptr, "mat_nr");
2161 RNA_def_property_ui_text(prop, "Material Index", "Material slot index of this curve");
2162 RNA_def_property_int_funcs(prop, nullptr, nullptr, "rna_Curve_material_index_range");
2163 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2164
2165 prop = RNA_def_property(srna, "character_index", PROP_INT, PROP_UNSIGNED);
2166 RNA_def_property_int_sdna(prop, nullptr, "charidx");
2167 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* Editing this needs knot recalc. */
2169 "Character Index",
2170 "Location of this character in the text data (only for text curves)");
2171 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2172
2173 RNA_def_struct_path_func(srna, "rna_Curve_spline_path");
2174
2175 RNA_api_curve_nurb(srna);
2176}
2177
2179{
2180 rna_def_curve(brna);
2181 rna_def_surface(brna);
2182 rna_def_text(brna);
2183 rna_def_textbox(brna);
2184 rna_def_charinfo(brna);
2185 rna_def_bpoint(brna);
2186 rna_def_beztriple(brna);
2187 rna_def_curve_nurb(brna);
2188}
2189
2190} // namespace blender
2191
2192#endif
#define SELECT
Definition BKE_mask.hh:19
#define DEG2RADF(_deg)
#define BLT_I18NCONTEXT_ID_ACTION
#define CTX_N_(context, msgid)
#define MAX_ID_NAME
Definition DNA_ID.h:367
#define CU_ACT_NONE
#define KEY_CU_EASE
Object is a sort of wrapper for general info.
#define MAXFRAME
Read Blender memory allocation and freeing.
#define RNA_TRANSLATION_PREC_DEFAULT
Definition RNA_types.hh:272
#define RNA_ENUM_ITEM_HEADING(name, description)
Definition RNA_types.hh:759
#define NC_GEOM
Definition WM_types.hh:406
#define ND_DRAW
Definition WM_types.hh:502
#define ND_DATA
Definition WM_types.hh:552
#define NC_OBJECT
Definition WM_types.hh:392
btScalar max
#define FLT_MAX
#define INT_MAX
BMesh Iterators.
void WM_main_add_notifier(uint type, void *reference)
static void rna_def_charinfo(BlenderRNA *brna)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void id_lib_extern(ID *id, bool enforce_fix=false)
Definition lib_id.cc:328
void BKE_curveprofile_init(struct CurveProfile *profile, short segments_len)
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
void BKE_nurb_points_add(Nurb *nu, int number)
Definition curve.cc:886
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
static const EnumPropertyItem fill_rule_items[]
Definition rna_curve.cc:154
static void rna_def_text(BlenderRNA *brna)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_enum_default(PropertyRNA *prop, int value)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
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_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
PointerRNA RNA_id_pointer_create(ID *id)
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
ListBaseT< Nurb > * BKE_curve_nurbs_get(Curve *cu)
Definition curve.cc:4992
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void BKE_nurbList_free(ListBaseT< Nurb > *lb)
Definition curve.cc:619
static const float tilt_limit
Definition rna_curve.cc:924
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
@ PROP_UNIT_LENGTH
Definition RNA_types.hh:222
@ FUNC_USE_REPORTS
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:980
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
bool BKE_nurb_order_clamp_u(Nurb *nu)
Definition curve.cc:4828
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
static void rna_def_bpoint(BlenderRNA *brna)
Definition rna_curve.cc:926
static const EnumPropertyItem curve3d_fill_mode_items[]
Definition rna_curve.cc:132
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
MINLINE int max_ii(int a, int b)
static void rna_def_curve_nurb(BlenderRNA *brna)
void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
void BKE_curve_texspace_ensure(Curve *cu)
Definition curve.cc:524
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
@ CU_DEFORM_BOUNDS_OFF
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:588
void BKE_nurb_knot_calc_v(Nurb *nu)
Definition curve.cc:1219
void rna_def_animdata_common(StructRNA *srna)
static const EnumPropertyItem curve_type_items[]
Definition rna_curve.cc:124
void BKE_nurb_bezierPoints_add(Nurb *nu, int number)
Definition curve.cc:900
static void rna_def_beztriple(BlenderRNA *brna)
Definition rna_curve.cc:981
static const EnumPropertyItem beztriple_handle_type_items[]
Definition rna_curve.cc:29
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
static const EnumPropertyItem fill_solver_items[]
Definition rna_curve.cc:140
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:541
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:593
static void rna_def_curve(BlenderRNA *brna)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
static void rna_def_curve_spline_bezpoints(BlenderRNA *brna, PropertyRNA *cprop)
@ PROP_BOOLEAN
Definition RNA_types.hh:210
@ PROP_POINTER
Definition RNA_types.hh:215
@ PROP_STRING
Definition RNA_types.hh:213
@ PROP_COLLECTION
Definition RNA_types.hh:216
void BKE_nurb_handles_calc(Nurb *nu)
Definition curve.cc:3992
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
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_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:162
@ CU_FILL_SOLVER_SWEEP_LINE
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
void RNA_api_curve(StructRNA *srna)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
@ CU_BEV_MODE_CURVE_PROFILE
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_curve(BlenderRNA *brna)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier_c_str, const char *call)
@ CU_BEVFAC_MAP_RESOLU
@ CU_BEVFAC_MAP_SEGMENT
@ CU_BEVFAC_MAP_SPLINE
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
@ CU_FILL_RULE_EVEN_ODD
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
static void rna_def_nurbs(BlenderRNA *, StructRNA *)
static void rna_def_textbox(BlenderRNA *brna)
void RNA_def_function_flag(FunctionRNA *func, FunctionFlag flag)
@ CU_TAPER_RADIUS_MULTIPLY
@ CU_TAPER_RADIUS_OVERRIDE
@ CU_TAPER_RADIUS_ADD
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
Definition report.cc:191
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
const EnumPropertyItem rna_enum_beztriple_interpolation_mode_items[]
Definition rna_curve.cc:66
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
struct CurveProfile * BKE_curveprofile_add(eCurveProfilePresets preset)
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ PROP_EDITABLE
Definition RNA_types.hh:376
@ PROP_PROPORTIONAL
Definition RNA_types.hh:419
@ PROP_THICK_WRAP
Definition RNA_types.hh:493
@ PROP_PTR_NO_OWNERSHIP
Definition RNA_types.hh:465
@ PROP_NEVER_NULL
Definition RNA_types.hh:447
@ PROP_ANIMATABLE
Definition RNA_types.hh:389
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
static void rna_def_curve_spline_points(BlenderRNA *brna, PropertyRNA *cprop)
bool BKE_nurb_type_convert(Nurb *nu, eNurbType type, bool use_handles, const char **r_err_msg)
Definition curve.cc:4848
@ CU_TEXSPACE_FLAG_AUTO
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
void DEG_relations_tag_update(Main *bmain)
bool BLI_remlink_safe(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:161
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
size_t BLI_strlen_utf8_ex(const char *strc, size_t *r_len_bytes) ATTR_NONNULL(1
void BKE_nurb_knot_calc_u(Nurb *nu)
Definition curve.cc:1214
@ PROP_FACTOR
Definition RNA_types.hh:308
@ PROP_TRANSLATION
Definition RNA_types.hh:318
@ PROP_DISTANCE
Definition RNA_types.hh:313
@ PROP_UNSIGNED
Definition RNA_types.hh:306
@ PARM_REQUIRED
Definition RNA_types.hh:631
@ PARM_RNAPTR
Definition RNA_types.hh:633
void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, ListBase *lb, IteratorSkipFunc skip)
void RNA_api_curve_nurb(StructRNA *srna)
void BKE_curve_texspace_calc(Curve *cu)
Definition curve.cc:490
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
static void rna_def_curve_splines(BlenderRNA *brna, PropertyRNA *cprop)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, void *data, size_t itemsize, int64_t length, bool free_ptr, IteratorSkipFunc skip)
@ CU_ALIGN_Y_TOP_BASELINE
@ CU_ALIGN_Y_BOTTOM_BASELINE
static void rna_def_path(BlenderRNA *, StructRNA *srna)
static void rna_def_surface(BlenderRNA *brna)
bool BKE_nurb_order_clamp_v(Nurb *nu)
Definition curve.cc:4838
void BKE_nurb_free(Nurb *nu)
Definition curve.cc:593
static void rna_def_font(BlenderRNA *, StructRNA *srna)
void BKE_curve_dimension_update(Curve *cu)
Definition curve.cc:459
const EnumPropertyItem rna_enum_keyframe_handle_type_items[]
Definition rna_curve.cc:38
#define min(a, b)
Definition sort.cc:38
const NodeType * type
Definition graph/node.h:179
eCurveBevelMode bevel_mode
#define N_(msgid)