Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-11-23 20:12:11 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-11-23 20:12:11 +0400
commit85497e35d0a012e8584022cfa021dd1b8435d17b (patch)
tree4262bec6539efdddc3e71d0fffe0e69f235db28d /source/blender/makesrna/intern/rna_curve.c
parentf48cc83b3e7327565c17fc18f42881099941b4bf (diff)
Added method clear to most of collections which supports new/remove.
This method not added to animation-specific structures yet/
Diffstat (limited to 'source/blender/makesrna/intern/rna_curve.c')
-rw-r--r--source/blender/makesrna/intern/rna_curve.c16
1 files changed, 16 insertions, 0 deletions
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);