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:
authorBenoit Bolsee <benoit.bolsee@online.be>2009-05-25 03:12:38 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2009-05-25 03:12:38 +0400
commit323052068a8f0c35ec293ff3bd70989acfc6be8e (patch)
treeb45786e23b5319d2805463f927410b3a69e40502
parent4e0e720158d9aae16960a1b659def19d8d635b74 (diff)
VideoTexture: exception in C++ was not returning an error in Python. Added function name ini PyArg_ParseTuple.
-rw-r--r--source/gameengine/VideoTexture/ImageBase.cpp8
-rw-r--r--source/gameengine/VideoTexture/ImageBuff.cpp3
-rw-r--r--source/gameengine/VideoTexture/ImageMix.cpp8
-rw-r--r--source/gameengine/VideoTexture/Texture.cpp4
-rw-r--r--source/gameengine/VideoTexture/VideoFFmpeg.cpp7
-rw-r--r--source/gameengine/VideoTexture/blendVideoTex.cpp4
6 files changed, 21 insertions, 13 deletions
diff --git a/source/gameengine/VideoTexture/ImageBase.cpp b/source/gameengine/VideoTexture/ImageBase.cpp
index dcca20de24a..5e2841271a6 100644
--- a/source/gameengine/VideoTexture/ImageBase.cpp
+++ b/source/gameengine/VideoTexture/ImageBase.cpp
@@ -437,7 +437,9 @@ PyObject * Image_getSource (PyImage * self, PyObject * args)
{
// get arguments
char * id;
- if (self->m_image != NULL && PyArg_ParseTuple(args, "s", &id))
+ if (!PyArg_ParseTuple(args, "s:getSource", &id))
+ return NULL;
+ if (self->m_image != NULL)
{
// get source object
PyObject * src = reinterpret_cast<PyObject*>(self->m_image->getSource(id));
@@ -460,7 +462,9 @@ PyObject * Image_setSource (PyImage * self, PyObject * args)
// get arguments
char * id;
PyObject * obj;
- if (self->m_image != NULL && PyArg_ParseTuple(args, "sO", &id, &obj))
+ if (!PyArg_ParseTuple(args, "sO:setSource", &id, &obj))
+ return NULL;
+ if (self->m_image != NULL)
{
// check type of object
if (pyImageTypes.in(obj->ob_type))
diff --git a/source/gameengine/VideoTexture/ImageBuff.cpp b/source/gameengine/VideoTexture/ImageBuff.cpp
index c8e62aff240..c7185660e83 100644
--- a/source/gameengine/VideoTexture/ImageBuff.cpp
+++ b/source/gameengine/VideoTexture/ImageBuff.cpp
@@ -71,10 +71,9 @@ static PyObject * load (PyImage * self, PyObject * args)
short width;
short height;
// parse parameters
- if (!PyArg_ParseTuple(args, "s#hh", &buff, &buffSize, &width, &height))
+ if (!PyArg_ParseTuple(args, "s#hh:load", &buff, &buffSize, &width, &height))
{
// report error
- PyErr_SetString(PyExc_TypeError, "Parameters are not correct");
return NULL;
}
// else check buffer size
diff --git a/source/gameengine/VideoTexture/ImageMix.cpp b/source/gameengine/VideoTexture/ImageMix.cpp
index 2418ba254e4..067143e57bb 100644
--- a/source/gameengine/VideoTexture/ImageMix.cpp
+++ b/source/gameengine/VideoTexture/ImageMix.cpp
@@ -109,7 +109,9 @@ PyObject * getWeight (PyImage * self, PyObject * args)
short weight = 0;
// get arguments
char * id;
- if (self->m_image != NULL && PyArg_ParseTuple(args, "s", &id))
+ if (!PyArg_ParseTuple(args, "s:getWeight", &id))
+ return NULL;
+ if (self->m_image != NULL)
// get weight
weight = getImageMix(self)->getWeight(id);
// return weight
@@ -123,7 +125,9 @@ PyObject * setWeight (PyImage * self, PyObject * args)
// get arguments
char * id;
short weight = 0;
- if (self->m_image != NULL && PyArg_ParseTuple(args, "sh", &id, &weight))
+ if (!PyArg_ParseTuple(args, "sh:setWeight", &id, &weight))
+ return NULL;
+ if (self->m_image != NULL)
// set weight
if (!getImageMix(self)->setWeight(id, weight))
{
diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp
index a8ece4bc17e..51d96d7596e 100644
--- a/source/gameengine/VideoTexture/Texture.cpp
+++ b/source/gameengine/VideoTexture/Texture.cpp
@@ -51,7 +51,7 @@ http://www.gnu.org/copyleft/lesser.txt.
// macro for exception handling and logging
#define CATCH_EXCP catch (Exception & exp) \
-{ exp.report(); }
+{ exp.report(); return NULL; }
// Blender GameObject type
@@ -280,7 +280,7 @@ PyObject * Texture_refresh (Texture * self, PyObject * args)
{
// get parameter - refresh source
PyObject * param;
- if (!PyArg_ParseTuple(args, "O", &param) || !PyBool_Check(param))
+ if (!PyArg_ParseTuple(args, "O:refresh", &param) || !PyBool_Check(param))
{
// report error
PyErr_SetString(PyExc_TypeError, "The value must be a bool");
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
index 08c02628f05..d509f366910 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
@@ -1178,7 +1178,7 @@ static int ImageFFmpeg_init (PyObject * pySelf, PyObject * args, PyObject * kwds
char * file = NULL;
// get parameters
- if (!PyArg_ParseTuple(args, "s", &file))
+ if (!PyArg_ParseTuple(args, "s:ImageFFmpeg", &file))
return -1;
try
@@ -1203,8 +1203,9 @@ static int ImageFFmpeg_init (PyObject * pySelf, PyObject * args, PyObject * kwds
PyObject * Image_reload (PyImage * self, PyObject *args)
{
char * newname = NULL;
-
- if (self->m_image != NULL && PyArg_ParseTuple(args, "|s", &newname))
+ if (!PyArg_ParseTuple(args, "|s:reload", &newname))
+ return NULL;
+ if (self->m_image != NULL)
{
VideoFFmpeg* video = getFFmpeg(self);
// check type of object
diff --git a/source/gameengine/VideoTexture/blendVideoTex.cpp b/source/gameengine/VideoTexture/blendVideoTex.cpp
index 239f43763b8..1dcc72c8f7d 100644
--- a/source/gameengine/VideoTexture/blendVideoTex.cpp
+++ b/source/gameengine/VideoTexture/blendVideoTex.cpp
@@ -74,7 +74,7 @@ static PyObject * getLastError (PyObject *self, PyObject *args)
static PyObject * setLogFile (PyObject *self, PyObject *args)
{
// get parameters
- if (!PyArg_ParseTuple(args, "s", &Exception::m_logFile))
+ if (!PyArg_ParseTuple(args, "s:setLogFile", &Exception::m_logFile))
return Py_BuildValue("i", -1);
// log file was loaded
return Py_BuildValue("i", 0);
@@ -86,7 +86,7 @@ static PyObject * imageToArray (PyObject * self, PyObject *args)
{
// parameter is Image object
PyObject * pyImg;
- if (!PyArg_ParseTuple(args, "O", &pyImg) || !pyImageTypes.in(pyImg->ob_type))
+ if (!PyArg_ParseTuple(args, "O:imageToArray", &pyImg) || !pyImageTypes.in(pyImg->ob_type))
{
// if object is incorect, report error
PyErr_SetString(PyExc_TypeError, "VideoTexture.imageToArray(image): The value must be a image source object");