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:
authorAlexander Gavrilov <angavrilov@gmail.com>2019-05-05 18:58:25 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2019-05-05 19:34:30 +0300
commitc7ec6bb748cbaf31299af91c06e6b67eb790d262 (patch)
treee653593b6f6eb448c58d5a49b017c6a4c3effc22 /source/blender/makesrna/intern/rna_object_api.c
parent2c92900a47784c9d3b121e3763444a62d4752deb (diff)
RNA: add an Object method to clear all shape keys for completeness.
This matches bpy.ops.object.shape_key_remove(all=True) in behavior.
Diffstat (limited to 'source/blender/makesrna/intern/rna_object_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 21300f22b95..5f41bf68572 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -433,6 +433,14 @@ static void rna_Object_shape_key_remove(Object *ob,
RNA_POINTER_INVALIDATE(kb_ptr);
}
+static void rna_Object_shape_key_clear(Object *ob, Main *bmain)
+{
+ BKE_object_shapekey_free(bmain, ob);
+
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+}
+
# if 0
static void rna_Mesh_assign_verts_to_group(
Object *ob, bDeformGroup *group, int *indices, int totindex, float weight, int assignmode)
@@ -921,6 +929,10 @@ void RNA_api_object(StructRNA *srna)
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ func = RNA_def_function(srna, "shape_key_clear", "rna_Object_shape_key_clear");
+ RNA_def_function_ui_description(func, "Remove all Shape Keys from this object");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+
/* Ray Cast */
func = RNA_def_function(srna, "ray_cast", "rna_Object_ray_cast");
RNA_def_function_ui_description(