Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2020-11-13 17:25:17 +0300
committerBastien Montagne <bastien@blender.org>2020-11-16 16:39:31 +0300
commitf39fbb3e604611b63c69661dd22ca987fb1d8791 (patch)
treeffd4c2ab279e2b1ff51d2a8a4400f1896bc2cde8 /source/blender/makesrna/intern/rna_define.c
parentb78bebb2af0f5cf8e351d42cded4a17abac31d3f (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.c7
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;