|
Blender
V2.59
|
00001 /* 00002 * $Id: rna_curve.c 39214 2011-08-09 14:50:40Z campbellbarton $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * Contributor(s): Blender Foundation (2008), Juho Veps�l�inen 00021 * 00022 * ***** END GPL LICENSE BLOCK ***** 00023 */ 00024 00030 #include <stdlib.h> 00031 00032 #include "RNA_define.h" 00033 00034 #include "rna_internal.h" 00035 00036 #include "DNA_curve_types.h" 00037 #include "DNA_key_types.h" 00038 #include "DNA_material_types.h" 00039 #include "DNA_scene_types.h" 00040 00041 #include "BKE_font.h" 00042 00043 #include "WM_types.h" 00044 00045 #include "BKE_curve.h" 00046 #include "ED_curve.h" 00047 00048 EnumPropertyItem beztriple_handle_type_items[] = { 00049 {HD_FREE, "FREE", 0, "Free", ""}, 00050 {HD_AUTO, "AUTO", 0, "Auto", ""}, 00051 {HD_VECT, "VECTOR", 0, "Vector", ""}, 00052 {HD_ALIGN, "ALIGNED", 0, "Aligned", ""}, 00053 {0, NULL, 0, NULL, NULL}}; 00054 00055 EnumPropertyItem beztriple_interpolation_mode_items[] = { 00056 {BEZT_IPO_CONST, "CONSTANT", 0, "Constant", ""}, 00057 {BEZT_IPO_LIN, "LINEAR", 0, "Linear", ""}, 00058 {BEZT_IPO_BEZ, "BEZIER", 0, "Bezier", ""}, 00059 {0, NULL, 0, NULL, NULL}}; 00060 00061 EnumPropertyItem curve_type_items[] = { 00062 {CU_POLY, "POLY", 0, "Poly", ""}, 00063 {CU_BEZIER, "BEZIER", 0, "Bezier", ""}, 00064 {CU_BSPLINE, "BSPLINE", 0, "BSpline", ""}, 00065 {CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""}, 00066 {CU_NURBS, "NURBS", 0, "Ease", ""}, 00067 {0, NULL, 0, NULL, NULL}}; 00068 00069 #ifdef RNA_RUNTIME 00070 00071 #include "BLI_math.h" 00072 00073 #include "DNA_object_types.h" 00074 00075 #include "BKE_curve.h" 00076 #include "BKE_depsgraph.h" 00077 #include "BKE_main.h" 00078 00079 #include "WM_api.h" 00080 00081 #include "MEM_guardedalloc.h" 00082 00083 #include "ED_curve.h" /* for BKE_curve_nurbs */ 00084 00085 /* highly irritating but from RNA we cant know this */ 00086 static Nurb *curve_nurb_from_point(Curve *cu, const void *point, int *nu_index, int *pt_index) 00087 { 00088 ListBase *nurbs= BKE_curve_nurbs(cu); 00089 Nurb *nu; 00090 int i= 0; 00091 00092 for(nu= nurbs->first; nu; nu= nu->next, i++) { 00093 if(nu->type == CU_BEZIER) { 00094 if(point >= (void *)nu->bezt && point < (void *)(nu->bezt + nu->pntsu)) { 00095 break; 00096 } 00097 } 00098 else { 00099 if(point >= (void *)nu->bp && point < (void *)(nu->bp + (nu->pntsu * nu->pntsv))) { 00100 break; 00101 } 00102 } 00103 } 00104 00105 if(nu) { 00106 if(nu_index) { 00107 *nu_index= i; 00108 } 00109 00110 if(pt_index) { 00111 if(nu->type == CU_BEZIER) *pt_index= (int)((BezTriple *)point - nu->bezt); 00112 else *pt_index= (int)((BPoint *)point - nu->bp); 00113 } 00114 } 00115 00116 return nu; 00117 } 00118 00119 static StructRNA *rna_Curve_refine(PointerRNA *ptr) 00120 { 00121 Curve *cu= (Curve*)ptr->data; 00122 short obtype= curve_type(cu); 00123 00124 if(obtype == OB_FONT) return &RNA_TextCurve; 00125 else if(obtype == OB_SURF) return &RNA_SurfaceCurve; 00126 else return &RNA_Curve; 00127 } 00128 00129 static void rna_BezTriple_handle1_get(PointerRNA *ptr, float *values) 00130 { 00131 BezTriple *bt= (BezTriple*)ptr->data; 00132 00133 values[0]= bt->vec[0][0]; 00134 values[1]= bt->vec[0][1]; 00135 values[2]= bt->vec[0][2]; 00136 } 00137 00138 static void rna_BezTriple_handle1_set(PointerRNA *ptr, const float *values) 00139 { 00140 BezTriple *bt= (BezTriple*)ptr->data; 00141 00142 bt->vec[0][0]= values[0]; 00143 bt->vec[0][1]= values[1]; 00144 bt->vec[0][2]= values[2]; 00145 } 00146 00147 static void rna_BezTriple_handle2_get(PointerRNA *ptr, float *values) 00148 { 00149 BezTriple *bt= (BezTriple*)ptr->data; 00150 00151 values[0]= bt->vec[2][0]; 00152 values[1]= bt->vec[2][1]; 00153 values[2]= bt->vec[2][2]; 00154 } 00155 00156 static void rna_BezTriple_handle2_set(PointerRNA *ptr, const float *values) 00157 { 00158 BezTriple *bt= (BezTriple*)ptr->data; 00159 00160 bt->vec[2][0]= values[0]; 00161 bt->vec[2][1]= values[1]; 00162 bt->vec[2][2]= values[2]; 00163 } 00164 00165 static void rna_BezTriple_ctrlpoint_get(PointerRNA *ptr, float *values) 00166 { 00167 BezTriple *bt= (BezTriple*)ptr->data; 00168 00169 values[0]= bt->vec[1][0]; 00170 values[1]= bt->vec[1][1]; 00171 values[2]= bt->vec[1][2]; 00172 } 00173 00174 static void rna_BezTriple_ctrlpoint_set(PointerRNA *ptr, const float *values) 00175 { 00176 BezTriple *bt= (BezTriple*)ptr->data; 00177 00178 bt->vec[1][0]= values[0]; 00179 bt->vec[1][1]= values[1]; 00180 bt->vec[1][2]= values[2]; 00181 } 00182 00183 static void rna_Curve_texspace_set(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) 00184 { 00185 Curve *cu= (Curve*)ptr->data; 00186 00187 if (cu->texflag & CU_AUTOSPACE) 00188 tex_space_curve(cu); 00189 } 00190 00191 static int rna_Curve_texspace_editable(PointerRNA *ptr) 00192 { 00193 Curve *cu= (Curve*)ptr->data; 00194 return (cu->texflag & CU_AUTOSPACE)? 0: PROP_EDITABLE; 00195 } 00196 00197 static void rna_Curve_texspace_loc_get(PointerRNA *ptr, float *values) 00198 { 00199 Curve *cu= (Curve *)ptr->data; 00200 00201 if (!cu->bb) 00202 tex_space_curve(cu); 00203 00204 copy_v3_v3(values, cu->loc); 00205 } 00206 00207 static void rna_Curve_texspace_loc_set(PointerRNA *ptr, const float *values) 00208 { 00209 Curve *cu= (Curve *)ptr->data; 00210 00211 copy_v3_v3(cu->loc, values); 00212 } 00213 00214 static void rna_Curve_texspace_size_get(PointerRNA *ptr, float *values) 00215 { 00216 Curve *cu= (Curve *)ptr->data; 00217 00218 if (!cu->bb) 00219 tex_space_curve(cu); 00220 00221 copy_v3_v3(values, cu->size); 00222 } 00223 00224 static void rna_Curve_texspace_size_set(PointerRNA *ptr, const float *values) 00225 { 00226 Curve *cu= (Curve *)ptr->data; 00227 00228 copy_v3_v3(cu->size, values); 00229 } 00230 00231 static void rna_Curve_material_index_range(PointerRNA *ptr, int *min, int *max) 00232 { 00233 Curve *cu= (Curve*)ptr->id.data; 00234 *min= 0; 00235 *max= cu->totcol-1; 00236 *max= MAX2(0, *max); 00237 } 00238 00239 static void rna_Curve_active_textbox_index_range(PointerRNA *ptr, int *min, int *max) 00240 { 00241 Curve *cu= (Curve*)ptr->id.data; 00242 *min= 0; 00243 *max= cu->totbox-1; 00244 *max= MAX2(0, *max); 00245 } 00246 00247 00248 static void rna_Curve_dimension_set(PointerRNA *ptr, int value) 00249 { 00250 Curve *cu= (Curve*)ptr->id.data; 00251 ListBase *nurbs= BKE_curve_nurbs(cu); 00252 Nurb *nu= nurbs->first; 00253 00254 if(value==CU_3D) { 00255 cu->flag |= CU_3D; 00256 for( ; nu; nu= nu->next) { 00257 nu->flag &= ~CU_2D; 00258 } 00259 } 00260 else { 00261 cu->flag &= ~CU_3D; 00262 for( ; nu; nu= nu->next) { 00263 nu->flag |= CU_2D; 00264 test2DNurb(nu); 00265 00266 /* since the handles are moved they need to be auto-located again */ 00267 if(nu->type == CU_BEZIER) 00268 calchandlesNurb(nu); 00269 } 00270 } 00271 } 00272 00273 00274 static int rna_Nurb_length(PointerRNA *ptr) 00275 { 00276 Nurb *nu= (Nurb*)ptr->data; 00277 if(nu->type == CU_BEZIER) return 0; 00278 return nu->pntsv>0 ? nu->pntsu*nu->pntsv : nu->pntsu; 00279 } 00280 00281 static void rna_Nurb_type_set(PointerRNA *ptr, int value) 00282 { 00283 Nurb *nu= (Nurb*)ptr->data; 00284 ED_nurb_set_spline_type(nu, value); 00285 } 00286 00287 static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) 00288 { 00289 Nurb *nu= (Nurb*)ptr->data; 00290 rna_iterator_array_begin(iter, (void*)nu->bp, sizeof(BPoint), nu->pntsv>0 ? nu->pntsu*nu->pntsv : nu->pntsu, 0, NULL); 00291 } 00292 00293 static void rna_Curve_update_data_id(Main *UNUSED(bmain), Scene *UNUSED(scene), ID *id) 00294 { 00295 DAG_id_tag_update(id, 0); 00296 WM_main_add_notifier(NC_GEOM|ND_DATA, id); 00297 } 00298 00299 static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) 00300 { 00301 rna_Curve_update_data_id(bmain, scene, ptr->id.data); 00302 } 00303 00304 static void rna_Curve_update_deps(Main *bmain, Scene *scene, PointerRNA *ptr) 00305 { 00306 DAG_scene_sort(bmain, scene); 00307 rna_Curve_update_data(bmain, scene, ptr); 00308 } 00309 00310 static void rna_Curve_update_points(Main *bmain, Scene *scene, PointerRNA *ptr) 00311 { 00312 Curve *cu= (Curve*)ptr->id.data; 00313 Nurb *nu= curve_nurb_from_point(cu, ptr->data, NULL, NULL); 00314 00315 if(nu) 00316 calchandlesNurb(nu); 00317 00318 rna_Curve_update_data(bmain, scene, ptr); 00319 } 00320 00321 static PointerRNA rna_Curve_bevelObject_get(PointerRNA *ptr) 00322 { 00323 Curve *cu= (Curve*)ptr->id.data; 00324 Object *ob= cu->bevobj; 00325 00326 if(ob) 00327 return rna_pointer_inherit_refine(ptr, &RNA_Object, ob); 00328 00329 return rna_pointer_inherit_refine(ptr, NULL, NULL); 00330 } 00331 00332 static void rna_Curve_bevelObject_set(PointerRNA *ptr, PointerRNA value) 00333 { 00334 Curve *cu= (Curve*)ptr->id.data; 00335 Object *ob= (Object*)value.data; 00336 00337 if (ob) { 00338 /* if bevel object has got the save curve, as object, for which it's */ 00339 /* set as bevobj, there could be infinity loop in displist calculation */ 00340 if (ob->type == OB_CURVE && ob->data != cu) { 00341 cu->bevobj = ob; 00342 } 00343 } else { 00344 cu->bevobj = NULL; 00345 } 00346 } 00347 00348 static int rna_Curve_otherObject_poll(PointerRNA *ptr, PointerRNA value) 00349 { 00350 Curve *cu= (Curve*)ptr->id.data; 00351 Object *ob= (Object*)value.data; 00352 00353 if (ob) { 00354 if (ob->type == OB_CURVE && ob->data != cu) { 00355 return 1; 00356 } 00357 } 00358 00359 return 0; 00360 } 00361 00362 static PointerRNA rna_Curve_taperObject_get(PointerRNA *ptr) 00363 { 00364 Curve *cu= (Curve*)ptr->id.data; 00365 Object *ob= cu->taperobj; 00366 00367 if(ob) 00368 return rna_pointer_inherit_refine(ptr, &RNA_Object, ob); 00369 00370 return rna_pointer_inherit_refine(ptr, NULL, NULL); 00371 } 00372 00373 static void rna_Curve_taperObject_set(PointerRNA *ptr, PointerRNA value) 00374 { 00375 Curve *cu= (Curve*)ptr->id.data; 00376 Object *ob= (Object*)value.data; 00377 00378 if (ob) { 00379 /* if taper object has got the save curve, as object, for which it's */ 00380 /* set as bevobj, there could be infinity loop in displist calculation */ 00381 if (ob->type == OB_CURVE && ob->data != cu) { 00382 cu->taperobj = ob; 00383 } 00384 } else { 00385 cu->taperobj = NULL; 00386 } 00387 } 00388 00389 static void rna_Curve_resolution_u_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) 00390 { 00391 Curve *cu= (Curve*)ptr->id.data; 00392 ListBase *nurbs= BKE_curve_nurbs(cu); 00393 Nurb *nu= nurbs->first; 00394 00395 while(nu) { 00396 nu->resolu= cu->resolu; 00397 nu= nu->next; 00398 } 00399 00400 rna_Curve_update_data(bmain, scene, ptr); 00401 } 00402 00403 static void rna_Curve_resolution_v_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) 00404 { 00405 Curve *cu= (Curve*)ptr->id.data; 00406 ListBase *nurbs= BKE_curve_nurbs(cu); 00407 Nurb *nu=nurbs->first; 00408 00409 00410 while(nu) { 00411 nu->resolv= cu->resolv; 00412 nu= nu->next; 00413 } 00414 00415 rna_Curve_update_data(bmain, scene, ptr); 00416 } 00417 00418 static float rna_Curve_offset_get(PointerRNA *ptr) 00419 { 00420 Curve *cu= (Curve*)ptr->id.data; 00421 return cu->width - 1.0f; 00422 } 00423 00424 static void rna_Curve_offset_set(PointerRNA *ptr, float value) 00425 { 00426 Curve *cu= (Curve*)ptr->id.data; 00427 cu->width= 1.0f + value; 00428 } 00429 00430 /* name functions that ignore the first two ID characters */ 00431 void rna_Curve_body_get(PointerRNA *ptr, char *value) 00432 { 00433 Curve *cu= (Curve*)ptr->id.data; 00434 BLI_strncpy(value, cu->str, cu->len+1); 00435 } 00436 00437 int rna_Curve_body_length(PointerRNA *ptr) 00438 { 00439 Curve *cu= (Curve*)ptr->id.data; 00440 return cu->len; 00441 } 00442 00443 /* TODO - check UTF & python play nice */ 00444 void rna_Curve_body_set(PointerRNA *ptr, const char *value) 00445 { 00446 int len= strlen(value); 00447 Curve *cu= (Curve*)ptr->id.data; 00448 00449 cu->len= cu->pos = len; 00450 00451 if(cu->str) MEM_freeN(cu->str); 00452 if(cu->strinfo) MEM_freeN(cu->strinfo); 00453 00454 cu->str = MEM_callocN(len + sizeof(wchar_t), "str"); 00455 cu->strinfo = MEM_callocN( (len+4) *sizeof(CharInfo), "strinfo"); /* don't know why this is +4, just duplicating load_editText() */ 00456 00457 //wcs2utf8s(cu->str, value); // value is not wchar_t 00458 BLI_strncpy(cu->str, value, len+1); 00459 } 00460 00461 static void rna_Nurb_update_cyclic_u(Main *bmain, Scene *scene, PointerRNA *ptr) 00462 { 00463 Nurb *nu= (Nurb*)ptr->data; 00464 00465 if(nu->type == CU_BEZIER) { 00466 calchandlesNurb(nu); 00467 } else { 00468 nurbs_knot_calc_u(nu); 00469 } 00470 00471 rna_Curve_update_data(bmain, scene, ptr); 00472 } 00473 00474 static void rna_Nurb_update_cyclic_v(Main *bmain, Scene *scene, PointerRNA *ptr) 00475 { 00476 Nurb *nu= (Nurb*)ptr->data; 00477 00478 nurbs_knot_calc_v(nu); 00479 00480 rna_Curve_update_data(bmain, scene, ptr); 00481 } 00482 00483 static void rna_Nurb_update_knot_u(Main *bmain, Scene *scene, PointerRNA *ptr) 00484 { 00485 Nurb *nu= (Nurb*)ptr->data; 00486 00487 clamp_nurb_order_u(nu); 00488 nurbs_knot_calc_u(nu); 00489 00490 rna_Curve_update_data(bmain, scene, ptr); 00491 } 00492 00493 static void rna_Nurb_update_knot_v(Main *bmain, Scene *scene, PointerRNA *ptr) 00494 { 00495 Nurb *nu= (Nurb*)ptr->data; 00496 00497 clamp_nurb_order_v(nu); 00498 nurbs_knot_calc_v(nu); 00499 00500 rna_Curve_update_data(bmain, scene, ptr); 00501 } 00502 00503 static void rna_Curve_spline_points_add(ID *id, Nurb *nu, ReportList *reports, int number) 00504 { 00505 if(nu->type == CU_BEZIER) { 00506 BKE_report(reports, RPT_ERROR, "Bezier spline can't have points added"); 00507 } 00508 else if(number==0) { 00509 // do nothing 00510 } else { 00511 00512 addNurbPoints(nu, number); 00513 00514 /* update */ 00515 nurbs_knot_calc_u(nu); 00516 00517 rna_Curve_update_data_id(NULL, NULL, id); 00518 } 00519 } 00520 00521 static void rna_Curve_spline_bezpoints_add(ID *id, Nurb *nu, ReportList *reports, int number) 00522 { 00523 if(nu->type != CU_BEZIER) { 00524 BKE_report(reports, RPT_ERROR, "Only Bezier splines can be added"); 00525 } 00526 else if(number==0) { 00527 // do nothing 00528 } else { 00529 addNurbPointsBezier(nu, number); 00530 00531 /* update */ 00532 nurbs_knot_calc_u(nu); 00533 00534 rna_Curve_update_data_id(NULL, NULL, id); 00535 } 00536 } 00537 00538 static Nurb *rna_Curve_spline_new(Curve *cu, int type) 00539 { 00540 Nurb *nu= ( Nurb * ) MEM_callocN( sizeof( Nurb ), "spline.new" ); 00541 00542 if(type==CU_BEZIER) { 00543 BezTriple *bezt= (BezTriple *)MEM_callocN(sizeof(BezTriple), "spline.new.bezt"); 00544 bezt->radius= 1.0; 00545 nu->bezt= bezt; 00546 } 00547 else { 00548 BPoint *bp= (BPoint *)MEM_callocN(sizeof(BPoint), "spline.new.bp"); 00549 bp->radius= 1.0f; 00550 nu->bp= bp; 00551 } 00552 00553 nu->type= type; 00554 nu->pntsu= 1; 00555 nu->pntsv= 1; 00556 00557 nu->orderu= nu->orderv= 4; 00558 nu->resolu= nu->resolv= 12; 00559 nu->flag= CU_SMOOTH; 00560 00561 BLI_addtail(BKE_curve_nurbs(cu), nu); 00562 00563 return nu; 00564 } 00565 00566 static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, Nurb *nu) 00567 { 00568 int found= 0; 00569 ListBase *nurbs= BKE_curve_nurbs(cu); 00570 00571 found= BLI_remlink_safe(nurbs, nu); 00572 00573 if(!found) { 00574 BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" does not contain spline given", cu->id.name+2); 00575 return; 00576 } 00577 00578 freeNurb(nu); 00579 /* invalidate pointer!, no can do */ 00580 } 00581 00582 static PointerRNA rna_Curve_active_spline_get(PointerRNA *ptr) 00583 { 00584 Curve *cu= (Curve*)ptr->data; 00585 Nurb *nu; 00586 ListBase *nurbs= BKE_curve_nurbs(cu); 00587 00588 // for curve outside editmode will set to -1, should be changed to be allowed outside of editmode. 00589 nu= BLI_findlink(nurbs, cu->actnu); 00590 00591 if(nu) 00592 return rna_pointer_inherit_refine(ptr, &RNA_Spline, nu); 00593 00594 return rna_pointer_inherit_refine(ptr, NULL, NULL); 00595 } 00596 00597 static void rna_Curve_active_spline_set(PointerRNA *ptr, PointerRNA value) 00598 { 00599 Curve *cu= (Curve*)ptr->data; 00600 Nurb *nu= value.data; 00601 ListBase *nubase= BKE_curve_nurbs(cu); 00602 00603 /* -1 is ok for an unset index */ 00604 if(nu==NULL) 00605 cu->actnu= -1; 00606 else 00607 cu->actnu= BLI_findindex(nubase, nu); 00608 } 00609 00610 static char *rna_Curve_spline_path(PointerRNA *ptr) 00611 { 00612 Curve *cu= (Curve*)ptr->id.data; 00613 ListBase *nubase= BKE_curve_nurbs(cu); 00614 Nurb *nu= ptr->data; 00615 int index= BLI_findindex(nubase, nu); 00616 00617 if (index >= 0) 00618 return BLI_sprintfN("splines[%d]", index); 00619 else 00620 return BLI_strdup(""); 00621 } 00622 00623 /* use for both bezier and nurbs */ 00624 static char *rna_Curve_spline_point_path(PointerRNA *ptr) 00625 { 00626 Curve *cu= (Curve*)ptr->id.data; 00627 Nurb *nu; 00628 void *point= ptr->data; 00629 int nu_index, pt_index; 00630 00631 nu= curve_nurb_from_point(cu, point, &nu_index, &pt_index); 00632 00633 if (nu) { 00634 if(nu->type == CU_BEZIER) { 00635 return BLI_sprintfN("splines[%d].bezier_points[%d]", nu_index, pt_index); 00636 } 00637 else { 00638 return BLI_sprintfN("splines[%d].points[%d]", nu_index, pt_index); 00639 } 00640 } 00641 else { 00642 return BLI_strdup(""); 00643 } 00644 } 00645 00646 00647 static char *rna_TextBox_path(PointerRNA *ptr) 00648 { 00649 Curve *cu= (Curve*)ptr->id.data; 00650 TextBox *tb= ptr->data; 00651 int index= (int)(tb - cu->tb); 00652 00653 if (index >= 0 && index < cu->totbox) 00654 return BLI_sprintfN("text_boxes[%d]", index); 00655 else 00656 return BLI_strdup(""); 00657 } 00658 00659 static void rna_Curve_splines_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) 00660 { 00661 Curve *cu= (Curve*)ptr->id.data; 00662 rna_iterator_listbase_begin(iter, BKE_curve_nurbs(cu), NULL); 00663 } 00664 00665 #else 00666 00667 static void rna_def_bpoint(BlenderRNA *brna) 00668 { 00669 StructRNA *srna; 00670 PropertyRNA *prop; 00671 00672 srna= RNA_def_struct(brna, "SplinePoint", NULL); 00673 RNA_def_struct_sdna(srna, "BPoint"); 00674 RNA_def_struct_ui_text(srna, "SplinePoint", "Spline point without handles"); 00675 00676 /* Boolean values */ 00677 prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); 00678 RNA_def_property_boolean_sdna(prop, NULL, "f1", 0); 00679 RNA_def_property_ui_text(prop, "Select", "Selection status"); 00680 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00681 00682 prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); 00683 RNA_def_property_boolean_sdna(prop, NULL, "hide", 0); 00684 RNA_def_property_ui_text(prop, "Hide", "Visibility status"); 00685 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00686 00687 /* Vector value */ 00688 prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION); 00689 RNA_def_property_array(prop, 3); 00690 RNA_def_property_float_sdna(prop, NULL, "vec"); 00691 RNA_def_property_ui_text(prop, "Point", "Point coordinates"); 00692 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00693 00694 prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE); 00695 RNA_def_property_float_sdna(prop, NULL, "vec[3]"); 00696 RNA_def_property_ui_text(prop, "Weight", "Nurbs weight"); 00697 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00698 00699 /* Number values */ 00700 prop= RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_NONE); 00701 RNA_def_property_float_sdna(prop, NULL, "alfa"); 00702 /*RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);*/ 00703 RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View"); 00704 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00705 00706 prop= RNA_def_property(srna, "weight_softbody", PROP_FLOAT, PROP_NONE); 00707 RNA_def_property_float_sdna(prop, NULL, "weight"); 00708 RNA_def_property_range(prop, 0.01f, 100.0f); 00709 RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight"); 00710 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00711 00712 prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE); 00713 RNA_def_property_float_sdna(prop, NULL, "radius"); 00714 RNA_def_property_range(prop, 0.0f, FLT_MAX); 00715 RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for bevelling"); 00716 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00717 00718 RNA_def_struct_path_func(srna, "rna_Curve_spline_point_path"); 00719 } 00720 00721 static void rna_def_beztriple(BlenderRNA *brna) 00722 { 00723 StructRNA *srna; 00724 PropertyRNA *prop; 00725 00726 srna= RNA_def_struct(brna, "BezierSplinePoint", NULL); 00727 RNA_def_struct_sdna(srna, "BezTriple"); 00728 RNA_def_struct_ui_text(srna, "Bezier Curve Point", "Bezier curve point with two handles"); 00729 00730 /* Boolean values */ 00731 prop= RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE); 00732 RNA_def_property_boolean_sdna(prop, NULL, "f1", 0); 00733 RNA_def_property_ui_text(prop, "Handle 1 selected", "Handle 1 selection status"); 00734 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00735 00736 prop= RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE); 00737 RNA_def_property_boolean_sdna(prop, NULL, "f3", 0); 00738 RNA_def_property_ui_text(prop, "Handle 2 selected", "Handle 2 selection status"); 00739 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00740 00741 prop= RNA_def_property(srna, "select_control_point", PROP_BOOLEAN, PROP_NONE); 00742 RNA_def_property_boolean_sdna(prop, NULL, "f2", 0); 00743 RNA_def_property_ui_text(prop, "Control Point selected", "Control point selection status"); 00744 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00745 00746 prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); 00747 RNA_def_property_boolean_sdna(prop, NULL, "hide", 0); 00748 RNA_def_property_ui_text(prop, "Hide", "Visibility status"); 00749 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00750 00751 /* Enums */ 00752 prop= RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE); 00753 RNA_def_property_enum_sdna(prop, NULL, "h1"); 00754 RNA_def_property_enum_items(prop, beztriple_handle_type_items); 00755 RNA_def_property_ui_text(prop, "Handle 1 Type", "Handle types"); 00756 RNA_def_property_update(prop, 0, "rna_Curve_update_points"); 00757 00758 prop= RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE); 00759 RNA_def_property_enum_sdna(prop, NULL, "h2"); 00760 RNA_def_property_enum_items(prop, beztriple_handle_type_items); 00761 RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle types"); 00762 RNA_def_property_update(prop, 0, "rna_Curve_update_points"); 00763 00764 /* Vector values */ 00765 prop= RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION); 00766 RNA_def_property_array(prop, 3); 00767 RNA_def_property_float_funcs(prop, "rna_BezTriple_handle1_get", "rna_BezTriple_handle1_set", NULL); 00768 RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle"); 00769 RNA_def_property_update(prop, 0, "rna_Curve_update_points"); 00770 00771 prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION); 00772 RNA_def_property_array(prop, 3); 00773 RNA_def_property_float_funcs(prop, "rna_BezTriple_ctrlpoint_get", "rna_BezTriple_ctrlpoint_set", NULL); 00774 RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point"); 00775 RNA_def_property_update(prop, 0, "rna_Curve_update_points"); 00776 00777 prop= RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION); 00778 RNA_def_property_array(prop, 3); 00779 RNA_def_property_float_funcs(prop, "rna_BezTriple_handle2_get", "rna_BezTriple_handle2_set", NULL); 00780 RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle"); 00781 RNA_def_property_update(prop, 0, "rna_Curve_update_points"); 00782 00783 /* Number values */ 00784 prop= RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_NONE); 00785 RNA_def_property_float_sdna(prop, NULL, "alfa"); 00786 /*RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);*/ 00787 RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View"); 00788 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00789 00790 prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE); 00791 RNA_def_property_range(prop, 0.01f, 100.0f); 00792 RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight"); 00793 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00794 00795 prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE); 00796 RNA_def_property_float_sdna(prop, NULL, "radius"); 00797 RNA_def_property_range(prop, 0.0f, FLT_MAX); 00798 RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for bevelling"); 00799 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00800 00801 RNA_def_struct_path_func(srna, "rna_Curve_spline_point_path"); 00802 } 00803 00804 static void rna_def_path(BlenderRNA *brna, StructRNA *srna) 00805 { 00806 PropertyRNA *prop; 00807 00808 /* number values */ 00809 prop= RNA_def_property(srna, "path_duration", PROP_INT, PROP_NONE); 00810 RNA_def_property_int_sdna(prop, NULL, "pathlen"); 00811 RNA_def_property_range(prop, 1, MAXFRAME); 00812 RNA_def_property_ui_text(prop, "Path Length", "The number of frames that are needed to traverse the path, defining the maximum value for the 'Evaluation Time' setting"); 00813 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00814 00815 /* flags */ 00816 prop= RNA_def_property(srna, "use_path", PROP_BOOLEAN, PROP_NONE); 00817 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_PATH); 00818 RNA_def_property_ui_text(prop, "Path", "Enable the curve to become a translation path"); 00819 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00820 00821 prop= RNA_def_property(srna, "use_path_follow", PROP_BOOLEAN, PROP_NONE); 00822 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FOLLOW); 00823 RNA_def_property_ui_text(prop, "Follow", "Make curve path children to rotate along the path"); 00824 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00825 00826 prop= RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE); 00827 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_STRETCH); 00828 RNA_def_property_ui_text(prop, "Stretch", "Option for curve-deform: makes deformed child to stretch along entire path"); 00829 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00830 00831 prop= RNA_def_property(srna, "use_deform_bounds", PROP_BOOLEAN, PROP_NONE); 00832 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CU_DEFORM_BOUNDS_OFF); 00833 RNA_def_property_ui_text(prop, "Bounds Clamp", "Use the mesh bounds to clamp the deformation"); 00834 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00835 00836 prop= RNA_def_property(srna, "use_time_offset", PROP_BOOLEAN, PROP_NONE); 00837 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_OFFS_PATHDIST); 00838 RNA_def_property_ui_text(prop, "Offset Path Distance", "Children will use TimeOffs value as path distance offset"); 00839 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00840 00841 prop= RNA_def_property(srna, "use_radius", PROP_BOOLEAN, PROP_NONE); 00842 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_PATH_RADIUS); 00843 RNA_def_property_ui_text(prop, "Radius", "Option for paths: apply the curve radius with path following it and deforming"); 00844 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00845 } 00846 00847 static void rna_def_nurbs(BlenderRNA *brna, StructRNA *srna) 00848 { 00849 PropertyRNA *prop; 00850 00851 /* flags */ 00852 prop= RNA_def_property(srna, "use_uv_as_generated", PROP_BOOLEAN, PROP_NONE); 00853 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UV_ORCO); 00854 RNA_def_property_ui_text(prop, "Use UV for Mapping", "Uses the UV values as Generated textured coordinates"); 00855 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00856 } 00857 00858 static void rna_def_font(BlenderRNA *brna, StructRNA *srna) 00859 { 00860 PropertyRNA *prop; 00861 00862 static EnumPropertyItem prop_align_items[] = { 00863 {CU_LEFT, "LEFT", 0, "Left", "Align text to the left"}, 00864 {CU_MIDDLE, "CENTER", 0, "Center", "Center text"}, 00865 {CU_RIGHT, "RIGHT", 0, "Right", "Align text to the right"}, 00866 {CU_JUSTIFY, "JUSTIFY", 0, "Justify", "Align to the left and the right"}, 00867 {CU_FLUSH, "FLUSH", 0, "Flush", "Align to the left and the right, with equal character spacing"}, 00868 {0, NULL, 0, NULL, NULL}}; 00869 00870 /* Enums */ 00871 prop= RNA_def_property(srna, "align", PROP_ENUM, PROP_NONE); 00872 RNA_def_property_enum_sdna(prop, NULL, "spacemode"); 00873 RNA_def_property_enum_items(prop, prop_align_items); 00874 RNA_def_property_ui_text(prop, "Text Align", "Text align from the object center"); 00875 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00876 00877 /* number values */ 00878 prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); 00879 RNA_def_property_float_sdna(prop, NULL, "fsize"); 00880 RNA_def_property_range(prop, 0.0001f, 10000.0f); 00881 RNA_def_property_ui_range(prop, 0.01, 10, 1, 3); 00882 RNA_def_property_ui_text(prop, "Font size", ""); 00883 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00884 00885 prop= RNA_def_property(srna, "small_caps_scale", PROP_FLOAT, PROP_NONE); 00886 RNA_def_property_float_sdna(prop, NULL, "smallcaps_scale"); 00887 RNA_def_property_ui_range(prop, 0, 1.0, 1, 2); 00888 RNA_def_property_ui_text(prop, "Small Caps", "Scale of small capitals"); 00889 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00890 00891 prop= RNA_def_property(srna, "space_line", PROP_FLOAT, PROP_NONE); 00892 RNA_def_property_float_sdna(prop, NULL, "linedist"); 00893 RNA_def_property_range(prop, 0.0f, 10.0f); 00894 RNA_def_property_ui_text(prop, "Distance between lines of text", ""); 00895 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00896 00897 prop= RNA_def_property(srna, "space_word", PROP_FLOAT, PROP_NONE); 00898 RNA_def_property_float_sdna(prop, NULL, "wordspace"); 00899 RNA_def_property_range(prop, 0.0f, 10.0f); 00900 RNA_def_property_ui_text(prop, "Spacing between words", ""); 00901 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00902 00903 prop= RNA_def_property(srna, "space_character", PROP_FLOAT, PROP_NONE); 00904 RNA_def_property_float_sdna(prop, NULL, "spacing"); 00905 RNA_def_property_range(prop, 0.0f, 10.0f); 00906 RNA_def_property_ui_text(prop, "Global spacing between characters", ""); 00907 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00908 00909 prop= RNA_def_property(srna, "shear", PROP_FLOAT, PROP_NONE); 00910 RNA_def_property_float_sdna(prop, NULL, "shear"); 00911 RNA_def_property_range(prop, -1.0f, 1.0f); 00912 RNA_def_property_ui_text(prop, "Shear", "Italic angle of the characters"); 00913 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00914 00915 prop= RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE); 00916 RNA_def_property_float_sdna(prop, NULL, "xof"); 00917 RNA_def_property_range(prop, -50.0f, 50.0f); 00918 RNA_def_property_ui_text(prop, "X Offset", "Horizontal offset from the object origin"); 00919 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00920 00921 prop= RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE); 00922 RNA_def_property_float_sdna(prop, NULL, "yof"); 00923 RNA_def_property_range(prop, -50.0f, 50.0f); 00924 RNA_def_property_ui_text(prop, "Y Offset", "Vertical offset from the object origin"); 00925 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00926 00927 prop= RNA_def_property(srna, "underline_position", PROP_FLOAT, PROP_NONE); 00928 RNA_def_property_float_sdna(prop, NULL, "ulpos"); 00929 RNA_def_property_range(prop, -0.2f, 0.8f); 00930 RNA_def_property_ui_text(prop, "Underline Position", "Vertical position of underline"); 00931 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00932 00933 prop= RNA_def_property(srna, "underline_height", PROP_FLOAT, PROP_NONE); 00934 RNA_def_property_float_sdna(prop, NULL, "ulheight"); 00935 RNA_def_property_range(prop, -0.2f, 0.8f); 00936 RNA_def_property_ui_text(prop, "Underline Thickness", ""); 00937 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00938 00939 prop= RNA_def_property(srna, "text_boxes", PROP_COLLECTION, PROP_NONE); 00940 RNA_def_property_collection_sdna(prop, NULL, "tb", "totbox"); 00941 RNA_def_property_struct_type(prop, "TextBox"); 00942 RNA_def_property_ui_text(prop, "Textboxes", ""); 00943 00944 prop= RNA_def_property(srna, "active_textbox", PROP_INT, PROP_NONE); 00945 RNA_def_property_int_sdna(prop, NULL, "actbox"); 00946 RNA_def_property_ui_text(prop, "The active text box", ""); 00947 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Curve_active_textbox_index_range"); 00948 00949 /* strings */ 00950 prop= RNA_def_property(srna, "family", PROP_STRING, PROP_NONE); 00951 RNA_def_property_string_maxlength(prop, MAX_ID_NAME-2); 00952 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"); 00953 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00954 00955 prop= RNA_def_property(srna, "body", PROP_STRING, PROP_NONE); 00956 RNA_def_property_string_sdna(prop, NULL, "str"); 00957 RNA_def_property_ui_text(prop, "Body Text", "contents of this text object"); 00958 RNA_def_property_string_funcs(prop, "rna_Curve_body_get", "rna_Curve_body_length", "rna_Curve_body_set"); 00959 RNA_def_property_string_maxlength(prop, 8192); /* note that originally str did not have a limit! */ 00960 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00961 00962 prop= RNA_def_property(srna, "body_format", PROP_COLLECTION, PROP_NONE); 00963 RNA_def_property_collection_sdna(prop, NULL, "strinfo", "len"); 00964 RNA_def_property_struct_type(prop, "TextCharacterFormat"); 00965 RNA_def_property_ui_text(prop, "Character Info", "Stores the style of each character"); 00966 00967 /* pointers */ 00968 prop= RNA_def_property(srna, "follow_curve", PROP_POINTER, PROP_NONE); 00969 RNA_def_property_pointer_sdna(prop, NULL, "textoncurve"); 00970 RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_otherObject_poll"); 00971 RNA_def_property_flag(prop, PROP_EDITABLE); 00972 RNA_def_property_ui_text(prop, "Text on Curve", "Curve deforming text object"); 00973 RNA_def_property_update(prop, 0, "rna_Curve_update_deps"); 00974 00975 prop= RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE); 00976 RNA_def_property_pointer_sdna(prop, NULL, "vfont"); 00977 RNA_def_property_ui_text(prop, "Font", ""); 00978 RNA_def_property_flag(prop, PROP_EDITABLE); 00979 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00980 00981 prop= RNA_def_property(srna, "font_bold", PROP_POINTER, PROP_NONE); 00982 RNA_def_property_pointer_sdna(prop, NULL, "vfontb"); 00983 RNA_def_property_ui_text(prop, "Font Bold", ""); 00984 RNA_def_property_flag(prop, PROP_EDITABLE); 00985 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00986 00987 prop= RNA_def_property(srna, "font_italic", PROP_POINTER, PROP_NONE); 00988 RNA_def_property_pointer_sdna(prop, NULL, "vfonti"); 00989 RNA_def_property_ui_text(prop, "Font Italic", ""); 00990 RNA_def_property_flag(prop, PROP_EDITABLE); 00991 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00992 00993 prop= RNA_def_property(srna, "font_bold_italic", PROP_POINTER, PROP_NONE); 00994 RNA_def_property_pointer_sdna(prop, NULL, "vfontbi"); 00995 RNA_def_property_ui_text(prop, "Font Bold Italic", ""); 00996 RNA_def_property_flag(prop, PROP_EDITABLE); 00997 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 00998 00999 prop= RNA_def_property(srna, "edit_format", PROP_POINTER, PROP_NONE); 01000 RNA_def_property_pointer_sdna(prop, NULL, "curinfo"); 01001 RNA_def_property_ui_text(prop, "Edit Format", "Editing settings character formatting"); 01002 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01003 01004 /* flags */ 01005 prop= RNA_def_property(srna, "use_fast_edit", PROP_BOOLEAN, PROP_NONE); 01006 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FAST); 01007 RNA_def_property_ui_text(prop, "Fast Editing", "Don't fill polygons while editing"); 01008 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01009 } 01010 01011 static void rna_def_textbox(BlenderRNA *brna) 01012 { 01013 StructRNA *srna; 01014 PropertyRNA *prop; 01015 01016 srna= RNA_def_struct(brna, "TextBox", NULL); 01017 RNA_def_struct_ui_text(srna, "Text Box", "Text bounding box for layout"); 01018 01019 /* number values */ 01020 prop= RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE); 01021 RNA_def_property_float_sdna(prop, NULL, "x"); 01022 RNA_def_property_range(prop, -50.0f, 50.0f); 01023 RNA_def_property_ui_text(prop, "Textbox X Offset", ""); 01024 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01025 01026 prop= RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE); 01027 RNA_def_property_float_sdna(prop, NULL, "y"); 01028 RNA_def_property_range(prop, -50.0f, 50.0f); 01029 RNA_def_property_ui_text(prop, "Textbox Y Offset", ""); 01030 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01031 01032 prop= RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE); 01033 RNA_def_property_float_sdna(prop, NULL, "w"); 01034 RNA_def_property_range(prop, 0.0f, 50.0f); 01035 RNA_def_property_ui_text(prop, "Textbox Width", ""); 01036 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01037 01038 prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE); 01039 RNA_def_property_float_sdna(prop, NULL, "h"); 01040 RNA_def_property_range(prop, 0.0f, 50.0f); 01041 RNA_def_property_ui_text(prop, "Textbox Height", ""); 01042 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01043 01044 RNA_def_struct_path_func(srna, "rna_TextBox_path"); 01045 } 01046 01047 static void rna_def_charinfo(BlenderRNA *brna) 01048 { 01049 StructRNA *srna; 01050 PropertyRNA *prop; 01051 01052 srna= RNA_def_struct(brna, "TextCharacterFormat", NULL); 01053 RNA_def_struct_sdna(srna, "CharInfo"); 01054 RNA_def_struct_ui_text(srna, "Text Character Format", "Text character formatting settings"); 01055 01056 /* flags */ 01057 prop= RNA_def_property(srna, "use_bold", PROP_BOOLEAN, PROP_NONE); 01058 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_BOLD); 01059 RNA_def_property_ui_text(prop, "Bold", ""); 01060 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01061 01062 prop= RNA_def_property(srna, "use_italic", PROP_BOOLEAN, PROP_NONE); 01063 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_ITALIC); 01064 RNA_def_property_ui_text(prop, "Italic", ""); 01065 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01066 01067 prop= RNA_def_property(srna, "use_underline", PROP_BOOLEAN, PROP_NONE); 01068 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_UNDERLINE); 01069 RNA_def_property_ui_text(prop, "Underline", ""); 01070 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01071 01072 /* probably there is no reason to expose this */ 01073 /* prop= RNA_def_property(srna, "wrap", PROP_BOOLEAN, PROP_NONE); 01074 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_WRAP); 01075 RNA_def_property_ui_text(prop, "Wrap", ""); 01076 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); */ 01077 01078 prop= RNA_def_property(srna, "use_small_caps", PROP_BOOLEAN, PROP_NONE); 01079 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_SMALLCAPS); 01080 RNA_def_property_ui_text(prop, "Small Caps", ""); 01081 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01082 } 01083 01084 static void rna_def_surface(BlenderRNA *brna) 01085 { 01086 StructRNA *srna; 01087 01088 srna= RNA_def_struct(brna, "SurfaceCurve", "Curve"); 01089 RNA_def_struct_sdna(srna, "Curve"); 01090 RNA_def_struct_ui_text(srna, "Surface Curve", "Curve datablock used for storing surfaces"); 01091 RNA_def_struct_ui_icon(srna, ICON_SURFACE_DATA); 01092 01093 rna_def_nurbs(brna, srna); 01094 } 01095 01096 static void rna_def_text(BlenderRNA *brna) 01097 { 01098 StructRNA *srna; 01099 01100 srna= RNA_def_struct(brna, "TextCurve", "Curve"); 01101 RNA_def_struct_sdna(srna, "Curve"); 01102 RNA_def_struct_ui_text(srna, "Text Curve", "Curve datablock used for storing text"); 01103 RNA_def_struct_ui_icon(srna, ICON_FONT_DATA); 01104 01105 rna_def_font(brna, srna); 01106 rna_def_nurbs(brna, srna); 01107 } 01108 01109 01110 /* curve.splines[0].points */ 01111 static void rna_def_curve_spline_points(BlenderRNA *brna, PropertyRNA *cprop) 01112 { 01113 StructRNA *srna; 01114 //PropertyRNA *prop; 01115 01116 FunctionRNA *func; 01117 //PropertyRNA *parm; 01118 01119 RNA_def_property_srna(cprop, "SplinePoints"); 01120 srna= RNA_def_struct(brna, "SplinePoints", NULL); 01121 RNA_def_struct_sdna(srna, "Nurb"); 01122 RNA_def_struct_ui_text(srna, "Spline Points", "Collection of spline points"); 01123 01124 func= RNA_def_function(srna, "add", "rna_Curve_spline_points_add"); 01125 RNA_def_function_ui_description(func, "Add a number of points to this spline."); 01126 RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_USE_REPORTS); 01127 RNA_def_int(func, "count", 1, 1, INT_MAX, "Number", "Number of points to add to the spline", 1, INT_MAX); 01128 01129 /* 01130 func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove"); 01131 RNA_def_function_ui_description(func, "Remove a spline from a curve."); 01132 RNA_def_function_flag(func, FUNC_USE_REPORTS); 01133 parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove."); 01134 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 01135 */ 01136 } 01137 01138 static void rna_def_curve_spline_bezpoints(BlenderRNA *brna, PropertyRNA *cprop) 01139 { 01140 StructRNA *srna; 01141 //PropertyRNA *prop; 01142 01143 FunctionRNA *func; 01144 //PropertyRNA *parm; 01145 01146 RNA_def_property_srna(cprop, "SplineBezierPoints"); 01147 srna= RNA_def_struct(brna, "SplineBezierPoints", NULL); 01148 RNA_def_struct_sdna(srna, "Nurb"); 01149 RNA_def_struct_ui_text(srna, "Spline Bezier Points", "Collection of spline bezirt points"); 01150 01151 func= RNA_def_function(srna, "add", "rna_Curve_spline_bezpoints_add"); 01152 RNA_def_function_ui_description(func, "Add a number of points to this spline."); 01153 RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_USE_REPORTS); 01154 RNA_def_int(func, "count", 1, INT_MIN, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX); 01155 01156 /* 01157 func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove"); 01158 RNA_def_function_ui_description(func, "Remove a spline from a curve."); 01159 RNA_def_function_flag(func, FUNC_USE_REPORTS); 01160 parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove."); 01161 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 01162 */ 01163 } 01164 01165 /* curve.splines */ 01166 static void rna_def_curve_splines(BlenderRNA *brna, PropertyRNA *cprop) 01167 { 01168 StructRNA *srna; 01169 PropertyRNA *prop; 01170 01171 FunctionRNA *func; 01172 PropertyRNA *parm; 01173 01174 RNA_def_property_srna(cprop, "CurveSplines"); 01175 srna= RNA_def_struct(brna, "CurveSplines", NULL); 01176 RNA_def_struct_sdna(srna, "Curve"); 01177 RNA_def_struct_ui_text(srna, "Curve Splines", "Collection of curve splines"); 01178 01179 func= RNA_def_function(srna, "new", "rna_Curve_spline_new"); 01180 RNA_def_function_ui_description(func, "Add a new spline to the curve."); 01181 parm= RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline."); 01182 RNA_def_property_flag(parm, PROP_REQUIRED); 01183 parm= RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline."); 01184 RNA_def_function_return(func, parm); 01185 01186 func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove"); 01187 RNA_def_function_ui_description(func, "Remove a spline from a curve."); 01188 RNA_def_function_flag(func, FUNC_USE_REPORTS); 01189 parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove."); 01190 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 01191 01192 prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); 01193 RNA_def_property_struct_type(prop, "Object"); 01194 RNA_def_property_pointer_funcs(prop, "rna_Curve_active_spline_get", "rna_Curve_active_spline_set", NULL, NULL); 01195 RNA_def_property_flag(prop, PROP_EDITABLE); 01196 RNA_def_property_ui_text(prop, "Active Spline", "Active curve spline"); 01197 /* Could call: ED_base_object_activate(C, scene->basact); 01198 * but would be a bad level call and it seems the notifier is enough */ 01199 RNA_def_property_update(prop, NC_SCENE|ND_OB_ACTIVE, NULL); 01200 } 01201 01202 01203 static void rna_def_curve(BlenderRNA *brna) 01204 { 01205 StructRNA *srna; 01206 PropertyRNA *prop; 01207 01208 static EnumPropertyItem curve_twist_mode_items[] = { 01209 {CU_TWIST_Z_UP, "Z_UP", 0, "Z-Up", "Use Z-Up axis to calculate the curve twist at each point"}, 01210 {CU_TWIST_MINIMUM, "MINIMUM", 0, "Minimum", "Use the least twist over the entire curve"}, 01211 {CU_TWIST_TANGENT, "TANGENT", 0, "Tangent", "Use the tangent to calculate twist"}, 01212 {0, NULL, 0, NULL, NULL}}; 01213 01214 static const EnumPropertyItem curve_axis_items[]= { 01215 {0, "2D", 0, "2D", "Clamp the Z axis of of the curve"}, 01216 {CU_3D, "3D", 0, "3D", "Allow editing on the Z axis of this curve, also allows tilt and curve radius to be used"}, 01217 {0, NULL, 0, NULL, NULL}}; 01218 01219 srna= RNA_def_struct(brna, "Curve", "ID"); 01220 RNA_def_struct_ui_text(srna, "Curve", "Curve datablock storing curves, splines and NURBS"); 01221 RNA_def_struct_ui_icon(srna, ICON_CURVE_DATA); 01222 RNA_def_struct_refine_func(srna, "rna_Curve_refine"); 01223 01224 rna_def_animdata_common(srna); 01225 01226 prop= RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE); 01227 RNA_def_property_pointer_sdna(prop, NULL, "key"); 01228 RNA_def_property_ui_text(prop, "Shape Keys", ""); 01229 01230 01231 prop= RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE); 01232 #if 0 01233 RNA_def_property_collection_sdna(prop, NULL, "nurb", NULL); 01234 #else 01235 /* this way we get editmode nurbs too, keyframe in editmode */ 01236 RNA_def_property_collection_funcs(prop, "rna_Curve_splines_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); 01237 #endif 01238 RNA_def_property_struct_type(prop, "Spline"); 01239 RNA_def_property_ui_text(prop, "Splines", "Collection of splines in this curve data object"); 01240 rna_def_curve_splines(brna, prop); 01241 01242 prop= RNA_def_property(srna, "show_handles", PROP_BOOLEAN, PROP_NONE); 01243 RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", CU_HIDE_HANDLES); 01244 RNA_def_property_ui_text(prop, "Draw Handles", "Display Bezier handles in editmode"); 01245 RNA_def_property_update(prop, NC_GEOM|ND_DATA, NULL); 01246 01247 prop= RNA_def_property(srna, "show_normal_face", PROP_BOOLEAN, PROP_NONE); 01248 RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", CU_HIDE_NORMALS); 01249 RNA_def_property_ui_text(prop, "Draw Normals", "Display 3D curve normals in editmode"); 01250 RNA_def_property_update(prop, NC_GEOM|ND_DATA, NULL); 01251 01252 rna_def_path(brna, srna); 01253 01254 /* Number values */ 01255 prop= RNA_def_property(srna, "bevel_resolution", PROP_INT, PROP_NONE); 01256 RNA_def_property_int_sdna(prop, NULL, "bevresol"); 01257 RNA_def_property_range(prop, 0, 32); 01258 RNA_def_property_ui_range(prop, 0, 32, 1.0, 0); 01259 RNA_def_property_ui_text(prop, "Bevel Resolution", "Bevel resolution when depth is non-zero and no specific bevel object has been defined"); 01260 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01261 01262 prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE); 01263 RNA_def_property_float_sdna(prop, NULL, "width"); 01264 RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3); 01265 RNA_def_property_float_funcs(prop, "rna_Curve_offset_get", "rna_Curve_offset_set", NULL); 01266 RNA_def_property_ui_text(prop, "Offset", "Offset the curve to adjust the width of a text"); 01267 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01268 01269 prop= RNA_def_property(srna, "extrude", PROP_FLOAT, PROP_NONE); 01270 RNA_def_property_float_sdna(prop, NULL, "ext1"); 01271 RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 3); 01272 RNA_def_property_range(prop, 0.0, FLT_MAX); 01273 RNA_def_property_ui_text(prop, "Extrude", "Amount of curve extrusion when not using a bevel object"); 01274 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01275 01276 prop= RNA_def_property(srna, "bevel_depth", PROP_FLOAT, PROP_NONE); 01277 RNA_def_property_float_sdna(prop, NULL, "ext2"); 01278 RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 3); 01279 RNA_def_property_ui_text(prop, "Bevel Depth", "Bevel depth when not using a bevel object"); 01280 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01281 01282 prop= RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE); 01283 RNA_def_property_int_sdna(prop, NULL, "resolu"); 01284 RNA_def_property_range(prop, 1, SHRT_MAX); 01285 RNA_def_property_ui_range(prop, 1, 64, 1, 0); 01286 RNA_def_property_ui_text(prop, "Resolution U", "Surface resolution in U direction"); 01287 RNA_def_property_update(prop, 0, "rna_Curve_resolution_u_update_data"); 01288 01289 prop= RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE); 01290 RNA_def_property_int_sdna(prop, NULL, "resolv"); 01291 RNA_def_property_ui_range(prop, 1, 64, 1, 0); 01292 RNA_def_property_range(prop, 1, SHRT_MAX); 01293 RNA_def_property_ui_text(prop, "Resolution V", "Surface resolution in V direction"); 01294 RNA_def_property_update(prop, 0, "rna_Curve_resolution_v_update_data"); 01295 01296 prop= RNA_def_property(srna, "render_resolution_u", PROP_INT, PROP_NONE); 01297 RNA_def_property_int_sdna(prop, NULL, "resolu_ren"); 01298 RNA_def_property_range(prop, 0, SHRT_MAX); 01299 RNA_def_property_ui_range(prop, 0, 64, 1, 0); 01300 RNA_def_property_ui_text(prop, "Render Resolution U", "Surface resolution in U direction used while rendering. Zero skips this property"); 01301 01302 prop= RNA_def_property(srna, "render_resolution_v", PROP_INT, PROP_NONE); 01303 RNA_def_property_int_sdna(prop, NULL, "resolv_ren"); 01304 RNA_def_property_ui_range(prop, 0, 64, 1, 0); 01305 RNA_def_property_range(prop, 0, SHRT_MAX); 01306 RNA_def_property_ui_text(prop, "Render Resolution V", "Surface resolution in V direction used while rendering. Zero skips this property"); 01307 01308 01309 prop= RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_NONE); 01310 RNA_def_property_float_sdna(prop, NULL, "ctime"); 01311 RNA_def_property_ui_text(prop, "Evaluation Time", "Parametric position along the length of the curve that Objects 'following' it should be at. Position is evaluated by dividing by the 'Path Length' value"); 01312 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01313 01314 /* pointers */ 01315 prop= RNA_def_property(srna, "bevel_object", PROP_POINTER, PROP_NONE); 01316 RNA_def_property_struct_type(prop, "Object"); 01317 RNA_def_property_pointer_sdna(prop, NULL, "bevobj"); 01318 RNA_def_property_flag(prop, PROP_EDITABLE); 01319 RNA_def_property_ui_text(prop, "Bevel Object", "Curve object name that defines the bevel shape"); 01320 RNA_def_property_update(prop, 0, "rna_Curve_update_deps"); 01321 RNA_def_property_pointer_funcs(prop, "rna_Curve_bevelObject_get", "rna_Curve_bevelObject_set", NULL, "rna_Curve_otherObject_poll"); 01322 01323 prop= RNA_def_property(srna, "taper_object", PROP_POINTER, PROP_NONE); 01324 RNA_def_property_struct_type(prop, "Object"); 01325 RNA_def_property_pointer_sdna(prop, NULL, "taperobj"); 01326 RNA_def_property_flag(prop, PROP_EDITABLE); 01327 RNA_def_property_ui_text(prop, "Taper Object", "Curve object name that defines the taper (width)"); 01328 RNA_def_property_update(prop, 0, "rna_Curve_update_deps"); 01329 RNA_def_property_pointer_funcs(prop, "rna_Curve_taperObject_get", "rna_Curve_taperObject_set", NULL, "rna_Curve_otherObject_poll"); 01330 01331 /* Flags */ 01332 01333 prop= RNA_def_property(srna, "dimensions", PROP_ENUM, PROP_NONE); /* as an enum */ 01334 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); 01335 RNA_def_property_enum_items(prop, curve_axis_items); 01336 RNA_def_property_enum_funcs(prop, NULL, "rna_Curve_dimension_set", NULL); 01337 RNA_def_property_ui_text(prop, "Dimensions", "Select 2D or 3D curve type"); 01338 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01339 01340 prop= RNA_def_property(srna, "use_fill_front", PROP_BOOLEAN, PROP_NONE); 01341 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FRONT); 01342 RNA_def_property_ui_text(prop, "Front", "Draw filled front for extruded/beveled curves"); 01343 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01344 01345 prop= RNA_def_property(srna, "use_fill_back", PROP_BOOLEAN, PROP_NONE); 01346 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_BACK); 01347 RNA_def_property_ui_text(prop, "Back", "Draw filled back for extruded/beveled curves"); 01348 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01349 01350 prop= RNA_def_property(srna, "twist_mode", PROP_ENUM, PROP_NONE); 01351 RNA_def_property_enum_sdna(prop, NULL, "twist_mode"); 01352 RNA_def_property_enum_items(prop, curve_twist_mode_items); 01353 RNA_def_property_ui_text(prop, "Twist Method", "The type of tilt calculation for 3D Curves"); 01354 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01355 01356 // XXX - would be nice to have a better way to do this, only add for testing. 01357 prop= RNA_def_property(srna, "twist_smooth", PROP_FLOAT, PROP_NONE); 01358 RNA_def_property_float_sdna(prop, NULL, "twist_smooth"); 01359 RNA_def_property_ui_range(prop, 0, 100.0, 1, 2); 01360 RNA_def_property_ui_text(prop, "Twist Smooth", "Smoothing iteration for tangents"); 01361 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01362 01363 prop= RNA_def_property(srna, "use_fill_deform", PROP_BOOLEAN, PROP_NONE); 01364 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_DEFORM_FILL); 01365 RNA_def_property_ui_text(prop, "Fill deformed", "Fill curve after applying shape keys and all modifiers"); 01366 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01367 01368 /* texture space */ 01369 prop= RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE); 01370 RNA_def_property_boolean_sdna(prop, NULL, "texflag", CU_AUTOSPACE); 01371 RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjusts active object's texture space automatically when transforming object"); 01372 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Curve_texspace_set"); 01373 01374 prop= RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION); 01375 RNA_def_property_array(prop, 3); 01376 RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location"); 01377 RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable"); 01378 RNA_def_property_float_funcs(prop, "rna_Curve_texspace_loc_get", "rna_Curve_texspace_loc_set", NULL); 01379 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01380 01381 prop= RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ); 01382 RNA_def_property_array(prop, 3); 01383 RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size"); 01384 RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable"); 01385 RNA_def_property_float_funcs(prop, "rna_Curve_texspace_size_get", "rna_Curve_texspace_size_set", NULL); 01386 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01387 01388 /* not supported yet 01389 prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER); 01390 RNA_def_property_float(prop, NULL, "rot"); 01391 RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation"); 01392 RNA_def_property_editable_func(prop, texspace_editable); 01393 RNA_def_property_update(prop, 0, "rna_Curve_update_data");*/ 01394 01395 prop= RNA_def_property(srna, "use_uv_as_generated", PROP_BOOLEAN, PROP_NONE); 01396 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UV_ORCO); 01397 RNA_def_property_ui_text(prop, "Use UV for mapping", "Uses the UV values as Generated textured coordinates"); 01398 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01399 01400 /* materials */ 01401 prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE); 01402 RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol"); 01403 RNA_def_property_struct_type(prop, "Material"); 01404 RNA_def_property_ui_text(prop, "Materials", ""); 01405 RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */ 01406 } 01407 01408 static void rna_def_curve_nurb(BlenderRNA *brna) 01409 { 01410 static EnumPropertyItem spline_interpolation_items[] = { 01411 {KEY_LINEAR, "LINEAR", 0, "Linear", ""}, 01412 {KEY_CARDINAL, "CARDINAL", 0, "Cardinal", ""}, 01413 {KEY_BSPLINE, "BSPLINE", 0, "BSpline", ""}, 01414 {KEY_CU_EASE, "EASE", 0, "Ease", ""}, /* todo, define somewhere, not one of BEZT_IPO_* */ 01415 {0, NULL, 0, NULL, NULL}}; 01416 01417 StructRNA *srna; 01418 PropertyRNA *prop; 01419 01420 srna= RNA_def_struct(brna, "Spline", NULL); 01421 RNA_def_struct_sdna(srna, "Nurb"); 01422 RNA_def_struct_ui_text(srna, "Spline", "Element of a curve, either Nurbs, Bezier or Polyline or a character with text objects"); 01423 01424 prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE); 01425 RNA_def_property_collection_sdna(prop, NULL, "bp", NULL); 01426 RNA_def_property_struct_type(prop, "SplinePoint"); 01427 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); 01428 RNA_def_property_ui_text(prop, "Points", "Collection of points that make up this poly or nurbs spline"); 01429 rna_def_curve_spline_points(brna, prop); 01430 01431 prop= RNA_def_property(srna, "bezier_points", PROP_COLLECTION, PROP_NONE); 01432 RNA_def_property_struct_type(prop, "BezierSplinePoint"); 01433 RNA_def_property_collection_sdna(prop, NULL, "bezt", "pntsu"); 01434 RNA_def_property_ui_text(prop, "Bezier Points", "Collection of points for Bezier curves only"); 01435 rna_def_curve_spline_bezpoints(brna, prop); 01436 01437 01438 prop= RNA_def_property(srna, "tilt_interpolation", PROP_ENUM, PROP_NONE); 01439 RNA_def_property_enum_sdna(prop, NULL, "tilt_interp"); 01440 RNA_def_property_enum_items(prop, spline_interpolation_items); 01441 RNA_def_property_ui_text(prop, "Tilt Interpolation", "The type of tilt interpolation for 3D, Bezier curves"); 01442 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01443 01444 prop= RNA_def_property(srna, "radius_interpolation", PROP_ENUM, PROP_NONE); 01445 RNA_def_property_enum_sdna(prop, NULL, "radius_interp"); 01446 RNA_def_property_enum_items(prop, spline_interpolation_items); 01447 RNA_def_property_ui_text(prop, "Radius Interpolation", "The type of radius interpolation for Bezier curves"); 01448 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01449 01450 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); 01451 RNA_def_property_enum_items(prop, curve_type_items); 01452 RNA_def_property_enum_funcs(prop, NULL, "rna_Nurb_type_set", NULL); 01453 RNA_def_property_ui_text(prop, "Type", "The interpolation type for this curve element"); 01454 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01455 01456 prop= RNA_def_property(srna, "point_count_u", PROP_INT, PROP_UNSIGNED); 01457 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/ 01458 RNA_def_property_int_sdna(prop, NULL, "pntsu"); 01459 RNA_def_property_ui_text(prop, "Points U", "Total number points for the curve or surface in the U direction"); 01460 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01461 01462 prop= RNA_def_property(srna, "point_count_v", PROP_INT, PROP_UNSIGNED); 01463 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/ 01464 RNA_def_property_int_sdna(prop, NULL, "pntsv"); 01465 RNA_def_property_ui_text(prop, "Points V", "Total number points for the surface on the V direction"); 01466 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01467 01468 01469 prop= RNA_def_property(srna, "order_u", PROP_INT, PROP_NONE); 01470 RNA_def_property_int_sdna(prop, NULL, "orderu"); 01471 RNA_def_property_range(prop, 2, 6); 01472 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"); 01473 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u"); 01474 01475 prop= RNA_def_property(srna, "order_v", PROP_INT, PROP_NONE); 01476 RNA_def_property_int_sdna(prop, NULL, "orderv"); 01477 RNA_def_property_range(prop, 2, 6); 01478 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"); 01479 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v"); 01480 01481 01482 prop= RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE); 01483 RNA_def_property_int_sdna(prop, NULL, "resolu"); 01484 RNA_def_property_range(prop, 1, SHRT_MAX); 01485 RNA_def_property_ui_range(prop, 1, 64, 1, 0); 01486 RNA_def_property_ui_text(prop, "Resolution U", "Curve or Surface subdivisions per segment"); 01487 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01488 01489 prop= RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE); 01490 RNA_def_property_int_sdna(prop, NULL, "resolv"); 01491 RNA_def_property_range(prop, 1, SHRT_MAX); 01492 RNA_def_property_ui_range(prop, 1, 64, 1, 0); 01493 RNA_def_property_ui_text(prop, "Resolution V", "Surface subdivisions per segment"); 01494 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01495 01496 prop= RNA_def_property(srna, "use_cyclic_u", PROP_BOOLEAN, PROP_NONE); 01497 RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_CYCLIC); 01498 RNA_def_property_ui_text(prop, "Cyclic U", "Make this curve or surface a closed loop in the U direction"); 01499 RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_u"); 01500 01501 prop= RNA_def_property(srna, "use_cyclic_v", PROP_BOOLEAN, PROP_NONE); 01502 RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_CYCLIC); 01503 RNA_def_property_ui_text(prop, "Cyclic V", "Make this surface a closed loop in the V direction"); 01504 RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_v"); 01505 01506 01507 /* Note, endpoint and bezier flags should never be on at the same time! */ 01508 prop= RNA_def_property(srna, "use_endpoint_u", PROP_BOOLEAN, PROP_NONE); 01509 RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_ENDPOINT); 01510 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)"); 01511 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u"); 01512 01513 prop= RNA_def_property(srna, "use_endpoint_v", PROP_BOOLEAN, PROP_NONE); 01514 RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_ENDPOINT); 01515 RNA_def_property_ui_text(prop, "Endpoint V", "Make this nurbs surface meet the endpoints in the V direction (Cyclic V must be disabled)"); 01516 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v"); 01517 01518 prop= RNA_def_property(srna, "use_bezier_u", PROP_BOOLEAN, PROP_NONE); 01519 RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_BEZIER); 01520 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)"); 01521 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u"); 01522 01523 prop= RNA_def_property(srna, "use_bezier_v", PROP_BOOLEAN, PROP_NONE); 01524 RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_BEZIER); 01525 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)"); 01526 RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v"); 01527 01528 01529 prop= RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE); 01530 RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_SMOOTH); 01531 RNA_def_property_ui_text(prop, "Smooth", "Smooth the normals of the surface or beveled curve"); 01532 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01533 01534 prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); 01535 RNA_def_property_boolean_sdna(prop, NULL, "hide", 1); 01536 RNA_def_property_ui_text(prop, "Hide", "Hide this curve in editmode"); 01537 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01538 01539 prop= RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED); 01540 RNA_def_property_int_sdna(prop, NULL, "mat_nr"); 01541 RNA_def_property_ui_text(prop, "Material Index", ""); 01542 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Curve_material_index_range"); 01543 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01544 01545 prop= RNA_def_property(srna, "character_index", PROP_INT, PROP_UNSIGNED); 01546 RNA_def_property_int_sdna(prop, NULL, "charidx"); 01547 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/ 01548 RNA_def_property_ui_text(prop, "Character Index", "Location of this character in the text data (only for text curves)"); 01549 RNA_def_property_update(prop, 0, "rna_Curve_update_data"); 01550 01551 RNA_def_struct_path_func(srna, "rna_Curve_spline_path"); 01552 } 01553 01554 void RNA_def_curve(BlenderRNA *brna) 01555 { 01556 rna_def_curve(brna); 01557 rna_def_surface(brna); 01558 rna_def_text(brna); 01559 rna_def_textbox(brna); 01560 rna_def_charinfo(brna); 01561 rna_def_bpoint(brna); 01562 rna_def_beztriple(brna); 01563 rna_def_curve_nurb(brna); 01564 } 01565 01566 #endif 01567