include invalid type name in mathutils error messages.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user