diff options
author | Bastien Montagne <bastien@blender.org> | 2020-11-13 17:25:17 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-11-16 16:39:31 +0300 |
commit | f39fbb3e604611b63c69661dd22ca987fb1d8791 (patch) | |
tree | ffd4c2ab279e2b1ff51d2a8a4400f1896bc2cde8 /source/blender/makesrna/intern/rna_define.c | |
parent | b78bebb2af0f5cf8e351d42cded4a17abac31d3f (diff) |
RNA define: check and report invalid usages of ID pointers properties.
Some RNA structs, like operators or keymaps, are not allowed to have ID
pointer properties. now this check will ignore those, and report an
error message in the console.
Related to T82597.
Diffstat (limited to 'source/blender/makesrna/intern/rna_define.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_define.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 1b0a2fca0ce..b72afe88dda 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -1823,6 +1823,13 @@ void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type) switch (prop->type) { case PROP_POINTER: { + if ((srna->flag & STRUCT_NO_DATABLOCK_IDPROPERTIES) != 0 && (type->flag & STRUCT_ID) != 0) { + CLOG_ERROR(&LOG, + "Struct \"%s\" (probably an operator or keymap) does not allow pointer " + "properties to ID datablocks.", + srna->identifier); + return; + } PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop; pprop->type = type; |