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:
authorAaron Carlisle <carlisle.b3d@gmail.com>2018-03-30 01:02:04 +0300
committerAaron Carlisle <carlisle.b3d@gmail.com>2018-03-30 01:02:04 +0300
commitee2aa319821fdf8be869fc2800711d01b6350f41 (patch)
treeea714e077fdfee31946091676486addb2ecad52a /doc/python_api/examples/bge.texture.py
parent354dfdac8824baffa46080f3552ae255451b2d40 (diff)
PyDoc: Merge manual docs for bge.texture
https://docs.blender.org/manual/en/dev/game_engine/python_api/videotexture.html Had a few things that this file did not while this file having things the other did not. To fix, I merged both documents into the python api.
Diffstat (limited to 'doc/python_api/examples/bge.texture.py')
-rw-r--r--doc/python_api/examples/bge.texture.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/doc/python_api/examples/bge.texture.py b/doc/python_api/examples/bge.texture.py
index ac1f5a21447..8b24530b10a 100644
--- a/doc/python_api/examples/bge.texture.py
+++ b/doc/python_api/examples/bge.texture.py
@@ -1,8 +1,11 @@
"""
Basic Video Playback
++++++++++++++++++++
-Example of how to replace a texture in game with a video. It needs to run
-everyframe.
+Example of how to replace a texture in game with a video.
+It needs to run everyframe.
+To avoid any confusion with the location of the file,
+we will use ``GameLogic.expandPath()`` to build an absolute file name,
+assuming the video file is in the same directory as the blend-file.
"""
import bge
from bge import texture
@@ -26,8 +29,18 @@ if not hasattr(logic, 'video'):
logic.video.source = texture.VideoFFmpeg(movie)
logic.video.source.scale = True
+ # Note that we can change the ``Texture`` source at any time.
+ # Suppose we want to switch between two movies during the game:
+ logic.mySources[0] = texture.VideoFFmpeg('movie1.avi')
+ logic.mySources[1] = texture.VideoFFmpeg('movie2.avi')
+
+ #And then assign (and reassign) the source during the game
+ logic.video.source = logic.mySources[movieSel]
+
# quick off the movie, but it wont play in the background
logic.video.source.play()
-# you need to call this function every frame to ensure update of the texture.
+
+# Video playback is not a background process: it happens only when we refresh the texture.
+# So you need to call this function every frame to ensure update of the texture.
logic.video.refresh(True)