[Bf-blender-cvs] [49a7bcafd9e] blender2.8: gpu.offscreen, fix pydoc, example and rename modelviewmatrix > viewmatrix

Dalai Felinto noreply at git.blender.org
Fri Nov 9 16:54:50 CET 2018


Commit: 49a7bcafd9e043ae250f0e50c54d2dec716a7191
Author: Dalai Felinto
Date:   Fri Nov 9 13:46:09 2018 -0200
Branches: blender2.8
https://developer.blender.org/rB49a7bcafd9e043ae250f0e50c54d2dec716a7191

gpu.offscreen, fix pydoc, example and rename modelviewmatrix > viewmatrix

Technically this is only the view matrix, not model view matrix.
And view layer was missing from the pydoc.

===================================================================

M	doc/python_api/examples/gpu.types.GPUOffScreen.py
M	source/blender/python/gpu/gpu_py_offscreen.c

===================================================================

diff --git a/doc/python_api/examples/gpu.types.GPUOffScreen.py b/doc/python_api/examples/gpu.types.GPUOffScreen.py
index ee0b6759f13..ac95c75bf6c 100644
--- a/doc/python_api/examples/gpu.types.GPUOffScreen.py
+++ b/doc/python_api/examples/gpu.types.GPUOffScreen.py
@@ -97,7 +97,7 @@ class VIEW3D_OT_draw_offscreen(bpy.types.Operator):
         render = scene.render
         camera = scene.camera
 
-        modelview_matrix = camera.matrix_world.inverted()
+        view_matrix = camera.matrix_world.inverted()
         projection_matrix = camera.calc_matrix_camera(
             context.depsgraph,
             x=render.resolution_x,
@@ -112,7 +112,7 @@ class VIEW3D_OT_draw_offscreen(bpy.types.Operator):
             context.space_data,
             context.region,
             projection_matrix,
-            modelview_matrix,
+            view_matrix,
         )
 
     def _opengl_draw(self, context, texture, aspect_ratio, scale):
diff --git a/source/blender/python/gpu/gpu_py_offscreen.c b/source/blender/python/gpu/gpu_py_offscreen.c
index f31b0e5eb3d..3deeb562b3b 100644
--- a/source/blender/python/gpu/gpu_py_offscreen.c
+++ b/source/blender/python/gpu/gpu_py_offscreen.c
@@ -185,18 +185,20 @@ PyDoc_STRVAR(bpygpu_offscreen_draw_view3d_doc,
 "\n"
 "   :param scene: Scene to draw.\n"
 "   :type scene: :class:`bpy.types.Scene`\n"
+"   :param view_layer: View layer to draw.\n"
+"   :type view_layer: :class:`bpy.types.ViewLayer`\n"
 "   :param view3d: 3D View to get the drawing settings from.\n"
 "   :type view3d: :class:`bpy.types.SpaceView3D`\n"
 "   :param region: Region of the 3D View.\n"
 "   :type region: :class:`bpy.types.Region`\n"
-"   :param modelview_matrix: ModelView Matrix.\n"
-"   :type modelview_matrix: :class:`mathutils.Matrix`\n"
+"   :param view_matrix: View Matrix.\n"
+"   :type view_matrix: :class:`mathutils.Matrix`\n"
 "   :param projection_matrix: Projection Matrix.\n"
 "   :type projection_matrix: :class:`mathutils.Matrix`\n"
 );
 static PyObject *bpygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *args, PyObject *kwds)
 {
-	MatrixObject *py_mat_modelview, *py_mat_projection;
+	MatrixObject *py_mat_view, *py_mat_projection;
 	PyObject *py_scene, *py_view_layer, *py_region, *py_view3d;
 
 	struct Depsgraph *depsgraph;
@@ -210,14 +212,14 @@ static PyObject *bpygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *a
 
 	static const char *_keywords[] = {
 	        "scene", "view_layer", "view3d", "region",
-	        "projection_matrix", "modelview_matrix", NULL};
+	        "projection_matrix", "view_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_projection,
-	        Matrix_Parse4x4, &py_mat_modelview) ||
+	        Matrix_Parse4x4, &py_mat_view) ||
 	    (!(scene       = PyC_RNA_AsPointer(py_scene, "Scene")) ||
 	     !(view_layer = PyC_RNA_AsPointer(py_view_layer, "ViewLayer")) ||
 	     !(v3d         = PyC_RNA_AsPointer(py_view3d, "SpaceView3D")) ||
@@ -241,7 +243,7 @@ static PyObject *bpygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *a
 	                         ar,
 	                         GPU_offscreen_width(self->ofs),
 	                         GPU_offscreen_height(self->ofs),
-	                         (float(*)[4])py_mat_modelview->matrix,
+	                         (float(*)[4])py_mat_view->matrix,
 	                         (float(*)[4])py_mat_projection->matrix,
 	                         false,
 	                         true,



More information about the Bf-blender-cvs mailing list