diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-12-18 12:08:22 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-12-18 12:08:22 +0300 |
commit | 994648a6741087ae40227037ee87395aa18f5b18 (patch) | |
tree | c75888e9901d85ccaad1ffa0d91f6d6c66803b8f /source/blender/makesrna/intern/makesrna.c | |
parent | c2ad5e805a4a26e6cc0f7959212f6d8b1285779d (diff) |
RNA: add new property falg for pointers (and collection), 'NO_OWNERSHIP'.
This flag means that the pointer does not 'own' the data it references.
This is the case of nearly all ID RNA pointers (NodeTrees will probably
again be some nasty exception here :( ), but also several other cases.
That kind of information is mandatory for complex processing over whole
data-blocks done in RNA, like some static override tasks (advanced
comparison...).
Diffstat (limited to 'source/blender/makesrna/intern/makesrna.c')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 19f66109665..9745ca39872 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -2995,6 +2995,28 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr } break; } + case PROP_POINTER: + { + PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop; + + /* 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)) { + prop->flag |= PROP_PTR_NO_OWNERSHIP; + } + break; + } + case PROP_COLLECTION: + { + CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop; + + /* 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)) { + prop->flag |= PROP_PTR_NO_OWNERSHIP; + } + break; + } default: break; } |