Document licensed Tesla revision and daylight Unreal walkthrough

This commit is contained in:
2026-09-15 17:48:37 +10:00
parent ac5407f073
commit cdf0d311ac
24 changed files with 668 additions and 6 deletions

View File

@@ -0,0 +1,24 @@
import unreal as u,time,json
from pathlib import Path
P=Path(__file__).resolve().parents[3];A=u.get_editor_subsystem(u.EditorActorSubsystem);E=u.get_editor_subsystem(u.LevelEditorSubsystem);world=u.get_editor_subsystem(u.UnrealEditorSubsystem).get_editor_world();u.EditorPythonScripting.set_keep_python_script_alive(True)
actors=A.get_all_level_actors()
sun=next(a for a in actors if isinstance(a,u.DirectionalLight))
sun.set_actor_rotation(u.MathLibrary.find_look_at_rotation(u.Vector(1200,-1400,2400),u.Vector(0,0,0)),False)
sun.set_actor_scale3d(u.Vector(1,1,1))
direction=sun.get_actor_forward_vector()
assert direction.z < -.5,str(direction)
sun.light_component.set_intensity(65000)
E.save_current_level()
f=P/'unreal-daylight-checks.json';r=json.loads(f.read_text());r['sun_forward']=[direction.x,direction.y,direction.z];r['sun_rotation']=str(sun.get_actor_rotation());r['sun_direction_corrected']=True;r['sun_elevation_degrees']=52.46;f.write_text(json.dumps(r,indent=2))
for c in ['r.HighResScreenshotDelay 64','r.AntiAliasingMethod 2','r.TemporalAASamples 64']:u.SystemLibrary.execute_console_command(world,c)
actors=A.get_all_level_actors()
cams=[next(a for a in actors if a.get_actor_label()==n) for n in ['CAM - Overview','CAM - Verandah','CAM - Licensed Tesla garage']];state={'start':time.monotonic(),'i':0,'task':None}
def tick(dt):
if time.monotonic()-state['start']<25:return
if state['task'] is None:
u.AutomationLibrary.finish_loading_before_screenshot();cam=cams[state['i']];u.EditorLevelLibrary.set_level_viewport_camera_info(cam.get_actor_location(),cam.get_actor_rotation());state['task']=u.AutomationLibrary.take_high_res_screenshot(1600,1000,str(P/'renders'/('daylight-'+['overview','verandah','tesla'][state['i']]+'.png')),camera=cam,delay=6)
elif state['task'].is_task_done():
state['i']+=1;state['task']=None
if state['i']==3:
u.unregister_slate_post_tick_callback(handle);u.log('CORRECTED_SUN_CAPTURED');u.SystemLibrary.quit_editor()
handle=u.register_slate_post_tick_callback(tick)