[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56388] trunk/blender/doc/python_api/ sphinx_doc_gen.py: update sphinx docgen
Campbell Barton
ideasman42 at gmail.com
Mon Apr 29 18:20:49 CEST 2013
Revision: 56388
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56388
Author: campbellbarton
Date: 2013-04-29 16:20:49 +0000 (Mon, 29 Apr 2013)
Log Message:
-----------
update sphinx docgen
was missing context property attributes - context.mode for example. add RNA properties into context docs.
also minor updates
- exclude freestyle if its not enabled.
- add missing context member.
Modified Paths:
--------------
trunk/blender/doc/python_api/sphinx_doc_gen.py
Modified: trunk/blender/doc/python_api/sphinx_doc_gen.py
===================================================================
--- trunk/blender/doc/python_api/sphinx_doc_gen.py 2013-04-29 16:03:21 UTC (rev 56387)
+++ trunk/blender/doc/python_api/sphinx_doc_gen.py 2013-04-29 16:20:49 UTC (rev 56388)
@@ -70,6 +70,14 @@
import rna_info # blender module
+
+def rna_info_BuildRNAInfo_cache():
+ if rna_info_BuildRNAInfo_cache.ret is None:
+ rna_info_BuildRNAInfo_cache.ret = rna_info.BuildRNAInfo()
+ return rna_info_BuildRNAInfo_cache.ret
+rna_info_BuildRNAInfo_cache.ret = None
+# --- end rna_info cache
+
# import rpdb2; rpdb2.start_embedded_debugger('test')
import os
import sys
@@ -302,6 +310,12 @@
BPY_LOGGER.debug("Warning: Built without 'aud' module, docs incomplete...")
EXCLUDE_MODULES = list(EXCLUDE_MODULES) + ["aud"]
+try:
+ __import__("freestyle")
+except ImportError:
+ BPY_LOGGER.debug("Warning: Built without 'freestyle' module, docs incomplete...")
+ EXCLUDE_MODULES = list(EXCLUDE_MODULES) + ["freestyle"]
+
# examples
EXAMPLES_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "examples"))
EXAMPLE_SET = set()
@@ -986,6 +1000,7 @@
"texture": ("Texture", False),
"texture_slot": ("MaterialTextureSlot", False),
"texture_user": ("ID", False),
+ "texture_user_property": ("Property", False),
"vertex_paint_object": ("Object", False),
"visible_bases": ("ObjectBase", True),
"visible_bones": ("EditBone", True),
@@ -1009,6 +1024,47 @@
fw("\n")
fw("Note that all context values are readonly, but may be modified through the data api or by running operators\n\n")
+ def write_contex_cls():
+
+ fw(title_string("Global Context", "-"))
+ fw("These properties are avilable in any contexts.\n\n")
+
+ # very silly. could make these global and only access once.
+ # structs, funcs, ops, props = rna_info.BuildRNAInfo()
+ structs, funcs, ops, props = rna_info_BuildRNAInfo_cache()
+ struct = structs[("", "Context")]
+ struct_blacklist = RNA_BLACKLIST.get(struct.identifier, ())
+ del structs, funcs, ops, props
+
+ sorted_struct_properties = struct.properties[:]
+ sorted_struct_properties.sort(key=lambda prop: prop.identifier)
+
+ # First write RNA
+ for prop in sorted_struct_properties:
+ # support blacklisting props
+ if prop.identifier in struct_blacklist:
+ continue
+
+ type_descr = prop.get_type_description(class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID)
+ fw(".. data:: %s\n\n" % prop.identifier)
+ if prop.description:
+ fw(" %s\n\n" % prop.description)
+
+ # special exception, cant use genric code here for enums
+ if prop.type == "enum":
+ enum_text = pyrna_enum2sphinx(prop)
+ if enum_text:
+ write_indented_lines(" ", fw, enum_text)
+ fw("\n")
+ del enum_text
+ # end enum exception
+
+ fw(" :type: %s\n\n" % type_descr)
+
+ write_contex_cls()
+ del write_contex_cls
+ # end
+
# nasty, get strings directly from blender because there is no other way to get it
import ctypes
@@ -1079,7 +1135,9 @@
def pyrna2sphinx(basepath):
""" bpy.types and bpy.ops
"""
- structs, funcs, ops, props = rna_info.BuildRNAInfo()
+ # structs, funcs, ops, props = rna_info.BuildRNAInfo()
+ structs, funcs, ops, props = rna_info_BuildRNAInfo_cache()
+
if FILTER_BPY_TYPES is not None:
structs = {k: v for k, v in structs.items() if k[1] in FILTER_BPY_TYPES}
More information about the Bf-blender-cvs
mailing list