Python: Create default node tree for new materials and worlds
The motivation is to keep backward compatibility after deprecating
`material.use_nodes()` and `world.use_nodes`. For example the
following script would behave the same way in 4.5 and 5.0:
```python
mat = bpy.data.materials.new("My new mat")
mat.use_nodes = True
```
Pull Request: https://projects.blender.org/blender/blender/pulls/147052
This commit is contained in:
@@ -934,6 +934,7 @@ def render_output(scene, bounds, filepath):
|
||||
scene.render.filepath = filepath
|
||||
|
||||
world = bpy.data.worlds.new(name_gen)
|
||||
world.node_tree.nodes.clear()
|
||||
output = world.node_tree.nodes.new("ShaderNodeOutputWorld")
|
||||
background = world.node_tree.nodes.new("ShaderNodeBackground")
|
||||
world.node_tree.links.new(output.outputs["Surface"], background.outputs["Surface"])
|
||||
|
||||
Reference in New Issue
Block a user