Skip to content

Commit

Permalink
Fixed creating sky if no world output
Browse files Browse the repository at this point in the history
  • Loading branch information
jlampel committed Jan 12, 2021
1 parent 1a48fda commit 28e7850
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions light_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,13 @@ def execute(self, context):
if bpy.context.scene.world == None:
bpy.context.scene.world = bpy.data.worlds.new(name=self.name + " Sky")
world = bpy.context.scene.world
world.use_nodes = True
nodes = world.node_tree.nodes
if "World Output" not in nodes.keys():
nodes.new("ShaderNodeOutputWorld")
if "Background" not in nodes.keys():
background = nodes.new("ShaderNodeBackground")
world.node_tree.links.new(background.outputs[0], nodes["World Output"].inputs[0])
sky_texture = nodes.new("ShaderNodeTexSky")
sky_texture.sky_type = "HOSEK_WILKIE"
sky_texture.turbidity = self.skyTurbidity
Expand Down

0 comments on commit 28e7850

Please sign in to comment.