[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59539] trunk/blender: Followup to r59536: make "is_argument_optional" available to py, and use it in API doc generation.
Bastien Montagne
montagne29 at wanadoo.fr
Mon Aug 26 23:39:06 CEST 2013
Revision: 59539
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59539
Author: mont29
Date: 2013-08-26 21:39:06 +0000 (Mon, 26 Aug 2013)
Log Message:
-----------
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!
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59536
Modified Paths:
--------------
trunk/blender/release/scripts/modules/rna_info.py
trunk/blender/source/blender/makesrna/intern/rna_rna.c
Modified: trunk/blender/release/scripts/modules/rna_info.py
===================================================================
--- trunk/blender/release/scripts/modules/rna_info.py 2013-08-26 21:35:06 UTC (rev 59538)
+++ trunk/blender/release/scripts/modules/rna_info.py 2013-08-26 21:39:06 UTC (rev 59539)
@@ -296,6 +296,8 @@
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")
Modified: trunk/blender/source/blender/makesrna/intern/rna_rna.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_rna.c 2013-08-26 21:35:06 UTC (rev 59538)
+++ trunk/blender/source/blender/makesrna/intern/rna_rna.c 2013-08-26 21:39:06 UTC (rev 59539)
@@ -566,6 +566,12 @@
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 @@
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);
More information about the Bf-blender-cvs
mailing list