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