I’ve started looking into the VideoTexture module and downloaded the demo off the blender wiki. The first thing I noticed was that the code uses “IMvideo.png” to call the texture that’s going to be replaced. This line had an error so I changed it to the “MAVideoMat” and it worked.
My first question… why couldn’t the demo call on the packed texture ‘video.png’. I haven’t been able to get it to successfully use the texture name at all yet.
Once I got the demo working I tried applying VideoTexture my project. After a failed attempt at seeing any changes using VideoTexture.ImageFFmpeg() I decided to just to use the demos code and call the ogg video file that came with it. I still had no luck. Blender is showing no errors and I used ‘print “switch”’ to test that the code was being ran and it was.
c1 is the material applied to my cube.
The scripts run on my cube.
When the ‘S’ key is pressed
import VideoTexture
contr = GameLogic.getCurrentController()
obj = contr.getOwner()
if not hasattr(GameLogic, 'video'):
matID = VideoTexture.materialID(obj, 'MAc1')
GameLogic.video = VideoTexture.Texture(obj, matID)
movie = GameLogic.expandPath('//trailer_400p.ogg')
GameLogic.video.source = VideoTexture.VideoFFmpeg(movie)
GameLogic.video.source.scale = True
GameLogic.video.source.play()
print "switched"
This is always running
# refresh video
if hasattr(GameLogic, 'video'):
GameLogic.video.refresh(True)
Last question, http://blenderartists.org/forum/showthread.php?p=1249864, gives a list of attributes that you can use. I wanted to debug using .status but I couldn’t figure out how to get it to work.
I tried using
print GameLogic.video.status()
and
print GameLogic.video.status
It came back with errors.