diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-11-23 20:12:11 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-11-23 20:12:11 +0400 |
commit | 85497e35d0a012e8584022cfa021dd1b8435d17b (patch) | |
tree | 4262bec6539efdddc3e71d0fffe0e69f235db28d /source/blender/makesrna/intern/rna_meta.c | |
parent | f48cc83b3e7327565c17fc18f42881099941b4bf (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_meta.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_meta.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index 323fb6780fb..5f948a3a243 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -147,6 +147,17 @@ static void rna_MetaBall_elements_remove(MetaBall *mb, ReportList *reports, Meta } } +static void rna_MetaBall_elements_clear(MetaBall *mb) +{ + BLI_freelistN(&mb->elems); + + /* cheating way for importers to avoid slow updates */ + if(mb->id.us > 0) { + DAG_id_tag_update(&mb->id, 0); + WM_main_add_notifier(NC_GEOM|ND_DATA, &mb->id); + } +} + #else static void rna_def_metaelement(BlenderRNA *brna) @@ -234,17 +245,20 @@ static void rna_def_metaball_elements(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_struct_ui_text(srna, "Meta Elements", "Collection of metaball elements"); func= RNA_def_function(srna, "new", "rna_MetaBall_elements_new"); - RNA_def_function_ui_description(func, "Add a new spline to the curve"); + RNA_def_function_ui_description(func, "Add a new element to the metaball"); RNA_def_enum(func, "type", metaelem_type_items, MB_BALL, "", "type for the new meta-element"); parm= RNA_def_pointer(func, "element", "MetaElement", "", "The newly created meta-element"); RNA_def_function_return(func, parm); func= RNA_def_function(srna, "remove", "rna_MetaBall_elements_remove"); - RNA_def_function_ui_description(func, "Remove a spline from a curve"); + RNA_def_function_ui_description(func, "Remove an element from the metaball"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm= RNA_def_pointer(func, "element", "MetaElement", "", "The element to remove"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + func= RNA_def_function(srna, "clear", "rna_MetaBall_elements_clear"); + RNA_def_function_ui_description(func, "Remove all elements from the metaball"); + prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "lastelem"); RNA_def_property_ui_text(prop, "Active Element", "Last selected element"); |