Cleanup: store results of function calls in const values.

This commit is contained in:
Bastien Montagne 2020-11-02 17:07:39 +01:00
parent db18ba07b5
commit 20c4aa13de
Notes: blender-bot 2023-02-14 08:29:54 +01:00
Referenced by commit b9ec6c305c, Revert "Cleanup: store results of function calls in const values."
1 changed files with 5 additions and 2 deletions

View File

@ -3388,7 +3388,10 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw)
if (!ptype) {
return NULL;
}
if (!RNA_struct_is_a(ptype, &RNA_PropertyGroup) && !RNA_struct_is_ID(ptype)) {
const bool is_property_group = RNA_struct_is_a(ptype, &RNA_PropertyGroup);
const bool is_id = RNA_struct_is_ID(ptype);
if (!is_property_group && !is_id) {
PyErr_Format(PyExc_TypeError,
"PointerProperty(...) expected an RNA type derived from %.200s or %.200s",
RNA_struct_ui_name(&RNA_ID),
@ -3413,7 +3416,7 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw)
}
if (RNA_struct_idprops_contains_datablock(ptype)) {
if (RNA_struct_is_a(srna, &RNA_PropertyGroup)) {
if (is_property_group) {
RNA_def_struct_flag(srna, STRUCT_CONTAINS_DATABLOCK_IDPROPERTIES);
}
}