From 68f50e0c6b147d9603d151d99f5085c09c0ce039 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Sat, 1 Nov 2008 22:28:27 +0000 Subject: VideoTexture: remove numpy dependency. --- source/gameengine/VideoTexture/blendVideoTex.cpp | 25 ++++-------------------- 1 file changed, 4 insertions(+), 21 deletions(-) (limited to 'source/gameengine/VideoTexture') diff --git a/source/gameengine/VideoTexture/blendVideoTex.cpp b/source/gameengine/VideoTexture/blendVideoTex.cpp index d08762b1d7c..7f55024fe4c 100644 --- a/source/gameengine/VideoTexture/blendVideoTex.cpp +++ b/source/gameengine/VideoTexture/blendVideoTex.cpp @@ -20,16 +20,12 @@ http://www.gnu.org/copyleft/lesser.txt. ----------------------------------------------------------------------------- */ -#define PY_ARRAY_UNIQUE_SYMBOL numpyPtr - #include #include #include -#include - //Old API //#include "TexPlayer.h" //#include "TexImage.h" @@ -85,15 +81,6 @@ static PyObject * setLogFile (PyObject *self, PyObject *args) } -// function to initialize numpy structures -static bool initNumpy (void) -{ - // init module and report failure - import_array1(false); - // report success - return true; -} - // image to numpy array static PyObject * imageToArray (PyObject * self, PyObject *args) { @@ -107,15 +94,14 @@ static PyObject * imageToArray (PyObject * self, PyObject *args) } // get image structure PyImage * img = reinterpret_cast(pyImg); - // check initialization of numpy interface, and initialize it if needed - if (numpyPtr == NULL && !initNumpy()) Py_RETURN_NONE; // create array object - npy_intp dim[1]; - dim[0] = img->m_image->getBuffSize() / sizeof(unsigned int); unsigned int * imgBuff = img->m_image->getImage(); // if image is available, convert it to array if (imgBuff != NULL) - return PyArray_SimpleNewFromData(1, dim, NPY_UBYTE, imgBuff); + // Nasty problem here: the image buffer is an array of integers + // in the processor endian format. The user must take care of that in the script. + // Need to find an elegant solution to this problem + return Py_BuildValue("s#", imgBuff, img->m_image->getBuffSize()); // otherwise return None Py_RETURN_NONE; } @@ -189,9 +175,6 @@ PyObject* initVideoTexture(void) if (m == NULL) return NULL; - // prepare numpy array - numpyPtr = NULL; - // initialize classes pyImageTypes.reg(m); pyFilterTypes.reg(m); -- cgit v1.2.3