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:
authorCampbell Barton <ideasman42@gmail.com>2013-07-04 02:57:00 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-07-04 02:57:00 +0400
commita0cfa3e42095e96af771f503335b0bf05bb26d63 (patch)
tree0356b3691615dfef6de1f8fd07ffc3b6b84b0204 /source/blender
parent374383997cc2dc36819eb0ec125d6a2d06809f71 (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')
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt5
-rw-r--r--source/blender/makesrna/intern/rna_armature.c12
-rw-r--r--source/blender/makesrna/intern/rna_curve.c17
-rw-r--r--source/blender/makesrna/intern/rna_lattice.c10
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c12
-rw-r--r--source/blender/makesrna/intern/rna_meta.c11
6 files changed, 67 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 11a4dcfab8a..af14e959c11 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -26,6 +26,11 @@
# Generated code has some unused vars we can ignore.
remove_strict_flags()
+if(CMAKE_COMPILER_IS_GNUCC)
+ # add here so we fail early.
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=implicit-function-declaration")
+endif()
+
# message(STATUS "Configuring makesrna")
# files rna_access.c rna_define.c makesrna.c intentionally excluded.
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index b222dd9148b..fd151ccebb9 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -472,6 +472,12 @@ static void rna_Armature_bones_next(CollectionPropertyIterator *iter)
iter->valid = (internal->link != NULL);
}
+static int rna_Armature_is_editmode_get(PointerRNA *ptr)
+{
+ bArmature *arm = (bArmature *)ptr->id.data;
+ return (arm->edbo != NULL);
+}
+
#else
static int rna_matrix_dimsize_4x4[] = {4, 4};
@@ -1071,6 +1077,12 @@ static void rna_def_armature(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
/* XXX deprecated ....... old animviz for armatures only */
+
+
+ prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Armature_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");
}
void RNA_def_armature(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index c9734545245..21bf2ec6719 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -683,6 +683,18 @@ static void rna_Curve_splines_begin(CollectionPropertyIterator *iter, PointerRNA
rna_iterator_listbase_begin(iter, BKE_curve_nurbs_get(cu), NULL);
}
+static int rna_Curve_is_editmode_get(PointerRNA *ptr)
+{
+ Curve *cu = (Curve *)ptr->id.data;
+ const short type = BKE_curve_type_get(cu);
+ if (type == OB_FONT) {
+ return (cu->editfont != NULL);
+ }
+ else {
+ return (cu->editnurb != NULL);
+ }
+}
+
#else
static void rna_def_bpoint(BlenderRNA *brna)
@@ -1485,6 +1497,11 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_range(prop, 0, 1.0);
RNA_def_property_ui_text(prop, "End Bevel Factor", "Factor that defines to where beveling of spline happens (0=to the very beginning, 1=to the very end)");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Curve_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");
}
static void rna_def_curve_nurb(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c
index e7b12206871..3bb00716302 100644
--- a/source/blender/makesrna/intern/rna_lattice.c
+++ b/source/blender/makesrna/intern/rna_lattice.c
@@ -234,6 +234,11 @@ static char *rna_LatticePoint_path(PointerRNA *ptr)
return BLI_strdup("");
}
+static int rna_Lattice_is_editmode_get(PointerRNA *ptr)
+{
+ Lattice *lt = (Lattice *)ptr->id.data;
+ return (lt->editlatt != NULL);
+}
#else
@@ -350,6 +355,11 @@ static void rna_def_lattice(BlenderRNA *brna)
"rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Points", "Points of the lattice");
+ prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Lattice_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);
}
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");
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);