[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38136] trunk/blender/doc/python_api: moving bge.texture example to an external file
Dalai Felinto
dfelinto at gmail.com
Wed Jul 6 09:15:57 CEST 2011
Revision: 38136
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38136
Author: dfelinto
Date: 2011-07-06 07:15:56 +0000 (Wed, 06 Jul 2011)
Log Message:
-----------
moving bge.texture example to an external file
Modified Paths:
--------------
trunk/blender/doc/python_api/rst/bge.texture.rst
Added Paths:
-----------
trunk/blender/doc/python_api/examples/bge.texture.py
Added: trunk/blender/doc/python_api/examples/bge.texture.py
===================================================================
--- trunk/blender/doc/python_api/examples/bge.texture.py (rev 0)
+++ trunk/blender/doc/python_api/examples/bge.texture.py 2011-07-06 07:15:56 UTC (rev 38136)
@@ -0,0 +1,32 @@
+"""
+Basic Video Playback
+++++++++++++++++++++++
+Example of how to replace a texture in game with a video. It needs to run everyframe
+"""
+import bge
+from bge import texture
+from bge import logic
+
+cont = logic.getCurrentController()
+obj = cont.owner
+
+# the creation of the texture must be done once: save the
+# texture object in an attribute of bge.logic module makes it persistent
+if not hasattr(logic, 'video'):
+
+ # identify a static texture by name
+ matID = texture.materialID(obj, 'IMvideo.png')
+
+ # create a dynamic texture that will replace the static texture
+ logic.video = texture.Texture(obj, matID)
+
+ # define a source of image for the texture, here a movie
+ movie = logic.expandPath('//trailer_400p.ogg')
+ logic.video.source = texture.VideoFFmpeg(movie)
+ logic.video.source.scale = True
+
+ # 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.
+logic.video.refresh(True)
\ No newline at end of file
Property changes on: trunk/blender/doc/python_api/examples/bge.texture.py
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/blender/doc/python_api/rst/bge.texture.rst
===================================================================
--- trunk/blender/doc/python_api/rst/bge.texture.rst 2011-07-06 07:05:29 UTC (rev 38135)
+++ trunk/blender/doc/python_api/rst/bge.texture.rst 2011-07-06 07:15:56 UTC (rev 38136)
@@ -1,6 +1,7 @@
Game Engine bge.texture Module
==============================
+
.. note::
This documentation is still very weak, and needs some help! Right now they are mostly a collection
of the docstrings found in the bge.texture source code + some random places filled with text.
@@ -38,37 +39,7 @@
When the texture object is deleted, the new texture is deleted and the old texture restored.
.. module:: bge.texture
-
-.. code-block:: python
- import bge
- from bge import texture
- from bge import logic
-
- cont = logic.getCurrentController()
- obj = cont.owner
-
- # the creation of the texture must be done once: save the
- # texture object in an attribute of GameLogic module makes it persistent
- if not hasattr(logic, 'video'):
-
- # identify a static texture by name
- matID = texture.materialID(obj, 'IMvideo.png')
-
- # create a dynamic texture that will replace the static texture
- logic.video = texture.Texture(obj, matID)
-
- # define a source of image for the texture, here a movie
- movie = logic.expandPath('//trailer_400p.ogg')
- logic.video.source = texture.VideoFFmpeg(movie)
- logic.video.source.scale = True
-
- # 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.
- logic.video.refresh(True)
-
.. class:: VideoFFmpeg(file [, capture=-1, rate=25.0, width=0, height=0])
FFmpeg video source
More information about the Bf-blender-cvs
mailing list