Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-11-13 13:20:04 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-13 13:20:04 +0400
commit72a7101576dc54f6608fda8a0def19db20d10f44 (patch)
tree25ecaa7957736a02af455a40fa8d0767c8d1b511 /source/blender
parent880225db77cddaa43174388768b81e361e9e99d6 (diff)
include invalid type name in mathutils error messages.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/python/mathutils/mathutils_Color.c42
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c15
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c14
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c35
4 files changed, 61 insertions, 45 deletions
diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c
index c374d0eb73d..3e7aeef3044 100644
--- a/source/blender/python/mathutils/mathutils_Color.c
+++ b/source/blender/python/mathutils/mathutils_Color.c
@@ -370,9 +370,10 @@ static PyObject *Color_add(PyObject *v1, PyObject *v2)
float col[COLOR_SIZE];
if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) {
- PyErr_SetString(PyExc_TypeError,
- "Color addition: "
- "arguments not valid for this operation");
+ PyErr_Format(PyExc_TypeError,
+ "Color addition: (%s + %s) "
+ "invalid type for this operation",
+ Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
return NULL;
}
color1 = (ColorObject*)v1;
@@ -392,9 +393,10 @@ static PyObject *Color_iadd(PyObject *v1, PyObject *v2)
ColorObject *color1 = NULL, *color2 = NULL;
if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) {
- PyErr_SetString(PyExc_TypeError,
- "Color addition: "
- "arguments not valid for this operation");
+ PyErr_Format(PyExc_TypeError,
+ "Color addition: (%s += %s) "
+ "invalid type for this operation",
+ Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
return NULL;
}
color1 = (ColorObject*)v1;
@@ -417,9 +419,10 @@ static PyObject *Color_sub(PyObject *v1, PyObject *v2)
float col[COLOR_SIZE];
if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) {
- PyErr_SetString(PyExc_TypeError,
- "Color subtraction: "
- "arguments not valid for this operation");
+ PyErr_Format(PyExc_TypeError,
+ "Color subtraction: (%s - %s) "
+ "invalid type for this operation",
+ Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
return NULL;
}
color1 = (ColorObject*)v1;
@@ -439,9 +442,10 @@ static PyObject *Color_isub(PyObject *v1, PyObject *v2)
ColorObject *color1= NULL, *color2= NULL;
if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) {
- PyErr_SetString(PyExc_TypeError,
- "Color subtraction: "
- "arguments not valid for this operation");
+ PyErr_Format(PyExc_TypeError,
+ "Color subtraction: (%s -= %s) "
+ "invalid type for this operation",
+ Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
return NULL;
}
color1 = (ColorObject*)v1;
@@ -554,9 +558,10 @@ static PyObject *Color_imul(PyObject *v1, PyObject *v2)
mul_vn_fl(color->col, COLOR_SIZE, scalar);
}
else {
- PyErr_SetString(PyExc_TypeError,
- "Color multiplication: "
- "arguments not acceptable for this operation");
+ PyErr_Format(PyExc_TypeError,
+ "Color multiplication: (%s *= %s) "
+ "invalid type for this operation",
+ Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
return NULL;
}
@@ -585,9 +590,10 @@ static PyObject *Color_idiv(PyObject *v1, PyObject *v2)
mul_vn_fl(color->col, COLOR_SIZE, 1.0f / scalar);
}
else {
- PyErr_SetString(PyExc_TypeError,
- "Color multiplication: "
- "arguments not acceptable for this operation");
+ PyErr_Format(PyExc_TypeError,
+ "Color division: (%s /= %s) "
+ "invalid type for this operation",
+ Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
return NULL;
}
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index 980dbd17a96..293a960e0a6 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -1489,9 +1489,10 @@ static PyObject *Matrix_add(PyObject *m1, PyObject *m2)
mat2 = (MatrixObject*)m2;
if (!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) {
- PyErr_SetString(PyExc_TypeError,
- "Matrix addition: "
- "arguments not valid for this operation");
+ PyErr_Format(PyExc_TypeError,
+ "Matrix addition: (%s + %s) "
+ "invalid type for this operation",
+ Py_TYPE(m1)->tp_name, Py_TYPE(m2)->tp_name);
return NULL;
}
@@ -1520,9 +1521,11 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2)
mat2 = (MatrixObject*)m2;
if (!MatrixObject_Check(m1) || !MatrixObject_Check(m2)) {
- PyErr_SetString(PyExc_TypeError,
- "Matrix addition: "
- "arguments not valid for this operation");
+ PyErr_Format(PyExc_TypeError,
+ "Matrix subtraction: (%s - %s) "
+ "invalid type for this operation",
+ Py_TYPE(m1)->tp_name, Py_TYPE(m2)->tp_name
+ );
return NULL;
}
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index 51ab5b50919..a8585f386d5 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -707,9 +707,10 @@ static PyObject *Quaternion_add(PyObject *q1, PyObject *q2)
QuaternionObject *quat1 = NULL, *quat2 = NULL;
if (!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) {
- PyErr_SetString(PyExc_TypeError,
- "Quaternion addition: "
- "arguments not valid for this operation");
+ PyErr_Format(PyExc_TypeError,
+ "Quaternion addition: (%s + %s) "
+ "invalid type for this operation",
+ Py_TYPE(q1)->tp_name, Py_TYPE(q2)->tp_name);
return NULL;
}
quat1 = (QuaternionObject*)q1;
@@ -730,9 +731,10 @@ static PyObject *Quaternion_sub(PyObject *q1, PyObject *q2)
QuaternionObject *quat1 = NULL, *quat2 = NULL;
if (!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) {
- PyErr_SetString(PyExc_TypeError,
- "Quaternion addition: "
- "arguments not valid for this operation");
+ PyErr_Format(PyExc_TypeError,
+ "Quaternion subtraction: (%s - %s) "
+ "invalid type for this operation",
+ Py_TYPE(q1)->tp_name, Py_TYPE(q2)->tp_name);
return NULL;
}
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index ba7cf604c42..66dda6a9623 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -953,9 +953,10 @@ static PyObject *Vector_add(PyObject *v1, PyObject *v2)
float vec[MAX_DIMENSIONS];
if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) {
- PyErr_SetString(PyExc_AttributeError,
- "Vector addition: "
- "arguments not valid for this operation");
+ PyErr_Format(PyExc_AttributeError,
+ "Vector addition: (%s + %s) "
+ "invalid type for this operation",
+ Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
return NULL;
}
vec1 = (VectorObject*)v1;
@@ -983,9 +984,10 @@ static PyObject *Vector_iadd(PyObject *v1, PyObject *v2)
VectorObject *vec1 = NULL, *vec2 = NULL;
if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) {
- PyErr_SetString(PyExc_AttributeError,
- "Vector addition: "
- "arguments not valid for this operation");
+ PyErr_Format(PyExc_AttributeError,
+ "Vector addition: (%s += %s) "
+ "invalid type for this operation",
+ Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
return NULL;
}
vec1 = (VectorObject*)v1;
@@ -1015,9 +1017,10 @@ static PyObject *Vector_sub(PyObject *v1, PyObject *v2)
float vec[MAX_DIMENSIONS];
if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) {
- PyErr_SetString(PyExc_AttributeError,
- "Vector subtraction: "
- "arguments not valid for this operation");
+ PyErr_Format(PyExc_AttributeError,
+ "Vector subtraction: (%s - %s) "
+ "invalid type for this operation",
+ Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
return NULL;
}
vec1 = (VectorObject*)v1;
@@ -1044,9 +1047,10 @@ static PyObject *Vector_isub(PyObject *v1, PyObject *v2)
VectorObject *vec1= NULL, *vec2= NULL;
if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) {
- PyErr_SetString(PyExc_AttributeError,
- "Vector subtraction: "
- "arguments not valid for this operation");
+ PyErr_Format(PyExc_AttributeError,
+ "Vector subtraction: (%s -= %s) "
+ "invalid type for this operation",
+ Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
return NULL;
}
vec1 = (VectorObject*)v1;
@@ -1281,9 +1285,10 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2)
mul_vn_fl(vec->vec, vec->size, scalar);
}
else {
- PyErr_SetString(PyExc_TypeError,
- "Vector multiplication: "
- "arguments not acceptable for this operation");
+ PyErr_Format(PyExc_TypeError,
+ "Vector multiplication: (%s *= %s) "
+ "invalid type for this operation",
+ Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
return NULL;
}