From 28f4e5cd6bc718d91d0f637c89bce4ce68671b71 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 26 Jun 2020 18:08:12 +0200 Subject: RNA: Add a way to prevent automatic addition of 'no ownership' flag for ID pointer properties. Since makesrna runs after all properties have been defined, we have to remember with a new internal flag when we explicitely disable the 'PROP_PTR_NO_OWNERSHIP' flag for a property. Otherwise there was no way to do so for ID pointer properties... --- source/blender/makesrna/intern/makesrna.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source/blender/makesrna/intern/makesrna.c') diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 6256fd47ade..59087df16dd 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -3770,7 +3770,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr /* XXX This systematically enforces that flag on ID pointers... * we'll probably have to revisit. :/ */ StructRNA *type = rna_find_struct((const char *)pprop->type); - if (type && (type->flag & STRUCT_ID)) { + if (type && (type->flag & STRUCT_ID) && + !(prop->flag_internal & PROP_INTERN_PTR_OWNERSHIP_FORCED)) { prop->flag |= PROP_PTR_NO_OWNERSHIP; } break; @@ -3781,7 +3782,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr /* XXX This systematically enforces that flag on ID pointers... * we'll probably have to revisit. :/ */ StructRNA *type = rna_find_struct((const char *)cprop->item_type); - if (type && (type->flag & STRUCT_ID)) { + if (type && (type->flag & STRUCT_ID) && + !(prop->flag_internal & PROP_INTERN_PTR_OWNERSHIP_FORCED)) { prop->flag |= PROP_PTR_NO_OWNERSHIP; } break; -- cgit v1.2.3