diff options
Diffstat (limited to 'source/gameengine/VideoTexture/FilterNormal.cpp')
-rw-r--r-- | source/gameengine/VideoTexture/FilterNormal.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/source/gameengine/VideoTexture/FilterNormal.cpp b/source/gameengine/VideoTexture/FilterNormal.cpp index 03a79c1c8ce..a7266967efb 100644 --- a/source/gameengine/VideoTexture/FilterNormal.cpp +++ b/source/gameengine/VideoTexture/FilterNormal.cpp @@ -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; } |