5
$\begingroup$

I have some basic render settings (border off, resolution, etc.) that I would like to have applied for all scenes in the .blend file using Python, via the -P command line switch.

I have tried:

for scene in bpy.data.scenes:

but it only operates on the active scene.

$\endgroup$
  • $\begingroup$ Operators usually operate on the active scene, if you iterate over bpy.data.scenes however, it will give you all scenes in the .blend. The active scene can be determined via bpy.context.scene. $\endgroup$ – CoDEmanX May 6 '14 at 20:23
7
$\begingroup$

It works fine for me.

import bpy

for scene in bpy.data.scenes:
    scene.render.resolution_x = 1920
    scene.render.resolution_y = 1080
    scene.render.resolution_percentage = 100
    scene.render.use_border = False

Placing this in a file (test.py) and running blender with

blender test.blend -P test.py

Opens blender with all the settings set to the values defined in the Python script, in both scenes.

$\endgroup$
  • $\begingroup$ Yes it works, classic user error, after adding the for loop I forgot to change "bpy.context.scene." to "scene." so it only got called on the current scene (for a couple of times :-) $\endgroup$ – Geejay May 6 '14 at 20:48

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.