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$
1
  • $\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, 2014 at 20:23

1 Answer 1

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$
1
  • $\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, 2014 at 20:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .