I'm trying to store render settings and other settings in a txt-file. Sadly I was not able to find a proper solution on google.

Is there an accurate way get the settings, store them in a file and put them back in an other file?

Example, store this:

bpy.context.scene.render.engine = 'BLENDER_EEVEE'

bpy.context.scene.eevee.taa_render_samples = 45

bpy.context.scene.eevee.use_motion_blur = False

And get it back in another file.

  • 1
    $\begingroup$ blender.stackexchange.com/a/134620/15543 $\endgroup$
    – batFINGER
    Commented Oct 21, 2020 at 9:14
  • $\begingroup$ I've seen that before, but it's not what I'm looking for. As you can see in the Example, it's not just about storing numbers. The second question is, how can I ask blender for the whole lines of code above. If there is a way for that, I can maybe store the code-lines as strings and then work with that somehow. $\endgroup$
    – Andi
    Commented Oct 21, 2020 at 9:20
  • 1
    $\begingroup$ Is this regarding my comment re the presets system? docs.blender.org/api/current/bpy.types.Menu.html#preset-menus which is used to both create a text file of selected properties and read and set from it. Pertaining to the example link would change obj = bpy.context.object to scene = bpy.context.scene and work from there. Could you please edit code markdown into question. $\endgroup$
    – batFINGER
    Commented Oct 21, 2020 at 11:15
  • 1
    $\begingroup$ Run bpy.utils.script_paths("presets") in console. Shows the root of the presets path. The I/O is done for us. $\endgroup$
    – batFINGER
    Commented Nov 1, 2020 at 7:38

1 Answer 1


To set settings:

import bpy
import json

my_txt = '''
    "render": {
        "engine": "BLENDER_EEVEE"
    "eevee": {
        "taa_render_samples": 45,
        "use_motion_blur": false

render_settings = json.loads(my_txt)

for section in render_settings.keys():
    for name, value in render_settings[section].items():
        setattr(getattr(bpy.context.scene, section), name, value)

To get primitive settings:

import bpy
import inspect

primitive_types = {int, str, float, bool}

section = bpy.context.scene.render

def is_valid(i):
    if i[0].startswith('_'):
        return False
    if not type(i[1]) in primitive_types:
        return False
    if section.is_property_readonly(i[0]):
        return False
    return True

settings = inspect.getmembers(section, lambda i: not(inspect.isroutine(i)))
settings = dict([i for i in settings if is_valid(i)])

for name, value in settings.items():
    print(name, value)
  • $\begingroup$ That looks great. I guess I need to learn a lot about json - without that knowledge, I'm not realy able to understand the script. Thank you both for the help! $\endgroup$
    – Andi
    Commented Oct 21, 2020 at 12:00

You must log in to answer this question.

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