Revision: 41774
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41774
Author:   campbellbarton
Date:     2011-11-13 09:20:04 +0000 (Sun, 13 Nov 2011)
Log Message:
-----------
include invalid type name in mathutils error messages.

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

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Color.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Color.c     
2011-11-12 23:38:41 UTC (rev 41773)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Color.c     
2011-11-13 09:20:04 UTC (rev 41774)
@@ -370,9 +370,10 @@
        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 @@
        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 @@
        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 @@
        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 @@
                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 @@
                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;
        }
 

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c    
2011-11-12 23:38:41 UTC (rev 41773)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c    
2011-11-13 09:20:04 UTC (rev 41774)
@@ -1489,9 +1489,10 @@
        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 @@
        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;
        }
 

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Quaternion.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Quaternion.c        
2011-11-12 23:38:41 UTC (rev 41773)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Quaternion.c        
2011-11-13 09:20:04 UTC (rev 41774)
@@ -707,9 +707,10 @@
        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 @@
        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;
        }
 

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Vector.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Vector.c    
2011-11-12 23:38:41 UTC (rev 41773)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Vector.c    
2011-11-13 09:20:04 UTC (rev 41774)
@@ -953,9 +953,10 @@
        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 @@
        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 @@
        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 @@
        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 @@
                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;
        }
 

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to