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:
authorCampbell Barton <campbell@blender.org>2022-07-15 15:14:04 +0300
committerCampbell Barton <campbell@blender.org>2022-07-15 15:16:44 +0300
commit00dc7477022acdd969e4d709a235c0be819efa6c (patch)
treeb6bd65095c8ce50520a638cddf2d843963369fc1 /source/blender/python
parent180db0f752c88d3bbd47774a0f7c9a31de5a3864 (diff)
Fix T99706: Crash rendering with headless builds
When rendering with headless builds, show an error instead of crashing. Previously GPU_backend_init was called indirectly from DRW_opengl_context_create, a new function is now called from the window manager (GPU_backend_init_once), so it's possible to check if the GPU has a back-end. This also disables the `bgl` Python module when building WITH_HEADLESS. Reviewed By: fclem Ref D15463
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/generic/CMakeLists.txt10
-rw-r--r--source/blender/python/intern/bpy_interface.c2
2 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt
index 69bcfdfae4e..dfca528e758 100644
--- a/source/blender/python/generic/CMakeLists.txt
+++ b/source/blender/python/generic/CMakeLists.txt
@@ -17,7 +17,6 @@ set(INC_SYS
)
set(SRC
- bgl.c
bl_math_py_api.c
blf_py_api.c
bpy_threads.c
@@ -27,7 +26,6 @@ set(SRC
py_capi_rna.c
py_capi_utils.c
- bgl.h
bl_math_py_api.h
blf_py_api.h
idprop_py_api.h
@@ -40,6 +38,14 @@ set(SRC
python_utildefines.h
)
+if(WITH_OPENGL)
+ list(APPEND SRC
+ bgl.c
+
+ bgl.h
+ )
+endif()
+
set(LIB
${GLEW_LIBRARY}
${PYTHON_LINKFLAGS}
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 939fa475344..08dd5fe9cfc 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -259,7 +259,9 @@ 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},