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!
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.
Sign up to join this communityThe 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.
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$
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$