3
$\begingroup$

I intend to make a framework for BGE using wxPython, being able to manage blend file libs, datablocks of the blends, alternative ways to make logic and ease the project management in general. I need to use Blender to edit the blend files contents (add logic bricks, edit datablocks, etc), so at first I thought to call blender in background mode through command line and execute Python scripts generated by the framework to make the changes to the blends. However, that would imply to open blender (in background) and save the blend file for each operation, even the simplest ones (like renaming), or queue the changes and add a annoying 'Apply' button. So, I wonder if it's possible to 'take control' of Blender's Python using the framework's Python, so the user can see the changes by the framework in real-time while being able to do changes that the framework won't do (like modeling, texturing, animation, etc). Is that possible? Thanks.

$\endgroup$
  • $\begingroup$ The ‘exec_from_stdin.py’ example from blender.stackexchange.com/a/101772/29586 is very similar - allows you to effectively pipe the output from one command into Blender to be invoked as python commands. However, it won’t work as-is on Windows - Linux (and possibly Mac) only. $\endgroup$ – Rich Sedman Mar 19 '18 at 10:17
  • $\begingroup$ Would it be possible to fire up your framework from inside Blender, so the Python running your framework is already the same one that's controlling Blender? $\endgroup$ – ajwood Jun 11 at 12:12
1
$\begingroup$

You'll have to build it yourself, but you can build Blender as a Python module. You can then do import bpy and use it as if you're inside Blender.

$\endgroup$
  • 1
    $\begingroup$ The wiki was archived, I've copied the page to the new wiki. $\endgroup$ – dr. Sybren Jun 11 at 12:05

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.