4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * Contributor(s): Blender Foundation (2008), Juho Veps�l�inen
22 * ***** END GPL LICENSE BLOCK *****
27 #include "RNA_define.h"
28 #include "RNA_types.h"
30 #include "rna_internal.h"
32 #include "DNA_curve_types.h"
33 #include "DNA_material_types.h"
34 #include "DNA_scene_types.h"
40 EnumPropertyItem beztriple_handle_type_items[] = {
41 {HD_FREE, "FREE", 0, "Free", ""},
42 {HD_AUTO, "AUTO", 0, "Auto", ""},
43 {HD_VECT, "VECTOR", 0, "Vector", ""},
44 {HD_ALIGN, "ALIGNED", 0, "Aligned", ""},
45 {HD_AUTO_ANIM, "AUTO_CLAMPED", 0, "Auto Clamped", ""},
46 {0, NULL, 0, NULL, NULL}};
48 EnumPropertyItem beztriple_interpolation_mode_items[] = {
49 {BEZT_IPO_CONST, "CONSTANT", 0, "Constant", ""},
50 {BEZT_IPO_LIN, "LINEAR", 0, "Linear", ""},
51 {BEZT_IPO_BEZ, "BEZIER", 0, "Bezier", ""},
52 {0, NULL, 0, NULL, NULL}};
54 EnumPropertyItem beztriple_keyframe_type_items[] = {
55 {BEZT_KEYTYPE_KEYFRAME, "KEYFRAME", 0, "Keyframe", ""},
56 {BEZT_KEYTYPE_BREAKDOWN, "BREAKDOWN", 0, "Breakdown", ""},
57 {BEZT_KEYTYPE_EXTREME, "EXTREME", 0, "Extreme", ""},
58 {0, NULL, 0, NULL, NULL}};
62 #include "DNA_object_types.h"
64 #include "BKE_curve.h"
65 #include "BKE_depsgraph.h"
70 #include "MEM_guardedalloc.h"
72 static StructRNA *rna_Curve_refine(PointerRNA *ptr)
74 Curve *cu= (Curve*)ptr->data;
75 short obtype= curve_type(cu);
77 if(obtype == OB_FONT) return &RNA_TextCurve;
78 else if(obtype == OB_SURF) return &RNA_SurfaceCurve;
79 else return &RNA_Curve;
83 static PointerRNA rna_Curve_active_nurb_get(PointerRNA *ptr)
85 Curve *cu= (Curve*)ptr->data;
89 nu = BLI_findlink(cu->editnurb, cu->actnu);
92 return rna_pointer_inherit_refine(ptr, &RNA_Nurb, nu);
94 return rna_pointer_inherit_refine(ptr, NULL, NULL);
98 static void rna_BezTriple_handle1_get(PointerRNA *ptr, float *values)
100 BezTriple *bt= (BezTriple*)ptr->data;
102 values[0]= bt->vec[0][0];
103 values[1]= bt->vec[0][1];
104 values[2]= bt->vec[0][2];
107 static void rna_BezTriple_handle1_set(PointerRNA *ptr, const float *values)
109 BezTriple *bt= (BezTriple*)ptr->data;
111 bt->vec[0][0]= values[0];
112 bt->vec[0][1]= values[1];
113 bt->vec[0][2]= values[2];
116 static void rna_BezTriple_handle2_get(PointerRNA *ptr, float *values)
118 BezTriple *bt= (BezTriple*)ptr->data;
120 values[0]= bt->vec[2][0];
121 values[1]= bt->vec[2][1];
122 values[2]= bt->vec[2][2];
125 static void rna_BezTriple_handle2_set(PointerRNA *ptr, const float *values)
127 BezTriple *bt= (BezTriple*)ptr->data;
129 bt->vec[2][0]= values[0];
130 bt->vec[2][1]= values[1];
131 bt->vec[2][2]= values[2];
134 static void rna_BezTriple_ctrlpoint_get(PointerRNA *ptr, float *values)
136 BezTriple *bt= (BezTriple*)ptr->data;
138 values[0]= bt->vec[1][0];
139 values[1]= bt->vec[1][1];
140 values[2]= bt->vec[1][2];
143 static void rna_BezTriple_ctrlpoint_set(PointerRNA *ptr, const float *values)
145 BezTriple *bt= (BezTriple*)ptr->data;
147 bt->vec[1][0]= values[0];
148 bt->vec[1][1]= values[1];
149 bt->vec[1][2]= values[2];
152 static int rna_Curve_texspace_editable(PointerRNA *ptr)
154 Curve *cu= (Curve*)ptr->data;
155 return (cu->texflag & CU_AUTOSPACE)? 0: PROP_EDITABLE;
158 static void rna_Curve_material_index_range(PointerRNA *ptr, int *min, int *max)
160 Curve *cu= (Curve*)ptr->id.data;
165 static void rna_Curve_active_textbox_index_range(PointerRNA *ptr, int *min, int *max)
167 Curve *cu= (Curve*)ptr->id.data;
173 static void rna_Curve_dimension_set(PointerRNA *ptr, int value)
175 Curve *cu= (Curve*)ptr->id.data;
176 Nurb *nu= cu->editnurb ? cu->editnurb->first : cu->nurb.first;
180 for( ; nu; nu= nu->next) {
186 for( ; nu; nu= nu->next) {
190 /* since the handles are moved they need to be auto-located again */
191 if(nu->type == CU_BEZIER)
199 static int rna_Nurb_length(PointerRNA *ptr)
201 Nurb *nu= (Nurb*)ptr->data;
202 return nu->pntsv>0 ? nu->pntsu*nu->pntsv : nu->pntsu;
205 static void rna_Nurb_type_set(PointerRNA *ptr, int value)
207 Nurb *nu= (Nurb*)ptr->data;
209 // XXX - TODO change datatypes
212 static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
214 Nurb *nu= (Nurb*)ptr->data;
215 rna_iterator_array_begin(iter, (void*)nu->bp, sizeof(BPoint), nu->pntsv>0 ? nu->pntsu*nu->pntsv : nu->pntsu, 0, NULL);
218 static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
220 ID *id= ptr->id.data;
222 DAG_id_flush_update(id, OB_RECALC_DATA);
223 WM_main_add_notifier(NC_GEOM|ND_DATA, id);
226 static void rna_Curve_update_deps(Main *bmain, Scene *scene, PointerRNA *ptr)
228 DAG_scene_sort(scene);
229 rna_Curve_update_data(bmain, scene, ptr);
232 static void rna_Curve_resolution_u_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
234 Curve *cu= (Curve*)ptr->id.data;
237 if (cu->editnurb) nu= cu->editnurb->first;
238 else nu=cu->nurb.first;
241 nu->resolu= cu->resolu;
245 rna_Curve_update_data(bmain, scene, ptr);
248 static void rna_Curve_resolution_v_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
250 Curve *cu= (Curve*)ptr->id.data;
253 if (cu->editnurb) nu= cu->editnurb->first;
254 else nu=cu->nurb.first;
257 nu->resolv= cu->resolv;
261 rna_Curve_update_data(bmain, scene, ptr);
264 /* name functions that ignore the first two ID characters */
265 void rna_Curve_body_get(PointerRNA *ptr, char *value)
267 Curve *cu= (Curve*)ptr->id.data;
268 strcpy(value, cu->str);
271 int rna_Curve_body_length(PointerRNA *ptr)
273 Curve *cu= (Curve*)ptr->id.data;
274 return strlen(cu->str);
277 /* TODO - check UTF & python play nice */
278 void rna_Curve_body_set(PointerRNA *ptr, const char *value)
280 int len= strlen(value);
281 Curve *cu= (Curve*)ptr->id.data;
286 if(cu->str) MEM_freeN(cu->str);
287 if(cu->strinfo) MEM_freeN(cu->strinfo);
289 cu->str = MEM_callocN(len + sizeof(wchar_t), "str");
290 cu->strinfo = MEM_callocN( (len+4) *sizeof(CharInfo), "strinfo"); /* don't know why this is +4, just duplicating load_editText() */
292 //wcs2utf8s(cu->str, value); // value is not wchar_t
293 BLI_strncpy(cu->str, value, len+1);
296 static void rna_Nurb_update_handle_data(Main *bmain, Scene *scene, PointerRNA *ptr)
298 Nurb *nu= (Nurb*)ptr->data;
300 if(nu->type == CU_BEZIER)
303 rna_Curve_update_data(bmain, scene, ptr);
306 static void rna_Nurb_update_knot_u(Main *bmain, Scene *scene, PointerRNA *ptr)
308 Nurb *nu= (Nurb*)ptr->data;
310 clamp_nurb_order_u(nu);
313 rna_Curve_update_data(bmain, scene, ptr);
316 static void rna_Nurb_update_knot_v(Main *bmain, Scene *scene, PointerRNA *ptr)
318 Nurb *nu= (Nurb*)ptr->data;
320 clamp_nurb_order_v(nu);
323 rna_Curve_update_data(bmain, scene, ptr);
328 static void rna_def_bpoint(BlenderRNA *brna)
333 srna= RNA_def_struct(brna, "SplinePoint", NULL);
334 RNA_def_struct_sdna(srna, "BPoint");
335 RNA_def_struct_ui_text(srna, "SplinePoint", "Spline point without handles.");
338 prop= RNA_def_property(srna, "selected", PROP_BOOLEAN, PROP_NONE);
339 RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
340 RNA_def_property_ui_text(prop, "Selected", "Selection status");
341 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
343 prop= RNA_def_property(srna, "hidden", PROP_BOOLEAN, PROP_NONE);
344 RNA_def_property_boolean_sdna(prop, NULL, "hide", 0);
345 RNA_def_property_ui_text(prop, "Hidden", "Visibility status");
346 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
349 prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
350 RNA_def_property_array(prop, 3);
351 RNA_def_property_float_sdna(prop, NULL, "vec");
352 RNA_def_property_ui_text(prop, "Point", "Point coordinates");
353 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
355 prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
356 RNA_def_property_float_sdna(prop, NULL, "vec[3]");
357 RNA_def_property_ui_text(prop, "Weight", "Nurbs weight");
358 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
361 prop= RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_NONE);
362 RNA_def_property_float_sdna(prop, NULL, "alfa");
363 /*RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);*/
364 RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3d View");
365 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
367 prop= RNA_def_property(srna, "weight_softbody", PROP_FLOAT, PROP_NONE);
368 RNA_def_property_float_sdna(prop, NULL, "weight");
369 RNA_def_property_range(prop, 0.01f, 100.0f);
370 RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
371 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
373 prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
374 RNA_def_property_float_sdna(prop, NULL, "radius");
375 /*RNA_def_property_range(prop, 0.0f, 1.0f);*/
376 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
377 RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for bevelling");
378 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
381 static void rna_def_beztriple(BlenderRNA *brna)
386 srna= RNA_def_struct(brna, "BezierSplinePoint", NULL);
387 RNA_def_struct_sdna(srna, "BezTriple");
388 RNA_def_struct_ui_text(srna, "Bezier Curve Point", "Bezier curve point with two handles.");
391 prop= RNA_def_property(srna, "selected_handle1", PROP_BOOLEAN, PROP_NONE);
392 RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
393 RNA_def_property_ui_text(prop, "Handle 1 selected", "Handle 1 selection status");
394 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
396 prop= RNA_def_property(srna, "selected_handle2", PROP_BOOLEAN, PROP_NONE);
397 RNA_def_property_boolean_sdna(prop, NULL, "f3", 0);
398 RNA_def_property_ui_text(prop, "Handle 2 selected", "Handle 2 selection status");
399 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
401 prop= RNA_def_property(srna, "selected_control_point", PROP_BOOLEAN, PROP_NONE);
402 RNA_def_property_boolean_sdna(prop, NULL, "f2", 0);
403 RNA_def_property_ui_text(prop, "Control Point selected", "Control point selection status");
404 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
406 prop= RNA_def_property(srna, "hidden", PROP_BOOLEAN, PROP_NONE);
407 RNA_def_property_boolean_sdna(prop, NULL, "hide", 0);
408 RNA_def_property_ui_text(prop, "Hidden", "Visibility status");
409 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
412 prop= RNA_def_property(srna, "handle1_type", PROP_ENUM, PROP_NONE);
413 RNA_def_property_enum_sdna(prop, NULL, "h1");
414 RNA_def_property_enum_items(prop, beztriple_handle_type_items);
415 RNA_def_property_ui_text(prop, "Handle 1 Type", "Handle types");
416 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
418 prop= RNA_def_property(srna, "handle2_type", PROP_ENUM, PROP_NONE);
419 RNA_def_property_enum_sdna(prop, NULL, "h2");
420 RNA_def_property_enum_items(prop, beztriple_handle_type_items);
421 RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle types");
422 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
424 prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
425 RNA_def_property_enum_sdna(prop, NULL, "ipo");
426 RNA_def_property_enum_items(prop, beztriple_interpolation_mode_items);
427 RNA_def_property_ui_text(prop, "Interpolation", "(For F-Curves Only) Interpolation to use for segment of curve starting from current BezTriple.");
428 //RNA_def_property_update(prop, 0, "rna_Curve_update_data"); // this should be an F-Curve update call instead...
430 prop= RNA_def_property(srna, "keyframe_type", PROP_ENUM, PROP_NONE);
431 RNA_def_property_enum_sdna(prop, NULL, "hide");
432 RNA_def_property_enum_items(prop, beztriple_keyframe_type_items);
433 RNA_def_property_ui_text(prop, "Keyframe Type", "(For F-Curves only) The type of keyframe this control point defines.");
434 //RNA_def_property_update(prop, 0, "rna_Curve_update_data"); // this should be an F-Curve update call instead...
437 prop= RNA_def_property(srna, "handle1", PROP_FLOAT, PROP_TRANSLATION);
438 RNA_def_property_array(prop, 3);
439 RNA_def_property_float_funcs(prop, "rna_BezTriple_handle1_get", "rna_BezTriple_handle1_set", NULL);
440 RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle");
441 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
443 prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
444 RNA_def_property_array(prop, 3);
445 RNA_def_property_float_funcs(prop, "rna_BezTriple_ctrlpoint_get", "rna_BezTriple_ctrlpoint_set", NULL);
446 RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
447 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
449 prop= RNA_def_property(srna, "handle2", PROP_FLOAT, PROP_TRANSLATION);
450 RNA_def_property_array(prop, 3);
451 RNA_def_property_float_funcs(prop, "rna_BezTriple_handle2_get", "rna_BezTriple_handle2_set", NULL);
452 RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle");
453 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
456 prop= RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_NONE);
457 RNA_def_property_float_sdna(prop, NULL, "alfa");
458 /*RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);*/
459 RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3d View");
460 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
462 prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
463 RNA_def_property_range(prop, 0.01f, 100.0f);
464 RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
465 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
467 prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
468 RNA_def_property_float_sdna(prop, NULL, "radius");
469 /*RNA_def_property_range(prop, 0.0f, 1.0f);*/
470 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
471 RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for bevelling");
472 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
475 static void rna_def_path(BlenderRNA *brna, StructRNA *srna)
480 prop= RNA_def_property(srna, "path_length", PROP_INT, PROP_NONE);
481 RNA_def_property_int_sdna(prop, NULL, "pathlen");
482 RNA_def_property_range(prop, 1, 32767);
483 RNA_def_property_ui_text(prop, "Path Length", "If no speed IPO was set, the length of path in frames.");
484 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
487 prop= RNA_def_property(srna, "use_path", PROP_BOOLEAN, PROP_NONE);
488 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_PATH);
489 RNA_def_property_ui_text(prop, "Path", "Enable the curve to become a translation path.");
490 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
492 prop= RNA_def_property(srna, "use_path_follow", PROP_BOOLEAN, PROP_NONE);
493 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FOLLOW);
494 RNA_def_property_ui_text(prop, "Follow", "Make curve path children to rotate along the path.");
495 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
497 prop= RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
498 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_STRETCH);
499 RNA_def_property_ui_text(prop, "Stretch", "Option for curve-deform: makes deformed child to stretch along entire path.");
500 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
502 prop= RNA_def_property(srna, "use_time_offset", PROP_BOOLEAN, PROP_NONE);
503 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_OFFS_PATHDIST);
504 RNA_def_property_ui_text(prop, "Offset Path Distance", "Children will use TimeOffs value as path distance offset.");
505 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
507 prop= RNA_def_property(srna, "use_radius", PROP_BOOLEAN, PROP_NONE);
508 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_PATH_RADIUS);
509 RNA_def_property_ui_text(prop, "Radius", "Option for paths: apply the curve radius with path following it and deforming.");
510 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
513 static void rna_def_nurbs(BlenderRNA *brna, StructRNA *srna)
518 prop= RNA_def_property(srna, "uv_orco", PROP_BOOLEAN, PROP_NONE);
519 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UV_ORCO);
520 RNA_def_property_ui_text(prop, "UV Orco", "Forces to use UV coordinates for texture mapping 'orco'.");
521 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
523 prop= RNA_def_property(srna, "vertex_normal_flip", PROP_BOOLEAN, PROP_NONE);
524 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CU_NOPUNOFLIP);
525 RNA_def_property_ui_text(prop, "Vertex Normal Flip", "Flip vertex normals towards the camera during render");
526 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
529 static void rna_def_font(BlenderRNA *brna, StructRNA *srna)
533 static EnumPropertyItem prop_align_items[] = {
534 {CU_LEFT, "LEFT", 0, "Left", "Align text to the left"},
535 {CU_MIDDLE, "CENTRAL", 0, "Center", "Center text"},
536 {CU_RIGHT, "RIGHT", 0, "Right", "Align text to the right"},
537 {CU_JUSTIFY, "JUSTIFY", 0, "Justify", "Align to the left and the right"},
538 {CU_FLUSH, "FLUSH", 0, "Flush", "Align to the left and the right, with equal character spacing"},
539 {0, NULL, 0, NULL, NULL}};
542 prop= RNA_def_property(srna, "spacemode", PROP_ENUM, PROP_NONE);
543 RNA_def_property_enum_items(prop, prop_align_items);
544 RNA_def_property_ui_text(prop, "Text Align", "Text align from the object center.");
545 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
548 prop= RNA_def_property(srna, "text_size", PROP_FLOAT, PROP_NONE);
549 RNA_def_property_float_sdna(prop, NULL, "fsize");
550 RNA_def_property_range(prop, 0.0001f, 10000.0f);
551 RNA_def_property_ui_range(prop, 0.01, 10, 1, 1);
552 RNA_def_property_ui_text(prop, "Font size", "");
553 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
555 prop= RNA_def_property(srna, "line_dist", PROP_FLOAT, PROP_NONE);
556 RNA_def_property_float_sdna(prop, NULL, "linedist");
557 RNA_def_property_range(prop, 0.0f, 10.0f);
558 RNA_def_property_ui_text(prop, "Distance between lines of text", "");
559 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
561 prop= RNA_def_property(srna, "word_spacing", PROP_FLOAT, PROP_NONE);
562 RNA_def_property_float_sdna(prop, NULL, "wordspace");
563 RNA_def_property_range(prop, 0.0f, 10.0f);
564 RNA_def_property_ui_text(prop, "Spacing between words", "");
565 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
567 prop= RNA_def_property(srna, "spacing", PROP_FLOAT, PROP_NONE);
568 RNA_def_property_float_sdna(prop, NULL, "spacing");
569 RNA_def_property_range(prop, 0.0f, 10.0f);
570 RNA_def_property_ui_text(prop, "Global spacing between characters", "");
571 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
573 prop= RNA_def_property(srna, "shear", PROP_FLOAT, PROP_NONE);
574 RNA_def_property_float_sdna(prop, NULL, "shear");
575 RNA_def_property_range(prop, -1.0f, 1.0f);
576 RNA_def_property_ui_text(prop, "Shear", "Italic angle of the characters");
577 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
579 prop= RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
580 RNA_def_property_float_sdna(prop, NULL, "xof");
581 RNA_def_property_range(prop, -50.0f, 50.0f);
582 RNA_def_property_ui_text(prop, "X Offset", "Horizontal offset from the object origin");
583 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
585 prop= RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
586 RNA_def_property_float_sdna(prop, NULL, "yof");
587 RNA_def_property_range(prop, -50.0f, 50.0f);
588 RNA_def_property_ui_text(prop, "Y Offset", "Vertical offset from the object origin");
589 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
591 prop= RNA_def_property(srna, "ul_position", PROP_FLOAT, PROP_NONE);
592 RNA_def_property_float_sdna(prop, NULL, "ulpos");
593 RNA_def_property_range(prop, -0.2f, 0.8f);
594 RNA_def_property_ui_text(prop, "Underline Position", "Vertical position of underline");
595 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
597 prop= RNA_def_property(srna, "ul_height", PROP_FLOAT, PROP_NONE);
598 RNA_def_property_float_sdna(prop, NULL, "ulheight");
599 RNA_def_property_range(prop, -0.2f, 0.8f);
600 RNA_def_property_ui_text(prop, "Underline Thickness", "");
601 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
603 prop= RNA_def_property(srna, "textboxes", PROP_COLLECTION, PROP_NONE);
604 RNA_def_property_collection_sdna(prop, NULL, "tb", "totbox");
605 RNA_def_property_struct_type(prop, "TextBox");
606 RNA_def_property_ui_text(prop, "Textboxes", "");
608 prop= RNA_def_property(srna, "active_textbox", PROP_INT, PROP_NONE);
609 RNA_def_property_int_sdna(prop, NULL, "actbox");
610 RNA_def_property_ui_text(prop, "The active text box", "");
611 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Curve_active_textbox_index_range");
614 prop= RNA_def_property(srna, "family", PROP_STRING, PROP_NONE);
615 RNA_def_property_string_maxlength(prop, 21);
616 RNA_def_property_ui_text(prop, "Object Font", "Use Blender Objects as font characters. Give font objects a common name followed by the character it represents, eg. familya, familyb etc, and turn on Verts Duplication");
617 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
619 prop= RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
620 RNA_def_property_string_sdna(prop, NULL, "str");
621 RNA_def_property_ui_text(prop, "Body Text", "contence of this text object");
622 RNA_def_property_string_funcs(prop, "rna_Curve_body_get", "rna_Curve_body_length", "rna_Curve_body_set");
623 RNA_def_property_string_maxlength(prop, 8192); /* note that originally str did not have a limit! */
624 RNA_def_struct_name_property(srna, prop);
625 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
628 prop= RNA_def_property(srna, "text_on_curve", PROP_POINTER, PROP_NONE);
629 RNA_def_property_pointer_sdna(prop, NULL, "textoncurve");
630 RNA_def_property_flag(prop, PROP_EDITABLE);
631 RNA_def_property_ui_text(prop, "Text on Curve", "Curve deforming text object.");
632 RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
634 prop= RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
635 RNA_def_property_pointer_sdna(prop, NULL, "vfont");
636 RNA_def_property_ui_text(prop, "Font", "");
637 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
639 prop= RNA_def_property(srna, "edit_format", PROP_POINTER, PROP_NONE);
640 RNA_def_property_pointer_sdna(prop, NULL, "curinfo");
641 RNA_def_property_ui_text(prop, "Edit Format", "Editing settings character formatting.");
642 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
645 prop= RNA_def_property(srna, "fast", PROP_BOOLEAN, PROP_NONE);
646 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FAST);
647 RNA_def_property_ui_text(prop, "Fast", "Don't fill polygons while editing.");
648 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
651 static void rna_def_textbox(BlenderRNA *brna)
656 srna= RNA_def_struct(brna, "TextBox", NULL);
657 RNA_def_struct_ui_text(srna, "Text Box", "Text bounding box for layout.");
660 prop= RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
661 RNA_def_property_float_sdna(prop, NULL, "x");
662 RNA_def_property_range(prop, -50.0f, 50.0f);
663 RNA_def_property_ui_text(prop, "Textbox X Offset", "");
664 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
666 prop= RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
667 RNA_def_property_float_sdna(prop, NULL, "y");
668 RNA_def_property_range(prop, -50.0f, 50.0f);
669 RNA_def_property_ui_text(prop, "Textbox Y Offset", "");
670 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
672 prop= RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE);
673 RNA_def_property_float_sdna(prop, NULL, "w");
674 RNA_def_property_range(prop, 0.0f, 50.0f);
675 RNA_def_property_ui_text(prop, "Textbox Width", "");
676 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
678 prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
679 RNA_def_property_float_sdna(prop, NULL, "h");
680 RNA_def_property_range(prop, 0.0f, 50.0f);
681 RNA_def_property_ui_text(prop, "Textbox Height", "");
682 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
685 static void rna_def_charinfo(BlenderRNA *brna)
690 srna= RNA_def_struct(brna, "TextCharacterFormat", NULL);
691 RNA_def_struct_sdna(srna, "CharInfo");
692 RNA_def_struct_ui_text(srna, "Text Character Format", "Text character formatting settings.");
695 prop= RNA_def_property(srna, "style", PROP_BOOLEAN, PROP_NONE);
696 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_STYLE);
697 RNA_def_property_ui_text(prop, "Style", "");
698 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
700 prop= RNA_def_property(srna, "bold", PROP_BOOLEAN, PROP_NONE);
701 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_BOLD);
702 RNA_def_property_ui_text(prop, "Bold", "");
703 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
705 prop= RNA_def_property(srna, "italic", PROP_BOOLEAN, PROP_NONE);
706 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_ITALIC);
707 RNA_def_property_ui_text(prop, "Italic", "");
708 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
710 prop= RNA_def_property(srna, "underline", PROP_BOOLEAN, PROP_NONE);
711 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UNDERLINE);
712 RNA_def_property_ui_text(prop, "Underline", "");
713 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
715 prop= RNA_def_property(srna, "wrap", PROP_BOOLEAN, PROP_NONE);
716 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_WRAP);
717 RNA_def_property_ui_text(prop, "Wrap", "");
718 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
721 static void rna_def_surface(BlenderRNA *brna)
725 srna= RNA_def_struct(brna, "SurfaceCurve", "Curve");
726 RNA_def_struct_sdna(srna, "Curve");
727 RNA_def_struct_ui_text(srna, "Surface Curve", "Curve datablock used for storing surfaces.");
728 RNA_def_struct_ui_icon(srna, ICON_SURFACE_DATA);
730 rna_def_nurbs(brna, srna);
733 static void rna_def_text(BlenderRNA *brna)
737 srna= RNA_def_struct(brna, "TextCurve", "Curve");
738 RNA_def_struct_sdna(srna, "Curve");
739 RNA_def_struct_ui_text(srna, "Text Curve", "Curve datablock used for storing text.");
740 RNA_def_struct_ui_icon(srna, ICON_FONT_DATA);
742 rna_def_font(brna, srna);
743 rna_def_nurbs(brna, srna);
746 static void rna_def_curve(BlenderRNA *brna)
751 static EnumPropertyItem curve_twist_mode_items[] = {
752 {CU_TWIST_Z_UP, "Z_UP", 0, "Z-Up", "Use Z-Up axis to calculate the curve twist at each point"},
753 {CU_TWIST_MINIMUM, "MINIMUM", 0, "Minimum", "Use the least twist over the entire curve"},
754 {CU_TWIST_TANGENT, "TANGENT", 0, "Tangent", "Use the tangent to calculate twist"},
755 {0, NULL, 0, NULL, NULL}};
757 static const EnumPropertyItem curve_axis_items[]= {
758 {0, "2D", 0, "2D", "Clamp the Z axis of of the curve"},
759 {CU_3D, "3D", 0, "3D", "Allow editing on the Z axis of this curve, also alows tilt and curve radius to be used."},
760 {0, NULL, 0, NULL, NULL}};
762 srna= RNA_def_struct(brna, "Curve", "ID");
763 RNA_def_struct_ui_text(srna, "Curve", "Curve datablock storing curves, splines and NURBS.");
764 RNA_def_struct_ui_icon(srna, ICON_CURVE_DATA);
765 RNA_def_struct_refine_func(srna, "rna_Curve_refine");
767 rna_def_animdata_common(srna);
768 rna_def_texmat_common(srna, "rna_Curve_texspace_editable");
770 prop= RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
771 RNA_def_property_pointer_sdna(prop, NULL, "key");
772 RNA_def_property_ui_text(prop, "Shape Keys", "");
774 prop= RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE);
775 RNA_def_property_collection_sdna(prop, NULL, "nurb", NULL);
776 RNA_def_property_struct_type(prop, "Nurb");
777 RNA_def_property_ui_text(prop, "Splines", "Collection of splines in this curve data object.");
779 prop= RNA_def_property(srna, "active_spline", PROP_POINTER, PROP_NONE);
780 RNA_def_property_struct_type(prop, "Nurb");
781 RNA_def_property_pointer_funcs(prop, "rna_Curve_active_nurb_get", NULL, NULL);
782 RNA_def_property_ui_text(prop, "Active Spline", "The active editmode spline");
785 prop= RNA_def_property(srna, "draw_handles", PROP_BOOLEAN, PROP_NONE);
786 RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", CU_HIDE_HANDLES);
787 RNA_def_property_ui_text(prop, "Draw Handles", "Display bezier handles in editmode.");
788 RNA_def_property_update(prop, NC_GEOM|ND_DATA, NULL);
790 prop= RNA_def_property(srna, "draw_normals", PROP_BOOLEAN, PROP_NONE);
791 RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", CU_HIDE_NORMALS);
792 RNA_def_property_ui_text(prop, "Draw Normals", "Display 3D curve normals in editmode.");
793 RNA_def_property_update(prop, NC_GEOM|ND_DATA, NULL);
795 rna_def_path(brna, srna);
798 prop= RNA_def_property(srna, "bevel_resolution", PROP_INT, PROP_NONE);
799 RNA_def_property_int_sdna(prop, NULL, "bevresol");
800 RNA_def_property_range(prop, 0, 32);
801 RNA_def_property_ui_range(prop, 0, 32, 1.0, 0);
802 RNA_def_property_ui_text(prop, "Bevel Resolution", "Bevel resolution when depth is non-zero and no specific bevel object has been defined.");
803 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
805 prop= RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE);
806 RNA_def_property_float_sdna(prop, NULL, "width");
807 RNA_def_property_ui_range(prop, 0, 2.0, 0.1, 0);
808 RNA_def_property_ui_text(prop, "Width", "Scale the original width (1.0) based on given factor.");
809 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
811 prop= RNA_def_property(srna, "extrude", PROP_FLOAT, PROP_NONE);
812 RNA_def_property_float_sdna(prop, NULL, "ext1");
813 RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 0);
814 RNA_def_property_ui_text(prop, "Extrude", "Amount of curve extrusion when not using a bevel object.");
815 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
817 prop= RNA_def_property(srna, "bevel_depth", PROP_FLOAT, PROP_NONE);
818 RNA_def_property_float_sdna(prop, NULL, "ext2");
819 RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 0);
820 RNA_def_property_ui_text(prop, "Bevel Depth", "Bevel depth when not using a bevel object.");
821 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
823 prop= RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE);
824 RNA_def_property_int_sdna(prop, NULL, "resolu");
825 RNA_def_property_ui_range(prop, 1, 1024, 1, 0);
826 RNA_def_property_ui_text(prop, "Resolution U", "Surface resolution in U direction.");
827 RNA_def_property_update(prop, 0, "rna_Curve_resolution_u_update_data");
829 prop= RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE);
830 RNA_def_property_int_sdna(prop, NULL, "resolv");
831 RNA_def_property_ui_range(prop, 1, 1024, 1, 0);
832 RNA_def_property_ui_text(prop, "Resolution V", "Surface resolution in V direction.");
833 RNA_def_property_update(prop, 0, "rna_Curve_resolution_v_update_data");
835 prop= RNA_def_property(srna, "render_resolution_u", PROP_INT, PROP_NONE);
836 RNA_def_property_int_sdna(prop, NULL, "resolu_ren");
837 RNA_def_property_ui_range(prop, 0, 1024, 1, 0);
838 RNA_def_property_ui_text(prop, "Render Resolution U", "Surface resolution in U direction used while rendering. Zero skips this property.");
840 prop= RNA_def_property(srna, "render_resolution_v", PROP_INT, PROP_NONE);
841 RNA_def_property_int_sdna(prop, NULL, "resolv_ren");
842 RNA_def_property_ui_range(prop, 0, 1024, 1, 0);
843 RNA_def_property_ui_text(prop, "Render Resolution V", "Surface resolution in V direction used while rendering. Zero skips this property.");
846 prop= RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_NONE);
847 RNA_def_property_float_sdna(prop, NULL, "ctime");
848 RNA_def_property_ui_text(prop, "Evaluation Time", "Parametric position along the length of the curve that Objects 'following' it should be at.");
849 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
852 prop= RNA_def_property(srna, "bevel_object", PROP_POINTER, PROP_NONE);
853 RNA_def_property_pointer_sdna(prop, NULL, "bevobj");
854 RNA_def_property_flag(prop, PROP_EDITABLE);
855 RNA_def_property_ui_text(prop, "Bevel Object", "Curve object name that defines the bevel shape.");
856 RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
858 prop= RNA_def_property(srna, "taper_object", PROP_POINTER, PROP_NONE);
859 RNA_def_property_pointer_sdna(prop, NULL, "taperobj");
860 RNA_def_property_flag(prop, PROP_EDITABLE);
861 RNA_def_property_ui_text(prop, "Taper Object", "Curve object name that defines the taper (width).");
862 RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
866 prop= RNA_def_property(srna, "dimensions", PROP_ENUM, PROP_NONE); /* as an enum */
867 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
868 RNA_def_property_enum_items(prop, curve_axis_items);
869 RNA_def_property_enum_funcs(prop, NULL, "rna_Curve_dimension_set", NULL);
870 RNA_def_property_ui_text(prop, "Dimensions", "Select 2D or 3D curve type.");
871 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
873 prop= RNA_def_property(srna, "front", PROP_BOOLEAN, PROP_NONE);
874 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FRONT);
875 RNA_def_property_ui_text(prop, "Front", "Draw filled front for extruded/beveled curves.");
876 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
878 prop= RNA_def_property(srna, "back", PROP_BOOLEAN, PROP_NONE);
879 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_BACK);
880 RNA_def_property_ui_text(prop, "Back", "Draw filled back for extruded/beveled curves.");
881 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
883 prop= RNA_def_property(srna, "twist_mode", PROP_ENUM, PROP_NONE);
884 RNA_def_property_enum_sdna(prop, NULL, "twist_mode");
885 RNA_def_property_enum_items(prop, curve_twist_mode_items);
886 RNA_def_property_ui_text(prop, "Twist Method", "The type of tilt calculation for 3D Curves.");
887 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
889 // XXX - would be nice to have a better way to do this, only add for testing.
890 prop= RNA_def_property(srna, "twist_smooth", PROP_FLOAT, PROP_NONE);
891 RNA_def_property_float_sdna(prop, NULL, "twist_smooth");
892 RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 0);
893 RNA_def_property_ui_text(prop, "Twist Smooth", "Smoothing iteration for tangents");
894 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
898 prop= RNA_def_property(srna, "retopo", PROP_BOOLEAN, PROP_NONE);
899 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_RETOPO);
900 RNA_def_property_ui_text(prop, "Retopo", "Turn on the re-topology tool.");
901 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
904 static void rna_def_curve_nurb(BlenderRNA *brna)
906 static EnumPropertyItem curve_type_items[] = {
907 {CU_POLY, "POLY", 0, "Poly", ""},
908 {CU_BEZIER, "BEZIER", 0, "Bezier", ""},
909 {CU_BSPLINE, "BSPLINE", 0, "BSpline", ""},
910 {CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
911 {CU_NURBS, "NURBS", 0, "Ease", ""},
912 {0, NULL, 0, NULL, NULL}};
914 static EnumPropertyItem spline_interpolation_items[] = {
915 {BEZT_IPO_CONST, "LINEAR", 0, "Linear", ""},
916 {BEZT_IPO_LIN, "CARDINAL", 0, "Cardinal", ""},
917 {BEZT_IPO_BEZ, "BSPLINE", 0, "BSpline", ""},
918 {BEZT_IPO_BEZ, "EASE", 0, "Ease", ""},
919 {0, NULL, 0, NULL, NULL}};
924 srna= RNA_def_struct(brna, "Nurb", NULL);
925 RNA_def_struct_ui_text(srna, "Spline", "Element of a curve, either Nurbs, Bezier or Polyline or a character with text objects.");
927 prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
928 RNA_def_property_collection_sdna(prop, NULL, "bp", NULL);
929 RNA_def_property_struct_type(prop, "SplinePoint");
930 RNA_def_property_collection_funcs(prop, "rna_BPoint_array_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_Nurb_length", 0, 0);
931 RNA_def_property_ui_text(prop, "Points", "Collection of points that make up this poly or nurbs spline.");
933 prop= RNA_def_property(srna, "bezier_points", PROP_COLLECTION, PROP_NONE);
934 RNA_def_property_struct_type(prop, "BezierSplinePoint");
935 RNA_def_property_collection_sdna(prop, NULL, "bezt", "pntsu");
936 RNA_def_property_ui_text(prop, "Bezier Points", "Collection of points for bezier curves only.");
939 prop= RNA_def_property(srna, "tilt_interpolation", PROP_ENUM, PROP_NONE);
940 RNA_def_property_enum_sdna(prop, NULL, "tilt_interp");
941 RNA_def_property_enum_items(prop, spline_interpolation_items);
942 RNA_def_property_ui_text(prop, "Tilt Interpolation", "The type of tilt interpolation for 3D, Bezier curves.");
943 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
945 prop= RNA_def_property(srna, "radius_interpolation", PROP_ENUM, PROP_NONE);
946 RNA_def_property_enum_sdna(prop, NULL, "radius_interp");
947 RNA_def_property_enum_items(prop, spline_interpolation_items);
948 RNA_def_property_ui_text(prop, "Radius Interpolation", "The type of radius interpolation for Bezier curves.");
949 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
951 // XXX - switching type probably needs comprehensive recalc of data like in 2.4x
952 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
953 RNA_def_property_enum_items(prop, curve_type_items);
954 RNA_def_property_enum_funcs(prop, NULL, "rna_Nurb_type_set", NULL);
955 RNA_def_property_ui_text(prop, "Type", "The interpolation type for this curve element.");
956 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
958 prop= RNA_def_property(srna, "point_count_u", PROP_INT, PROP_NONE);
959 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/
960 RNA_def_property_int_sdna(prop, NULL, "pntsu");
961 RNA_def_property_ui_text(prop, "Points U", "Total number points for the curve or surface in the U direction");
962 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
964 prop= RNA_def_property(srna, "point_count_v", PROP_INT, PROP_NONE);
965 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/
966 RNA_def_property_int_sdna(prop, NULL, "pntsv");
967 RNA_def_property_ui_text(prop, "Points V", "Total number points for the surface on the V direction");
968 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
971 prop= RNA_def_property(srna, "order_u", PROP_INT, PROP_NONE);
972 RNA_def_property_int_sdna(prop, NULL, "orderu");
973 RNA_def_property_range(prop, 2, 6);
974 RNA_def_property_ui_text(prop, "Order U", "Nurbs order in the U direction (For splines and surfaces), Higher values let points influence a greater area");
975 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
977 prop= RNA_def_property(srna, "order_v", PROP_INT, PROP_NONE);
978 RNA_def_property_int_sdna(prop, NULL, "orderv");
979 RNA_def_property_range(prop, 2, 6);
980 RNA_def_property_ui_text(prop, "Order V", "Nurbs order in the V direction (For surfaces only), Higher values let points influence a greater area");
981 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
984 prop= RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE);
985 RNA_def_property_int_sdna(prop, NULL, "resolu");
986 RNA_def_property_range(prop, 1, 1024);
987 RNA_def_property_ui_text(prop, "Resolution U", "Curve or Surface subdivisions per segment");
988 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
990 prop= RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE);
991 RNA_def_property_int_sdna(prop, NULL, "resolv");
992 RNA_def_property_range(prop, 1, 1024);
993 RNA_def_property_ui_text(prop, "Resolution V", "Surface subdivisions per segment");
994 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
996 prop= RNA_def_property(srna, "cyclic_u", PROP_BOOLEAN, PROP_NONE);
997 RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_CYCLIC);
998 RNA_def_property_ui_text(prop, "Cyclic U", "Make this curve or surface a closed loop in the U direction.");
999 RNA_def_property_update(prop, 0, "rna_Nurb_update_handle_data"); /* only needed for cyclic_u because cyclic_v cant do bezier */
1001 prop= RNA_def_property(srna, "cyclic_v", PROP_BOOLEAN, PROP_NONE);
1002 RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_CYCLIC);
1003 RNA_def_property_ui_text(prop, "Cyclic V", "Make this surface a closed loop in the V direction.");
1004 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1007 /* Note, endpoint and bezier flags should never be on at the same time! */
1008 prop= RNA_def_property(srna, "endpoint_u", PROP_BOOLEAN, PROP_NONE);
1009 RNA_def_property_boolean_sdna(prop, NULL, "flagu", 2);
1010 RNA_def_property_ui_text(prop, "Endpoint U", "Make this nurbs curve or surface meet the endpoints in the U direction (Cyclic U must be disabled).");
1011 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
1013 prop= RNA_def_property(srna, "endpoint_v", PROP_BOOLEAN, PROP_NONE);
1014 RNA_def_property_boolean_sdna(prop, NULL, "flagv", 2);
1015 RNA_def_property_ui_text(prop, "Endpoint V", "Make this nurbs surface meet the endpoints in the V direction (Cyclic V must be disabled).");
1016 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
1018 prop= RNA_def_property(srna, "bezier_u", PROP_BOOLEAN, PROP_NONE);
1019 RNA_def_property_boolean_sdna(prop, NULL, "flagu", 4);
1020 RNA_def_property_ui_text(prop, "Bezier U", "Make this nurbs curve or surface act like a bezier spline in the U direction (Order U must be 3 or 4, Cyclic U must be disabled).");
1021 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
1023 prop= RNA_def_property(srna, "bezier_v", PROP_BOOLEAN, PROP_NONE);
1024 RNA_def_property_boolean_sdna(prop, NULL, "flagv", 4);
1025 RNA_def_property_ui_text(prop, "Bezier V", "Make this nurbs surface act like a bezier spline in the V direction (Order V must be 3 or 4, Cyclic V must be disabled).");
1026 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
1029 prop= RNA_def_property(srna, "smooth", PROP_BOOLEAN, PROP_NONE);
1030 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_SMOOTH);
1031 RNA_def_property_ui_text(prop, "Smooth", "Smooth the normals of the surface or beveled curve.");
1032 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1034 prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
1035 RNA_def_property_boolean_sdna(prop, NULL, "hide", 1);
1036 RNA_def_property_ui_text(prop, "Hide", "Hide this curve in editmode.");
1037 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1039 prop= RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
1040 RNA_def_property_int_sdna(prop, NULL, "mat_nr");
1041 RNA_def_property_ui_text(prop, "Material Index", "");
1042 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Curve_material_index_range");
1043 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1045 prop= RNA_def_property(srna, "character_index", PROP_INT, PROP_UNSIGNED);
1046 RNA_def_property_int_sdna(prop, NULL, "charidx");
1047 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/
1048 RNA_def_property_ui_text(prop, "Character Index", "Location of this character in the text data (only for text curves)");
1049 RNA_def_property_update(prop, 0, "rna_Curve_update_data");
1052 void RNA_def_curve(BlenderRNA *brna)
1054 rna_def_curve(brna);
1055 rna_def_surface(brna);
1057 rna_def_textbox(brna);
1058 rna_def_charinfo(brna);
1059 rna_def_bpoint(brna);
1060 rna_def_beztriple(brna);
1061 rna_def_curve_nurb(brna);