Blender V4.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
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#include "BLI_math_vector.h"
17#include "BLI_utildefines.h"
18
19#include "BLT_translation.hh"
20
21#include "RNA_access.hh"
22#include "RNA_define.hh"
23#include "RNA_enum_types.hh"
24
25#include "rna_internal.hh"
26
27#include "WM_types.hh"
28
29#ifndef RNA_RUNTIME
31 {HD_FREE, "FREE", 0, "Free", ""},
32 {HD_VECT, "VECTOR", 0, "Vector", ""},
33 {HD_ALIGN, "ALIGNED", 0, "Aligned", ""},
34 {HD_AUTO, "AUTO", 0, "Auto", ""},
35 {0, nullptr, 0, nullptr, nullptr},
36};
37#endif
38
40 {HD_FREE, "FREE", ICON_HANDLE_FREE, "Free", "Completely independent manually set handle"},
41 {HD_ALIGN,
42 "ALIGNED",
43 ICON_HANDLE_ALIGNED,
44 "Aligned",
45 "Manually set handle with rotation locked together with its pair"},
46 {HD_VECT,
47 "VECTOR",
48 ICON_HANDLE_VECTOR,
49 "Vector",
50 "Automatic handles that create straight lines"},
51 {HD_AUTO,
52 "AUTO",
53 ICON_HANDLE_AUTO,
54 "Automatic",
55 "Automatic handles that create smooth curves"},
57 "AUTO_CLAMPED",
58 ICON_HANDLE_AUTOCLAMPED,
59 "Auto Clamped",
60 "Automatic handles that create smooth curves which only change direction at keyframes"},
61 {0, nullptr, 0, nullptr, nullptr},
62};
63
64/* NOTE: this is a near exact duplicate of `gpencil_interpolation_type_items`,
65 * Changes here will likely apply there too. */
66
68 /* Interpolation. */
70 N_("Standard transitions between keyframes")),
72 "CONSTANT",
73 ICON_IPO_CONSTANT,
74 "Constant",
75 "No interpolation, value of A gets held until B is encountered"},
77 "LINEAR",
78 ICON_IPO_LINEAR,
79 "Linear",
80 "Straight-line interpolation between A and B (i.e. no ease in/out)"},
82 "BEZIER",
83 ICON_IPO_BEZIER,
84 "Bézier",
85 "Smooth interpolation between A and B, with some control over curve shape"},
86
87 /* Easing. */
89 N_("Predefined inertial transitions, useful for motion graphics "
90 "(from least to most \"dramatic\")")),
92 "SINE",
93 ICON_IPO_SINE,
94 "Sinusoidal",
95 "Sinusoidal easing (weakest, almost linear but with a slight curvature)"},
96 {BEZT_IPO_QUAD, "QUAD", ICON_IPO_QUAD, "Quadratic", "Quadratic easing"},
97 {BEZT_IPO_CUBIC, "CUBIC", ICON_IPO_CUBIC, "Cubic", "Cubic easing"},
98 {BEZT_IPO_QUART, "QUART", ICON_IPO_QUART, "Quartic", "Quartic easing"},
99 {BEZT_IPO_QUINT, "QUINT", ICON_IPO_QUINT, "Quintic", "Quintic easing"},
100 {BEZT_IPO_EXPO, "EXPO", ICON_IPO_EXPO, "Exponential", "Exponential easing (dramatic)"},
102 "CIRC",
103 ICON_IPO_CIRC,
104 "Circular",
105 "Circular easing (strongest and most dynamic)"},
106
108 N_("Simple physics-inspired easing effects")),
109 {BEZT_IPO_BACK, "BACK", ICON_IPO_BACK, "Back", "Cubic easing with overshoot and settle"},
111 "BOUNCE",
112 ICON_IPO_BOUNCE,
113 "Bounce",
114 "Exponentially decaying parabolic bounce, like when objects collide"},
116 "ELASTIC",
117 ICON_IPO_ELASTIC,
118 "Elastic",
119 "Exponentially decaying sine wave, like an elastic band"},
120
121 {0, nullptr, 0, nullptr, nullptr},
122};
123
124#ifndef RNA_RUNTIME
126 {CU_POLY, "POLY", 0, "Poly", ""},
127 {CU_BEZIER, "BEZIER", 0, "Bézier", ""},
128 {CU_NURBS, "NURBS", 0, "Ease", ""},
129 {0, nullptr, 0, nullptr, nullptr},
130};
131#endif
132
134 {0, "FULL", 0, "Full", ""},
135 {CU_BACK, "BACK", 0, "Back", ""},
136 {CU_FRONT, "FRONT", 0, "Front", ""},
137 {CU_FRONT | CU_BACK, "HALF", 0, "Half", ""},
138 {0, nullptr, 0, nullptr, nullptr},
139};
140
141#ifdef RNA_RUNTIME
142static const EnumPropertyItem curve2d_fill_mode_items[] = {
143 {0, "NONE", 0, "None", ""},
144 {CU_BACK, "BACK", 0, "Back", ""},
145 {CU_FRONT, "FRONT", 0, "Front", ""},
146 {CU_FRONT | CU_BACK, "BOTH", 0, "Both", ""},
147 {0, nullptr, 0, nullptr, nullptr},
148};
149#endif
150
151#ifdef RNA_RUNTIME
152
153# include <fmt/format.h>
154
155# include "DNA_object_types.h"
156
157# include "BKE_curve.hh"
158# include "BKE_curveprofile.h"
159# include "BKE_main.hh"
160# include "BKE_vfont.hh"
161
162# include "DEG_depsgraph.hh"
163# include "DEG_depsgraph_build.hh"
164
165# include "WM_api.hh"
166
167# include "MEM_guardedalloc.h"
168
169# include "ED_curve.hh" /* for BKE_curve_nurbs_get */
170
171/* highly irritating but from RNA we can't know this */
172static Nurb *curve_nurb_from_point(Curve *cu, const void *point, int *nu_index, int *pt_index)
173{
174 ListBase *nurbs = BKE_curve_nurbs_get(cu);
175 Nurb *nu;
176 int i = 0;
177
178 for (nu = static_cast<Nurb *>(nurbs->first); nu; nu = nu->next, i++) {
179 if (nu->type == CU_BEZIER) {
180 if (point >= static_cast<void *>(nu->bezt) &&
182 {
183 break;
184 }
185 }
186 else {
187 if (point >= static_cast<void *>(nu->bp) &&
188 point < static_cast<void *>(nu->bp + (nu->pntsu * nu->pntsv)))
189 {
190 break;
191 }
192 }
193 }
194
195 if (nu) {
196 if (nu_index) {
197 *nu_index = i;
198 }
199
200 if (pt_index) {
201 if (nu->type == CU_BEZIER) {
202 *pt_index = int(static_cast<const BezTriple *>(point) - nu->bezt);
203 }
204 else {
205 *pt_index = int(static_cast<const BPoint *>(point) - nu->bp);
206 }
207 }
208 }
209
210 return nu;
211}
212
213static StructRNA *rna_Curve_refine(PointerRNA *ptr)
214{
215 Curve *cu = static_cast<Curve *>(ptr->data);
216 short obtype = BKE_curve_type_get(cu);
217
218 if (obtype == OB_FONT) {
219 return &RNA_TextCurve;
220 }
221 else if (obtype == OB_SURF) {
222 return &RNA_SurfaceCurve;
223 }
224 else {
225 return &RNA_Curve;
226 }
227}
228
229static void rna_BezTriple_handle1_get(PointerRNA *ptr, float *values)
230{
231 BezTriple *bezt = static_cast<BezTriple *>(ptr->data);
232 copy_v3_v3(values, bezt->vec[0]);
233}
234
235static void rna_BezTriple_handle1_set(PointerRNA *ptr, const float *values)
236{
237 BezTriple *bezt = static_cast<BezTriple *>(ptr->data);
238 copy_v3_v3(bezt->vec[0], values);
239}
240
241static void rna_BezTriple_handle2_get(PointerRNA *ptr, float *values)
242{
243 BezTriple *bezt = static_cast<BezTriple *>(ptr->data);
244 copy_v3_v3(values, bezt->vec[2]);
245}
246
247static void rna_BezTriple_handle2_set(PointerRNA *ptr, const float *values)
248{
249 BezTriple *bezt = static_cast<BezTriple *>(ptr->data);
250 copy_v3_v3(bezt->vec[2], values);
251}
252
253static void rna_BezTriple_ctrlpoint_get(PointerRNA *ptr, float *values)
254{
255 BezTriple *bezt = static_cast<BezTriple *>(ptr->data);
256 copy_v3_v3(values, bezt->vec[1]);
257}
258
259static void rna_BezTriple_ctrlpoint_set(PointerRNA *ptr, const float *values)
260{
261 BezTriple *bezt = static_cast<BezTriple *>(ptr->data);
262 copy_v3_v3(bezt->vec[1], values);
263}
264
265static void rna_Curve_texspace_set(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
266{
267 Curve *cu = static_cast<Curve *>(ptr->data);
268
271 }
272}
273
274static int rna_Curve_texspace_editable(const PointerRNA *ptr, const char ** /*r_info*/)
275{
276 Curve *cu = static_cast<Curve *>(ptr->data);
278}
279
280static void rna_Curve_texspace_location_get(PointerRNA *ptr, float *values)
281{
282 Curve *cu = static_cast<Curve *>(ptr->data);
283
285
286 copy_v3_v3(values, cu->texspace_location);
287}
288
289static void rna_Curve_texspace_location_set(PointerRNA *ptr, const float *values)
290{
291 Curve *cu = static_cast<Curve *>(ptr->data);
292
293 copy_v3_v3(cu->texspace_location, values);
294}
295
296static void rna_Curve_texspace_size_get(PointerRNA *ptr, float *values)
297{
298 Curve *cu = static_cast<Curve *>(ptr->data);
299
301
302 copy_v3_v3(values, cu->texspace_size);
303}
304
305static void rna_Curve_texspace_size_set(PointerRNA *ptr, const float *values)
306{
307 Curve *cu = static_cast<Curve *>(ptr->data);
308
309 copy_v3_v3(cu->texspace_size, values);
310}
311
312static void rna_Curve_material_index_range(
313 PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
314{
315 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
316 *min = 0;
317 *max = max_ii(0, cu->totcol - 1);
318}
319
320/* simply offset by don't expose -1 */
321static int rna_ChariInfo_material_index_get(PointerRNA *ptr)
322{
323 CharInfo *info = static_cast<CharInfo *>(ptr->data);
324 return info->mat_nr ? info->mat_nr : 0;
325}
326
327static void rna_ChariInfo_material_index_set(PointerRNA *ptr, int value)
328{
329 CharInfo *info = static_cast<CharInfo *>(ptr->data);
330 info->mat_nr = value;
331}
332
333static void rna_Curve_active_textbox_index_range(
334 PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
335{
336 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
337 *min = 0;
338 *max = max_ii(0, cu->totbox - 1);
339}
340
341static void rna_Curve_dimension_set(PointerRNA *ptr, int value)
342{
343 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
344 if (value == CU_3D) {
345 cu->flag |= CU_3D;
346 }
347 else {
348 cu->flag &= ~CU_3D;
350 }
351}
352
353static const EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext * /*C*/,
355 PropertyRNA * /*prop*/,
356 bool * /*r_free*/)
357{
358 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
359
360 /* cast to quiet warning it IS a const still */
361 return static_cast<const EnumPropertyItem *>((cu->flag & CU_3D) ? curve3d_fill_mode_items :
362 curve2d_fill_mode_items);
363}
364
365static int rna_Nurb_length(PointerRNA *ptr)
366{
367 Nurb *nu = static_cast<Nurb *>(ptr->data);
368 if (nu->type == CU_BEZIER) {
369 return 0;
370 }
371 return nu->pntsv > 0 ? nu->pntsu * nu->pntsv : nu->pntsu;
372}
373
374static void rna_Nurb_type_set(PointerRNA *ptr, int value)
375{
376 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
377 Nurb *nu = static_cast<Nurb *>(ptr->data);
378 const int pntsu_prev = nu->pntsu;
379
380 if (BKE_nurb_type_convert(nu, value, true, nullptr)) {
381 if (nu->pntsu != pntsu_prev) {
382 cu->actvert = CU_ACT_NONE;
383 }
384 }
385}
386
387static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
388{
389 Nurb *nu = static_cast<Nurb *>(ptr->data);
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_pointer_inherit_refine(ptr, &RNA_Object, ob);
434 }
435
436 return rna_pointer_inherit_refine(ptr, nullptr, nullptr);
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_pointer_inherit_refine(ptr, &RNA_Object, ob);
507 }
508
509 return rna_pointer_inherit_refine(ptr, nullptr, nullptr);
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 = static_cast<char *>(MEM_mallocN(len_bytes + sizeof(char32_t), "str"));
599 memcpy(cu->str, value, len_bytes + 1);
600
601 cu->strinfo = static_cast<CharInfo *>(
602 MEM_callocN((len_chars + 4) * sizeof(CharInfo), "strinfo"));
603}
604
605static void rna_Nurb_update_cyclic_u(Main *bmain, Scene *scene, PointerRNA *ptr)
606{
607 Nurb *nu = static_cast<Nurb *>(ptr->data);
608
609 if (nu->type == CU_BEZIER) {
611 }
612 else {
614 }
615
616 rna_Curve_update_data(bmain, scene, ptr);
617}
618
619static void rna_Nurb_update_cyclic_v(Main *bmain, Scene *scene, PointerRNA *ptr)
620{
621 Nurb *nu = static_cast<Nurb *>(ptr->data);
622
624
625 rna_Curve_update_data(bmain, scene, ptr);
626}
627
628static void rna_Nurb_update_knot_u(Main *bmain, Scene *scene, PointerRNA *ptr)
629{
630 Nurb *nu = static_cast<Nurb *>(ptr->data);
631
634
635 rna_Curve_update_data(bmain, scene, ptr);
636}
637
638static void rna_Nurb_update_knot_v(Main *bmain, Scene *scene, PointerRNA *ptr)
639{
640 Nurb *nu = static_cast<Nurb *>(ptr->data);
641
644
645 rna_Curve_update_data(bmain, scene, ptr);
646}
647
648static void rna_Curve_spline_points_add(ID *id, Nurb *nu, ReportList *reports, int number)
649{
650 if (nu->type == CU_BEZIER) {
651 BKE_report(reports, RPT_ERROR, "Bézier spline cannot have points added");
652 }
653 else if (number == 0) {
654 /* do nothing */
655 }
656 else {
657
658 BKE_nurb_points_add(nu, number);
659
660 /* update */
662
663 rna_Curve_update_data_id(nullptr, nullptr, id);
664 }
665}
666
667static void rna_Curve_spline_bezpoints_add(ID *id, Nurb *nu, ReportList *reports, int number)
668{
669 if (nu->type != CU_BEZIER) {
670 BKE_report(reports, RPT_ERROR, "Only Bézier splines can be added");
671 }
672 else if (number == 0) {
673 /* do nothing */
674 }
675 else {
676 BKE_nurb_bezierPoints_add(nu, number);
677
678 /* update */
680
681 rna_Curve_update_data_id(nullptr, nullptr, id);
682 }
683}
684
685static Nurb *rna_Curve_spline_new(Curve *cu, int type)
686{
687 Nurb *nu = static_cast<Nurb *>(MEM_callocN(sizeof(Nurb), "spline.new"));
688
689 if (type == CU_BEZIER) {
690 BezTriple *bezt = static_cast<BezTriple *>(MEM_callocN(sizeof(BezTriple), "spline.new.bezt"));
691 bezt->radius = 1.0;
692 nu->bezt = bezt;
693 }
694 else {
695 BPoint *bp = static_cast<BPoint *>(MEM_callocN(sizeof(BPoint), "spline.new.bp"));
696 bp->radius = 1.0f;
697 nu->bp = bp;
698 }
699
700 nu->type = type;
701 nu->pntsu = 1;
702 nu->pntsv = 1;
703
704 nu->orderu = nu->orderv = 4;
705 nu->resolu = cu->resolu;
706 nu->resolv = cu->resolv;
707 nu->flag = CU_SMOOTH;
708
710
711 return nu;
712}
713
714static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, PointerRNA *nu_ptr)
715{
716 Nurb *nu = static_cast<Nurb *>(nu_ptr->data);
717 ListBase *nurbs = BKE_curve_nurbs_get(cu);
718
719 if (BLI_remlink_safe(nurbs, nu) == false) {
720 BKE_reportf(reports, RPT_ERROR, "Curve '%s' does not contain spline given", cu->id.name + 2);
721 return;
722 }
723
724 BKE_nurb_free(nu);
726
729}
730
731static void rna_Curve_spline_clear(Curve *cu)
732{
733 ListBase *nurbs = BKE_curve_nurbs_get(cu);
734
735 BKE_nurbList_free(nurbs);
736
739}
740
741static PointerRNA rna_Curve_active_spline_get(PointerRNA *ptr)
742{
743 Curve *cu = static_cast<Curve *>(ptr->data);
744 Nurb *nu;
745 ListBase *nurbs = BKE_curve_nurbs_get(cu);
746
747 /* For curve outside editmode will set to -1,
748 * should be changed to be allowed outside of editmode. */
749 nu = static_cast<Nurb *>(BLI_findlink(nurbs, cu->actnu));
750
751 if (nu) {
752 return rna_pointer_inherit_refine(ptr, &RNA_Spline, nu);
753 }
754
755 return rna_pointer_inherit_refine(ptr, nullptr, nullptr);
756}
757
758static void rna_Curve_active_spline_set(PointerRNA *ptr,
759 PointerRNA value,
760 ReportList * /*reports*/)
761{
762 Curve *cu = static_cast<Curve *>(ptr->data);
763 Nurb *nu = static_cast<Nurb *>(value.data);
764 ListBase *nubase = BKE_curve_nurbs_get(cu);
765
766 /* -1 is ok for an unset index */
767 if (nu == nullptr) {
768 cu->actnu = -1;
769 }
770 else {
771 cu->actnu = BLI_findindex(nubase, nu);
772 }
773}
774
775static std::optional<std::string> rna_Curve_spline_path(const PointerRNA *ptr)
776{
777 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
778 ListBase *nubase = BKE_curve_nurbs_get(cu);
779 Nurb *nu = static_cast<Nurb *>(ptr->data);
780 int index = BLI_findindex(nubase, nu);
781
782 if (index >= 0) {
783 return fmt::format("splines[{}]", index);
784 }
785 return "";
786}
787
788/* use for both bezier and nurbs */
789static std::optional<std::string> rna_Curve_spline_point_path(const PointerRNA *ptr)
790{
791 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
792 Nurb *nu;
793 void *point = ptr->data;
794 int nu_index, pt_index;
795
796 nu = curve_nurb_from_point(cu, point, &nu_index, &pt_index);
797
798 if (nu) {
799 if (nu->type == CU_BEZIER) {
800 return fmt::format("splines[{}].bezier_points[{}]", nu_index, pt_index);
801 }
802 return fmt::format("splines[{}].points[{}]", nu_index, pt_index);
803 }
804 return "";
805}
806
807static std::optional<std::string> rna_TextBox_path(const PointerRNA *ptr)
808{
809 const Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
810 const TextBox *tb = static_cast<TextBox *>(ptr->data);
811 int index = int(tb - cu->tb);
812
813 if (index >= 0 && index < cu->totbox) {
814 return fmt::format("text_boxes[{}]", index);
815 }
816 return "";
817}
818
819static void rna_Curve_splines_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
820{
821 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
823}
824
825static bool rna_Curve_is_editmode_get(PointerRNA *ptr)
826{
827 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
828 const short type = BKE_curve_type_get(cu);
829 if (type == OB_FONT) {
830 return (cu->editfont != nullptr);
831 }
832 else {
833 return (cu->editnurb != nullptr);
834 }
835}
836
837static bool rna_TextCurve_is_select_bold_get(PointerRNA *ptr)
838{
839 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
840 if (cu->editfont != nullptr) {
842 }
843 return false;
844}
845
846static bool rna_TextCurve_is_select_italic_get(PointerRNA *ptr)
847{
848 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
849 if (cu->editfont != nullptr) {
851 }
852 return false;
853}
854
855static bool rna_TextCurve_is_select_underline_get(PointerRNA *ptr)
856{
857 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
858 if (cu->editfont != nullptr) {
860 }
861 return false;
862}
863
864static bool rna_TextCurve_is_select_smallcaps_get(PointerRNA *ptr)
865{
866 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
867 if (cu->editfont != nullptr) {
869 }
870 return false;
871}
872
873static bool rna_TextCurve_has_selection_get(PointerRNA *ptr)
874{
875 Curve *cu = reinterpret_cast<Curve *>(ptr->owner_id);
876 if (cu->editfont != nullptr) {
877 return (cu->editfont->selboxes != nullptr);
878 }
879 return false;
880}
881
882#else
883
884static const float tilt_limit = DEG2RADF(21600.0f);
885
886static void rna_def_bpoint(BlenderRNA *brna)
887{
888 StructRNA *srna;
889 PropertyRNA *prop;
890
891 srna = RNA_def_struct(brna, "SplinePoint", nullptr);
892 RNA_def_struct_sdna(srna, "BPoint");
893 RNA_def_struct_ui_text(srna, "SplinePoint", "Spline point without handles");
894
895 /* Boolean values */
896 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
897 RNA_def_property_boolean_sdna(prop, nullptr, "f1", SELECT);
898 RNA_def_property_ui_text(prop, "Select", "Selection status");
899 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
900
901 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
902 RNA_def_property_boolean_sdna(prop, nullptr, "hide", 0);
903 RNA_def_property_ui_text(prop, "Hide", "Visibility status");
904 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
905
906 /* Vector value */
907 prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
908 RNA_def_property_array(prop, 3);
909 RNA_def_property_float_sdna(prop, nullptr, "vec");
910 RNA_def_property_ui_text(prop, "Point", "Point coordinates");
912 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
913
914 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
915 RNA_def_property_float_sdna(prop, nullptr, "vec[3]");
916 RNA_def_property_ui_text(prop, "Weight", "NURBS weight");
917 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
918
919 /* Number values */
920 prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
923 RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
924 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
925
926 prop = RNA_def_property(srna, "weight_softbody", PROP_FLOAT, PROP_NONE);
927 RNA_def_property_float_sdna(prop, nullptr, "weight");
928 RNA_def_property_range(prop, 0.01f, 100.0f);
929 RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
930 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
931
932 prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
933 RNA_def_property_float_sdna(prop, nullptr, "radius");
934 RNA_def_property_range(prop, 0.0f, FLT_MAX);
935 RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for beveling");
936 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
937
938 RNA_def_struct_path_func(srna, "rna_Curve_spline_point_path");
939}
940
942{
943 StructRNA *srna;
944 PropertyRNA *prop;
945
946 srna = RNA_def_struct(brna, "BezierSplinePoint", nullptr);
947 RNA_def_struct_sdna(srna, "BezTriple");
948 RNA_def_struct_ui_text(srna, "Bézier Curve Point", "Bézier curve point with two handles");
949
950 /* Boolean values */
951 prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
952 RNA_def_property_boolean_sdna(prop, nullptr, "f1", SELECT);
953 RNA_def_property_ui_text(prop, "Handle 1 selected", "Handle 1 selection status");
954 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
955
956 prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
957 RNA_def_property_boolean_sdna(prop, nullptr, "f3", SELECT);
958 RNA_def_property_ui_text(prop, "Handle 2 selected", "Handle 2 selection status");
959 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
960
961 prop = RNA_def_property(srna, "select_control_point", PROP_BOOLEAN, PROP_NONE);
962 RNA_def_property_boolean_sdna(prop, nullptr, "f2", SELECT);
963 RNA_def_property_ui_text(prop, "Control Point selected", "Control point selection status");
964 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
965
966 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
967 RNA_def_property_boolean_sdna(prop, nullptr, "hide", 0);
968 RNA_def_property_ui_text(prop, "Hide", "Visibility status");
969 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
970
971 /* Enums */
972 prop = RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
973 RNA_def_property_enum_sdna(prop, nullptr, "h1");
975 RNA_def_property_ui_text(prop, "Handle 1 Type", "Handle types");
976 RNA_def_property_update(prop, 0, "rna_Curve_update_points");
977
978 prop = RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
979 RNA_def_property_enum_sdna(prop, nullptr, "h2");
981 RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle types");
982 RNA_def_property_update(prop, 0, "rna_Curve_update_points");
983
984 /* Vector values */
985 prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
986 RNA_def_property_array(prop, 3);
988 prop, "rna_BezTriple_handle1_get", "rna_BezTriple_handle1_set", nullptr);
989 RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle");
991 RNA_def_property_update(prop, 0, "rna_Curve_update_points");
992
993 prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
994 RNA_def_property_array(prop, 3);
996 prop, "rna_BezTriple_ctrlpoint_get", "rna_BezTriple_ctrlpoint_set", nullptr);
997 RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
999 RNA_def_property_update(prop, 0, "rna_Curve_update_points");
1000
1001 prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
1002 RNA_def_property_array(prop, 3);
1004 prop, "rna_BezTriple_handle2_get", "rna_BezTriple_handle2_set", nullptr);
1005 RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle");
1007 RNA_def_property_update(prop, 0, "rna_Curve_update_points");
1008
1009 /* Number values */
1010 prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
1013 RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
1014 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1015
1016 prop = RNA_def_property(srna, "weight_softbody", PROP_FLOAT, PROP_NONE);
1017 RNA_def_property_float_sdna(prop, nullptr, "weight");
1018 RNA_def_property_range(prop, 0.01f, 100.0f);
1019 RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
1020 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1021
1022 prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
1023 RNA_def_property_float_sdna(prop, nullptr, "radius");
1024 RNA_def_property_range(prop, 0.0f, FLT_MAX);
1025 RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for beveling");
1026 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1027
1028 RNA_def_struct_path_func(srna, "rna_Curve_spline_point_path");
1029}
1030
1031static void rna_def_path(BlenderRNA * /*brna*/, StructRNA *srna)
1032{
1033 PropertyRNA *prop;
1034
1035 /* number values */
1036 prop = RNA_def_property(srna, "path_duration", PROP_INT, PROP_TIME);
1037 RNA_def_property_int_sdna(prop, nullptr, "pathlen");
1040 "Path Duration",
1041 "The number of frames that are needed to traverse the path, "
1042 "defining the maximum value for the 'Evaluation Time' setting");
1043 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1044
1045 /* flags */
1046 prop = RNA_def_property(srna, "use_path", PROP_BOOLEAN, PROP_NONE);
1047 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_PATH);
1048 RNA_def_property_ui_text(prop, "Path", "Enable the curve to become a translation path");
1049 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1050
1051 prop = RNA_def_property(srna, "use_path_follow", PROP_BOOLEAN, PROP_NONE);
1052 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_FOLLOW);
1053 RNA_def_property_ui_text(prop, "Follow", "Make curve path children rotate along the path");
1054 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1055
1056 prop = RNA_def_property(srna, "use_path_clamp", PROP_BOOLEAN, PROP_NONE);
1057 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_PATH_CLAMP);
1059 prop,
1060 "Clamp",
1061 "Clamp the curve path children so they can't travel past the start/end point of the curve");
1062 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1063
1064 prop = RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
1065 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_STRETCH);
1067 "Stretch",
1068 "Option for curve-deform: "
1069 "make deformed child stretch along entire path");
1070 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1071
1072 prop = RNA_def_property(srna, "use_deform_bounds", PROP_BOOLEAN, PROP_NONE);
1075 "Bounds Clamp",
1076 "Option for curve-deform: "
1077 "Use the mesh bounds to clamp the deformation");
1078 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1079
1080 prop = RNA_def_property(srna, "use_radius", PROP_BOOLEAN, PROP_NONE);
1081 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_PATH_RADIUS);
1083 "Radius",
1084 "Option for paths and curve-deform: "
1085 "apply the curve radius to objects following it "
1086 "and to deformed objects");
1087 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1088}
1089
1090static void rna_def_nurbs(BlenderRNA * /*brna*/, StructRNA * /*srna*/)
1091{
1092 /* Nothing. */
1093}
1094
1095static void rna_def_font(BlenderRNA * /*brna*/, StructRNA *srna)
1096{
1097 PropertyRNA *prop;
1098
1099 static const EnumPropertyItem prop_align_items[] = {
1100 {CU_ALIGN_X_LEFT, "LEFT", ICON_ALIGN_LEFT, "Left", "Align text to the left"},
1101 {CU_ALIGN_X_MIDDLE, "CENTER", ICON_ALIGN_CENTER, "Center", "Center text"},
1102 {CU_ALIGN_X_RIGHT, "RIGHT", ICON_ALIGN_RIGHT, "Right", "Align text to the right"},
1104 "JUSTIFY",
1105 ICON_ALIGN_JUSTIFY,
1106 "Justify",
1107 "Align to the left and the right"},
1109 "FLUSH",
1110 ICON_ALIGN_FLUSH,
1111 "Flush",
1112 "Align to the left and the right, with equal character spacing"},
1113 {0, nullptr, 0, nullptr, nullptr},
1114 };
1115
1116 static const EnumPropertyItem prop_align_y_items[] = {
1117 {CU_ALIGN_Y_TOP, "TOP", ICON_ALIGN_TOP, "Top", "Align text to the top"},
1119 "TOP_BASELINE",
1120 ICON_ALIGN_TOP,
1121 "Top Baseline",
1122 "Align text to the top line's baseline"},
1123 {CU_ALIGN_Y_CENTER, "CENTER", ICON_ALIGN_MIDDLE, "Middle", "Align text to the middle"},
1125 "BOTTOM_BASELINE",
1126 ICON_ALIGN_BOTTOM,
1127 "Bottom Baseline",
1128 "Align text to the bottom line's baseline"},
1129 {CU_ALIGN_Y_BOTTOM, "BOTTOM", ICON_ALIGN_BOTTOM, "Bottom", "Align text to the bottom"},
1130 {0, nullptr, 0, nullptr, nullptr},
1131 };
1132
1133 static const EnumPropertyItem prop_overflow_items[] = {
1134 {CU_OVERFLOW_NONE, "NONE", 0, "Overflow", "Let the text overflow outside the text boxes"},
1136 "SCALE",
1137 0,
1138 "Scale to Fit",
1139 "Scale down the text to fit inside the text boxes"},
1141 "TRUNCATE",
1142 0,
1143 "Truncate",
1144 "Truncate the text that would go outside the text boxes"},
1145 {0, nullptr, 0, nullptr, nullptr},
1146 };
1147
1148 /* Enums */
1149 prop = RNA_def_property(srna, "align_x", PROP_ENUM, PROP_NONE);
1150 RNA_def_property_enum_sdna(prop, nullptr, "spacemode");
1151 RNA_def_property_enum_items(prop, prop_align_items);
1153 prop, "Horizontal Alignment", "Text horizontal alignment from the object center");
1154 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1155
1156 prop = RNA_def_property(srna, "align_y", PROP_ENUM, PROP_NONE);
1157 RNA_def_property_enum_sdna(prop, nullptr, "align_y");
1158 RNA_def_property_enum_items(prop, prop_align_y_items);
1160 prop, "Vertical Alignment", "Text vertical alignment from the object center");
1161 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1162
1163 prop = RNA_def_property(srna, "overflow", PROP_ENUM, PROP_NONE);
1164 RNA_def_property_enum_sdna(prop, nullptr, "overflow");
1165 RNA_def_property_enum_items(prop, prop_overflow_items);
1168 prop, "Textbox Overflow", "Handle the text behavior when it doesn't fit in the text boxes");
1169 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1170
1171 /* number values */
1172 prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
1173 RNA_def_property_float_sdna(prop, nullptr, "fsize");
1174 RNA_def_property_range(prop, 0.0001f, 10000.0f);
1175 RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
1176 RNA_def_property_ui_text(prop, "Font Size", "");
1177 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1178
1179 prop = RNA_def_property(srna, "small_caps_scale", PROP_FLOAT, PROP_NONE);
1180 RNA_def_property_float_sdna(prop, nullptr, "smallcaps_scale");
1181 RNA_def_property_ui_range(prop, 0, 1.0, 1, 2);
1182 RNA_def_property_ui_text(prop, "Small Caps", "Scale of small capitals");
1183 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1184
1185 prop = RNA_def_property(srna, "space_line", PROP_FLOAT, PROP_NONE);
1186 RNA_def_property_float_sdna(prop, nullptr, "linedist");
1187 RNA_def_property_range(prop, 0.0f, 10.0f);
1188 RNA_def_property_ui_text(prop, "Distance between lines of text", "");
1189 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1190
1191 prop = RNA_def_property(srna, "space_word", PROP_FLOAT, PROP_NONE);
1192 RNA_def_property_float_sdna(prop, nullptr, "wordspace");
1193 RNA_def_property_range(prop, 0.0f, 10.0f);
1194 RNA_def_property_ui_text(prop, "Spacing between words", "");
1195 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1196
1197 prop = RNA_def_property(srna, "space_character", PROP_FLOAT, PROP_NONE);
1198 RNA_def_property_float_sdna(prop, nullptr, "spacing");
1199 RNA_def_property_range(prop, 0.0f, 10.0f);
1200 RNA_def_property_ui_text(prop, "Global spacing between characters", "");
1201 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1202
1203 prop = RNA_def_property(srna, "shear", PROP_FLOAT, PROP_NONE);
1204 RNA_def_property_float_sdna(prop, nullptr, "shear");
1205 RNA_def_property_range(prop, -1.0f, 1.0f);
1206 RNA_def_property_ui_text(prop, "Shear", "Italic angle of the characters");
1207 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1208
1209 prop = RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_DISTANCE);
1210 RNA_def_property_float_sdna(prop, nullptr, "xof");
1212 RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
1213 RNA_def_property_ui_text(prop, "X Offset", "Horizontal offset from the object origin");
1214 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1215
1216 prop = RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_DISTANCE);
1217 RNA_def_property_float_sdna(prop, nullptr, "yof");
1219 RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
1220 RNA_def_property_ui_text(prop, "Y Offset", "Vertical offset from the object origin");
1221 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1222
1223 prop = RNA_def_property(srna, "underline_position", PROP_FLOAT, PROP_NONE);
1224 RNA_def_property_float_sdna(prop, nullptr, "ulpos");
1225 RNA_def_property_range(prop, -0.2f, 0.8f);
1226 RNA_def_property_ui_text(prop, "Underline Position", "Vertical position of underline");
1227 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1228
1229 prop = RNA_def_property(srna, "underline_height", PROP_FLOAT, PROP_NONE);
1230 RNA_def_property_float_sdna(prop, nullptr, "ulheight");
1231 RNA_def_property_range(prop, 0.0f, 0.8f);
1232 RNA_def_property_ui_text(prop, "Underline Thickness", "");
1233 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1234
1235 prop = RNA_def_property(srna, "text_boxes", PROP_COLLECTION, PROP_NONE);
1236 RNA_def_property_collection_sdna(prop, nullptr, "tb", "totbox");
1237 RNA_def_property_struct_type(prop, "TextBox");
1238 RNA_def_property_ui_text(prop, "Textboxes", "");
1239
1240 prop = RNA_def_property(srna, "active_textbox", PROP_INT, PROP_NONE);
1241 RNA_def_property_int_sdna(prop, nullptr, "actbox");
1242 RNA_def_property_ui_text(prop, "Active Text Box", "");
1243 RNA_def_property_int_funcs(prop, nullptr, nullptr, "rna_Curve_active_textbox_index_range");
1244
1245 /* strings */
1246 prop = RNA_def_property(srna, "family", PROP_STRING, PROP_NONE);
1249 prop,
1250 "Object Font",
1251 "Use objects as font characters (give font objects a common name "
1252 "followed by the character they represent, eg. 'family-a', 'family-b', etc, "
1253 "set this setting to 'family-', and turn on Vertex Instancing)");
1254 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1255
1256 prop = RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
1257 RNA_def_property_string_sdna(prop, nullptr, "str");
1258 RNA_def_property_ui_text(prop, "Body Text", "Content of this text object");
1260 prop, "rna_Curve_body_get", "rna_Curve_body_length", "rna_Curve_body_set");
1261 /* note that originally str did not have a limit! */
1263 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1264
1265 prop = RNA_def_property(srna, "body_format", PROP_COLLECTION, PROP_NONE);
1266 RNA_def_property_collection_sdna(prop, nullptr, "strinfo", "len_char32");
1267 RNA_def_property_struct_type(prop, "TextCharacterFormat");
1268 RNA_def_property_ui_text(prop, "Character Info", "Stores the style of each character");
1269
1270 /* pointers */
1271 prop = RNA_def_property(srna, "follow_curve", PROP_POINTER, PROP_NONE);
1272 RNA_def_property_pointer_sdna(prop, nullptr, "textoncurve");
1273 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, "rna_Curve_otherObject_poll");
1276 RNA_def_property_ui_text(prop, "Text on Curve", "Curve deforming text object");
1277 RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
1278
1279 prop = RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
1280 RNA_def_property_pointer_sdna(prop, nullptr, "vfont");
1281 RNA_def_property_ui_text(prop, "Font", "");
1284 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1285
1286 prop = RNA_def_property(srna, "font_bold", PROP_POINTER, PROP_NONE);
1287 RNA_def_property_pointer_sdna(prop, nullptr, "vfontb");
1288 RNA_def_property_ui_text(prop, "Font Bold", "");
1291 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1292
1293 prop = RNA_def_property(srna, "font_italic", PROP_POINTER, PROP_NONE);
1294 RNA_def_property_pointer_sdna(prop, nullptr, "vfonti");
1295 RNA_def_property_ui_text(prop, "Font Italic", "");
1298 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1299
1300 prop = RNA_def_property(srna, "font_bold_italic", PROP_POINTER, PROP_NONE);
1301 RNA_def_property_pointer_sdna(prop, nullptr, "vfontbi");
1302 RNA_def_property_ui_text(prop, "Font Bold Italic", "");
1305 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1306
1307 prop = RNA_def_property(srna, "edit_format", PROP_POINTER, PROP_NONE);
1308 RNA_def_property_pointer_sdna(prop, nullptr, "curinfo");
1309 RNA_def_property_ui_text(prop, "Edit Format", "Editing settings character formatting");
1310 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1311
1312 /* flags */
1313 prop = RNA_def_property(srna, "use_fast_edit", PROP_BOOLEAN, PROP_NONE);
1314 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_FAST);
1315 RNA_def_property_ui_text(prop, "Fast Editing", "Don't fill polygons while editing");
1316 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1317
1318 prop = RNA_def_property(srna, "is_select_bold", PROP_BOOLEAN, PROP_NONE);
1319 RNA_def_property_boolean_funcs(prop, "rna_TextCurve_is_select_bold_get", nullptr);
1320 RNA_def_property_ui_text(prop, "Selected Bold", "Whether the selected text is bold");
1322
1323 prop = RNA_def_property(srna, "is_select_italic", PROP_BOOLEAN, PROP_NONE);
1324 RNA_def_property_boolean_funcs(prop, "rna_TextCurve_is_select_italic_get", nullptr);
1325 RNA_def_property_ui_text(prop, "Selected Italic", "Whether the selected text is italics");
1327
1328 prop = RNA_def_property(srna, "is_select_underline", PROP_BOOLEAN, PROP_NONE);
1329 RNA_def_property_boolean_funcs(prop, "rna_TextCurve_is_select_underline_get", nullptr);
1330 RNA_def_property_ui_text(prop, "Selected Underline", "Whether the selected text is underlined");
1332
1333 prop = RNA_def_property(srna, "is_select_smallcaps", PROP_BOOLEAN, PROP_NONE);
1334 RNA_def_property_boolean_funcs(prop, "rna_TextCurve_is_select_smallcaps_get", nullptr);
1335 RNA_def_property_ui_text(prop, "Selected Small Caps", "Whether the selected text is small caps");
1337
1338 prop = RNA_def_property(srna, "has_selection", PROP_BOOLEAN, PROP_NONE);
1339 RNA_def_property_boolean_funcs(prop, "rna_TextCurve_has_selection_get", nullptr);
1340 RNA_def_property_ui_text(prop, "Text Selected", "Whether there is any text selected");
1342}
1343
1344static void rna_def_textbox(BlenderRNA *brna)
1345{
1346 StructRNA *srna;
1347 PropertyRNA *prop;
1348
1349 srna = RNA_def_struct(brna, "TextBox", nullptr);
1350 RNA_def_struct_ui_text(srna, "Text Box", "Text bounding box for layout");
1351
1352 /* number values */
1353 prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_DISTANCE);
1354 RNA_def_property_float_sdna(prop, nullptr, "x");
1356 RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
1357 RNA_def_property_ui_text(prop, "Textbox X Offset", "");
1358 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1359
1360 prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_DISTANCE);
1361 RNA_def_property_float_sdna(prop, nullptr, "y");
1363 RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
1364 RNA_def_property_ui_text(prop, "Textbox Y Offset", "");
1365 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1366
1367 prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
1368 RNA_def_property_float_sdna(prop, nullptr, "w");
1369 RNA_def_property_range(prop, 0.0f, FLT_MAX);
1370 RNA_def_property_ui_range(prop, 0.0f, 50.0f, 10, 3);
1371 RNA_def_property_ui_text(prop, "Textbox Width", "");
1372 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1373
1374 prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
1375 RNA_def_property_float_sdna(prop, nullptr, "h");
1376 RNA_def_property_range(prop, 0.0f, FLT_MAX);
1377 RNA_def_property_ui_range(prop, 0.0f, 50.0f, 10, 3);
1378 RNA_def_property_ui_text(prop, "Textbox Height", "");
1379 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1380
1381 RNA_def_struct_path_func(srna, "rna_TextBox_path");
1382}
1383
1385{
1386 StructRNA *srna;
1387 PropertyRNA *prop;
1388
1389 srna = RNA_def_struct(brna, "TextCharacterFormat", nullptr);
1390 RNA_def_struct_sdna(srna, "CharInfo");
1391 RNA_def_struct_ui_text(srna, "Text Character Format", "Text character formatting settings");
1392
1393 /* flags */
1394 prop = RNA_def_property(srna, "use_bold", PROP_BOOLEAN, PROP_NONE);
1395 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_CHINFO_BOLD);
1396 RNA_def_property_ui_text(prop, "Bold", "");
1397 RNA_def_property_ui_icon(prop, ICON_BOLD, 0);
1398 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1399
1400 prop = RNA_def_property(srna, "use_italic", PROP_BOOLEAN, PROP_NONE);
1401 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_CHINFO_ITALIC);
1402 RNA_def_property_ui_text(prop, "Italic", "");
1403 RNA_def_property_ui_icon(prop, ICON_ITALIC, 0);
1404 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1405
1406 prop = RNA_def_property(srna, "use_underline", PROP_BOOLEAN, PROP_NONE);
1407 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_CHINFO_UNDERLINE);
1408 RNA_def_property_ui_text(prop, "Underline", "");
1409 RNA_def_property_ui_icon(prop, ICON_UNDERLINE, 0);
1410 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1411
1412 /* probably there is no reason to expose this */
1413# if 0
1414 prop = RNA_def_property(srna, "use_wrap", PROP_BOOLEAN, PROP_NONE);
1415 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_CHINFO_WRAP);
1416 RNA_def_property_ui_text(prop, "Wrap", "");
1417 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1418# endif
1419
1420 prop = RNA_def_property(srna, "use_small_caps", PROP_BOOLEAN, PROP_NONE);
1421 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_CHINFO_SMALLCAPS);
1422 RNA_def_property_ui_text(prop, "Small Caps", "");
1423 RNA_def_property_ui_icon(prop, ICON_SMALL_CAPS, 0);
1424 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1425
1426 prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
1427 // RNA_def_property_int_sdna(prop, nullptr, "mat_nr");
1428 RNA_def_property_ui_text(prop, "Material Index", "Material slot index of this character");
1430 "rna_ChariInfo_material_index_get",
1431 "rna_ChariInfo_material_index_set",
1432 "rna_Curve_material_index_range");
1433 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1434
1435 prop = RNA_def_property(srna, "kerning", PROP_FLOAT, PROP_NONE);
1436 RNA_def_property_float_sdna(prop, nullptr, "kern");
1437 RNA_def_property_ui_text(prop, "Kerning", "Spacing between characters");
1438 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1439}
1440
1441static void rna_def_surface(BlenderRNA *brna)
1442{
1443 StructRNA *srna;
1444
1445 srna = RNA_def_struct(brna, "SurfaceCurve", "Curve");
1446 RNA_def_struct_sdna(srna, "Curve");
1447 RNA_def_struct_ui_text(srna, "Surface Curve", "Curve data-block used for storing surfaces");
1448 RNA_def_struct_ui_icon(srna, ICON_SURFACE_DATA);
1449
1450 rna_def_nurbs(brna, srna);
1451}
1452
1453static void rna_def_text(BlenderRNA *brna)
1454{
1455 StructRNA *srna;
1456
1457 srna = RNA_def_struct(brna, "TextCurve", "Curve");
1458 RNA_def_struct_sdna(srna, "Curve");
1459 RNA_def_struct_ui_text(srna, "Text Curve", "Curve data-block used for storing text");
1460 RNA_def_struct_ui_icon(srna, ICON_FONT_DATA);
1461
1462 rna_def_font(brna, srna);
1463 rna_def_nurbs(brna, srna);
1464}
1465
1466/* curve.splines[0].points */
1468{
1469 StructRNA *srna;
1470 // PropertyRNA *prop;
1471
1472 FunctionRNA *func;
1473 PropertyRNA *parm;
1474
1475 RNA_def_property_srna(cprop, "SplinePoints");
1476 srna = RNA_def_struct(brna, "SplinePoints", nullptr);
1477 RNA_def_struct_sdna(srna, "Nurb");
1478 RNA_def_struct_ui_text(srna, "Spline Points", "Collection of spline points");
1479
1480 func = RNA_def_function(srna, "add", "rna_Curve_spline_points_add");
1481 RNA_def_function_ui_description(func, "Add a number of points to this spline");
1483 parm = RNA_def_int(
1484 func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
1486
1487# if 0
1488 func = RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
1489 RNA_def_function_ui_description(func, "Remove a spline from a curve");
1491 parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
1494# endif
1495}
1496
1498{
1499 StructRNA *srna;
1500 // PropertyRNA *prop;
1501
1502 FunctionRNA *func;
1503 PropertyRNA *parm;
1504
1505 RNA_def_property_srna(cprop, "SplineBezierPoints");
1506 srna = RNA_def_struct(brna, "SplineBezierPoints", nullptr);
1507 RNA_def_struct_sdna(srna, "Nurb");
1508 RNA_def_struct_ui_text(srna, "Spline Bézier Points", "Collection of spline Bézier points");
1509
1510 func = RNA_def_function(srna, "add", "rna_Curve_spline_bezpoints_add");
1511 RNA_def_function_ui_description(func, "Add a number of points to this spline");
1513 parm = RNA_def_int(
1514 func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
1516
1517# if 0
1518 func = RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
1519 RNA_def_function_ui_description(func, "Remove a spline from a curve");
1521 parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
1524# endif
1525}
1526
1527/* curve.splines */
1529{
1530 StructRNA *srna;
1531 PropertyRNA *prop;
1532
1533 FunctionRNA *func;
1534 PropertyRNA *parm;
1535
1536 RNA_def_property_srna(cprop, "CurveSplines");
1537 srna = RNA_def_struct(brna, "CurveSplines", nullptr);
1538 RNA_def_struct_sdna(srna, "Curve");
1539 RNA_def_struct_ui_text(srna, "Curve Splines", "Collection of curve splines");
1540
1541 func = RNA_def_function(srna, "new", "rna_Curve_spline_new");
1542 RNA_def_function_ui_description(func, "Add a new spline to the curve");
1543 parm = RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline");
1545 parm = RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline");
1546 RNA_def_function_return(func, parm);
1547
1548 func = RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
1549 RNA_def_function_ui_description(func, "Remove a spline from a curve");
1551 parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
1554
1555 func = RNA_def_function(srna, "clear", "rna_Curve_spline_clear");
1556 RNA_def_function_ui_description(func, "Remove all splines from a curve");
1557
1558 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1559 RNA_def_property_struct_type(prop, "Spline");
1561 prop, "rna_Curve_active_spline_get", "rna_Curve_active_spline_set", nullptr, nullptr);
1563 RNA_def_property_ui_text(prop, "Active Spline", "Active curve spline");
1564}
1565
1566static void rna_def_curve(BlenderRNA *brna)
1567{
1568 StructRNA *srna;
1569 PropertyRNA *prop;
1570
1571 static const EnumPropertyItem curve_twist_mode_items[] = {
1573 "Z_UP",
1574 0,
1575 "Z-Up",
1576 "Use Z-Up axis to calculate the curve twist at each point"},
1577 {CU_TWIST_MINIMUM, "MINIMUM", 0, "Minimum", "Use the least twist over the entire curve"},
1578 {CU_TWIST_TANGENT, "TANGENT", 0, "Tangent", "Use the tangent to calculate twist"},
1579 {0, nullptr, 0, nullptr, nullptr},
1580 };
1581
1582 static const EnumPropertyItem curve_axis_items[] = {
1583 {0, "2D", 0, "2D", "Clamp the Z axis of the curve"},
1584 {CU_3D,
1585 "3D",
1586 0,
1587 "3D",
1588 "Allow editing on the Z axis of this curve, also allows tilt and curve radius to be used"},
1589 {0, nullptr, 0, nullptr, nullptr},
1590 };
1591
1592 static const EnumPropertyItem bevfac_mapping_items[] = {
1594 "RESOLUTION",
1595 0,
1596 "Resolution",
1597 "Map the geometry factor to the number of subdivisions of a spline (U resolution)"},
1599 "SEGMENTS",
1600 0,
1601 "Segments",
1602 "Map the geometry factor to the length of a segment and to the number of subdivisions of a "
1603 "segment"},
1605 "SPLINE",
1606 0,
1607 "Spline",
1608 "Map the geometry factor to the length of a spline"},
1609 {0, nullptr, 0, nullptr, nullptr},
1610 };
1611
1612 static const EnumPropertyItem bevel_mode_items[] = {
1614 "ROUND",
1615 0,
1616 "Round",
1617 "Use circle for the section of the curve's bevel geometry"},
1619 "OBJECT",
1620 0,
1621 "Object",
1622 "Use an object for the section of the curve's bevel geometry segment"},
1624 "PROFILE",
1625 0,
1626 "Profile",
1627 "Use a custom profile for each quarter of curve's bevel geometry"},
1628 {0, nullptr, 0, nullptr, nullptr},
1629 };
1630
1631 static const EnumPropertyItem curve_taper_radius_mode_items[] = {
1633 "OVERRIDE",
1634 0,
1635 "Override",
1636 "Override the radius of the spline point with the taper radius"},
1638 "MULTIPLY",
1639 0,
1640 "Multiply",
1641 "Multiply the radius of the spline point by the taper radius"},
1643 "ADD",
1644 0,
1645 "Add",
1646 "Add the radius of the bevel point to the taper radius"},
1647 {0, nullptr, 0, nullptr, nullptr},
1648 };
1649
1650 srna = RNA_def_struct(brna, "Curve", "ID");
1651 RNA_def_struct_ui_text(srna, "Curve", "Curve data-block storing curves, splines and NURBS");
1652 RNA_def_struct_ui_icon(srna, ICON_CURVE_DATA);
1653 RNA_def_struct_refine_func(srna, "rna_Curve_refine");
1654
1655 prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
1656 RNA_def_property_pointer_sdna(prop, nullptr, "key");
1659 RNA_def_property_ui_text(prop, "Shape Keys", "");
1660
1661 prop = RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE);
1662# if 0
1663 RNA_def_property_collection_sdna(prop, nullptr, "nurb", nullptr);
1664# else
1665 /* this way we get editmode nurbs too, keyframe in editmode */
1667 "rna_Curve_splines_begin",
1668 "rna_iterator_listbase_next",
1669 "rna_iterator_listbase_end",
1670 "rna_iterator_listbase_get",
1671 nullptr,
1672 nullptr,
1673 nullptr,
1674 nullptr);
1675# endif
1676 RNA_def_property_struct_type(prop, "Spline");
1677 RNA_def_property_ui_text(prop, "Splines", "Collection of splines in this curve data object");
1678 rna_def_curve_splines(brna, prop);
1679
1680 rna_def_path(brna, srna);
1681
1682 prop = RNA_def_property(srna, "bevel_mode", PROP_ENUM, PROP_NONE);
1683 RNA_def_property_enum_sdna(prop, nullptr, "bevel_mode");
1684 RNA_def_property_enum_items(prop, bevel_mode_items);
1686 prop, "Bevel Mode", "Determine how to build the curve's bevel geometry");
1687 RNA_def_property_enum_funcs(prop, nullptr, "rna_Curve_bevel_mode_set", nullptr);
1688 /* Use this update function so the curve profile is properly initialized when
1689 * switching back to "Profile" mode after changing the resolution. */
1690 RNA_def_property_update(prop, 0, "rna_Curve_bevel_resolution_update");
1691
1692 prop = RNA_def_property(srna, "bevel_profile", PROP_POINTER, PROP_NONE);
1693 RNA_def_property_struct_type(prop, "CurveProfile");
1694 RNA_def_property_pointer_sdna(prop, nullptr, "bevel_profile");
1695 RNA_def_property_ui_text(prop, "Custom Profile Path", "The path for the curve's custom profile");
1696 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1697
1698 /* Number values */
1699 prop = RNA_def_property(srna, "bevel_resolution", PROP_INT, PROP_NONE);
1700 RNA_def_property_int_sdna(prop, nullptr, "bevresol");
1701 RNA_def_property_range(prop, 0, 32);
1702 RNA_def_property_ui_range(prop, 0, 32, 1.0, -1);
1704 prop, "Bevel Resolution", "The number of segments in each quarter-circle of the bevel");
1705 RNA_def_property_update(prop, 0, "rna_Curve_bevel_resolution_update");
1706
1707 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
1708 RNA_def_property_float_sdna(prop, nullptr, "offset");
1709 RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3);
1710 RNA_def_property_float_funcs(prop, "rna_Curve_offset_get", "rna_Curve_offset_set", nullptr);
1711 RNA_def_property_ui_text(prop, "Offset", "Distance to move the curve parallel to its normals");
1712 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1713
1714 prop = RNA_def_property(srna, "extrude", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
1715 RNA_def_property_float_sdna(prop, nullptr, "extrude");
1716 RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 3);
1717 RNA_def_property_range(prop, 0.0, FLT_MAX);
1719 "Extrude",
1720 "Length of the depth added in the local Z direction along the curve, "
1721 "perpendicular to its normals");
1722 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1723
1724 prop = RNA_def_property(srna, "bevel_depth", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
1725 RNA_def_property_float_sdna(prop, nullptr, "bevel_radius");
1726 RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 3);
1728 prop, "Bevel Depth", "Radius of the bevel geometry, not including extrusion");
1729 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1730
1731 prop = RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE);
1732 RNA_def_property_int_sdna(prop, nullptr, "resolu");
1734 RNA_def_property_range(prop, 1, 1024);
1735 RNA_def_property_ui_range(prop, 1, 64, 1, -1);
1737 prop,
1738 "Resolution U",
1739 "Number of computed points in the U direction between every pair of control points");
1740 RNA_def_property_update(prop, 0, "rna_Curve_resolution_u_update_data");
1741
1742 prop = RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE);
1743 RNA_def_property_int_sdna(prop, nullptr, "resolv");
1745 RNA_def_property_ui_range(prop, 1, 64, 1, -1);
1746 RNA_def_property_range(prop, 1, 1024);
1748 prop,
1749 "Resolution V",
1750 "The number of computed points in the V direction between every pair of control points");
1751 RNA_def_property_update(prop, 0, "rna_Curve_resolution_v_update_data");
1752
1753 prop = RNA_def_property(srna, "render_resolution_u", PROP_INT, PROP_NONE);
1754 RNA_def_property_int_sdna(prop, nullptr, "resolu_ren");
1755 RNA_def_property_range(prop, 0, 1024);
1756 RNA_def_property_ui_range(prop, 0, 64, 1, -1);
1758 prop,
1759 "Render Resolution U",
1760 "Surface resolution in U direction used while rendering (zero uses preview resolution)");
1761
1762 prop = RNA_def_property(srna, "render_resolution_v", PROP_INT, PROP_NONE);
1763 RNA_def_property_int_sdna(prop, nullptr, "resolv_ren");
1764 RNA_def_property_ui_range(prop, 0, 64, 1, -1);
1765 RNA_def_property_range(prop, 0, 1024);
1767 prop,
1768 "Render Resolution V",
1769 "Surface resolution in V direction used while rendering (zero uses preview resolution)");
1770
1771 prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_TIME);
1772 RNA_def_property_float_sdna(prop, nullptr, "ctime");
1774 prop,
1775 "Evaluation Time",
1776 "Parametric position along the length of the curve that Objects 'following' it should be "
1777 "at (position is evaluated by dividing by the 'Path Length' value)");
1778 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1779
1780 /* pointers */
1781 prop = RNA_def_property(srna, "bevel_object", PROP_POINTER, PROP_NONE);
1782 RNA_def_property_struct_type(prop, "Object");
1783 RNA_def_property_pointer_sdna(prop, nullptr, "bevobj");
1787 prop, "Bevel Object", "The name of the Curve object that defines the bevel shape");
1788 RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
1790 "rna_Curve_bevelObject_get",
1791 "rna_Curve_bevelObject_set",
1792 nullptr,
1793 "rna_Curve_otherObject_poll");
1794
1795 prop = RNA_def_property(srna, "taper_object", PROP_POINTER, PROP_NONE);
1796 RNA_def_property_struct_type(prop, "Object");
1797 RNA_def_property_pointer_sdna(prop, nullptr, "taperobj");
1801 prop, "Taper Object", "Curve object name that defines the taper (width)");
1802 RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
1804 "rna_Curve_taperObject_get",
1805 "rna_Curve_taperObject_set",
1806 nullptr,
1807 "rna_Curve_otherObject_poll");
1808
1809 /* Flags */
1810
1811 prop = RNA_def_property(srna, "dimensions", PROP_ENUM, PROP_NONE); /* as an enum */
1812 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
1813 RNA_def_property_enum_items(prop, curve_axis_items);
1814 RNA_def_property_enum_funcs(prop, nullptr, "rna_Curve_dimension_set", nullptr);
1815 RNA_def_property_ui_text(prop, "Dimensions", "Select 2D or 3D curve type");
1816 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1817
1818 prop = RNA_def_property(srna, "fill_mode", PROP_ENUM, PROP_NONE);
1819 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
1821 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Curve_fill_mode_itemf");
1822 RNA_def_property_ui_text(prop, "Fill Mode", "Mode of filling curve");
1823 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1824
1825 prop = RNA_def_property(srna, "twist_mode", PROP_ENUM, PROP_NONE);
1826 RNA_def_property_enum_sdna(prop, nullptr, "twist_mode");
1827 RNA_def_property_enum_items(prop, curve_twist_mode_items);
1828 RNA_def_property_ui_text(prop, "Twist Method", "The type of tilt calculation for 3D Curves");
1829 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1830
1831 prop = RNA_def_property(srna, "taper_radius_mode", PROP_ENUM, PROP_NONE);
1832 RNA_def_property_enum_sdna(prop, nullptr, "taper_radius_mode");
1833 RNA_def_property_enum_items(prop, curve_taper_radius_mode_items);
1835 "Taper Radius",
1836 "Determine how the effective radius of the spline point is computed "
1837 "when a taper object is specified");
1838 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1839
1840 prop = RNA_def_property(srna, "bevel_factor_mapping_start", PROP_ENUM, PROP_NONE);
1841 RNA_def_property_enum_sdna(prop, nullptr, "bevfac1_mapping");
1842 RNA_def_property_enum_items(prop, bevfac_mapping_items);
1844 prop, "Start Mapping Type", "Determine how the geometry start factor is mapped to a spline");
1845 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1846
1847 prop = RNA_def_property(srna, "bevel_factor_mapping_end", PROP_ENUM, PROP_NONE);
1848 RNA_def_property_enum_sdna(prop, nullptr, "bevfac2_mapping");
1849 RNA_def_property_enum_items(prop, bevfac_mapping_items);
1851 prop, "End Mapping Type", "Determine how the geometry end factor is mapped to a spline");
1852 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1853
1854 /* XXX: would be nice to have a better way to do this, only add for testing. */
1855 prop = RNA_def_property(srna, "twist_smooth", PROP_FLOAT, PROP_NONE);
1856 RNA_def_property_float_sdna(prop, nullptr, "twist_smooth");
1857 RNA_def_property_ui_range(prop, 0, 100.0, 1, 2);
1858 RNA_def_property_ui_text(prop, "Twist Smooth", "Smoothing iteration for tangents");
1859 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1860
1861 prop = RNA_def_property(srna, "use_fill_caps", PROP_BOOLEAN, PROP_NONE);
1862 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_FILL_CAPS);
1863 RNA_def_property_ui_text(prop, "Fill Caps", "Fill caps for beveled curves");
1864 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1865
1866 prop = RNA_def_property(srna, "use_map_taper", PROP_BOOLEAN, PROP_NONE);
1867 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_MAP_TAPER);
1869 prop, "Map Taper", "Map effect of the taper object to the beveled part of the curve");
1870 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1871
1872 /* texture space */
1873 prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
1874 RNA_def_property_boolean_sdna(prop, nullptr, "texspace_flag", CU_TEXSPACE_FLAG_AUTO);
1876 prop,
1877 "Auto Texture Space",
1878 "Adjust active object's texture space automatically when transforming object");
1879 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Curve_texspace_set");
1880
1881 prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
1882 RNA_def_property_array(prop, 3);
1883 RNA_def_property_ui_text(prop, "Texture Space Location", "");
1885 RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable");
1887 prop, "rna_Curve_texspace_location_get", "rna_Curve_texspace_location_set", nullptr);
1888 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1889
1890 prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
1891 RNA_def_property_array(prop, 3);
1893 RNA_def_property_ui_text(prop, "Texture Space Size", "");
1894 RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable");
1896 prop, "rna_Curve_texspace_size_get", "rna_Curve_texspace_size_set", nullptr);
1897 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1898
1899 /* materials */
1900 prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
1901 RNA_def_property_collection_sdna(prop, nullptr, "mat", "totcol");
1902 RNA_def_property_struct_type(prop, "Material");
1903 RNA_def_property_ui_text(prop, "Materials", "");
1904 RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.cc */
1906 nullptr,
1907 nullptr,
1908 nullptr,
1909 nullptr,
1910 nullptr,
1911 nullptr,
1912 nullptr,
1913 "rna_IDMaterials_assign_int");
1914
1915 prop = RNA_def_property(srna, "bevel_factor_start", PROP_FLOAT, PROP_FACTOR);
1916 RNA_def_property_float_sdna(prop, nullptr, "bevfac1");
1917 RNA_def_property_range(prop, 0, 1.0);
1919 "Geometry Start Factor",
1920 "Define where along the spline the curve geometry starts (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, "bevel_factor_end", PROP_FLOAT, PROP_FACTOR);
1925 RNA_def_property_float_sdna(prop, nullptr, "bevfac2");
1926 RNA_def_property_range(prop, 0, 1.0);
1928 "Geometry End Factor",
1929 "Define where along the spline the curve geometry ends (0 for the "
1930 "beginning, 1 for the end)");
1931 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1932
1933 prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
1934 RNA_def_property_boolean_funcs(prop, "rna_Curve_is_editmode_get", nullptr);
1936 RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
1937
1939
1940 RNA_api_curve(srna);
1941}
1942
1944{
1945 static const EnumPropertyItem spline_interpolation_items[] = {
1946 {KEY_LINEAR, "LINEAR", 0, "Linear", ""},
1947 {KEY_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
1948 {KEY_BSPLINE, "BSPLINE", 0, "BSpline", ""},
1949 /* TODO: define somewhere, not one of BEZT_IPO_*. */
1950 {KEY_CU_EASE, "EASE", 0, "Ease", ""},
1951 {0, nullptr, 0, nullptr, nullptr},
1952 };
1953
1954 StructRNA *srna;
1955 PropertyRNA *prop;
1956
1957 srna = RNA_def_struct(brna, "Spline", nullptr);
1958 RNA_def_struct_sdna(srna, "Nurb");
1960 srna,
1961 "Spline",
1962 "Element of a curve, either NURBS, Bézier or Polyline or a character with text objects");
1963
1964 prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
1965 RNA_def_property_collection_sdna(prop, nullptr, "bp", nullptr);
1966 RNA_def_property_struct_type(prop, "SplinePoint");
1968 "rna_BPoint_array_begin",
1969 "rna_iterator_array_next",
1970 "rna_iterator_array_end",
1971 "rna_iterator_array_get",
1972 "rna_Nurb_length",
1973 nullptr,
1974 nullptr,
1975 nullptr);
1977 prop, "Points", "Collection of points that make up this poly or nurbs spline");
1978 rna_def_curve_spline_points(brna, prop);
1979
1980 prop = RNA_def_property(srna, "bezier_points", PROP_COLLECTION, PROP_NONE);
1981 RNA_def_property_struct_type(prop, "BezierSplinePoint");
1982 RNA_def_property_collection_sdna(prop, nullptr, "bezt", "pntsu");
1983 RNA_def_property_ui_text(prop, "Bézier Points", "Collection of points for Bézier curves only");
1985
1986 prop = RNA_def_property(srna, "tilt_interpolation", PROP_ENUM, PROP_NONE);
1987 RNA_def_property_enum_sdna(prop, nullptr, "tilt_interp");
1988 RNA_def_property_enum_items(prop, spline_interpolation_items);
1990 prop, "Tilt Interpolation", "The type of tilt interpolation for 3D, Bézier curves");
1991 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1992
1993 prop = RNA_def_property(srna, "radius_interpolation", PROP_ENUM, PROP_NONE);
1994 RNA_def_property_enum_sdna(prop, nullptr, "radius_interp");
1995 RNA_def_property_enum_items(prop, spline_interpolation_items);
1997 prop, "Radius Interpolation", "The type of radius interpolation for Bézier curves");
1998 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1999
2000 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2002 RNA_def_property_enum_funcs(prop, nullptr, "rna_Nurb_type_set", nullptr);
2003 RNA_def_property_ui_text(prop, "Type", "The interpolation type for this curve element");
2004 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2005
2006 prop = RNA_def_property(srna, "point_count_u", PROP_INT, PROP_UNSIGNED);
2007 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* Editing this needs knot recalc. */
2008 RNA_def_property_int_sdna(prop, nullptr, "pntsu");
2010 prop, "Points U", "Total number points for the curve or surface in the U direction");
2011 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2012
2013 prop = RNA_def_property(srna, "point_count_v", PROP_INT, PROP_UNSIGNED);
2014 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* Editing this needs knot recalc. */
2015 RNA_def_property_int_sdna(prop, nullptr, "pntsv");
2017 prop, "Points V", "Total number points for the surface on the V direction");
2018 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2019
2020 prop = RNA_def_property(srna, "order_u", PROP_INT, PROP_NONE);
2021 RNA_def_property_int_sdna(prop, nullptr, "orderu");
2023 RNA_def_property_range(prop, 2, 64);
2024 RNA_def_property_ui_range(prop, 2, 6, 1, -1);
2026 "Order U",
2027 "NURBS order in the U direction. Higher values make each point "
2028 "influence a greater area, but have worse performance.");
2029 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
2030
2031 prop = RNA_def_property(srna, "order_v", PROP_INT, PROP_NONE);
2032 RNA_def_property_int_sdna(prop, nullptr, "orderv");
2034 RNA_def_property_range(prop, 2, 64);
2035 RNA_def_property_ui_range(prop, 2, 6, 1, -1);
2037 "Order V",
2038 "NURBS order in the V direction. Higher values make each point "
2039 "influence a greater area, but have worse performance.");
2040 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
2041
2042 prop = RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE);
2043 RNA_def_property_int_sdna(prop, nullptr, "resolu");
2045 RNA_def_property_range(prop, 1, 1024);
2046 RNA_def_property_ui_range(prop, 1, 64, 1, -1);
2047 RNA_def_property_ui_text(prop, "Resolution U", "Curve or Surface subdivisions per segment");
2048 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2049
2050 prop = RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE);
2051 RNA_def_property_int_sdna(prop, nullptr, "resolv");
2053 RNA_def_property_range(prop, 1, 1024);
2054 RNA_def_property_ui_range(prop, 1, 64, 1, -1);
2055 RNA_def_property_ui_text(prop, "Resolution V", "Surface subdivisions per segment");
2056 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2057
2058 prop = RNA_def_property(srna, "use_cyclic_u", PROP_BOOLEAN, PROP_NONE);
2059 RNA_def_property_boolean_sdna(prop, nullptr, "flagu", CU_NURB_CYCLIC);
2062 prop, "Cyclic U", "Make this curve or surface a closed loop in the U direction");
2063 RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_u");
2064
2065 prop = RNA_def_property(srna, "use_cyclic_v", PROP_BOOLEAN, PROP_NONE);
2066 RNA_def_property_boolean_sdna(prop, nullptr, "flagv", CU_NURB_CYCLIC);
2068 RNA_def_property_ui_text(prop, "Cyclic V", "Make this surface a closed loop in the V direction");
2069 RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_v");
2070
2071 prop = RNA_def_property(srna, "use_endpoint_u", PROP_BOOLEAN, PROP_NONE);
2072 RNA_def_property_boolean_sdna(prop, nullptr, "flagu", CU_NURB_ENDPOINT);
2075 prop,
2076 "Endpoint U",
2077 "Make this nurbs curve or surface meet the endpoints in the U direction");
2078 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
2079
2080 prop = RNA_def_property(srna, "use_endpoint_v", PROP_BOOLEAN, PROP_NONE);
2081 RNA_def_property_boolean_sdna(prop, nullptr, "flagv", CU_NURB_ENDPOINT);
2084 prop, "Endpoint V", "Make this nurbs surface meet the endpoints in the V direction");
2085 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
2086
2087 prop = RNA_def_property(srna, "use_bezier_u", PROP_BOOLEAN, PROP_NONE);
2088 RNA_def_property_boolean_sdna(prop, nullptr, "flagu", CU_NURB_BEZIER);
2091 prop,
2092 "Bézier U",
2093 "Make this nurbs curve or surface act like a Bézier spline in the U direction");
2094 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
2095
2096 prop = RNA_def_property(srna, "use_bezier_v", PROP_BOOLEAN, PROP_NONE);
2097 RNA_def_property_boolean_sdna(prop, nullptr, "flagv", CU_NURB_BEZIER);
2100 prop, "Bézier V", "Make this nurbs surface act like a Bézier spline in the V direction");
2101 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
2102
2103 prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
2104 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CU_SMOOTH);
2105 RNA_def_property_ui_text(prop, "Smooth", "Smooth the normals of the surface or beveled curve");
2106 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2107
2108 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
2109 RNA_def_property_boolean_sdna(prop, nullptr, "hide", 1);
2110 RNA_def_property_ui_text(prop, "Hide", "Hide this curve in Edit mode");
2111 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2112
2113 prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
2114 RNA_def_property_int_sdna(prop, nullptr, "mat_nr");
2115 RNA_def_property_ui_text(prop, "Material Index", "Material slot index of this curve");
2116 RNA_def_property_int_funcs(prop, nullptr, nullptr, "rna_Curve_material_index_range");
2117 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2118
2119 prop = RNA_def_property(srna, "character_index", PROP_INT, PROP_UNSIGNED);
2120 RNA_def_property_int_sdna(prop, nullptr, "charidx");
2121 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* Editing this needs knot recalc. */
2123 "Character Index",
2124 "Location of this character in the text data (only for text curves)");
2125 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
2126
2127 RNA_def_struct_path_func(srna, "rna_Curve_spline_path");
2128
2129 RNA_api_curve_nurb(srna);
2130}
2131
2133{
2134 rna_def_curve(brna);
2135 rna_def_surface(brna);
2136 rna_def_text(brna);
2137 rna_def_textbox(brna);
2138 rna_def_charinfo(brna);
2139 rna_def_bpoint(brna);
2140 rna_def_beztriple(brna);
2141 rna_def_curve_nurb(brna);
2142}
2143
2144#endif
bool BKE_nurb_type_convert(Nurb *nu, short type, bool use_handles, const char **r_err_msg)
Definition curve.cc:4821
void BKE_nurb_handles_calc(Nurb *nu)
Definition curve.cc:3955
void BKE_curve_texspace_ensure(Curve *cu)
Definition curve.cc:500
void BKE_nurb_free(Nurb *nu)
Definition curve.cc:569
ListBase * BKE_curve_nurbs_get(Curve *cu)
Definition curve.cc:4965
void BKE_curve_texspace_calc(Curve *cu)
Definition curve.cc:466
void BKE_nurb_knot_calc_u(Nurb *nu)
Definition curve.cc:1181
void BKE_curve_dimension_update(Curve *cu)
Definition curve.cc:437
bool BKE_nurb_order_clamp_u(Nurb *nu)
Definition curve.cc:4801
void BKE_nurbList_free(ListBase *lb)
Definition curve.cc:596
void BKE_nurb_knot_calc_v(Nurb *nu)
Definition curve.cc:1186
short BKE_curve_type_get(const Curve *cu)
Definition curve.cc:416
void BKE_nurb_bezierPoints_add(Nurb *nu, int number)
Definition curve.cc:875
bool BKE_nurb_order_clamp_v(Nurb *nu)
Definition curve.cc:4811
void BKE_nurb_points_add(Nurb *nu, int number)
Definition curve.cc:862
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:283
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:125
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool BLI_remlink_safe(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:153
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:110
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
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:1041
#define MAX_ID_NAME
Definition DNA_ID.h:377
@ CU_TAPER_RADIUS_OVERRIDE
@ CU_TAPER_RADIUS_MULTIPLY
@ CU_TAPER_RADIUS_ADD
@ CU_SMOOTH
@ CU_OVERFLOW_SCALE
@ CU_OVERFLOW_TRUNCATE
@ CU_OVERFLOW_NONE
@ CU_ALIGN_Y_TOP
@ CU_ALIGN_Y_BOTTOM_BASELINE
@ CU_ALIGN_Y_CENTER
@ CU_ALIGN_Y_BOTTOM
@ CU_ALIGN_Y_TOP_BASELINE
@ CU_BEZIER
@ CU_POLY
@ CU_NURBS
@ CU_ALIGN_X_FLUSH
@ CU_ALIGN_X_MIDDLE
@ CU_ALIGN_X_LEFT
@ CU_ALIGN_X_JUSTIFY
@ CU_ALIGN_X_RIGHT
#define CU_ACT_NONE
@ 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_BEV_MODE_OBJECT
@ CU_BEV_MODE_ROUND
@ CU_BEV_MODE_CURVE_PROFILE
@ CU_CHINFO_WRAP
@ CU_CHINFO_UNDERLINE
@ CU_CHINFO_BOLD
@ CU_CHINFO_ITALIC
@ CU_CHINFO_SMALLCAPS
@ HD_AUTO_ANIM
@ HD_VECT
@ HD_FREE
@ HD_AUTO
@ HD_ALIGN
#define KEY_CU_EASE
@ CU_TEXSPACE_FLAG_AUTO
@ CU_BEVFAC_MAP_SPLINE
@ CU_BEVFAC_MAP_RESOLU
@ CU_BEVFAC_MAP_SEGMENT
@ 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_TWIST_MINIMUM
@ CU_TWIST_TANGENT
@ CU_TWIST_Z_UP
@ CU_NURB_CYCLIC
@ CU_NURB_ENDPOINT
@ CU_NURB_BEZIER
@ 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.
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
#define RNA_POINTER_INVALIDATE(ptr)
ParameterFlag
Definition RNA_types.hh:396
@ PARM_RNAPTR
Definition RNA_types.hh:399
@ PARM_REQUIRED
Definition RNA_types.hh:397
@ FUNC_USE_REPORTS
Definition RNA_types.hh:680
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:667
@ PROP_FLOAT
Definition RNA_types.hh:67
@ PROP_BOOLEAN
Definition RNA_types.hh:65
@ PROP_ENUM
Definition RNA_types.hh:69
@ PROP_INT
Definition RNA_types.hh:66
@ PROP_STRING
Definition RNA_types.hh:68
@ PROP_POINTER
Definition RNA_types.hh:70
@ PROP_COLLECTION
Definition RNA_types.hh:71
@ PROP_UNIT_LENGTH
Definition RNA_types.hh:77
#define RNA_TRANSLATION_PREC_DEFAULT
Definition RNA_types.hh:127
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:355
PropertyFlag
Definition RNA_types.hh:201
@ PROP_THICK_WRAP
Definition RNA_types.hh:312
@ PROP_ANIMATABLE
Definition RNA_types.hh:220
@ PROP_PROPORTIONAL
Definition RNA_types.hh:250
@ PROP_EDITABLE
Definition RNA_types.hh:207
@ PROP_NEVER_NULL
Definition RNA_types.hh:266
@ PROP_PTR_NO_OWNERSHIP
Definition RNA_types.hh:284
#define RNA_ENUM_ITEM_HEADING(name, description)
Definition RNA_types.hh:522
@ PROP_TIME
Definition RNA_types.hh:156
@ PROP_XYZ
Definition RNA_types.hh:172
@ PROP_DISTANCE
Definition RNA_types.hh:159
@ PROP_ANGLE
Definition RNA_types.hh:155
@ PROP_NONE
Definition RNA_types.hh:136
@ PROP_FACTOR
Definition RNA_types.hh:154
@ PROP_TRANSLATION
Definition RNA_types.hh:164
@ PROP_UNSIGNED
Definition RNA_types.hh:152
#define NC_GEOM
Definition WM_types.hh:360
#define ND_DRAW
Definition WM_types.hh:428
#define ND_DATA
Definition WM_types.hh:475
#define NC_OBJECT
Definition WM_types.hh:346
#define SELECT
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void *(* MEM_mallocN)(size_t len, const char *str)
Definition mallocn.cc:44
void MEM_freeN(void *vmemh)
Definition mallocn.cc:105
void *(* MEM_callocN)(size_t len, const char *str)
Definition mallocn.cc:42
void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb, IteratorSkipFunc skip)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, bool free_ptr, IteratorSkipFunc skip)
PointerRNA rna_pointer_inherit_refine(const PointerRNA *ptr, StructRNA *type, void *data)
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:30
static void rna_def_curve(BlenderRNA *brna)
static void rna_def_bpoint(BlenderRNA *brna)
Definition rna_curve.cc:886
static void rna_def_font(BlenderRNA *, StructRNA *srna)
static const EnumPropertyItem curve3d_fill_mode_items[]
Definition rna_curve.cc:133
static void rna_def_text(BlenderRNA *brna)
static void rna_def_beztriple(BlenderRNA *brna)
Definition rna_curve.cc:941
static void rna_def_surface(BlenderRNA *brna)
const EnumPropertyItem rna_enum_beztriple_interpolation_mode_items[]
Definition rna_curve.cc:67
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:39
static const float tilt_limit
Definition rna_curve.cc:884
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:125
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_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_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
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.c:32
#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
float texspace_size[3]
float texspace_location[3]
struct Object * taperobj
EditFontSelBox * selboxes
Definition BKE_vfont.hh:41
int select_char_info_flag
Definition BKE_vfont.hh:59
Definition DNA_ID.h:413
char name[66]
Definition DNA_ID.h:425
void * first
short orderu
struct Nurb * next
short orderv
short flag
short type
BezTriple * bezt
BPoint * bp
short resolu
short resolv
ID * owner_id
Definition RNA_types.hh:40
void * data
Definition RNA_types.hh:42
#define N_(msgid)
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4126