From a0cfa3e42095e96af771f503335b0bf05bb26d63 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 3 Jul 2013 22:57:00 +0000 Subject: fix [#35984] no way to know if a datablock is in editmode the report explains the issue in detail, but basically you couldn't know if a mesh was in editmode without checking all the objects that use it. add `is_editmode` readonly property for all datatypes which support editmode. also make rna fail to build on implicit function declarations. --- source/blender/makesrna/intern/rna_meta.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/blender/makesrna/intern/rna_meta.c') diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index f38151fd721..898825820ac 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -158,6 +158,12 @@ static void rna_MetaBall_elements_clear(MetaBall *mb) } } +static int rna_Meta_is_editmode_get(PointerRNA *ptr) +{ + MetaBall *mb = ptr->id.data; + return (mb->editelems != NULL); +} + #else static void rna_def_metaelement(BlenderRNA *brna) @@ -350,6 +356,11 @@ static void rna_def_metaball(BlenderRNA *brna) RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */ RNA_def_property_collection_funcs(prop, 0, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int"); + prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_Meta_is_editmode_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode"); + /* anim */ rna_def_animdata_common(srna); -- cgit v1.2.3