Fix #115151, step one: Fallback to `ID_OB` in case of defined unknown ID type.

This is mainly intended to support forward compatibility with future,
unknwon ID types. Actual reported issue will be fixed in next commit.
This commit is contained in:
Bastien Montagne 2023-11-21 15:59:36 +01:00
parent 8845dba79d
commit f0f378d31e
1 changed files with 5 additions and 1 deletions

View File

@ -644,7 +644,11 @@ static void idprop_ui_data_to_dict_id(IDProperty *property, PyObject *dict)
}
const char *id_type = nullptr;
RNA_enum_identifier(rna_enum_id_type_items, id_type_value, &id_type);
if (!RNA_enum_identifier(rna_enum_id_type_items, id_type_value, &id_type)) {
/* Same fall-back as above, in case it is an unknown ID type (from a future version of Blender
* e.g.). */
RNA_enum_identifier(rna_enum_id_type_items, ID_OB, &id_type);
}
PyObject *item = PyUnicode_FromString(id_type);
PyDict_SetItemString(dict, "id_type", item);
Py_DECREF(item);