[Bf-blender-cvs] [ea01c8c5f6c] blender-v2.92-release: Fix T84402: Off-screen rendering works only once from Python
Campbell Barton
noreply at git.blender.org
Wed Jan 27 10:25:31 CET 2021
Commit: ea01c8c5f6ce5bf7df1af13795155f2dec473e0a
Author: Campbell Barton
Date: Wed Jan 27 20:21:55 2021 +1100
Branches: blender-v2.92-release
https://developer.blender.org/rBea01c8c5f6ce5bf7df1af13795155f2dec473e0a
Fix T84402: Off-screen rendering works only once from Python
Off-screen drawing doesn't work once the 'bgl' workaround is enabled.
Disable this for off-screen drawing.
===================================================================
M source/blender/python/gpu/gpu_py_offscreen.c
===================================================================
diff --git a/source/blender/python/gpu/gpu_py_offscreen.c b/source/blender/python/gpu/gpu_py_offscreen.c
index 00d367c603b..51038aae598 100644
--- a/source/blender/python/gpu/gpu_py_offscreen.c
+++ b/source/blender/python/gpu/gpu_py_offscreen.c
@@ -247,6 +247,12 @@ static PyObject *py_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *args,
depsgraph = BKE_scene_ensure_depsgraph(G_MAIN, scene, view_layer);
+ /* Disable 'bgl' state since it interfere with off-screen drawing, see: T84402. */
+ const bool is_bgl = GPU_bgl_get();
+ if (is_bgl) {
+ GPU_bgl_end();
+ }
+
GPU_offscreen_bind(self->ofs, true);
ED_view3d_draw_offscreen(depsgraph,
@@ -267,6 +273,10 @@ static PyObject *py_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *args,
GPU_offscreen_unbind(self->ofs, true);
+ if (is_bgl) {
+ GPU_bgl_start();
+ }
+
Py_RETURN_NONE;
}
More information about the Bf-blender-cvs
mailing list