Reputation:
At Blender I can use Python to develop a game... But can I also use Blender in Python? Is it possible to import Blender into a Python script? Here I made an overview:
Python ->
Blender ->
import Models -> create the game
Is this possible?
Thank you
Upvotes: 3
Views: 1815
Reputation: 1
You can use the old Blender 2.79 to develope a game in the game engine. Or you go to the fork of the Blender Game Engine: https://upbge.org. Another solution is the Armory Project: https://armory3d.org which integrated their engine capabilities into Blender.
And yes you can built Blender as a python module: Blender as Python Module If you want to dig deep into the topic, you might be interested in Tensorflow or Torch. Tensorflow is a neural network. If you want to build a game in 3 clicks, you first need to integrate the game development process into a Tensorflow or Torch model.
Torch-Project-Website Tensorflow-Project-Website
Upvotes: 0
Reputation: 2355
Sorry it is not possible, Many softwares and platforms support for python and they have their own implementation which are completely isolated. However I liked what @sambler proposed however doing that you have to be familiar with Blender source codes which is in C and I bet if someone could extract Blender's python object outside the project will do the rest in C not python, Theoretically you are able to do that but actually it is not a good idea!
Upvotes: 0
Reputation: 7079
Technically yes that is possible.
First you need to compile blender from source yourself - see the blender wiki and this little bit of information here
Basically when you first setup the configuration for building blender there is an option called WITH_PYTHON_MODULE
which is described as Enable building as a python module which runs without a user interface, like running regular blender in background mode (experimental, only enable for development)
If building using cmake this option is listed under Advanced options so you need to enable advanced options to see it. Not certain if scons has a similar option.
This appears mostly undocumented, but sounds like you import bpy and have access to what you would normally use in a blender script just with the limitations of not having a gui.
Upvotes: 2
Reputation: 638
This package link is a module which gives you access to Blender colors, objects etc
Just have a look!
Upvotes: 1
Reputation:
I don't know concretely I just know that you can import 3D-models with the fileending .obj into pygame with this script:
Upvotes: -1