Fix the sun in L_World and L_Gym: positional unreal.Rotator is (roll, pitch, yaw)

Both scripts passed (pitch, yaw, roll) and pitched the sun upward, so every scene rendered as night and the
viewport's auto exposure sat at EV -8.5, which is what the 'cached lighting is going to be clipped' warning
reports. Keyword arguments now; the gym script re-applies the rotation on an existing sun; the world script
removes the old external actor folder on disk rather than through the asset library, which cannot load
streaming proxies on their own.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Rainer Leit
2026-09-16 22:03:42 +03:00
co-authored by Claude Fable 5.1
parent 4025b04941
commit d64748f76f
535 changed files with 816 additions and 806 deletions
+7 -3
View File
@@ -46,10 +46,14 @@ def ensure_floor():
def ensure_daylight():
if not find_actor("Gym_Sun"):
sun = spawn(unreal.DirectionalLight, "Gym_Sun", unreal.Vector(0, 0, 500), unreal.Rotator(-45, 30, 0))
sun.light_component.set_editor_property("intensity", 8.0)
sun = find_actor("Gym_Sun")
if not sun:
sun = spawn(unreal.DirectionalLight, "Gym_Sun", unreal.Vector(0, 0, 500))
sun.light_component.set_editor_property("intensity", 10.0)
sun.light_component.set_editor_property("atmosphere_sun_light", True)
# Always re-applied, with keyword arguments: positional unreal.Rotator is (roll, pitch, yaw), and the first
# version of this script pitched the sun 30 degrees upward, which lit the gym as night.
sun.set_actor_rotation(unreal.Rotator(roll=0.0, pitch=-45.0, yaw=30.0), False)
if not find_actor("Gym_Sky"):
spawn(unreal.SkyAtmosphere, "Gym_Sky", unreal.Vector(0, 0, 0))
if not find_actor("Gym_SkyLight"):
+11 -5
View File
@@ -12,6 +12,7 @@ Size: 4033 vertices a side at 350 cm a quad is 14.11 km a side, 199 km2. Z scale
+1280 m, so 65535 in the PNG is 1280 m above the landscape origin and sea level (0.18 of the range) is -820 m.
"""
import os
import shutil
import sys
import unreal
@@ -61,9 +62,13 @@ def recreate_level():
unreal.log(f"{LEVEL_PATH} exists; deleting it and its external actors")
level_subsystem.new_level("/Temp/Untitled_Scratch", False) # do not delete the level we stand in
asset_lib.delete_asset(LEVEL_PATH)
for folder in ("/Game/__ExternalActors__/Maps/L_World", "/Game/__ExternalObjects__/Maps/L_World"):
if asset_lib.does_directory_exist(folder):
asset_lib.delete_directory(folder)
# The external actor packages of streaming proxies cannot be loaded on their own, so the asset library
# refuses to delete the folder; remove what is left on disk instead.
content_dir = unreal.Paths.project_content_dir()
for folder in ("__ExternalActors__/Maps/L_World", "__ExternalObjects__/Maps/L_World"):
path = os.path.join(content_dir, folder)
if os.path.isdir(path):
shutil.rmtree(path, ignore_errors=True)
level_subsystem.new_level(LEVEL_PATH, True) # world-partitioned: 200 km2 must stream
@@ -102,8 +107,9 @@ def ground_height_at(x, y, fallback):
def ensure_daylight():
sun = spawn(unreal.DirectionalLight, "World_Sun", unreal.Vector(0, 0, 50000), unreal.Rotator(-38, 25, 0))
sun.light_component.set_editor_property("intensity", 8.0)
# Keyword arguments on purpose: positional unreal.Rotator is (roll, pitch, yaw), and a sun pitched upward is night.
sun = spawn(unreal.DirectionalLight, "World_Sun", unreal.Vector(0, 0, 50000), unreal.Rotator(roll=0.0, pitch=-38.0, yaw=25.0))
sun.light_component.set_editor_property("intensity", 10.0)
sun.light_component.set_editor_property("atmosphere_sun_light", True)
sun.light_component.set_editor_property("dynamic_shadow_distance_movable_light", 60000.0)
spawn(unreal.SkyAtmosphere, "World_Sky")