2
$\begingroup$

I simply want to take the render settings from one scene and copy them to another scene. Something like

bpy.data.scenes[1].render = bpy.data.scenes[0].render

except that this fails as bpy.types.Scene.render is read-only. Ideally I'd like the render settings linked between the scenes but I'll settle for deep-copying.

I previously found Can you link render settings across all scenes so they can all be changed at once? but it doesn't get an answer.

The only solution I can come up with is manually copying each and every attribute one at a time but this seems very cumbersome. I also found https://stackoverflow.com/questions/3818825/python-what-is-the-correct-way-to-copy-an-objects-attributes-over-to-another/3818861#3818861 which gets me some of the way but falls over for read-only attributes, i.e. the other classes within bpy.types.Scene.render.

Any help much appreciated as this appears simple to do! Thanks.

$\endgroup$
1
  • $\begingroup$ Is there a better solution without any add-on now in Blender 3.1? $\endgroup$
    – Chouettou
    Mar 18, 2022 at 8:25

1 Answer 1

3
$\begingroup$

There is this bundled addon for this:

enter image description here

If you specifically need the python code, you can do it like this:

import bpy
settings = ["resolution_x", "resolution_y", "resolution_percentage"]
dict = {sett: getattr(bpy.context.scene.render, sett) for sett in settings}
for scene in bpy.data.scenes:
    for sett, val in dict.items():
        setattr(scene.render, sett, val)
$\endgroup$

You must log in to answer this question.

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