[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28109] trunk/blender: rna reference docs, list inherited properties and functions at the bottom of each type.
Campbell Barton
ideasman42 at gmail.com
Fri Apr 9 22:43:59 CEST 2010
Revision: 28109
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28109
Author: campbellbarton
Date: 2010-04-09 22:43:58 +0200 (Fri, 09 Apr 2010)
Log Message:
-----------
rna reference docs, list inherited properties and functions at the bottom of each type.
Modified Paths:
--------------
trunk/blender/release/scripts/modules/rna_info.py
trunk/blender/source/blender/python/doc/sphinx_doc_gen.py
Modified: trunk/blender/release/scripts/modules/rna_info.py
===================================================================
--- trunk/blender/release/scripts/modules/rna_info.py 2010-04-09 20:04:37 UTC (rev 28108)
+++ trunk/blender/release/scripts/modules/rna_info.py 2010-04-09 20:43:58 UTC (rev 28109)
@@ -31,10 +31,10 @@
base = rna_type.base
if not base:
- return props
+ return [prop for prop in props]
else:
props_base = getattr(base, attr).values()
- return dict([(prop.identifier, prop) for prop in props if prop not in props_base])
+ return [prop for prop in props if prop not in props_base]
def get_direct_properties(rna_type):
@@ -86,8 +86,8 @@
def build(self):
rna_type = self.bl_rna
parent_id = self.identifier
- self.properties[:] = [GetInfoPropertyRNA(rna_prop, parent_id) for rna_id, rna_prop in get_direct_properties(rna_type).items() if rna_id != "rna_type"]
- self.functions[:] = [GetInfoFunctionRNA(rna_prop, parent_id) for rna_prop in get_direct_functions(rna_type).values()]
+ self.properties[:] = [GetInfoPropertyRNA(rna_prop, parent_id) for rna_prop in get_direct_properties(rna_type) if rna_prop.identifier != "rna_type"]
+ self.functions[:] = [GetInfoFunctionRNA(rna_prop, parent_id) for rna_prop in get_direct_functions(rna_type)]
def get_bases(self):
bases = []
@@ -385,7 +385,7 @@
rna_full_path_dict = {} # store the result of full_rna_struct_path(rna_struct)
rna_children_dict = {} # store all rna_structs nested from here
rna_references_dict = {} # store a list of rna path strings that reference this type
- rna_functions_dict = {} # store all functions directly in this type (not inherited)
+ # rna_functions_dict = {} # store all functions directly in this type (not inherited)
def rna_id_ignore(rna_id):
if rna_id == "rna_type":
@@ -445,7 +445,8 @@
rna_full_path_dict[identifier] = full_rna_struct_path(rna_struct)
# Store a list of functions, remove inherited later
- rna_functions_dict[identifier] = get_direct_functions(rna_struct)
+ # NOT USED YET
+ ## rna_functions_dict[identifier] = get_direct_functions(rna_struct)
# fill in these later
@@ -494,7 +495,8 @@
# rna_struct_path = full_rna_struct_path(rna_struct)
rna_struct_path = rna_full_path_dict[identifier]
- for rna_prop_identifier, rna_prop in get_direct_properties(rna_struct).items():
+ for rna_prop in get_direct_properties(rna_struct):
+ rna_prop_identifier = rna_prop.identifier
if rna_prop_identifier == 'RNA' or rna_id_ignore(rna_prop_identifier):
continue
@@ -504,7 +506,7 @@
if rna_prop_ptr:
rna_references_dict[rna_prop_ptr.identifier].append("%s.%s" % (rna_struct_path, rna_prop_identifier))
- for rna_func in get_direct_functions(rna_struct).values():
+ for rna_func in get_direct_functions(rna_struct):
for rna_prop_identifier, rna_prop in rna_func.parameters.items():
if rna_prop_identifier == 'RNA' or rna_id_ignore(rna_prop_identifier):
Modified: trunk/blender/source/blender/python/doc/sphinx_doc_gen.py
===================================================================
--- trunk/blender/source/blender/python/doc/sphinx_doc_gen.py 2010-04-09 20:04:37 UTC (rev 28108)
+++ trunk/blender/source/blender/python/doc/sphinx_doc_gen.py 2010-04-09 20:43:58 UTC (rev 28109)
@@ -488,6 +488,44 @@
write_example_ref(" ", fw, struct.identifier + "." + attribute)
fw("\n")
+ lines = []
+
+ if struct.base:
+ bases = list(reversed(struct.get_bases()))
+
+ # props
+ lines[:] = []
+ for base in bases:
+ for prop in base.properties:
+ lines.append("* :class:`%s.%s`\n" % (base.identifier, prop.identifier))
+
+ for identifier, py_prop in base.get_py_properties():
+ lines.append("* :class:`%s.%s`\n" % (base.identifier, identifier))
+
+ if lines:
+ fw(".. rubric:: Inherited Properties\n\n")
+ for line in lines:
+ fw(line)
+ fw("\n")
+
+
+ # funcs
+ lines[:] = []
+ for base in bases:
+ for func in base.functions:
+ lines.append("* :class:`%s.%s`\n" % (base.identifier, func.identifier))
+ for identifier, py_func in base.get_py_functions():
+ lines.append("* :class:`%s.%s`\n" % (base.identifier, identifier))
+
+ if lines:
+ fw(".. rubric:: Inherited Functions\n\n")
+ for line in lines:
+ fw(line)
+ fw("\n")
+
+ lines[:] = []
+
+
if struct.references:
# use this otherwise it gets in the index for a normal heading.
fw(".. rubric:: References\n\n")
More information about the Bf-blender-cvs
mailing list