[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38379] trunk/blender/source/blender/ python/generic: formatting changes for python mathutils module.
Campbell Barton
ideasman42 at gmail.com
Thu Jul 14 03:25:07 CEST 2011
Revision: 38379
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38379
Author: campbellbarton
Date: 2011-07-14 01:25:05 +0000 (Thu, 14 Jul 2011)
Log Message:
-----------
formatting changes for python mathutils module.
Modified Paths:
--------------
trunk/blender/source/blender/python/generic/mathutils.c
trunk/blender/source/blender/python/generic/mathutils_Color.c
trunk/blender/source/blender/python/generic/mathutils_Euler.c
trunk/blender/source/blender/python/generic/mathutils_Matrix.c
trunk/blender/source/blender/python/generic/mathutils_Quaternion.c
trunk/blender/source/blender/python/generic/mathutils_Vector.c
trunk/blender/source/blender/python/generic/mathutils_geometry.c
Modified: trunk/blender/source/blender/python/generic/mathutils.c
===================================================================
--- trunk/blender/source/blender/python/generic/mathutils.c 2011-07-13 23:45:47 UTC (rev 38378)
+++ trunk/blender/source/blender/python/generic/mathutils.c 2011-07-14 01:25:05 UTC (rev 38379)
@@ -57,8 +57,16 @@
size= PySequence_Fast_GET_SIZE(value_fast);
if(size > array_max || size < array_min) {
- if (array_max == array_min) PyErr_Format(PyExc_ValueError, "%.200s: sequence size is %d, expected %d", error_prefix, size, array_max);
- else PyErr_Format(PyExc_ValueError, "%.200s: sequence size is %d, expected [%d - %d]", error_prefix, size, array_min, array_max);
+ if (array_max == array_min) {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s: sequence size is %d, expected %d",
+ error_prefix, size, array_max);
+ }
+ else {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s: sequence size is %d, expected [%d - %d]",
+ error_prefix, size, array_min, array_max);
+ }
Py_DECREF(value_fast);
return -1;
}
@@ -67,7 +75,10 @@
do {
i--;
if(((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) && PyErr_Occurred()) {
- PyErr_Format(PyExc_ValueError, "%.200s: sequence index %d expected a number, found '%.200s' type, ", error_prefix, i, Py_TYPE(item)->tp_name);
+ PyErr_Format(PyExc_ValueError,
+ "%.200s: sequence index %d expected a number, "
+ "found '%.200s' type, ",
+ error_prefix, i, Py_TYPE(item)->tp_name);
Py_DECREF(value_fast);
return -1;
}
@@ -93,8 +104,16 @@
}
if(size > array_max || size < array_min) {
- if (array_max == array_min) PyErr_Format(PyExc_ValueError, "%.200s: sequence size is %d, expected %d", error_prefix, size, array_max);
- else PyErr_Format(PyExc_ValueError, "%.200s: sequence size is %d, expected [%d - %d]", error_prefix, size, array_min, array_max);
+ if (array_max == array_min) {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s: sequence size is %d, expected %d",
+ error_prefix, size, array_max);
+ }
+ else {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s: sequence size is %d, expected [%d - %d]",
+ error_prefix, size, array_min, array_max);
+ }
return -1;
}
@@ -135,7 +154,9 @@
return -1;
}
else if(((MatrixObject *)value)->col_size < 3 || ((MatrixObject *)value)->row_size < 3) {
- PyErr_Format(PyExc_ValueError, "%.200s: matrix must have minimum 3x3 dimensions", error_prefix);
+ PyErr_Format(PyExc_ValueError,
+ "%.200s: matrix must have minimum 3x3 dimensions",
+ error_prefix);
return -1;
}
else {
@@ -145,7 +166,9 @@
}
}
else {
- PyErr_Format(PyExc_TypeError, "%.200s: expected a Euler, Quaternion or Matrix type, found %.200s", error_prefix, Py_TYPE(value)->tp_name);
+ PyErr_Format(PyExc_TypeError,
+ "%.200s: expected a Euler, Quaternion or Matrix type, "
+ "found %.200s", error_prefix, Py_TYPE(value)->tp_name);
return -1;
}
}
@@ -213,8 +236,11 @@
if(cb->get(self, self->cb_subtype) != -1)
return 0;
- if(!PyErr_Occurred())
- PyErr_Format(PyExc_RuntimeError, "%s read, user has become invalid", Py_TYPE(self)->tp_name);
+ if(!PyErr_Occurred()) {
+ PyErr_Format(PyExc_RuntimeError,
+ "%s read, user has become invalid",
+ Py_TYPE(self)->tp_name);
+ }
return -1;
}
@@ -224,8 +250,11 @@
if(cb->set(self, self->cb_subtype) != -1)
return 0;
- if(!PyErr_Occurred())
- PyErr_Format(PyExc_RuntimeError, "%s write, user has become invalid", Py_TYPE(self)->tp_name);
+ if(!PyErr_Occurred()) {
+ PyErr_Format(PyExc_RuntimeError,
+ "%s write, user has become invalid",
+ Py_TYPE(self)->tp_name);
+ }
return -1;
}
@@ -235,8 +264,11 @@
if(cb->get_index(self, self->cb_subtype, index) != -1)
return 0;
- if(!PyErr_Occurred())
- PyErr_Format(PyExc_RuntimeError, "%s read index, user has become invalid", Py_TYPE(self)->tp_name);
+ if(!PyErr_Occurred()) {
+ PyErr_Format(PyExc_RuntimeError,
+ "%s read index, user has become invalid",
+ Py_TYPE(self)->tp_name);
+ }
return -1;
}
@@ -246,8 +278,11 @@
if(cb->set_index(self, self->cb_subtype, index) != -1)
return 0;
- if(!PyErr_Occurred())
- PyErr_Format(PyExc_RuntimeError, "%s write index, user has become invalid", Py_TYPE(self)->tp_name);
+ if(!PyErr_Occurred()) {
+ PyErr_Format(PyExc_RuntimeError,
+ "%s write index, user has become invalid",
+ Py_TYPE(self)->tp_name);
+ }
return -1;
}
Modified: trunk/blender/source/blender/python/generic/mathutils_Color.c
===================================================================
--- trunk/blender/source/blender/python/generic/mathutils_Color.c 2011-07-13 23:45:47 UTC (rev 38378)
+++ trunk/blender/source/blender/python/generic/mathutils_Color.c 2011-07-14 01:25:05 UTC (rev 38379)
@@ -43,7 +43,9 @@
float col[3]= {0.0f, 0.0f, 0.0f};
if(kwds && PyDict_Size(kwds)) {
- PyErr_SetString(PyExc_TypeError, "mathutils.Color(): takes no keyword args");
+ PyErr_SetString(PyExc_TypeError,
+ "mathutils.Color(): "
+ "takes no keyword args");
return NULL;
}
@@ -55,7 +57,9 @@
return NULL;
break;
default:
- PyErr_SetString(PyExc_TypeError, "mathutils.Color(): more then a single arg given");
+ PyErr_SetString(PyExc_TypeError,
+ "mathutils.Color(): "
+ "more then a single arg given");
return NULL;
}
return newColorObject(col, Py_NEW, type);
@@ -174,7 +178,9 @@
if(i<0) i= COLOR_SIZE-i;
if(i < 0 || i >= COLOR_SIZE) {
- PyErr_SetString(PyExc_IndexError, "color[attribute]: array index out of range");
+ PyErr_SetString(PyExc_IndexError,
+ "color[attribute]: "
+ "array index out of range");
return NULL;
}
@@ -191,14 +197,17 @@
float f = PyFloat_AsDouble(value);
if(f == -1 && PyErr_Occurred()) { // parsed item not a number
- PyErr_SetString(PyExc_TypeError, "color[attribute] = x: argument not a number");
+ PyErr_SetString(PyExc_TypeError,
+ "color[attribute] = x: "
+ "argument not a number");
return -1;
}
if(i<0) i= COLOR_SIZE-i;
if(i < 0 || i >= COLOR_SIZE){
- PyErr_SetString(PyExc_IndexError, "color[attribute] = x: array assignment index out of range");
+ PyErr_SetString(PyExc_IndexError, "color[attribute] = x: "
+ "array assignment index out of range");
return -1;
}
@@ -250,7 +259,9 @@
return -1;
if(size != (end - begin)){
- PyErr_SetString(PyExc_TypeError, "color[begin:end] = []: size mismatch in slice assignment");
+ PyErr_SetString(PyExc_TypeError,
+ "color[begin:end] = []: "
+ "size mismatch in slice assignment");
return -1;
}
@@ -285,12 +296,15 @@
return Color_slice(self, start, stop);
}
else {
- PyErr_SetString(PyExc_TypeError, "slice steps not supported with color");
+ PyErr_SetString(PyExc_TypeError,
+ "slice steps not supported with color");
return NULL;
}
}
else {
- PyErr_Format(PyExc_TypeError, "color indices must be integers, not %.200s", Py_TYPE(item)->tp_name);
+ PyErr_Format(PyExc_TypeError,
+ "color indices must be integers, not %.200s",
+ Py_TYPE(item)->tp_name);
return NULL;
}
}
@@ -314,12 +328,15 @@
if (step == 1)
return Color_ass_slice(self, start, stop, value);
else {
- PyErr_SetString(PyExc_TypeError, "slice steps not supported with color");
+ PyErr_SetString(PyExc_TypeError,
+ "slice steps not supported with color");
return -1;
}
}
else {
- PyErr_Format(PyExc_TypeError, "color indices must be integers, not %.200s", Py_TYPE(item)->tp_name);
+ PyErr_Format(PyExc_TypeError,
+ "color indices must be integers, not %.200s",
+ Py_TYPE(item)->tp_name);
return -1;
}
}
@@ -354,7 +371,9 @@
float col[COLOR_SIZE];
if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) {
- PyErr_SetString(PyExc_AttributeError, "Color addition: arguments not valid for this operation");
+ PyErr_SetString(PyExc_AttributeError,
+ "Color addition: "
+ "arguments not valid for this operation");
return NULL;
}
color1 = (ColorObject*)v1;
@@ -374,7 +393,9 @@
ColorObject *color1 = NULL, *color2 = NULL;
if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) {
- PyErr_SetString(PyExc_AttributeError, "Color addition: arguments not valid for this operation");
+ PyErr_SetString(PyExc_AttributeError,
+ "Color addition: "
+ "arguments not valid for this operation");
return NULL;
}
color1 = (ColorObject*)v1;
@@ -397,7 +418,9 @@
float col[COLOR_SIZE];
if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) {
- PyErr_SetString(PyExc_AttributeError, "Color subtraction: arguments not valid for this operation");
+ PyErr_SetString(PyExc_AttributeError,
+ "Color subtraction: "
+ "arguments not valid for this operation");
return NULL;
}
color1 = (ColorObject*)v1;
@@ -417,7 +440,9 @@
ColorObject *color1= NULL, *color2= NULL;
if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) {
- PyErr_SetString(PyExc_AttributeError, "Color subtraction: arguments not valid for this operation");
+ PyErr_SetString(PyExc_AttributeError,
+ "Color subtraction: "
+ "arguments not valid for this operation");
return NULL;
}
color1 = (ColorObject*)v1;
@@ -476,7 +501,10 @@
BLI_assert(!"internal error");
}
- PyErr_Format(PyExc_TypeError, "Color multiplication: not supported between '%.200s' and '%.200s' types", Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
+ PyErr_Format(PyExc_TypeError,
+ "Color multiplication: not supported between "
+ "'%.200s' and '%.200s' types",
+ Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
return NULL;
}
@@ -491,20 +519,25 @@
return NULL;
}
else {
- PyErr_SetString(PyExc_TypeError, "Color division not supported in this order");
+ PyErr_SetString(PyExc_TypeError,
+ "Color division not supported in this order");
return NULL;
}
/* make sure v1 is always the vector */
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list