Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_curve.c
| Show First 20 Lines • Show All 310 Lines • ▼ Show 20 Lines | |||||
| static int rna_Nurb_length(PointerRNA *ptr) | static int rna_Nurb_length(PointerRNA *ptr) | ||||
| { | { | ||||
| Nurb *nu = (Nurb *)ptr->data; | Nurb *nu = (Nurb *)ptr->data; | ||||
| if (nu->type == CU_BEZIER) return 0; | if (nu->type == CU_BEZIER) return 0; | ||||
| return nu->pntsv > 0 ? nu->pntsu * nu->pntsv : nu->pntsu; | return nu->pntsv > 0 ? nu->pntsu * nu->pntsv : nu->pntsu; | ||||
| } | } | ||||
| static float rna_Nurb_length_get(PointerRNA *ptr) | |||||
| { | |||||
| Nurb *nu = (Nurb *)ptr->data; | |||||
| return BKE_nurb_length_get(nu); | |||||
| } | |||||
| static void rna_Nurb_type_set(PointerRNA *ptr, int value) | static void rna_Nurb_type_set(PointerRNA *ptr, int value) | ||||
| { | { | ||||
| Curve *cu = (Curve *)ptr->id.data; | Curve *cu = (Curve *)ptr->id.data; | ||||
| Nurb *nu = (Nurb *)ptr->data; | Nurb *nu = (Nurb *)ptr->data; | ||||
| const int pntsu_prev = nu->pntsu; | const int pntsu_prev = nu->pntsu; | ||||
| if (BKE_nurb_type_convert(nu, value, true)) { | if (BKE_nurb_type_convert(nu, value, true)) { | ||||
| if (nu->pntsu != pntsu_prev) { | if (nu->pntsu != pntsu_prev) { | ||||
| ▲ Show 20 Lines • Show All 1,406 Lines • ▼ Show 20 Lines | static void rna_def_curve_nurb(BlenderRNA *brna) | ||||
| prop = RNA_def_property(srna, "character_index", PROP_INT, PROP_UNSIGNED); | prop = RNA_def_property(srna, "character_index", PROP_INT, PROP_UNSIGNED); | ||||
| RNA_def_property_int_sdna(prop, NULL, "charidx"); | RNA_def_property_int_sdna(prop, NULL, "charidx"); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/ | RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/ | ||||
| RNA_def_property_ui_text(prop, "Character Index", | RNA_def_property_ui_text(prop, "Character Index", | ||||
| "Location of this character in the text data (only for text curves)"); | "Location of this character in the text data (only for text curves)"); | ||||
| RNA_def_property_update(prop, 0, "rna_Curve_update_data"); | RNA_def_property_update(prop, 0, "rna_Curve_update_data"); | ||||
| prop = RNA_def_property(srna, "length", PROP_FLOAT, PROP_DISTANCE); | |||||
| RNA_def_property_float_funcs(prop, "rna_Nurb_length_get", NULL, NULL); | |||||
| RNA_def_property_range(prop, 0.0, FLT_MAX); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| RNA_def_property_ui_text(prop, "Length", "Length of the spline"); | |||||
| RNA_def_struct_path_func(srna, "rna_Curve_spline_path"); | RNA_def_struct_path_func(srna, "rna_Curve_spline_path"); | ||||
| } | } | ||||
| void RNA_def_curve(BlenderRNA *brna) | void RNA_def_curve(BlenderRNA *brna) | ||||
| { | { | ||||
| rna_def_curve(brna); | rna_def_curve(brna); | ||||
| rna_def_surface(brna); | rna_def_surface(brna); | ||||
| rna_def_text(brna); | rna_def_text(brna); | ||||
| rna_def_textbox(brna); | rna_def_textbox(brna); | ||||
| rna_def_charinfo(brna); | rna_def_charinfo(brna); | ||||
| rna_def_bpoint(brna); | rna_def_bpoint(brna); | ||||
| rna_def_beztriple(brna); | rna_def_beztriple(brna); | ||||
| rna_def_curve_nurb(brna); | rna_def_curve_nurb(brna); | ||||
| } | } | ||||
| #endif | #endif | ||||