[Bf-blender-cvs] [cf7bdb4] master: BGE VideoTexture: refresh() on ImageFFmpeg should have no effect.

Benoit Bolsee noreply at git.blender.org
Fri Dec 5 00:00:34 CET 2014


Commit: cf7bdb42ac7c270ae9711d30bfb9db623111b0c8
Author: Benoit Bolsee
Date:   Thu Dec 4 23:49:15 2014 +0100
Branches: master
https://developer.blender.org/rBcf7bdb42ac7c270ae9711d30bfb9db623111b0c8

BGE VideoTexture: refresh() on ImageFFmpeg should have no effect.

ImageFFmpeg objects will not refresh properly because the image
file is closed immediately after creation. Therefore refresh()
should have no effect on them.
This was causing problems with ImageMix using ImageFFmpeg as
sources: refreshing the ImageMix object is required to update
the mix but it has the side effect of refreshing the underlying
sources, hence the need to skip refresh on fixed images.

===================================================================

M	source/gameengine/VideoTexture/VideoFFmpeg.cpp
M	source/gameengine/VideoTexture/VideoFFmpeg.h

===================================================================

diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
index edf3c58..db76ba5 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
@@ -86,6 +86,13 @@ VideoFFmpeg::~VideoFFmpeg ()
 {
 }
 
+void VideoFFmpeg::refresh(void)
+{
+    // a fixed image will not refresh because it is loaded only once at creation
+    if (m_isImage)
+        return;
+    m_avail = false;
+}
 
 // release components
 bool VideoFFmpeg::release()
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.h b/source/gameengine/VideoTexture/VideoFFmpeg.h
index 4a948fe..4834a7c 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.h
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.h
@@ -85,7 +85,8 @@ public:
 
 	/// release video source
 	virtual bool release (void);
-
+    /// overwrite base refresh to handle fixed image
+    virtual void refresh(void);
 	/// play video
 	virtual bool play (void);
 	/// pause video




More information about the Bf-blender-cvs mailing list