diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-05-29 19:12:31 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-05-29 19:12:31 +0400 |
commit | 688b7c73ad42148bfa946a195549c4fc6b38c266 (patch) | |
tree | 1208edf7df719a00a145e59b0a3b26f491a5d1a6 /source/blender/makesrna/intern/makesrna.c | |
parent | 10e8672c8de27769b9e6857cf9b7f2805ca837b2 (diff) |
RNA:
* Added PROP_ID_REFCOUNT flag to control if refcounting should
be done on ID pointer properties. All ID pointers are refcounted,
by default, with the exception of Object, Scene and Text.
* Also made TextureFace image pointer editable, with the special
refcounting behavior.
Diffstat (limited to 'source/blender/makesrna/intern/makesrna.c')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index b6ea00a08e0..438100243e3 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -509,17 +509,15 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr fprintf(f, " %s(ptr, value);\n", manualfunc); } else { - PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; - StructRNA *type= rna_find_struct((char*)pprop->type); - rna_print_data_get(f, dp); - if(type && (type->flag & STRUCT_ID) && strcmp(type->identifier, "Object")!=0) { + if(prop->flag & PROP_ID_REFCOUNT) { fprintf(f, "\n if(data->%s)\n", dp->dnaname); fprintf(f, " id_us_min((ID*)data->%s);\n", dp->dnaname); fprintf(f, " if(value.data)\n"); fprintf(f, " id_us_plus((ID*)value.data);\n\n"); } + fprintf(f, " data->%s= value.data;\n", dp->dnaname); } @@ -1212,9 +1210,16 @@ static void rna_auto_types() if(dp->dnatype) { if(dp->prop->type == PROP_POINTER) { PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop; + StructRNA *type; if(!pprop->type && !pprop->get) pprop->type= (StructRNA*)rna_find_type(dp->dnatype); + + if(pprop->type) { + type= rna_find_struct((char*)pprop->type); + if(type && (type->flag & STRUCT_ID_REFCOUNT)) + pprop->property.flag |= PROP_ID_REFCOUNT; + } } else if(dp->prop->type== PROP_COLLECTION) { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop; |