Followup to r59536: make "is_argument_optional" available to py, and use it in API doc generation.
Thanks Campbell for the much better name suggestion!
This commit is contained in:
@@ -296,6 +296,8 @@ class InfoPropertyRNA:
|
||||
elif as_arg:
|
||||
if not self.is_required:
|
||||
type_info.append("optional")
|
||||
if self.is_argument_optional:
|
||||
type_info.append("optional argument")
|
||||
else: # readonly is only useful for self's, not args
|
||||
if self.is_readonly:
|
||||
type_info.append("readonly")
|
||||
|
||||
@@ -566,6 +566,12 @@ static int rna_Property_is_required_get(PointerRNA *ptr)
|
||||
return prop->flag & PROP_REQUIRED ? 1 : 0;
|
||||
}
|
||||
|
||||
static int rna_Property_is_argument_optional_get(PointerRNA *ptr)
|
||||
{
|
||||
PropertyRNA *prop = (PropertyRNA *)ptr->data;
|
||||
return prop->flag & PROP_PYFUNC_OPTIONAL ? 1 : 0;
|
||||
}
|
||||
|
||||
static int rna_Property_is_never_none_get(PointerRNA *ptr)
|
||||
{
|
||||
PropertyRNA *prop = (PropertyRNA *)ptr->data;
|
||||
@@ -1171,6 +1177,12 @@ static void rna_def_property(BlenderRNA *brna)
|
||||
RNA_def_property_boolean_funcs(prop, "rna_Property_is_required_get", NULL);
|
||||
RNA_def_property_ui_text(prop, "Required", "False when this property is an optional argument in an RNA function");
|
||||
|
||||
prop = RNA_def_property(srna, "is_argument_optional", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_boolean_funcs(prop, "rna_Property_is_argument_optional_get", NULL);
|
||||
RNA_def_property_ui_text(prop, "Optional Argument",
|
||||
"True when the property is optional in a Python function implementing an RNA function");
|
||||
|
||||
prop = RNA_def_property(srna, "is_never_none", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_boolean_funcs(prop, "rna_Property_is_never_none_get", NULL);
|
||||
|
||||
Reference in New Issue
Block a user