Node Wrangler: create world output if the node tree is of type world

When using the node.nw_link_out operator (O key) in a world node tree,
a material output would be created instead of a world one.
This commit is contained in:
Damien Picard 2022-06-02 11:48:17 +02:00
parent 67273f17e8
commit ebe0bd5677
1 changed files with 4 additions and 1 deletions

View File

@ -3777,7 +3777,10 @@ class NWLinkToOutputNode(Operator):
if not output_node:
bpy.ops.node.select_all(action="DESELECT")
if tree_type == 'ShaderNodeTree':
output_node = nodes.new('ShaderNodeOutputMaterial')
if context.space_data.shader_type == 'OBJECT':
output_node = nodes.new('ShaderNodeOutputMaterial')
elif context.space_data.shader_type == 'WORLD':
output_node = nodes.new('ShaderNodeOutputWorld')
elif tree_type == 'CompositorNodeTree':
output_node = nodes.new('CompositorNodeComposite')
elif tree_type == 'TextureNodeTree':