4
$\begingroup$

How can I use Blender's bpy outside Blender? I need to use it in a project to check for some Blender settings in a .blend-file and to automatically start rendering. Since it should completely stand-alone I don't want to set up any paths.

Thanks!

$\endgroup$

1 Answer 1

4
$\begingroup$

The easy way is to use blender. You can start it with cli options to run in the background (without gui) and to run a python script.

blender --background --python myscript.py

You can also start rendering from the cli without a script.

blender -b mymodel.blend --render-frame 1

or render an animation

blender -b mymodel.blend --frame-start 1 --frame-end 100 --render-anim

For something more interactive you can use blenders built-in python console

blender -b --python-console

The other option to get access to bpy without a normal blender install means you will need to compile your own copy of blender as a pymodule.

$\endgroup$
2
  • $\begingroup$ The blender command can only be run if you're in the folder where Blender is installed (if you don't use paths, of course). So let's say I have a copy of Blender in my projects folder; how can use the blender command? $\endgroup$
    – user34684
    Commented Feb 10, 2018 at 14:26
  • $\begingroup$ If the system can't find blender in it's search of known commands, you need to provide a path that will allow it to be found. If it is in the current dir, then ./blender can be used on *nix systems, other OS's vary. Everything else remains the same, with the exception of finding scriptand blend files that you specify by name or path. $\endgroup$
    – sambler
    Commented Feb 10, 2018 at 20:55

You must log in to answer this question.