[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24551] trunk/blender/source/blender: documentat & cross reference collection types
Campbell Barton
ideasman42 at gmail.com
Fri Nov 13 18:42:44 CET 2009
Revision: 24551
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24551
Author: campbellbarton
Date: 2009-11-13 18:42:44 +0100 (Fri, 13 Nov 2009)
Log Message:
-----------
documentat & cross reference collection types
Modified Paths:
--------------
trunk/blender/source/blender/makesrna/intern/rna_rna.c
trunk/blender/source/blender/python/epy_doc_gen.py
Modified: trunk/blender/source/blender/makesrna/intern/rna_rna.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_rna.c 2009-11-13 16:37:44 UTC (rev 24550)
+++ trunk/blender/source/blender/makesrna/intern/rna_rna.c 2009-11-13 17:42:44 UTC (rev 24551)
@@ -406,6 +406,13 @@
return prop->subtype;
}
+static PointerRNA rna_Property_srna_get(PointerRNA *ptr)
+{
+ PropertyRNA *prop= (PropertyRNA*)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return rna_pointer_inherit_refine(ptr, &RNA_Struct, prop->srna);
+}
+
static int rna_Property_unit_get(PointerRNA *ptr)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
@@ -900,6 +907,12 @@
RNA_def_property_enum_funcs(prop, "rna_Property_subtype_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Subtype", "Semantic interpretation of the property.");
+ prop= RNA_def_property(srna, "srna", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Struct");
+ RNA_def_property_pointer_funcs(prop, "rna_Property_srna_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Base", "Struct definition used for properties assigned to this item.");
+
prop= RNA_def_property(srna, "unit", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, unit_items);
Modified: trunk/blender/source/blender/python/epy_doc_gen.py
===================================================================
--- trunk/blender/source/blender/python/epy_doc_gen.py 2009-11-13 16:37:44 UTC (rev 24550)
+++ trunk/blender/source/blender/python/epy_doc_gen.py 2009-11-13 17:42:44 UTC (rev 24551)
@@ -194,7 +194,15 @@
if rna_prop_type=='pointer':
rna_prop_type_refine = "L{%s}" % rna_prop.fixed_type.identifier
else:
- rna_prop_type_refine = rna_prop_type
+ # Collections/Arrays can have a srna type
+ rna_prop_srna_type = rna_prop.srna
+ if rna_prop_srna_type:
+ print(rna_prop_srna_type.identifier)
+ rna_prop_type_refine = "L{%s}" % rna_prop_srna_type.identifier
+ else:
+ rna_prop_type_refine = rna_prop_type
+
+ del rna_prop_srna_type
try: length = rna_prop.array_length
@@ -373,6 +381,13 @@
if rna_prop_type=='collection': collection_str = 'Collection of '
else: collection_str = ''
+
+ # some collections have a srna for their own properties
+ # TODO - arrays, however this isnt used yet
+ rna_prop_srna_type = rna_prop.srna
+ if rna_prop_srna_type:
+ collection_str = "L{%s} %s" % (rna_prop_srna_type.identifier, collection_str)
+ del rna_prop_srna_type
try: rna_prop_ptr = rna_prop.fixed_type
except: rna_prop_ptr = None
@@ -530,13 +545,12 @@
if rna_id_ignore(rna_prop_identifier): continue
if rna_prop_identifier in rna_base_prop_keys: continue
- try: rna_prop_ptr = rna_prop.fixed_type
- except: rna_prop_ptr = None
+
+ for rna_prop_ptr in (getattr(rna_prop, "fixed_type", None), getattr(rna_prop, "srna", None)):
+ # Does this property point to me?
+ if rna_prop_ptr:
+ rna_references_dict[rna_prop_ptr.identifier].append( "%s.%s" % (rna_struct_path, rna_prop_identifier) )
- # Does this property point to me?
- if rna_prop_ptr:
- rna_references_dict[rna_prop_ptr.identifier].append( "%s.%s" % (rna_struct_path, rna_prop_identifier) )
-
for rna_func in rna_struct.functions:
for rna_prop_identifier, rna_prop in rna_func.parameters.items():
More information about the Bf-blender-cvs
mailing list