From 54401d36aadabe38decd9cd64f1385e1757bd303 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Sat, 1 Nov 2008 12:48:46 +0000 Subject: [PATCH] BGE Video Texture: fix constant initializer problem with Exception description. Uniformized the line ending. --- source/gameengine/VideoTexture/Exception.cpp | 13 ++++++++++++- source/gameengine/VideoTexture/Exception.h | 15 +++++++++++++++ source/gameengine/VideoTexture/ImageMix.cpp | 4 ++-- source/gameengine/VideoTexture/ImageRender.cpp | 10 +++++++--- source/gameengine/VideoTexture/Texture.cpp | 4 ++-- source/gameengine/VideoTexture/VideoFFmpeg.cpp | 2 +- source/gameengine/VideoTexture/blendVideoTex.cpp | 1 + 7 files changed, 40 insertions(+), 9 deletions(-) diff --git a/source/gameengine/VideoTexture/Exception.cpp b/source/gameengine/VideoTexture/Exception.cpp index a326430b27a..c576cebddc8 100644 --- a/source/gameengine/VideoTexture/Exception.cpp +++ b/source/gameengine/VideoTexture/Exception.cpp @@ -44,7 +44,6 @@ ExpDesc errNFoundDesc (ErrNotFound, "Error description not found"); ExpDesc::ExpDesc (ExceptionID & exp, char * desc, RESULT hres) : m_expID(exp), m_hRslt(hres), m_description(desc) { - m_expDescs.push_back(this); } // destructor @@ -196,3 +195,15 @@ void Exception::copy (const Exception & xpt) m_fileName = xpt.m_fileName; m_line = xpt.m_line; } + +void registerAllExceptions(void) +{ + errGenerDesc.registerDesc(); + errNFoundDesc.registerDesc(); + MaterialNotAvailDesc.registerDesc(); + ImageSizesNotMatchDesc.registerDesc(); + SceneInvalidDesc.registerDesc(); + CameraInvalidDesc.registerDesc(); + SourceVideoEmptyDesc.registerDesc(); + SourceVideoCreationDesc.registerDesc(); +} diff --git a/source/gameengine/VideoTexture/Exception.h b/source/gameengine/VideoTexture/Exception.h index 85865fb3654..5345e87f199 100644 --- a/source/gameengine/VideoTexture/Exception.h +++ b/source/gameengine/VideoTexture/Exception.h @@ -27,6 +27,7 @@ http://www.gnu.org/copyleft/lesser.txt. #include #include #include +#include #include "Common.h" @@ -117,6 +118,11 @@ public: desc = m_description; } + void registerDesc(void) + { + if (std::find(m_expDescs.begin(), m_expDescs.end(), this) == m_expDescs.end()) + m_expDescs.push_back(this); + } // list of exception descriptions static std::vector m_expDescs; @@ -192,4 +198,13 @@ protected: }; +extern ExpDesc MaterialNotAvailDesc; +extern ExpDesc ImageSizesNotMatchDesc; +extern ExpDesc SceneInvalidDesc; +extern ExpDesc CameraInvalidDesc; +extern ExpDesc SourceVideoEmptyDesc; +extern ExpDesc SourceVideoCreationDesc; + + +void registerAllExceptions(void); #endif diff --git a/source/gameengine/VideoTexture/ImageMix.cpp b/source/gameengine/VideoTexture/ImageMix.cpp index 56503066161..71250005129 100644 --- a/source/gameengine/VideoTexture/ImageMix.cpp +++ b/source/gameengine/VideoTexture/ImageMix.cpp @@ -58,9 +58,9 @@ bool ImageMix::setWeight (const char * id, short weight) return true; } -static ExceptionID ImageSizesNotMatch; +ExceptionID ImageSizesNotMatch; -static ExpDesc ImageSizesNotMatchDesc (ImageSizesNotMatch, "Image sizes of sources are different"); +ExpDesc ImageSizesNotMatchDesc (ImageSizesNotMatch, "Image sizes of sources are different"); // calculate image from sources and set its availability void ImageMix::calcImage (unsigned int texId) diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp index c800b92e71d..ce27a24d35a 100644 --- a/source/gameengine/VideoTexture/ImageRender.cpp +++ b/source/gameengine/VideoTexture/ImageRender.cpp @@ -94,6 +94,10 @@ void ImageRender::calcImage (unsigned int texId) ImageViewport::calcImage(texId); } +void ImageRender::Render() +{ + // +} // refresh lights void ImageRender::refreshLights (void) @@ -120,9 +124,9 @@ BlendType sceneType ("KX_Scene"); BlendType cameraType ("KX_Camera"); -static ExceptionID SceneInvalid, CameraInvalid; -static ExpDesc SceneInvalidDesc (SceneInvalid, "Scene object is invalid"); -static ExpDesc CameraInvalidDesc (CameraInvalid, "Camera object is invalid"); +ExceptionID SceneInvalid, CameraInvalid; +ExpDesc SceneInvalidDesc (SceneInvalid, "Scene object is invalid"); +ExpDesc CameraInvalidDesc (CameraInvalid, "Camera object is invalid"); // object initialization static int ImageRender_init (PyObject * pySelf, PyObject * args, PyObject * kwds) diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp index d208802675c..243c5f31db0 100644 --- a/source/gameengine/VideoTexture/Texture.cpp +++ b/source/gameengine/VideoTexture/Texture.cpp @@ -165,8 +165,8 @@ void Texture_dealloc (Texture * self) } -static ExceptionID MaterialNotAvail; -static ExpDesc MaterialNotAvailDesc (MaterialNotAvail, "Texture material is not available"); +ExceptionID MaterialNotAvail; +ExpDesc MaterialNotAvailDesc (MaterialNotAvail, "Texture material is not available"); // Texture object initialization int Texture_init (Texture *self, PyObject *args, PyObject *kwds) diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp index b12bad4b416..65bd5f4cbf4 100644 --- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp +++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp @@ -265,7 +265,7 @@ void VideoFFmpeg::openCam (char * file, short camIdx) AVInputFormat *inputFormat; AVFormatParameters formatParams; AVRational frameRate; - char *p, filename[28], rateStr[20]; + char filename[28], rateStr[20]; do_init_ffmpeg(); diff --git a/source/gameengine/VideoTexture/blendVideoTex.cpp b/source/gameengine/VideoTexture/blendVideoTex.cpp index 0f15a26db2f..d08762b1d7c 100644 --- a/source/gameengine/VideoTexture/blendVideoTex.cpp +++ b/source/gameengine/VideoTexture/blendVideoTex.cpp @@ -174,6 +174,7 @@ PyObject* initVideoTexture(void) // prepare classes registerAllTypes(); + registerAllExceptions(); if (!pyImageTypes.ready()) return NULL;