Fix #126156: Do not allow to assign embedded IDs to IDProperties.

This is just not supported, and typically not doable from Blender UI
(since embedded IDs won't be listed in ID template list).

Add asserts to IDProp code itself, and checks & error reports in
relevant BPY and RNA setters.
This commit is contained in:
Bastien Montagne
2024-08-21 18:16:59 +02:00
parent 08d5eb8f9c
commit de47fee2e1
4 changed files with 40 additions and 33 deletions

View File

@@ -980,6 +980,12 @@ static IDProperty *idp_from_DatablockPointer(IDProperty *prop_exist,
IDProperty *prop = nullptr;
ID *value = nullptr;
pyrna_id_FromPyObject(ob, &value);
if (value && (value->flag & ID_FLAG_EMBEDDED_DATA) != 0) {
PyErr_SetString(PyExc_ValueError, "Cannot assign an embedded ID pointer to an id-property");
return nullptr;
}
if (prop_exist) {
if (prop_exist->type == IDP_ID) {
IDP_AssignID(prop_exist, value, 0);