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>2012-08-12 18:57:19 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-12 18:57:19 +0400
commit32254596d4de9558b7af81bfe69db5d160a97769 (patch)
tree022629de72b05ce7bf7165ed43a123435de7b9ab /source/blender/makesrna
parent82688e61fc330022bd8685a5a137fca024a60b8a (diff)
replace ELEM8(gs, ID_ME, ID_CU, ID_MB, ID_LT, ID_LA, ID_CA, ID_TXT, ID_SPK) with macro: OB_DATA_SUPPORT_ID()
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c1
-rw-r--r--source/blender/makesrna/intern/rna_object.c9
2 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index c702972b3b7..59eae3259b4 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -140,6 +140,7 @@ Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, const cha
Object *ob;
int type = OB_EMPTY;
if (data) {
+ /* keep in sync with OB_DATA_SUPPORT_ID() macro */
switch (GS(data->name)) {
case ID_ME:
type = OB_MESH;
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 7aedbf40eba..9770b51654c 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -355,10 +355,14 @@ static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
set_mesh(ob, (Mesh *)id);
}
else {
- if (ob->data)
+ if (ob->data) {
id_us_min((ID *)ob->data);
- if (id)
+ }
+ if (id) {
+ /* no need to type-check here ID. this is done in the _typef() function */
+ BLI_assert(OB_DATA_SUPPORT_ID(GS(id->name)));
id_us_plus(id);
+ }
ob->data = id;
test_object_materials(id);
@@ -374,6 +378,7 @@ static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
{
Object *ob = (Object *)ptr->data;
+ /* keep in sync with OB_DATA_SUPPORT_ID() macro */
switch (ob->type) {
case OB_EMPTY: return &RNA_Image;
case OB_MESH: return &RNA_Mesh;