Skip to content

Commit

Permalink
add operator to quickly attach a sun to the sky
Browse files Browse the repository at this point in the history
  • Loading branch information
Theverat committed Mar 18, 2018
1 parent 36727b0 commit 792fdf3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion engine/final.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _render_layer(engine, scene):
last_stat_refresh = time()
computed_optimal_clamp = False

while not engine.test_break() and not done:
while not done:
now = time()

if now - last_stat_refresh > stat_refresh_interval:
Expand Down
14 changes: 14 additions & 0 deletions operators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,17 @@ def execute(self, context):
new_node.node_tree = vol_tree

return {"FINISHED"}


class LUXCORE_OT_attach_sun_to_sky(bpy.types.Operator):
bl_idname = "luxcore.attach_sun_to_sky"
bl_label = "Attach to Sky"
bl_description = "Attach if the sky should use the rotation and turbidity settings of this sun"

@classmethod
def poll(cls, context):
return context.scene.world and context.object

def execute(self, context):
context.scene.world.luxcore.sun = context.object
return {"FINISHED"}
3 changes: 3 additions & 0 deletions ui/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ def draw(self, context):
layout.prop(lamp.luxcore, "sun_type", expand=True)

if lamp.luxcore.sun_type == "sun":
world = context.scene.world
if world.luxcore.light == "sky2" and world.luxcore.sun != context.object:
layout.operator("luxcore.attach_sun_to_sky", icon="WORLD")
layout.prop(lamp.luxcore, "relsize")
layout.prop(lamp.luxcore, "turbidity")
elif lamp.luxcore.sun_type == "distant":
Expand Down

0 comments on commit 792fdf3

Please sign in to comment.