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>2008-11-02 01:28:27 +0300
committerBenoit Bolsee <benoit.bolsee@online.be>2008-11-02 01:28:27 +0300
commit68f50e0c6b147d9603d151d99f5085c09c0ce039 (patch)
tree8309e1b97962f127d5e492f88e38319e6d519e09 /source/gameengine/VideoTexture
parente72d6c7bfaee29c0a1c360237299484ca5caaeb7 (diff)
VideoTexture: remove numpy dependency.
Diffstat (limited to 'source/gameengine/VideoTexture')
-rw-r--r--source/gameengine/VideoTexture/blendVideoTex.cpp25
1 files changed, 4 insertions, 21 deletions
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 <Python.h>
#include <RAS_GLExtensionManager.h>
#include <RAS_IPolygonMaterial.h>
-#include <numpy/arrayobject.h>
-
//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<PyImage*>(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);