[Bf-blender-cvs] [b75ff0a] framebuffer: Cleanup: naming

Campbell Barton noreply at git.blender.org
Mon Oct 19 17:03:44 CEST 2015


Commit: b75ff0a0fd781b227f29e59246a554e8e4f3aa79
Author: Campbell Barton
Date:   Tue Oct 20 01:38:19 2015 +1100
Branches: framebuffer
https://developer.blender.org/rBb75ff0a0fd781b227f29e59246a554e8e4f3aa79

Cleanup: naming

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

M	source/blender/python/intern/gpu_offscreen.c

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

diff --git a/source/blender/python/intern/gpu_offscreen.c b/source/blender/python/intern/gpu_offscreen.c
index 624d465..7fb0bda 100644
--- a/source/blender/python/intern/gpu_offscreen.c
+++ b/source/blender/python/intern/gpu_offscreen.c
@@ -122,8 +122,8 @@ PyDoc_STRVAR(pygpu_offscreen_bind_doc,
 );
 static PyObject *pygpu_offscreen_bind(PyGPUOffScreen *self, PyObject *args, PyObject *kwds)
 {
-	bool save = true;
 	static const char *kwlist[] = {"save", NULL};
+	bool save = true;
 
 	BPY_GPU_OFFSCREEN_CHECK_OBJ(self, "bind");
 
@@ -148,8 +148,8 @@ PyDoc_STRVAR(pygpu_offscreen_unbind_doc,
 );
 static PyObject *pygpu_offscreen_unbind(PyGPUOffScreen *self, PyObject *args, PyObject *kwds)
 {
-	bool restore = true;
 	static const char *kwlist[] = {"restore", NULL};
+	bool restore = true;
 
 	BPY_GPU_OFFSCREEN_CHECK_OBJ(self, "unbind");
 
@@ -169,22 +169,22 @@ static PyObject *pygpu_offscreen_unbind(PyGPUOffScreen *self, PyObject *args, Py
  */
 static int pygpu_offscreen_check_matrix(PyObject *o, void *p)
 {
-	MatrixObject **PyMat_p = p;
-	MatrixObject *PyMat = (MatrixObject *)o;
+	MatrixObject **pymat_p = p;
+	MatrixObject  *pymat = (MatrixObject *)o;
 
-	if (!MatrixObject_Check(PyMat)) {
+	if (!MatrixObject_Check(pymat)) {
 		PyErr_Format(PyExc_TypeError,
 		             "matrix is not in a valid format (e.g., mathutils.Matrix)",
 		             Py_TYPE(o)->tp_name);
 		return 0;
 	}
 
-	if (BaseMath_ReadCallback(PyMat) == -1) {
+	if (BaseMath_ReadCallback(pymat) == -1) {
 		return 0;
 	}
 
-	if ((PyMat->num_col != 4) ||
-	    (PyMat->num_row != 4))
+	if ((pymat->num_col != 4) ||
+	    (pymat->num_row != 4))
 	{
 		PyErr_Format(PyExc_TypeError,
 		             "matrix must have 4 rows and 4 columns",
@@ -192,7 +192,7 @@ static int pygpu_offscreen_check_matrix(PyObject *o, void *p)
 		return 0;
 	}
 
-	*PyMat_p = PyMat;
+	*pymat_p = pymat;
 	return 1;
 }
 
@@ -208,12 +208,10 @@ PyDoc_STRVAR(pygpu_offscreen_draw_view3d_doc,
 );
 static PyObject *pygpu_offscreen_draw_view3d(PyGPUOffScreen *self, PyObject *args, PyObject *kwds)
 {
-	MatrixObject *PyModelViewMatrix;
-	MatrixObject *PyProjectionMatrix;
+	static const char *kwlist[] = {"scene", "region", "view3d", "projection_matrix", "modelview_matrix", NULL};
 
-	PyObject *pyscene;
-	PyObject *pyregion;
-	PyObject *pyview3d;
+	MatrixObject *py_mat_modelview, *py_mat_projection;
+	PyObject *py_scene, *py_region, *py_view3d;
 
 	Scene *scene;
 	View3D *v3d;
@@ -221,31 +219,30 @@ static PyObject *pygpu_offscreen_draw_view3d(PyGPUOffScreen *self, PyObject *arg
 	GPUFX *fx;
 	GPUFXSettings fx_settings;
 
-	static const char *kwlist[] = {"scene", "region", "view3d", "projection_matrix", "modelview_matrix", NULL};
-
 	BPY_GPU_OFFSCREEN_CHECK_OBJ(self, "draw_view3d");
 
-	if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOOO&O&:draw_view3d", (char **)(kwlist),
-	                                 &pyscene, &pyregion, &pyview3d,
-	                                 pygpu_offscreen_check_matrix, &PyProjectionMatrix,
-	                                 pygpu_offscreen_check_matrix, &PyModelViewMatrix))
+	if (!PyArg_ParseTupleAndKeywords(
+	        args, kwds, "OOOO&O&:draw_view3d", (char **)(kwlist),
+	        &py_scene, &py_region, &py_view3d,
+	        pygpu_offscreen_check_matrix, &py_mat_projection,
+	        pygpu_offscreen_check_matrix, &py_mat_modelview))
 	{
 		return NULL;
 	}
 
-	scene = (Scene *)PyC_RNA_AsPointer(pyscene, "Scene");
+	scene = (Scene *)PyC_RNA_AsPointer(py_scene, "Scene");
 	if (scene == NULL) {
 		PyErr_SetString(PyExc_SystemError, "draw_view3d: No valid scene");
 		return NULL;
 	}
 
-	ar = (ARegion *)PyC_RNA_AsPointer(pyregion, "ARegion");
+	ar = (ARegion *)PyC_RNA_AsPointer(py_region, "ARegion");
 	if (ar == NULL) {
 		PyErr_SetString(PyExc_SystemError, "draw_view3d: No valid region");
 		return NULL;
 	}
 
-	v3d = (View3D *)PyC_RNA_AsPointer(pyview3d, "View3D");
+	v3d = (View3D *)PyC_RNA_AsPointer(py_view3d, "View3D");
 	if (v3d == NULL) {
 		PyErr_SetString(PyExc_SystemError, "draw_view3d: No valid 3d view");
 		return NULL;
@@ -260,20 +257,11 @@ static PyObject *pygpu_offscreen_draw_view3d(PyGPUOffScreen *self, PyObject *arg
 	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])PyProjectionMatrix->matrix,
-	            (float(*)[4])PyModelViewMatrix->matrix,
-	            false,
-	            true,
-	            true,
-	            "",
-	            fx,
-	            &fx_settings,
-	            self->ofs);
+	        scene, v3d, ar, GPU_offscreen_width(self->ofs), GPU_offscreen_height(self->ofs),
+	        (float(*)[4])py_mat_projection->matrix, (float(*)[4])py_mat_modelview->matrix,
+	        false, true, true, "",
+	        fx, &fx_settings,
+	        self->ofs);
 
 	GPU_fx_compositor_destroy(fx);
 	GPU_offscreen_unbind(self->ofs, true); /* unbind */
@@ -400,14 +388,18 @@ PyDoc_STRVAR(pygpu_offscreen_new_doc,
 );
 static PyObject *pygpu_offscreen_new(PyObject *UNUSED(self), PyObject *args, PyObject *kwds)
 {
+	static const char *kwlist[] = {"width", "height", "samples", NULL};
+
 	GPUOffScreen *ofs;
 	unsigned int width, height, samples;
 	char err_out[256];
 
-	static const char *kwlist[] = {"width", "height", "samples", NULL};
-
-	if (!PyArg_ParseTupleAndKeywords(args, kwds, "iii:new", (char **)(kwlist), &width, &height, &samples))
+	if (!PyArg_ParseTupleAndKeywords(
+	        args, kwds, "iii:new", (char **)(kwlist),
+	        &width, &height, &samples))
+	{
 		return NULL;
+	}
 
 	if (UINT_IS_NEG(width)) {
 		PyErr_SetString(PyExc_ValueError, "negative 'width' given");




More information about the Bf-blender-cvs mailing list