PyAPI: re-enable the "bgl" module for headless builds

Instead of removing the `bgl` module, set all it's functions to stubs
so importing `bgl` or any of it's members doesn't raise an error.

This avoids problems for scripts that import bgl but don't call it's
functions when running in background mode.
This commit is contained in:
2022-07-16 17:28:09 +10:00
parent 49babc7caa
commit 0a8d21e0c9
3 changed files with 50 additions and 28 deletions

View File

@@ -259,9 +259,7 @@ static struct _inittab bpy_internal_modules[] = {
{"mathutils.kdtree", PyInit_mathutils_kdtree},
#endif
{"_bpy_path", BPyInit__bpy_path},
#ifdef WITH_OPENGL
{"bgl", BPyInit_bgl},
#endif
{"blf", BPyInit_blf},
{"bl_math", BPyInit_bl_math},
{"imbuf", BPyInit_imbuf},