[Bf-blender-cvs] [0e413053441] master: Cleanup: reference 'bpy.types.bpy_struct' directly

Campbell Barton noreply at git.blender.org
Mon May 11 09:07:56 CEST 2020


Commit: 0e413053441f466e253d3b716b2309b879b3cae4
Author: Campbell Barton
Date:   Mon May 11 16:56:09 2020 +1000
Branches: master
https://developer.blender.org/rB0e413053441f466e253d3b716b2309b879b3cae4

Cleanup: reference 'bpy.types.bpy_struct' directly

Previously there wasn't a way to access this directly from bpy.types.

===================================================================

M	doc/python_api/sphinx_doc_gen.py

===================================================================

diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 6febbbf2ded..6207ca6753e 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -492,6 +492,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.
@@ -1443,7 +1448,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("__")
                 ]
 
@@ -1571,7 +1576,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,



More information about the Bf-blender-cvs mailing list