static PyObject *pygpu_offscreen_draw_view3d(BPy_GPUOffScreen *self, PyObject *args, PyObject *kwds) { static const char *kwlist[] = {"scene", "view3d", "region", "projection_matrix", "modelview_matrix", NULL}; MatrixObject *py_mat_modelview, *py_mat_projection; PyObject *py_scene, *py_region, *py_view3d; Scene *scene; View3D *v3d; ARegion *ar; GPUFX *fx; GPUFXSettings fx_settings; void *rv3d_mats; BPY_GPU_OFFSCREEN_CHECK_OBJ(self); if (!PyArg_ParseTupleAndKeywords( args, kwds, "OOOO&O&:draw_view3d", (char **)(kwlist), &py_scene, &py_view3d, &py_region, pygpu_offscreen_check_matrix, &py_mat_projection, pygpu_offscreen_check_matrix, &py_mat_modelview) || (!(scene = PyC_RNA_AsPointer(py_scene, "Scene")) || !(v3d = PyC_RNA_AsPointer(py_view3d, "SpaceView3D")) || !(ar = PyC_RNA_AsPointer(py_region, "Region")))) { return NULL; } fx = GPU_fx_compositor_create(); fx_settings = v3d->fx_settings; /* full copy */ ED_view3d_draw_offscreen_init(scene, v3d); rv3d_mats = ED_view3d_mats_rv3d_backup(ar->regiondata); GPU_offscreen_bind(self->ofs, true); /* bind */ ED_view3d_draw_offscreen( scene, v3d, ar, GPU_offscreen_width(self->ofs), GPU_offscreen_height(self->ofs), (float(*)[4])py_mat_modelview->matrix, (float(*)[4])py_mat_projection->matrix, false, true, true, "", fx, &fx_settings, self->ofs); GPU_fx_compositor_destroy(fx); GPU_offscreen_unbind(self->ofs, true); /* unbind */ ED_view3d_mats_rv3d_restore(ar->regiondata, rv3d_mats); MEM_freeN(rv3d_mats); Py_RETURN_NONE; }
static PyObject *bpygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *args, PyObject *kwds) { MatrixObject *py_mat_view, *py_mat_projection; PyObject *py_scene, *py_view_layer, *py_region, *py_view3d; struct Depsgraph *depsgraph; struct Scene *scene; struct ViewLayer *view_layer; View3D *v3d; ARegion *ar; struct RV3DMatrixStore *rv3d_mats; BPY_GPU_OFFSCREEN_CHECK_OBJ(self); static const char *_keywords[] = { "scene", "view_layer", "view3d", "region", "view_matrix", "projection_matrix", NULL}; static _PyArg_Parser _parser = {"OOOOO&O&:draw_view3d", _keywords, 0}; if (!_PyArg_ParseTupleAndKeywordsFast(args, kwds, &_parser, &py_scene, &py_view_layer, &py_view3d, &py_region, Matrix_Parse4x4, &py_mat_view, Matrix_Parse4x4, &py_mat_projection) || (!(scene = PyC_RNA_AsPointer(py_scene, "Scene")) || !(view_layer = PyC_RNA_AsPointer(py_view_layer, "ViewLayer")) || !(v3d = PyC_RNA_AsPointer(py_view3d, "SpaceView3D")) || !(ar = PyC_RNA_AsPointer(py_region, "Region")))) { return NULL; } BLI_assert(BKE_id_is_in_global_main(&scene->id)); depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); rv3d_mats = ED_view3d_mats_rv3d_backup(ar->regiondata); GPU_offscreen_bind(self->ofs, true); ED_view3d_draw_offscreen(depsgraph, scene, v3d->shading.type, v3d, ar, GPU_offscreen_width(self->ofs), GPU_offscreen_height(self->ofs), (float(*)[4])py_mat_view->matrix, (float(*)[4])py_mat_projection->matrix, false, true, "", true, self->ofs, NULL); GPU_offscreen_unbind(self->ofs, true); ED_view3d_mats_rv3d_restore(ar->regiondata, rv3d_mats); MEM_freeN(rv3d_mats); Py_RETURN_NONE; }