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.
This commit is contained in:
parent
4b7b4efd5b
commit
ea01c8c5f6
Notes:
blender-bot
2023-02-14 05:52:32 +01:00
Referenced by issue #84402, Offscreen rendering works only once
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue