2.50: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19323...
[blender.git] / source / gameengine / VideoTexture / FilterNormal.cpp
index 03a79c1..a726696 100644 (file)
@@ -74,7 +74,7 @@ static int setColor (PyFilter * self, PyObject * value, void * closure)
        // check validity of parameter
        if (value == NULL || !PyInt_Check(value))
        {
-               PyErr_SetString(PyExc_TypeError, "The value must be a int");
+               PyErr_SetString(PyExc_TypeError, "filt.colorIdx = int: VideoTexture.FilterNormal, expected the value must be a int");
                return -1;
        }
        // set color index
@@ -94,15 +94,20 @@ static PyObject * getDepth (PyFilter * self, void * closure)
 static int setDepth (PyFilter * self, PyObject * value, void * closure)
 {
        // check validity of parameter
-       if (value == NULL || !PyFloat_Check(value))
+       if (value)
        {
-               PyErr_SetString(PyExc_TypeError, "The value must be a float");
-               return -1;
+               float depth= (float)PyFloat_AsDouble(value);
+               if ((depth==-1 && PyErr_Occurred()) == 0) /* no error converting to a float? */
+               {
+                       // set depth
+                       getFilter(self)->setDepth(depth);
+                       // success
+                       return 0;
+               }
        }
-       // set depth
-       getFilter(self)->setDepth(float(PyFloat_AsDouble(value)));
-       // success
-       return 0;
+
+       PyErr_SetString(PyExc_TypeError, "filt.depth = float: VideoTexture.FilterNormal, expected the value must be a float");
+       return -1;
 }