I've looked all over this stack for other people's code bits but nothing has worked so far.
I want to run a bpy script. I have the following function which I call at the end of a for loop, after I change the scenes geometry, as I desire.
def render_image_indexed(output_dir, out_type, step, ani_length):
string_order= int(np.ceil(np.log10(ani_length+1)))
index_order = int(np.ceil(np.log10(step+1)))
out_string = ""
for i in range(string_order-index_order):
out_string += "0"
if (step != 0):
out_string += str(int(step))
bpy.context.scene.render.filepath = output_dir+out_string
bpy.ops.render.render(write_still = True)
I have the following set within the bpy script:
#Render settings
bpy.context.scene.render.engine = 'CYCLES'
bpy.context.scene.cycles.device = 'GPU'
Which I hoped would solve the problem, despite having the same settings set within the Blender GUI. I know there is a _cycles package I can import with a _cycles.render(), but I can't find any documentation for this function on the internet. Hopefully you guys have a fish to give, because I'm having trouble catching my own.
Ideally this solution would not involve command line options, though I will welcome one if I must.