Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-11-13 20:42:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-11-13 20:42:44 +0300
commite12fe32febb9f64877879ec98da7ffc4ed60f96e (patch)
treea72dae2d6fc6ac4b8a30def52932cd2fba71e8d9
parentc1d0f9179d4972eeb85fc8c5e182708ab7385930 (diff)
documentat & cross reference collection types
-rw-r--r--source/blender/makesrna/intern/rna_rna.c13
-rw-r--r--source/blender/python/epy_doc_gen.py28
2 files changed, 34 insertions, 7 deletions
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 29a95c99851..f8109b9794d 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -406,6 +406,13 @@ static int rna_Property_subtype_get(PointerRNA *ptr)
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 @@ static void rna_def_property(BlenderRNA *brna)
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);
diff --git a/source/blender/python/epy_doc_gen.py b/source/blender/python/epy_doc_gen.py
index b0126a0b9a0..f16c7504cb2 100644
--- a/source/blender/python/epy_doc_gen.py
+++ b/source/blender/python/epy_doc_gen.py
@@ -194,7 +194,15 @@ def write_func(rna, ident, out, func_type):
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 @@ def rna2epy(BASEPATH):
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,12 +545,11 @@ def rna2epy(BASEPATH):
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
-
- # 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_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) )
for rna_func in rna_struct.functions:
for rna_prop_identifier, rna_prop in rna_func.parameters.items():