[Bf-blender-cvs] [c1f05c3] master: PyAPI: expose low level RNA to bpy.types

Campbell Barton noreply at git.blender.org
Mon Nov 30 01:10:57 CET 2015


Commit: c1f05c30f9282620bcb7c6c9fec4eeb8f262e207
Author: Campbell Barton
Date:   Mon Nov 30 11:02:09 2015 +1100
Branches: master
https://developer.blender.org/rBc1f05c30f9282620bcb7c6c9fec4eeb8f262e207

PyAPI: expose low level RNA to bpy.types

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

M	release/scripts/modules/bpy_types.py
M	source/blender/python/intern/bpy.c
M	source/blender/python/intern/bpy_rna.c

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

diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index 92dbd2d..4f71cdf 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -21,8 +21,8 @@
 from _bpy import types as bpy_types
 import _bpy
 
-StructRNA = bpy_types.Struct.__bases__[0]
-StructMetaPropGroup = _bpy.StructMetaPropGroup
+StructRNA = bpy_types.bpy_struct
+StructMetaPropGroup = bpy_types.bpy_struct_meta_idprop
 # StructRNA = bpy_types.Struct
 
 bpy_types.BlendDataLibraries.load = _bpy._library_load
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index fa2ad3a..bdae2a7 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -320,9 +320,6 @@ void BPy_init_modules(void)
 	/* needs to be first so bpy_types can run */
 	PyModule_AddObject(mod, "types", BPY_rna_types());
 
-	/* metaclass for idprop types, bpy_types.py needs access */
-	PyModule_AddObject(mod, "StructMetaPropGroup", (PyObject *)&pyrna_struct_meta_idprop_Type);
-
 	/* needs to be first so bpy_types can run */
 	BPY_library_module(mod);
 
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 220ec5b..47d89cd 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -6678,6 +6678,21 @@ PyObject *BPY_rna_types(void)
 	/* add __name__ since help() expects its */
 	PyDict_SetItem(pyrna_basetype_Type.tp_dict, bpy_intern_str___name__, bpy_intern_str_bpy_types);
 
+	/* internal base types we have no other accessors for */
+	{
+		PyTypeObject *pyrna_types[] = {
+		    &pyrna_struct_meta_idprop_Type,
+		    &pyrna_struct_Type,
+		    &pyrna_prop_Type,
+		    &pyrna_prop_array_Type,
+		    &pyrna_prop_collection_Type,
+		    &pyrna_func_Type,
+		};
+
+		for (int i = 0; i < ARRAY_SIZE(pyrna_types); i += 1) {
+			PyDict_SetItemString(pyrna_basetype_Type.tp_dict, pyrna_types[i]->tp_name, (PyObject *)pyrna_types[i]);
+		}
+	}
 
 	self = (BPy_BaseTypeRNA *)PyObject_NEW(BPy_BaseTypeRNA, &pyrna_basetype_Type);




More information about the Bf-blender-cvs mailing list