From addb2bbff252b6751e3eb97ac859d4ecbd4e1b78 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 16 Jul 2010 22:21:37 +0000 Subject: [PATCH] fix for assigning any ID in rna, it would not run id_lib_extern() which means the library reference would be lost on reload. --- source/blender/makesrna/intern/makesrna.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 40f6c1de67e..35b2eff9c62 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -628,6 +628,14 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr fprintf(f, " if(value.data)\n"); fprintf(f, " id_us_plus((ID*)value.data);\n\n"); } + else { + PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop; + StructRNA *type= rna_find_struct((char*)pprop->type); + if(type && (type->flag & STRUCT_ID)) { + fprintf(f, " if(value.data)\n"); + fprintf(f, " id_lib_extern((ID*)value.data);\n\n"); + } + } fprintf(f, " data->%s= value.data;\n", dp->dnaname);