4
$\begingroup$
import bge

from bge import render, logic

def makescreenshot():
    path = logic.expandPath("//")

    def main(): 

        cont = bge.logic.getCurrentController()
        own = cont.owner

        render.makeScreenshot(path+"image.png")

    main()
makescreenshot()

^This is the code I have to take a screenshot of the current scene and I want to connect this with an always sensor to the camera, but the only way I know to do so is by using bpy...is there any way to take screenshots using bpy or is there any way to add logic bricks using bge?

Thanks!

$\endgroup$
  • $\begingroup$ You want to create logic bricks setup in Blender? I think that is possible. I can remember someone published a generator to be used by the node editor. Btw. makeScreenshot() supports "//" already and the code does not benefit from the nested function "main". So you can get really simple code. - edit: I just checked he generated the python code not the bricks. - sorry $\endgroup$ – Monster Aug 3 '15 at 8:01
  • $\begingroup$ The Blender API blender.org/api/blender_python_api_2_75_3/bpy.ops.logic.html contains something like this: bpy.ops.logic.controller_add(). It might help you to investigate further. $\endgroup$ – Monster Aug 5 '15 at 11:15
-1
$\begingroup$

In Bge you can indeed add an always sensor and link it to the python script

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.