diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-02-26 23:21:09 +0300 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-02-26 23:21:09 +0300 |
commit | 63b31ef91b562a1a4aa95991323555a140dd6ede (patch) | |
tree | 4287fcc7edc5e01efbd4b26d7c923c9b0cd8d830 /doc/python_api/sphinx_doc_gen.py | |
parent | 745e396d63ed15fa69203e04840597112498ec3b (diff) | |
parent | 2f0d93ba563ae2c87a088f21113d5559ab9abfc4 (diff) |
Merged changes in the trunk up to revision 35203.
Conflicts resolved:
source/creator/creator.c
source/blender/python/intern/bpy.c
Diffstat (limited to 'doc/python_api/sphinx_doc_gen.py')
-rw-r--r-- | doc/python_api/sphinx_doc_gen.py | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index accb9634647..dc2d9f0a643 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -519,6 +519,8 @@ def pycontext2sphinx(BASEPATH): else: pass # will have raised an error above + file.close() + def pyrna2sphinx(BASEPATH): """ bpy.types and bpy.ops @@ -739,6 +741,7 @@ def pyrna2sphinx(BASEPATH): # docs last?, disable for now # write_example_ref("", fw, "bpy.types.%s" % struct.identifier) + file.close() if "bpy.types" not in EXCLUDE_MODULES: for struct in structs.values(): @@ -777,46 +780,51 @@ def pyrna2sphinx(BASEPATH): for key, descr in descr_items: if type(descr) == GetSetDescriptorType: py_descr2sphinx(" ", fw, descr, "bpy.types", _BPY_STRUCT_FAKE, key) + file.close() # operators def write_ops(): API_BASEURL = "https://svn.blender.org/svnroot/bf-blender/trunk/blender/release/scripts" - fw = None - last_mod = '' - for op_key in sorted(ops.keys()): - op = ops[op_key] + op_modules = {} + for op in ops.values(): + op_modules.setdefault(op.module_name, []).append(op) + del op - if last_mod != op.module_name: - filepath = os.path.join(BASEPATH, "bpy.ops.%s.rst" % op.module_name) - file = open(filepath, "w") - fw = file.write + for op_module_name, ops_mod in op_modules.items(): + filepath = os.path.join(BASEPATH, "bpy.ops.%s.rst" % op_module_name) + file = open(filepath, "w") + fw = file.write - title = "%s Operators" % (op.module_name[0].upper() + op.module_name[1:]) - fw("%s\n%s\n\n" % (title, "=" * len(title))) + title = "%s Operators" % op_module_name.replace("_", " ").title() + fw("%s\n%s\n\n" % (title, "=" * len(title))) - fw(".. module:: bpy.ops.%s\n\n" % op.module_name) - last_mod = op.module_name + fw(".. module:: bpy.ops.%s\n\n" % op_module_name) - args_str = ", ".join(prop.get_arg_default(force=True) for prop in op.args) - fw(".. function:: %s(%s)\n\n" % (op.func_name, args_str)) + ops_mod.sort(key=lambda op: op.func_name) - # if the description isn't valid, we output the standard warning - # with a link to the wiki so that people can help - if not op.description or op.description == "(undocumented operator)": - operator_description = undocumented_message('bpy.ops', op.module_name, op.func_name) - else: - operator_description = op.description + for op in ops_mod: + args_str = ", ".join(prop.get_arg_default(force=True) for prop in op.args) + fw(".. function:: %s(%s)\n\n" % (op.func_name, args_str)) - fw(" %s\n\n" % operator_description) - for prop in op.args: - write_param(" ", fw, prop) - if op.args: - fw("\n") + # if the description isn't valid, we output the standard warning + # with a link to the wiki so that people can help + if not op.description or op.description == "(undocumented operator)": + operator_description = undocumented_message('bpy.ops', op.module_name, op.func_name) + else: + operator_description = op.description + + fw(" %s\n\n" % operator_description) + for prop in op.args: + write_param(" ", fw, prop) + if op.args: + fw("\n") + + location = op.get_location() + if location != (None, None): + fw(" :file: `%s <%s/%s>`_:%d\n\n" % (location[0], API_BASEURL, location[0], location[1])) - location = op.get_location() - if location != (None, None): - fw(" :file: `%s <%s/%s>`_:%d\n\n" % (location[0], API_BASEURL, location[0], location[1])) + file.close() if "bpy.ops" not in EXCLUDE_MODULES: write_ops() |