[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42269] trunk/blender/source/blender/ python/mathutils: formatting edits (120 width max) and remove some redundant casts

Campbell Barton ideasman42 at gmail.com
Tue Nov 29 21:22:40 CET 2011


Revision: 42269
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42269
Author:   campbellbarton
Date:     2011-11-29 20:22:35 +0000 (Tue, 29 Nov 2011)
Log Message:
-----------
formatting edits (120 width max) and remove some redundant casts

Modified Paths:
--------------
    trunk/blender/source/blender/python/mathutils/mathutils.c
    trunk/blender/source/blender/python/mathutils/mathutils.h
    trunk/blender/source/blender/python/mathutils/mathutils_Color.h
    trunk/blender/source/blender/python/mathutils/mathutils_Euler.c
    trunk/blender/source/blender/python/mathutils/mathutils_Euler.h
    trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c
    trunk/blender/source/blender/python/mathutils/mathutils_Matrix.h
    trunk/blender/source/blender/python/mathutils/mathutils_Quaternion.c
    trunk/blender/source/blender/python/mathutils/mathutils_Quaternion.h
    trunk/blender/source/blender/python/mathutils/mathutils_Vector.h

Modified: trunk/blender/source/blender/python/mathutils/mathutils.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils.c	2011-11-29 20:13:20 UTC (rev 42268)
+++ trunk/blender/source/blender/python/mathutils/mathutils.c	2011-11-29 20:22:35 UTC (rev 42269)
@@ -39,7 +39,9 @@
 PyDoc_STRVAR(M_Mathutils_doc,
 "This module provides access to matrices, eulers, quaternions and vectors."
 );
-static int mathutils_array_parse_fast(float *array, int array_min, int array_max, PyObject *value, const char *error_prefix)
+static int mathutils_array_parse_fast(float *array,
+                                      int array_min, int array_max,
+                                      PyObject *value, const char *error_prefix)
 {
 	PyObject *value_fast= NULL;
 	PyObject *item;
@@ -72,7 +74,9 @@
 	i= size;
 	do {
 		i--;
-		if (((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) && PyErr_Occurred()) {
+		if ( ((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) &&
+		     PyErr_Occurred())
+		{
 			PyErr_Format(PyExc_TypeError,
 			             "%.200s: sequence index %d expected a number, "
 			             "found '%.200s' type, ",

Modified: trunk/blender/source/blender/python/mathutils/mathutils.h
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils.h	2011-11-29 20:13:20 UTC (rev 42268)
+++ trunk/blender/source/blender/python/mathutils/mathutils.h	2011-11-29 20:22:35 UTC (rev 42269)
@@ -40,16 +40,18 @@
 extern char BaseMathObject_Wrapped_doc[];
 extern char BaseMathObject_Owner_doc[];
 
-#define BASE_MATH_MEMBERS(_data) \
-	PyObject_VAR_HEAD \
-	float *_data;				/* array of data (alias), wrapped status depends on wrapped status */ \
-	PyObject *cb_user;			/* if this vector references another object, otherwise NULL, *Note* this owns its reference */ \
-	unsigned char cb_type;		/* which user funcs do we adhere to, RNA, GameObject, etc */ \
-	unsigned char cb_subtype;	/* subtype: location, rotation... to avoid defining many new functions for every attribute of the same type */ \
-	unsigned char wrapped;		/* wrapped data type? */ \
+#define BASE_MATH_MEMBERS(_data)                                                                                 \
+	PyObject_VAR_HEAD                                                                                            \
+	float *_data;               /* array of data (alias), wrapped status depends on wrapped status */            \
+	PyObject *cb_user;          /* if this vector references another object, otherwise NULL,                     \
+	                             * *Note* this owns its reference */                                             \
+	unsigned char cb_type;      /* which user funcs do we adhere to, RNA, GameObject, etc */                     \
+	unsigned char cb_subtype;   /* subtype: location, rotation...                                                \
+	                             * to avoid defining many new functions for every attribute of the same type */  \
+	unsigned char wrapped       /* wrapped data type? */                                                         \
 
 typedef struct {
-	BASE_MATH_MEMBERS(data)
+	BASE_MATH_MEMBERS(data);
 } BaseMathObject;
 
 /* types */
@@ -80,11 +82,11 @@
 
 typedef struct Mathutils_Callback Mathutils_Callback;
 
-typedef int (*BaseMathCheckFunc)(BaseMathObject *);							/* checks the user is still valid */
-typedef int (*BaseMathGetFunc)(BaseMathObject *, int);				/* gets the vector from the user */
-typedef int (*BaseMathSetFunc)(BaseMathObject *, int);				/* sets the users vector values once the vector is modified */
-typedef int (*BaseMathGetIndexFunc)(BaseMathObject *, int, int);	/* same as above but only for an index */
-typedef int (*BaseMathSetIndexFunc)(BaseMathObject *, int, int);	/* same as above but only for an index */
+typedef int (*BaseMathCheckFunc)(BaseMathObject *);               /* checks the user is still valid */
+typedef int (*BaseMathGetFunc)(BaseMathObject *, int);            /* gets the vector from the user */
+typedef int (*BaseMathSetFunc)(BaseMathObject *, int);            /* sets the users vector values once its modified */
+typedef int (*BaseMathGetIndexFunc)(BaseMathObject *, int, int);  /* same as above but only for an index */
+typedef int (*BaseMathSetIndexFunc)(BaseMathObject *, int, int);  /* same as above but only for an index */
 
 struct Mathutils_Callback {
 	BaseMathCheckFunc		check;
@@ -102,10 +104,14 @@
 int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index);
 
 /* since this is called so often avoid where possible */
-#define BaseMath_ReadCallback(_self) (((_self)->cb_user ?	_BaseMathObject_ReadCallback((BaseMathObject *)_self):0))
-#define BaseMath_WriteCallback(_self) (((_self)->cb_user ?_BaseMathObject_WriteCallback((BaseMathObject *)_self):0))
-#define BaseMath_ReadIndexCallback(_self, _index) (((_self)->cb_user ?	_BaseMathObject_ReadIndexCallback((BaseMathObject *)_self, _index):0))
-#define BaseMath_WriteIndexCallback(_self, _index) (((_self)->cb_user ?	_BaseMathObject_WriteIndexCallback((BaseMathObject *)_self, _index):0))
+#define BaseMath_ReadCallback(_self) \
+	(((_self)->cb_user ?	_BaseMathObject_ReadCallback((BaseMathObject *)_self):0))
+#define BaseMath_WriteCallback(_self) \
+	(((_self)->cb_user ?_BaseMathObject_WriteCallback((BaseMathObject *)_self):0))
+#define BaseMath_ReadIndexCallback(_self, _index) \
+	(((_self)->cb_user ?	_BaseMathObject_ReadIndexCallback((BaseMathObject *)_self, _index):0))
+#define BaseMath_WriteIndexCallback(_self, _index) \
+	(((_self)->cb_user ?	_BaseMathObject_WriteIndexCallback((BaseMathObject *)_self, _index):0))
 
 /* utility func */
 int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *value, const char *error_prefix);

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Color.h
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Color.h	2011-11-29 20:13:20 UTC (rev 42268)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Color.h	2011-11-29 20:22:35 UTC (rev 42269)
@@ -39,7 +39,7 @@
 #define ColorObject_Check(_v) PyObject_TypeCheck((_v), &color_Type)
 
 typedef struct {
-	BASE_MATH_MEMBERS(col)
+	BASE_MATH_MEMBERS(col);
 } ColorObject;
 
 /*struct data contains a pointer to the actual data that the

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Euler.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Euler.c	2011-11-29 20:13:20 UTC (rev 42268)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Euler.c	2011-11-29 20:22:35 UTC (rev 42269)
@@ -264,8 +264,11 @@
 	if (BaseMath_ReadCallback(self) == -1)
 		return NULL;
 
-	if (mathutils_array_parse(teul, EULER_SIZE, EULER_SIZE, value, "euler.make_compatible(other), invalid 'other' arg") == -1)
+	if (mathutils_array_parse(teul, EULER_SIZE, EULER_SIZE, value,
+	                          "euler.make_compatible(other), invalid 'other' arg") == -1)
+	{
 		return NULL;
+	}
 
 	compatible_eul(self->eul, teul);
 

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Euler.h
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Euler.h	2011-11-29 20:13:20 UTC (rev 42268)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Euler.h	2011-11-29 20:22:35 UTC (rev 42269)
@@ -39,7 +39,7 @@
 #define EulerObject_Check(_v) PyObject_TypeCheck((_v), &euler_Type)
 
 typedef struct {
-	BASE_MATH_MEMBERS(eul)
+	BASE_MATH_MEMBERS(eul);
 	unsigned char order;		/* rotation order */
 
 } EulerObject;

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c	2011-11-29 20:13:20 UTC (rev 42268)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c	2011-11-29 20:22:35 UTC (rev 42269)
@@ -125,7 +125,7 @@
 
 	switch(PyTuple_GET_SIZE(args)) {
 		case 0:
-			return (PyObject *) Matrix_CreatePyObject(NULL, 4, 4, Py_NEW, type);
+			return Matrix_CreatePyObject(NULL, 4, 4, Py_NEW, type);
 		case 1:
 		{
 			PyObject *arg= PyTuple_GET_ITEM(args, 0);
@@ -478,7 +478,9 @@
 		int vec_size= (matSize == 2 ? 2 : 3);
 		float tvec[4];
 
-		if (mathutils_array_parse(tvec, vec_size, vec_size, axis, "Matrix.OrthoProjection(axis, size), invalid 'axis' arg") == -1) {
+		if (mathutils_array_parse(tvec, vec_size, vec_size, axis,
+		                          "Matrix.OrthoProjection(axis, size), invalid 'axis' arg") == -1)
+		{
 			return NULL;
 		}
 
@@ -827,12 +829,12 @@
 		return NULL;
 
 	if (self->col_size==4 && self->row_size==4) {
-		return (PyObject *)Matrix_CreatePyObject(self->contigPtr, 4, 4, Py_NEW, Py_TYPE(self));
+		return Matrix_CreatePyObject(self->contigPtr, 4, 4, Py_NEW, Py_TYPE(self));
 	}
 	else if (self->col_size==3 && self->row_size==3) {
 		float mat[4][4];
 		copy_m4_m3(mat, (float (*)[3])self->contigPtr);
-		return (PyObject *)Matrix_CreatePyObject((float *)mat, 4, 4, Py_NEW, Py_TYPE(self));
+		return Matrix_CreatePyObject((float *)mat, 4, 4, Py_NEW, Py_TYPE(self));
 	}
 	/* TODO, 2x2 matrix */
 
@@ -1133,7 +1135,7 @@
 		return NULL;
 	}
 
-	return (PyObject*)Matrix_CreatePyObject(mat, self->row_size, self->col_size, Py_NEW, Py_TYPE(self));
+	return Matrix_CreatePyObject(mat, self->row_size, self->col_size, Py_NEW, Py_TYPE(self));
 }
 
 /*---------------------------matrix.determinant() ----------------*/
@@ -1286,7 +1288,7 @@
 	if (BaseMath_ReadCallback(self) == -1)
 		return NULL;
 
-	return (PyObject*)Matrix_CreatePyObject((float (*))self->contigPtr, self->row_size, self->col_size, Py_NEW, Py_TYPE(self));
+	return Matrix_CreatePyObject((float (*))self->contigPtr, self->row_size, self->col_size, Py_NEW, Py_TYPE(self));
 }
 
 /*----------------------------print object (internal)-------------*/
@@ -1470,7 +1472,9 @@
 			/*parse each sub sequence*/
 			PyObject *item= PySequence_Fast_GET_ITEM(value_fast, i);
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list