Setup automatic rendering of different blender files via python scripting

by Gagandeep Singh   Last Updated April 16, 2019 08:15 AM

I want to achieve following functionality using python in blender -

  1. I want to open blender files located at a given path.
  2. Change textures of some objects in that blender file
  3. Set angle of the camera
  4. Render the scene and save the render at a given location. This will go in a loop for many blender scenes with proper lighting.

From above points I have achieved all points. But my problem is when i open a blender file using following script -

obj_root = pathlib.Path("I:/PythonBlender/first.blend") bpy.ops.wm.open_mainfile(filepath= str(obj_root))

the old file running the python scripts is closed and this new first.blend file is opened in blender. I want my python scripts to keep running and the scenes should load as an addon. and remove the addon scenes after rendering is finished. I also want to know what approach you will follow to achieve the above functionality with proper memory management and loading, unloading of textures and other files after rendering is done.



Related Questions


Updated March 28, 2015 06:05 AM

Updated August 12, 2015 17:06 PM

Updated June 07, 2017 09:15 AM

Updated July 05, 2017 13:15 PM