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:
Diffstat (limited to 'doc/python_api/sphinx_doc_gen.py')
-rw-r--r--doc/python_api/sphinx_doc_gen.py72
1 files changed, 38 insertions, 34 deletions
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 68a7a0df075..d4cc1d37262 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -403,32 +403,21 @@ MODULE_GROUPING = {
# -------------------------------BLENDER----------------------------------------
-blender_version_strings = [str(v) for v in bpy.app.version]
-is_release = bpy.app.version_cycle in {"rc", "release"}
-
# converting bytes to strings, due to T30154
BLENDER_REVISION = str(bpy.app.build_hash, 'utf_8')
-if is_release:
- # '2.62a'
- BLENDER_VERSION_DOTS = ".".join(blender_version_strings[:2]) + bpy.app.version_char
-else:
- # '2.62.1'
- BLENDER_VERSION_DOTS = ".".join(blender_version_strings)
+# '2.83.0 Beta' or '2.83.0' or '2.83.1'
+BLENDER_VERSION_DOTS = bpy.app.version_string
if BLENDER_REVISION != "Unknown":
- # '2.62a SHA1' (release) or '2.62.1 SHA1' (non-release)
+ # SHA1 Git hash
BLENDER_VERSION_HASH = BLENDER_REVISION
else:
# Fallback: Should not be used
BLENDER_VERSION_HASH = "Hash Unknown"
-if is_release:
- # '2_62a_release'
- BLENDER_VERSION_PATH = "%s%s_release" % ("_".join(blender_version_strings[:2]), bpy.app.version_char)
-else:
- # '2_62_1'
- BLENDER_VERSION_PATH = "_".join(blender_version_strings)
+# '2_83'
+BLENDER_VERSION_PATH = "%d_%d" % (bpy.app.version[0], bpy.app.version[1])
# --------------------------DOWNLOADABLE FILES----------------------------------
@@ -492,6 +481,11 @@ if _BPY_PROP_COLLECTION_FAKE:
else:
_BPY_PROP_COLLECTION_ID = "collection"
+if _BPY_STRUCT_FAKE:
+ bpy_struct = bpy.types.bpy_struct
+else:
+ bpy_struct = None
+
def escape_rst(text):
""" Escape plain text which may contain characters used by RST.
@@ -512,7 +506,7 @@ def is_struct_seq(value):
def undocumented_message(module_name, type_name, identifier):
- return "Undocumented `contribute <https://developer.blender.org/T51061>`"
+ return "Undocumented, consider `contributing <https://developer.blender.org/T51061>`__."
def range_str(val):
@@ -694,11 +688,13 @@ def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier):
doc = undocumented_message(module_name, type_name, identifier)
if type(descr) == GetSetDescriptorType:
- fw(ident + ".. attribute:: %s\n\n" % identifier)
+ fw(ident + ".. attribute:: %s\n" % identifier)
+ fw(ident + " :noindex:\n\n")
write_indented_lines(ident + " ", fw, doc, False)
fw("\n")
elif type(descr) == MemberDescriptorType: # same as above but use 'data'
- fw(ident + ".. data:: %s\n\n" % identifier)
+ fw(ident + ".. data:: %s\n" % identifier)
+ fw(ident + " :noindex:\n\n")
write_indented_lines(ident + " ", fw, doc, False)
fw("\n")
elif type(descr) in {MethodDescriptorType, ClassMethodDescriptorType}:
@@ -738,11 +734,14 @@ def pyprop2sphinx(ident, fw, identifier, py_prop):
'''
# readonly properties use "data" directive, variables use "attribute" directive
if py_prop.fset is None:
- fw(ident + ".. data:: %s\n\n" % identifier)
+ fw(ident + ".. data:: %s\n" % identifier)
+ fw(ident + " :noindex:\n\n")
else:
- fw(ident + ".. attribute:: %s\n\n" % identifier)
+ fw(ident + ".. attribute:: %s\n" % identifier)
+ fw(ident + " :noindex:\n\n")
write_indented_lines(ident + " ", fw, py_prop.__doc__)
if py_prop.fset is None:
+ fw("\n")
fw(ident + " (readonly)\n\n")
else:
fw("\n")
@@ -908,7 +907,8 @@ def pymodule2sphinx(basepath, module_name, module, title):
elif issubclass(value_type, (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)
+ fw(".. data:: %s\n" % attribute)
+ fw(" :noindex:\n\n")
write_indented_lines(" ", fw, "constant value %s" % repr(value), False)
fw("\n")
else:
@@ -1052,6 +1052,7 @@ context_type_map = {
"selected_editable_fcurves": ("FCurve", True),
"selected_editable_objects": ("Object", True),
"selected_editable_sequences": ("Sequence", True),
+ "selected_nla_strips": ("NlaStrip", True),
"selected_nodes": ("Node", True),
"selected_objects": ("Object", True),
"selected_pose_bones": ("PoseBone", True),
@@ -1115,7 +1116,8 @@ def pycontext2sphinx(basepath):
type_descr = prop.get_type_description(
class_fmt=":class:`bpy.types.%s`", collection_id=_BPY_PROP_COLLECTION_ID)
- fw(".. data:: %s\n\n" % prop.identifier)
+ fw(".. data:: %s\n" % prop.identifier)
+ fw(" :noindex:\n\n")
if prop.description:
fw(" %s\n\n" % prop.description)
@@ -1160,7 +1162,8 @@ def pycontext2sphinx(basepath):
i = 0
while char_array[i] is not None:
member = ctypes.string_at(char_array[i]).decode(encoding="ascii")
- fw(".. data:: %s\n\n" % member)
+ fw(".. data:: %s\n" % member)
+ fw(" :noindex:\n\n")
member_type, is_seq = context_type_map[member]
fw(" :type: %s :class:`bpy.types.%s`\n\n" % ("sequence of " if is_seq else "", member_type))
unique.add(member)
@@ -1304,7 +1307,7 @@ def pyrna2sphinx(basepath):
fw(title_string(title, "="))
- fw(".. module:: %s\n\n" % struct_module_name)
+ fw(".. module:: %s.%s\n\n" % (struct_module_name, struct_id))
# docs first?, ok
write_example_ref("", fw, "%s.%s" % (struct_module_name, struct_id))
@@ -1363,9 +1366,11 @@ def pyrna2sphinx(basepath):
type_descr = prop.get_type_description(class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID)
# readonly properties use "data" directive, variables properties use "attribute" directive
if 'readonly' in type_descr:
- fw(" .. data:: %s\n\n" % prop.identifier)
+ fw(" .. data:: %s\n" % prop.identifier)
+ fw(" :noindex:\n\n")
else:
- fw(" .. attribute:: %s\n\n" % prop.identifier)
+ fw(" .. attribute:: %s\n" % prop.identifier)
+ fw(" :noindex:\n\n")
if prop.description:
fw(" %s\n\n" % prop.description)
@@ -1442,7 +1447,7 @@ def pyrna2sphinx(basepath):
if _BPY_STRUCT_FAKE:
descr_items = [
- (key, descr) for key, descr in sorted(bpy.types.Struct.__bases__[0].__dict__.items())
+ (key, descr) for key, descr in sorted(bpy_struct.__dict__.items())
if not key.startswith("__")
]
@@ -1458,9 +1463,6 @@ def pyrna2sphinx(basepath):
for identifier, py_prop in base.get_py_properties():
lines.append(" * :class:`%s.%s`\n" % (base.identifier, 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")
@@ -1484,6 +1486,8 @@ def pyrna2sphinx(basepath):
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))
+ for identifier, py_func in base.get_py_c_functions():
+ lines.append(" * :class:`%s.%s`\n" % (base.identifier, identifier))
if lines:
fw(".. rubric:: Inherited Functions\n\n")
@@ -1536,7 +1540,7 @@ def pyrna2sphinx(basepath):
fw(title_string(class_name, "="))
- fw(".. module:: %s\n" % class_module_name)
+ fw(".. module:: %s.%s\n" % (class_module_name, class_name))
fw("\n")
if use_subclasses:
@@ -1571,7 +1575,7 @@ def pyrna2sphinx(basepath):
# write fake classes
if _BPY_STRUCT_FAKE:
- class_value = bpy.types.Struct.__bases__[0]
+ class_value = bpy_struct
fake_bpy_type(
"bpy.types", class_value, _BPY_STRUCT_FAKE,
"built-in base class for all classes in bpy.types.", use_subclasses=True,
@@ -1711,7 +1715,7 @@ class PatchedPythonDomain(PythonDomain):
fw("def setup(app):\n")
fw(" app.add_stylesheet('css/theme_overrides.css')\n")
- fw(" app.override_domain(PatchedPythonDomain)\n\n")
+ fw(" app.add_domain(PatchedPythonDomain, override=True)\n\n")
file.close()