diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-04-06 02:37:09 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-04-06 02:37:09 +0400 |
commit | e302f33be704198d7e31031b732bb6e496843cfb (patch) | |
tree | f114596e568b9ac636b5510b7e1012f73f6026ac /source/blender/python/doc/sphinx_doc_gen.py | |
parent | a9fa23c6244d4a5c0fd3c9a18d82b6e2230e2edf (diff) |
document bpy.types.Struct methods C methods, currently only keyframe_delete() and keyframe_insert() have useful docstrings.
http://www.blender.org/documentation/250PythonDoc/bpy.types.Struct.html?highlight=bpy.types.struct#bpy.types.Struct.keyframe_insert
Diffstat (limited to 'source/blender/python/doc/sphinx_doc_gen.py')
-rw-r--r-- | source/blender/python/doc/sphinx_doc_gen.py | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/source/blender/python/doc/sphinx_doc_gen.py b/source/blender/python/doc/sphinx_doc_gen.py index 944dbb082a6..667e282da2c 100644 --- a/source/blender/python/doc/sphinx_doc_gen.py +++ b/source/blender/python/doc/sphinx_doc_gen.py @@ -43,6 +43,10 @@ import bpy import rna_info reload(rna_info) +# lame, python wont give some access +MethodDescriptorType = type(dict.get) +GetSetDescriptorType = type(int.real) + EXAMPLE_SET = set() EXAMPLE_SET_USED = set() @@ -144,11 +148,6 @@ def pyprop2sphinx(ident, fw, identifier, py_prop): def pymodule2sphinx(BASEPATH, module_name, module, title): import types - # lame, python wont give some access - MethodDescriptorType = type(dict.get) - GetSetDescriptorType = type(int.real) - - filepath = os.path.join(BASEPATH, module_name + ".rst") @@ -180,7 +179,7 @@ def pymodule2sphinx(BASEPATH, module_name, module, title): classes = [] - for attribute in dir(module): + for attribute in sorted(dir(module)): if not attribute.startswith("_"): value = getattr(module, attribute) @@ -194,6 +193,14 @@ def pymodule2sphinx(BASEPATH, module_name, module, title): py_c_func2sphinx("", fw, attribute, value, is_class=False) elif value_type == type: classes.append((attribute, value)) + elif value_type in (bool, int, float, str, tuple): + # constant, not much fun we can do here except to list it. + # TODO, figure out some way to document these! + fw(".. data:: %s\n\n" % attribute) + write_indented_lines(" ", fw, "constant value %s" % repr(value), False) + fw("\n") + else: + print("\tnot documenting %s.%s" % (module_name, attribute)) # TODO, more types... # write collected classes now @@ -472,6 +479,15 @@ def rna2sphinx(BASEPATH): pyfunc2sphinx(" ", fw, identifier, py_func, is_class=True) del py_funcs, py_func + # c/python methods, only for the base class + if struct.identifier == "Struct": + for attribute, descr in bpy.types.Struct.__bases__[0].__dict__.items(): + if type(descr) == MethodDescriptorType: # GetSetDescriptorType, GetSetDescriptorType's are not documented yet + if descr.__doc__: + write_indented_lines(" ", fw, descr.__doc__, False) + write_example_ref(" ", fw, struct.identifier + "." + attribute) + fw("\n") + if struct.references: # use this otherwise it gets in the index for a normal heading. fw(".. rubric:: References\n\n") |