diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-04 02:57:00 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-04 02:57:00 +0400 |
commit | a0cfa3e42095e96af771f503335b0bf05bb26d63 (patch) | |
tree | 0356b3691615dfef6de1f8fd07ffc3b6b84b0204 /source/blender/makesrna/intern/rna_mesh.c | |
parent | 374383997cc2dc36819eb0ec125d6a2d06809f71 (diff) |
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.
Diffstat (limited to 'source/blender/makesrna/intern/rna_mesh.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 85a669adcc0..3a0e52aa3f2 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1556,6 +1556,13 @@ static PointerRNA rna_Mesh_tessface_uv_texture_new(struct Mesh *me, ReportList * return ptr; } + +static int rna_Mesh_is_editmode_get(PointerRNA *ptr) +{ + Mesh *me = rna_mesh(ptr); + return (me->edit_btmesh != NULL); +} + /* only to quiet warnings */ static void UNUSED_FUNCTION(rna_mesh_unused)(void) { @@ -3211,6 +3218,11 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Selected Face Total", "Selected face count in editmode"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_Mesh_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"); + /* pointers */ rna_def_animdata_common(srna); rna_def_texmat_common(srna, "rna_Mesh_texspace_editable"); |