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
path: root/doc
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-05-18 09:59:16 +0300
committerCampbell Barton <campbell@blender.org>2022-05-18 10:06:03 +0300
commitc8edc458d13c0483907d0fe6f44f6e2887263b57 (patch)
treedfa5cc3575a312c44e10d3c5d406318628967a6a /doc
parent88fbe94d70dc850b6534a5351dd4da4d844e2120 (diff)
PyDoc: support building full API docs on macOS & WIN32
Accessing context members depended on `ctypes` to access symbols which were hidden for macOS & WIN32. Add an API call that doesn't require the symbols to be exported. This allows most symbols to be hidden on Linux, see D14971.
Diffstat (limited to 'doc')
-rw-r--r--doc/python_api/sphinx_doc_gen.py33
1 files changed, 7 insertions, 26 deletions
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index eba12b75b63..1c52bb3e57d 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -1200,34 +1200,18 @@ def pycontext2sphinx(basepath):
del write_contex_cls
# end
- # nasty, get strings directly from Blender because there is no other way to get it
- import ctypes
-
- context_strings = (
- "screen_context_dir",
- "view3d_context_dir",
- "buttons_context_dir",
- "image_context_dir",
- "node_context_dir",
- "text_context_dir",
- "clip_context_dir",
- "sequencer_context_dir",
- "file_context_dir",
- )
+ # Internal API call only intended to be used to extract context members.
+ from _bpy import context_members
+ context_member_map = context_members()
+ del context_members
# Track unique for `context_strings` to validate `context_type_map`.
unique_context_strings = set()
- blend_cdll = ctypes.CDLL("")
- for ctx_str in context_strings:
+ for ctx_str, ctx_members in sorted(context_member_map.items()):
subsection = "%s Context" % ctx_str.split("_")[0].title()
fw("\n%s\n%s\n\n" % (subsection, (len(subsection) * '-')))
-
- attr = ctypes.addressof(getattr(blend_cdll, ctx_str))
- c_char_p_p = ctypes.POINTER(ctypes.c_char_p)
- char_array = c_char_p_p.from_address(attr)
i = 0
- while char_array[i] is not None:
- member = ctypes.string_at(char_array[i]).decode(encoding="ascii")
+ for member in ctx_members:
unique_all_len = len(unique)
unique.add(member)
member_visited = unique_all_len == len(unique)
@@ -2167,10 +2151,7 @@ def rna2sphinx(basepath):
# context
if "bpy.context" not in EXCLUDE_MODULES:
- # one of a kind, context doc (uses ctypes to extract info!)
- # doesn't work on mac and windows
- if PLATFORM not in {"darwin", "windows"}:
- pycontext2sphinx(basepath)
+ pycontext2sphinx(basepath)
# internal modules
write_rst_bpy(basepath) # bpy, disabled by default