So I have a camera fly-by and I would like to save the frames from the Game Engine to make a movie.
I have this code from Mike Pans old mountain fly-by scene, but it does not seem to work in 2.65. Or maybe I am doing something wrong, but.
Should this work?
import Rasterizer
cont = GameLogic.getCurrentController()
obj = cont.getOwner()
sep = ""
num = str(obj.counter)
filename = sep.join([num,".BMP"])
Rasterizer.makeScreenshot(filename)
obj.counter += 1
dberube4
(dberube4)
January 16, 2013, 1:37pm
2
Try this code:
I assumed “counter” is a property.
from bge.logic import getCurrentController
from bge.render import makeScreenshot
cont = getCurrentController()
obj = cont.owner()
num = str(obj['counter'])
filename = "{0}.BMP".format(num)
makeScreenshot(filename)
obj['counter'] += 1
well rasterizer is now bge.render and gamelogic is now bge.logic so try this maybe:
from bge import render,logic
cont = logic.getCurrentController()
obj = cont.owner
sep = ""
try: num = str(obj['counter'])
except : obj['counter'] = 0; num = str(obj['counter'])
filename = sep.join([num,".BMP"])
render.makeScreenshot(filename)
obj['counter'] += 1
I think it will save your screenshots in the folder you installed Blender
Mobious
(Mobious)
January 16, 2013, 1:49pm
4
Use this code instead.
import Rasterizer
import bge
cont = bge.logic.getCurrentController()
obj = cont.owner
num = str(obj['counter'])
filename = '//' + num
Rasterizer.makeScreenshot(filename)
obj['counter'] += 1
Make sure the object running the script has a integer property named ‘counter’.
Mobious:
Use this code instead.
import Rasterizer
import bge
cont = bge.logic.getCurrentController()
obj = cont.owner
num = str(obj['counter'])
filename = '//' + num
Rasterizer.makeScreenshot(filename)
obj['counter'] += 1
Make sure the object running the script has a integer property named ‘counter’.
Wait this would be for 2.49 right? And how what would change for 2.65? rasterizer -> bge.render only right?
sdfgeoff
(sdfgeoff)
January 20, 2013, 5:40pm
6
Yeah, he left the rasterizer line at the top. He was trying to take a shortcut importing bge.render as Rasterizer probably. Just use one of the other ones posted above.