4
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!

batFINGER
  • 84,216
  • 10
  • 108
  • 233
29374819
  • 331
  • 4
  • 10
  • 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 – Monster Aug 03 '15 at 08:01
  • The Blender API http://www.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. – Monster Aug 05 '15 at 11:15

1 Answers1

-1

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

enter image description here