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.
This commit is contained in:
Bastien Montagne 2020-11-13 15:25:17 +01:00
parent b78bebb2af
commit f39fbb3e60
Notes: blender-bot 2023-02-14 05:50:03 +01:00
Referenced by commit c1d8df47f6, Revert "RNA define: check and report invalid usages of ID pointers properties."
1 changed files with 7 additions and 0 deletions

View File

@ -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;