From 85497e35d0a012e8584022cfa021dd1b8435d17b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 23 Nov 2011 16:12:11 +0000 Subject: Added method clear to most of collections which supports new/remove. This method not added to animation-specific structures yet/ --- source/blender/makesrna/intern/rna_curve.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source/blender/makesrna/intern/rna_curve.c') diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 95f44d86058..3125c2eec08 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -588,6 +588,19 @@ static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, Nurb *nu) freeNurb(nu); /* invalidate pointer!, no can do */ + + DAG_id_tag_update(&cu->id, OB_RECALC_DATA); + WM_main_add_notifier(NC_GEOM|ND_DATA, NULL); +} + +static void rna_Curve_spline_clear(Curve *cu) +{ + ListBase *nurbs= BKE_curve_nurbs(cu); + + freeNurblist(nurbs); + + DAG_id_tag_update(&cu->id, OB_RECALC_DATA); + WM_main_add_notifier(NC_GEOM|ND_DATA, NULL); } static PointerRNA rna_Curve_active_spline_get(PointerRNA *ptr) @@ -1200,6 +1213,9 @@ static void rna_def_curve_splines(BlenderRNA *brna, PropertyRNA *cprop) parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + func= RNA_def_function(srna, "clear", "rna_Curve_spline_clear"); + RNA_def_function_ui_description(func, "Remove all spline from a curve"); + prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_pointer_funcs(prop, "rna_Curve_active_spline_get", "rna_Curve_active_spline_set", NULL, NULL); -- cgit v1.2.3