diff options
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_curve.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_curve_api.c | 21 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 1 |
3 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 59fbde13ee3..233303ef613 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -1759,6 +1759,8 @@ static void rna_def_curve_nurb(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Curve_update_data"); RNA_def_struct_path_func(srna, "rna_Curve_spline_path"); + + RNA_api_curve_nurb(srna); } void RNA_def_curve(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_curve_api.c b/source/blender/makesrna/intern/rna_curve_api.c index 695f1f75c16..d83a843c5c1 100644 --- a/source/blender/makesrna/intern/rna_curve_api.c +++ b/source/blender/makesrna/intern/rna_curve_api.c @@ -49,6 +49,11 @@ static void rna_Curve_transform(Curve *cu, float *mat, bool shape_keys) DAG_id_tag_update(&cu->id, 0); } +static float rna_Nurb_calc_length(Nurb *nu, int resolution_u) +{ + return BKE_nurb_calc_length(nu, resolution_u); +} + #else void RNA_api_curve(StructRNA *srna) @@ -69,4 +74,20 @@ void RNA_api_curve(StructRNA *srna) RNA_def_function_return(func, parm); } +void RNA_api_curve_nurb(StructRNA *srna) +{ + FunctionRNA *func; + PropertyRNA *parm; + + func = RNA_def_function(srna, "calc_length", "rna_Nurb_calc_length"); + RNA_def_function_ui_description(func, "Calculate spline length"); + RNA_def_int( + func, "resolution", 0, 0, 1024, "Resolution", + "Spline resolution to be used, 0 defaults to the resolution_u", 0, 64); + parm = RNA_def_float_distance( + func, "length", 0.0f, 0.0f, FLT_MAX, "Length", + "Length of the polygonaly approximated spline", 0.0f, FLT_MAX); + RNA_def_function_return(func, parm); +} + #endif diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 67fbee8d0ef..c3ccdc6f446 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -261,6 +261,7 @@ void RNA_api_armature_edit_bone(StructRNA *srna); void RNA_api_bone(StructRNA *srna); void RNA_api_camera(StructRNA *srna); void RNA_api_curve(StructRNA *srna); +void RNA_api_curve_nurb(StructRNA *srna); void RNA_api_fcurves(StructRNA *srna); void RNA_api_drivers(StructRNA *srna); void RNA_api_image_packed_file(struct StructRNA *srna); |