diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-04-20 19:06:46 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-04-20 19:06:46 +0400 |
commit | 874c29cea8e6f9bc411fccf2d6f4cb07e94328d0 (patch) | |
tree | 5971e577cf7c02e05a1e37b5ad058c71a6744877 /source/gameengine/VideoTexture | |
parent | 7555bfa793a2b0fc187c6211c56986f35b2d7b09 (diff) | |
parent | c5bc4e4fb1a33eda8c31f2ea02e91f32f74c8fa5 (diff) |
2.50: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19323:HEAD
Notes:
* blenderbuttons and ICON_SNAP_PEEL_OBJECT were not merged.
Diffstat (limited to 'source/gameengine/VideoTexture')
-rw-r--r-- | source/gameengine/VideoTexture/FilterNormal.cpp | 21 | ||||
-rw-r--r-- | source/gameengine/VideoTexture/FilterSource.h | 3 | ||||
-rw-r--r-- | source/gameengine/VideoTexture/ImageRender.cpp | 27 | ||||
-rw-r--r-- | source/gameengine/VideoTexture/ImageViewport.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/VideoTexture/Texture.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/VideoTexture/VideoBase.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/VideoTexture/VideoFFmpeg.h | 8 | ||||
-rw-r--r-- | source/gameengine/VideoTexture/blendVideoTex.cpp | 10 |
8 files changed, 45 insertions, 30 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; } diff --git a/source/gameengine/VideoTexture/FilterSource.h b/source/gameengine/VideoTexture/FilterSource.h index 6385ed5108f..254e0a02679 100644 --- a/source/gameengine/VideoTexture/FilterSource.h +++ b/source/gameengine/VideoTexture/FilterSource.h @@ -225,7 +225,7 @@ protected: // otherwise if only vertical interpolation is needed } } - else if ((y & 1) == 1) + else if ((y & 1) == 1) { // if this pixel is on the edge if (isEdge(x, y, size)) { @@ -239,6 +239,7 @@ protected: d = interpolV(m_buffU + offset) - 128; e = interpolV(m_buffV + offset) - 128; } + } // convert to RGB // R = clip(( 298 * C + 409 * E + 128) >> 8) // G = clip(( 298 * C - 100 * D - 208 * E + 128) >> 8) diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp index 58697ed3cc7..09c3c22f258 100644 --- a/source/gameengine/VideoTexture/ImageRender.cpp +++ b/source/gameengine/VideoTexture/ImageRender.cpp @@ -28,7 +28,7 @@ http://www.gnu.org/copyleft/lesser.txt. #include <math.h> -#include <BIF_gl.h> +#include "GL/glew.h" #include "KX_PythonInit.h" #include "DNA_scene_types.h" @@ -249,7 +249,7 @@ void ImageRender::Render() // restore the stereo mode now that the matrix is computed m_rasterizer->SetStereoMode(stereomode); - // do not update the mesh, we don't want to do it more than once per frame + // do not update the mesh transform, we don't want to do it more than once per frame //m_scene->UpdateMeshTransformations(); m_scene->CalculateVisibleMeshes(m_rasterizer,m_camera); @@ -434,26 +434,35 @@ static int ImageMirror_init (PyObject * pySelf, PyObject * args, PyObject * kwds { // get scene pointer KX_Scene * scenePtr (NULL); - if (scene != NULL && PyObject_TypeCheck(scene, &KX_Scene::Type)) - scenePtr = static_cast<KX_Scene*>(scene); - else + if (scene != NULL && PyObject_TypeCheck(scene, &KX_Scene::Type)) + scenePtr = static_cast<KX_Scene*>BGE_PROXY_REF(scene); + else THRWEXCP(SceneInvalid, S_OK); - + + if(scenePtr==NULL) /* incase the python proxy reference is invalid */ + THRWEXCP(SceneInvalid, S_OK); + // get observer pointer KX_GameObject * observerPtr (NULL); if (observer != NULL && PyObject_TypeCheck(observer, &KX_GameObject::Type)) - observerPtr = static_cast<KX_GameObject*>(observer); + observerPtr = static_cast<KX_GameObject*>BGE_PROXY_REF(observer); else if (observer != NULL && PyObject_TypeCheck(observer, &KX_Camera::Type)) - observerPtr = static_cast<KX_Camera*>(observer); + observerPtr = static_cast<KX_Camera*>BGE_PROXY_REF(observer); else THRWEXCP(ObserverInvalid, S_OK); + + if(observerPtr==NULL) /* incase the python proxy reference is invalid */ + THRWEXCP(ObserverInvalid, S_OK); // get mirror pointer KX_GameObject * mirrorPtr (NULL); if (mirror != NULL && PyObject_TypeCheck(mirror, &KX_GameObject::Type)) - mirrorPtr = static_cast<KX_GameObject*>(mirror); + mirrorPtr = static_cast<KX_GameObject*>BGE_PROXY_REF(mirror); else THRWEXCP(MirrorInvalid, S_OK); + + if(mirrorPtr==NULL) /* incase the python proxy reference is invalid */ + THRWEXCP(MirrorInvalid, S_OK); // locate the material in the mirror RAS_IPolyMaterial * material = getMaterial(mirror, materialID); diff --git a/source/gameengine/VideoTexture/ImageViewport.cpp b/source/gameengine/VideoTexture/ImageViewport.cpp index 4c2c81e2208..a4e36b5948c 100644 --- a/source/gameengine/VideoTexture/ImageViewport.cpp +++ b/source/gameengine/VideoTexture/ImageViewport.cpp @@ -25,7 +25,7 @@ http://www.gnu.org/copyleft/lesser.txt. #include <PyObjectPlus.h> #include <structmember.h> -#include <BIF_gl.h> +#include "GL/glew.h" #include "Texture.h" #include "ImageBase.h" diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp index 12d4e79ad89..3533cee0f7f 100644 --- a/source/gameengine/VideoTexture/Texture.cpp +++ b/source/gameengine/VideoTexture/Texture.cpp @@ -45,7 +45,7 @@ http://www.gnu.org/copyleft/lesser.txt. #include "Exception.h" #include <memory.h> -#include <BIF_gl.h> +#include "GL/glew.h" // macro for exception handling and logging diff --git a/source/gameengine/VideoTexture/VideoBase.cpp b/source/gameengine/VideoTexture/VideoBase.cpp index 10117c3af9e..3c703d75cda 100644 --- a/source/gameengine/VideoTexture/VideoBase.cpp +++ b/source/gameengine/VideoTexture/VideoBase.cpp @@ -22,7 +22,7 @@ http://www.gnu.org/copyleft/lesser.txt. #if defined WIN32 #define WINDOWS_LEAN_AND_MEAN -#include <Windows.h> +#include <windows.h> #endif #include "VideoBase.h" diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.h b/source/gameengine/VideoTexture/VideoFFmpeg.h index 51ce2c4eebe..51f1067c466 100644 --- a/source/gameengine/VideoTexture/VideoFFmpeg.h +++ b/source/gameengine/VideoTexture/VideoFFmpeg.h @@ -25,10 +25,10 @@ http://www.gnu.org/copyleft/lesser.txt. #ifdef WITH_FFMPEG extern "C" { #include <pthread.h> -#include <ffmpeg/avformat.h> -#include <ffmpeg/avcodec.h> -#include <ffmpeg/rational.h> -#include <ffmpeg/swscale.h> +#include <libavformat/avformat.h> +#include <libavcodec/avcodec.h> +#include <libavutil/rational.h> +#include <libswscale/swscale.h> #include "DNA_listBase.h" #include "BLI_threads.h" #include "BLI_blenlib.h" diff --git a/source/gameengine/VideoTexture/blendVideoTex.cpp b/source/gameengine/VideoTexture/blendVideoTex.cpp index ec066811a52..c11e7fffecd 100644 --- a/source/gameengine/VideoTexture/blendVideoTex.cpp +++ b/source/gameengine/VideoTexture/blendVideoTex.cpp @@ -1,6 +1,6 @@ /* $Id$ ----------------------------------------------------------------------------- -This source file is part of VideoTexure library +This source file is part of VideoTexture library Copyright (c) 2006 The Zdeno Ash Miklas @@ -49,14 +49,14 @@ static PyObject * getMaterialID (PyObject *self, PyObject *args) char * matName; // get parameters - if (!PyArg_ParseTuple(args, "Os", &obj, &matName)) + if (!PyArg_ParseTuple(args, "Os:materialID", &obj, &matName)) return NULL; // get material id short matID = getMaterialID(obj, matName); // if material was not found, report errot if (matID < 0) { - PyErr_SetString(PyExc_RuntimeError, "object doesn't have material with given name"); + PyErr_SetString(PyExc_RuntimeError, "VideoTexture.materialID(ob, string): Object doesn't have material with given name"); return NULL; } // return material ID @@ -67,7 +67,7 @@ static PyObject * getMaterialID (PyObject *self, PyObject *args) // get last error description static PyObject * getLastError (PyObject *self, PyObject *args) { - return Py_BuildValue("s", Exception::m_lastError.c_str()); + return PyString_FromString(Exception::m_lastError.c_str()); } // set log file @@ -89,7 +89,7 @@ static PyObject * imageToArray (PyObject * self, PyObject *args) if (!PyArg_ParseTuple(args, "O", &pyImg) || !pyImageTypes.in(pyImg->ob_type)) { // if object is incorect, report error - PyErr_SetString(PyExc_TypeError, "The value must be a image source object"); + PyErr_SetString(PyExc_TypeError, "VideoTexture.imageToArray(image): The value must be a image source object"); return NULL; } // get image structure |