I'm just getting started with the Blender API, and I'm trying to set the background texture using the API.
In the GUI, I do the following:
- Choose the Cycles render engine
bpy.context.scene.render.engine = 'CYCLES'
- Press the World context button,
- In the Surface menu, press Use nodes,
- In the Surface box, Background,
- In the Color box select Gradient Texture,
- In the box below that select Easing,
I tried to reproduce this in the console, with:
bpy.context.space_data.context = 'WORLD' bpy.data.node_groups["Shader Nodetree"].nodes["Gradient Texture"].gradient_type = 'EASING'
and I got the following error:
Traceback (most recent call last):
File "", line 1, in KeyError: 'bpy_prop_collection[key]: key "Shader Nodetree" not found'
I spent over an hour reading the doc and Googling, but I still can't do this in my script? Really appreciate any advice how to do this programatically/in a headless script?