21 lines
2.6 KiB
Python
21 lines
2.6 KiB
Python
import unreal as u,time,json
|
|
from pathlib import Path
|
|
ROOT=Path(__file__).resolve().parents[3];ACT=u.get_editor_subsystem(u.EditorActorSubsystem);LEVEL=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=ACT.get_all_level_actors()
|
|
sun=next(a for a in actors if a.get_actor_label()=='Warm northeast morning');sun.set_actor_rotation(u.Rotator(-32,140,0),False)
|
|
post=next(a for a in actors if a.get_actor_label()=='Natural architectural exposure');p=post.settings;p.auto_exposure_min_brightness=5.7;p.auto_exposure_max_brightness=5.7;p.override_lumen_scene_lighting_quality=True;p.lumen_scene_lighting_quality=2;p.override_lumen_final_gather_quality=True;p.lumen_final_gather_quality=2;post.set_editor_property('settings',p)
|
|
for i,x in enumerate([-350,270]):
|
|
light=ACT.spawn_actor_from_class(u.RectLight,u.Vector(x,-310,300),u.Rotator(-12,90,0));light.set_actor_label('Presentation soft verandah bounce '+str(i));light.light_component.set_mobility(u.ComponentMobility.MOVABLE);light.light_component.set_intensity(2400);light.light_component.set_light_color(u.LinearColor(1,.89,.75,1));light.light_component.set_editor_property('source_width',430);light.light_component.set_editor_property('source_height',190);light.light_component.set_editor_property('attenuation_radius',1100)
|
|
LEVEL.save_current_level()
|
|
for cmd in ['r.HighResScreenshotDelay 64','r.AntiAliasingMethod 2','r.TemporalAASamples 64']:u.SystemLibrary.execute_console_command(world,cmd)
|
|
cams=[next(a for a in actors if a.get_actor_label()=='CAM - Verandah'),next(a for a in actors if a.get_actor_label()=='CAM - Overview')];state={'start':time.monotonic(),'i':0,'task':None}
|
|
def tick(dt):
|
|
if time.monotonic()-state['start']<25:return
|
|
if state['task'] is None:
|
|
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(1920,1080,str(ROOT/'renders'/('unreal-'+['verandah','overview'][state['i']]+'.png')),camera=cam,delay=6)
|
|
elif state['task'].is_task_done():
|
|
state['i']+=1;state['task']=None
|
|
if state['i']==2:
|
|
u.unregister_slate_post_tick_callback(handle);r=json.loads((ROOT/'unreal-build-checks.json').read_text());r['render']='Actual Unreal overview and verandah captures completed';r['lighting']='Northeast sun, architectural fill and Lumen GI';(ROOT/'unreal-build-checks.json').write_text(json.dumps(r,indent=2));u.log('UNREAL_PRESENTATION_REFINED');u.SystemLibrary.quit_editor()
|
|
handle=u.register_slate_post_tick_callback(tick)
|