[Bf-blender-cvs] [f39fbb3e604] master: RNA define: check and report invalid usages of ID pointers properties.

Bastien Montagne noreply at git.blender.org
Mon Nov 16 14:39:37 CET 2020


Commit: f39fbb3e604611b63c69661dd22ca987fb1d8791
Author: Bastien Montagne
Date:   Fri Nov 13 15:25:17 2020 +0100
Branches: master
https://developer.blender.org/rBf39fbb3e604611b63c69661dd22ca987fb1d8791

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.

===================================================================

M	source/blender/makesrna/intern/rna_define.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list