PyAPI: document never none pointer/collection properties
Set never null for pointer props automatically during RNA generation. Ref: !126755
This commit is contained in:
committed by
Campbell Barton
parent
b4c9b3e87f
commit
48abc7aabc
@@ -2228,6 +2228,11 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
|
||||
DefRNA.error = true;
|
||||
}
|
||||
|
||||
if (dp->dnapointerlevel == 0 && pprop->get == nullptr) {
|
||||
/* Set the flag for generated documentation. */
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
}
|
||||
|
||||
pprop->get = reinterpret_cast<PropPointerGetFunc>(
|
||||
rna_def_property_get_func(f, srna, prop, dp, (const char *)pprop->get));
|
||||
pprop->set = reinterpret_cast<PropPointerSetFunc>(
|
||||
|
||||
@@ -4275,6 +4275,9 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw)
|
||||
bpy_prop_assign_flag_override(prop, override_enum.value);
|
||||
}
|
||||
|
||||
/* Set the flag for generated documentation. */
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
|
||||
if (RNA_struct_idprops_contains_datablock(ptype)) {
|
||||
if (RNA_struct_is_a(srna, &RNA_PropertyGroup)) {
|
||||
RNA_def_struct_flag(srna, STRUCT_CONTAINS_DATABLOCK_IDPROPERTIES);
|
||||
@@ -4412,6 +4415,10 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw)
|
||||
bpy_prop_assign_flag_override(prop, override_enum.value);
|
||||
}
|
||||
|
||||
if (RNA_struct_is_a(ptype, &RNA_PropertyGroup)) {
|
||||
/* Set the flag for generated documentation. */
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
}
|
||||
if (RNA_struct_idprops_contains_datablock(ptype)) {
|
||||
if (RNA_struct_is_a(srna, &RNA_PropertyGroup)) {
|
||||
RNA_def_struct_flag(srna, STRUCT_CONTAINS_DATABLOCK_IDPROPERTIES);
|
||||
|
||||
Reference in New Issue
Block a user