diff --git a/engine/final.py b/engine/final.py index 1a5ef237..b89be757 100644 --- a/engine/final.py +++ b/engine/final.py @@ -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: diff --git a/operators/__init__.py b/operators/__init__.py index f542501f..01e4929d 100644 --- a/operators/__init__.py +++ b/operators/__init__.py @@ -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"} diff --git a/ui/light.py b/ui/light.py index 4e11d4b4..cc177794 100644 --- a/ui/light.py +++ b/ui/light.py @@ -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":