diff options
Diffstat (limited to 'source/blender/python/gpu/gpu_py_offscreen.c')
-rw-r--r-- | source/blender/python/gpu/gpu_py_offscreen.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/source/blender/python/gpu/gpu_py_offscreen.c b/source/blender/python/gpu/gpu_py_offscreen.c index 457f00b1267..6f23c2213e2 100644 --- a/source/blender/python/gpu/gpu_py_offscreen.c +++ b/source/blender/python/gpu/gpu_py_offscreen.c @@ -227,7 +227,7 @@ static PyObject *pygpu_offscreen__tp_new(PyTypeObject *UNUSED(self), } if (GPU_context_active_get()) { - ofs = GPU_offscreen_create(width, height, true, false, err_out); + ofs = GPU_offscreen_create(width, height, true, GPU_RGBA8, err_out); } else { STRNCPY(err_out, "No active GPU context found"); @@ -279,7 +279,8 @@ static PyObject *pygpu_offscreen_texture_color_get(BPyGPUOffScreen *self, void * PyDoc_STRVAR( pygpu_offscreen_draw_view3d_doc, - ".. method:: draw_view3d(scene, view_layer, view3d, region, view_matrix, projection_matrix)\n" + ".. method:: draw_view3d(scene, view_layer, view3d, region, view_matrix, projection_matrix, " + "do_color_management=False)\n" "\n" " Draw the 3d viewport in the offscreen object.\n" "\n" @@ -294,7 +295,9 @@ PyDoc_STRVAR( " :arg view_matrix: View Matrix (e.g. ``camera.matrix_world.inverted()``).\n" " :type view_matrix: :class:`mathutils.Matrix`\n" " :arg projection_matrix: Projection Matrix (e.g. ``camera.calc_matrix_camera(...)``).\n" - " :type projection_matrix: :class:`mathutils.Matrix`\n"); + " :type projection_matrix: :class:`mathutils.Matrix`\n" + " :arg do_color_management: Color manage the output.\n" + " :type do_color_management: bool\n"); static PyObject *pygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *args, PyObject *kwds) { MatrixObject *py_mat_view, *py_mat_projection; @@ -306,12 +309,20 @@ static PyObject *pygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *ar View3D *v3d; ARegion *region; + bool do_color_management = false; + BPY_GPU_OFFSCREEN_CHECK_OBJ(self); - static const char *_keywords[] = { - "scene", "view_layer", "view3d", "region", "view_matrix", "projection_matrix", NULL}; + static const char *_keywords[] = {"scene", + "view_layer", + "view3d", + "region", + "view_matrix", + "projection_matrix", + "do_color_management", + NULL}; - static _PyArg_Parser _parser = {"OOOOO&O&:draw_view3d", _keywords, 0}; + static _PyArg_Parser _parser = {"OOOOO&O&|$O&:draw_view3d", _keywords, 0}; if (!_PyArg_ParseTupleAndKeywordsFast(args, kwds, &_parser, @@ -322,7 +333,9 @@ static PyObject *pygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *ar Matrix_Parse4x4, &py_mat_view, Matrix_Parse4x4, - &py_mat_projection) || + &py_mat_projection, + PyC_ParseBool, + &do_color_management) || (!(scene = PyC_RNA_AsPointer(py_scene, "Scene")) || !(view_layer = PyC_RNA_AsPointer(py_view_layer, "ViewLayer")) || !(v3d = PyC_RNA_AsPointer(py_view3d, "SpaceView3D")) || @@ -354,7 +367,7 @@ static PyObject *pygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *ar true, true, "", - false, + do_color_management, true, self->ofs, NULL); |