Nodes: Remove "Use Nodes" in Shader Editor for World
Part of https://projects.blender.org/blender/blender/pulls/141278 Blend files compatibility: If a World exists and "Use Nodes" is disabled, we add new nodes to the existing node tree (or create one if it doesn't) that emulates the behavior of a world without a node tree. This ensures backward and forward compatibility. Python API compatibility: - `world.use_nodes` was removed from Python API => **Breaking change** - `world.color` is still being used by Workbench, so it stays there, although it has no effect anymore when using Cycles or EEVEE. Python API changes: Creating a World using `bpy.data.worlds.new()` now creates a World with an empty (embedded) node tree. This was necessary to enable Python scripts to add nodes without having to create a node tree (which is currently not possible, because World node trees are embedded). Pull Request: https://projects.blender.org/blender/blender/pulls/142342
This commit is contained in:
@@ -934,8 +934,10 @@ def render_output(scene, bounds, filepath):
|
||||
scene.render.filepath = filepath
|
||||
|
||||
world = bpy.data.worlds.new(name_gen)
|
||||
world.color = 1.0, 1.0, 1.0
|
||||
world.use_nodes = False
|
||||
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"])
|
||||
background.inputs["Color"].default_value = 1.0, 1.0, 1.0, 1.0
|
||||
scene.world = world
|
||||
|
||||
# Some space around the edges.
|
||||
|
||||
Reference in New Issue
Block a user