Skip to content

Python & Blueprint

Everything in the panel is available from Python in the editor, and the runtime part from Blueprint and Python in the game. There are three entry points:

  • unreal.TALamplighterEditorSubsystem (editor): capture scenarios, apply, preview, compare, thumbnails, contact sheets, transition previews and the Scenario Blender.
  • unreal.TALamplighterLibrary (runtime, also as Blueprint nodes in the ta Lamplighter category): apply and blend in a world, compare, capture the current lighting.
  • TALamplighterSubsystem of a world (runtime): transitions, scenario volumes and their events. TALamplighterLibrary.get_lamplighter_subsystem(world) returns it.
import unreal
sub = unreal.get_editor_subsystem(unreal.TALamplighterEditorSubsystem)
day = sub.create_scenario("Day", unreal.TALamplighterCaptureOptions(), "")
night = sub.create_scenario("Night", unreal.TALamplighterCaptureOptions(), "")
sub.apply_scenario(day)
sub.start_compare(day, night)
sub.export_contact_sheet([day, night], "D:/Review/looks.png", "D:/Review/looks.pdf", 0)

TALamplighterCaptureOptions has categories (a bit per category, all by default; TALamplighterLibrary.make_category_mask builds one from a list), tags (only actors with one of these tags) and actors (only these actors). An empty folder uses the folder from the settings.

world = unreal.get_editor_subsystem(unreal.UnrealEditorSubsystem).get_editor_world()
lib = unreal.TALamplighterLibrary
options = unreal.TALamplighterBlendOptions()
options.duration = 4.0
lib.blend_to_scenario(world, night, options)
lamplighter = lib.get_lamplighter_subsystem(world)
print(lamplighter.get_active_scenario_volume())

TALamplighterBlendOptions: duration (seconds, 0 applies at once), easing (LINEAR, EASE_IN, EASE_OUT, EASE_IN_OUT, SMOOTH_STEP), stagger (0 to 0.95), stagger_order (DISTANCE, DISTANCE_REVERSED, RANDOM, NAME), stagger_from_viewer and stagger_origin.

Function What it does
create_scenario(name, options, folder) Captures the editor level into a new scenario asset (saved).
recapture_scenario(scenario) Captures the scenario again from the level, with the options it was made with (undoable).
apply_scenario(scenario) Applies the scenario to the editor level (undoable, saved with the level).
find_scenarios(all_levels) Scenarios captured in the open level, or in any level.
save_scenario(scenario) Saves the asset.
preview_scenario(scenario), end_preview(restore), is_previewing() Shows a scenario without changing the level for good.
diff_scenarios(a, b, include_same) Value differences; a null side is the editor level as it is.
start_compare(a, b), stop_compare(restore), keep_compare_side(keep_b), recapture_compare() The A/B desk. A null side is the level as it was.
set_compare_mode(mode), set_compare_wipe(position), set_compare_show_a(show_a) The view: WIPE, SIDE_BY_SIDE, FLICKER, TOGGLE.
get_compare_stats() Mean luminance, stops difference, clipped and crushed per side, changed pixels, histograms, changed values.
save_compare_image(path, which) Saves A, B, side by side or the wipe as a PNG.
is_compare_busy(), is_comparing(), is_compare_view_stale() The state of the comparison.
capture_thumbnails(scenarios) Viewport thumbnails (async; the lighting is put back after).
export_contact_sheet(scenarios, png, pdf, columns) 2 to 12 scenarios from the current camera as a PNG and a PDF page.
compose_contact_sheet_from_files(images, names, png, pdf, columns) A sheet from your own pictures.
is_playing(), create_scenario_from_play(name, options, folder) Capture during Play in Editor.
play_transition_preview(a, b, options), scrub_transition(a, b, options, alpha) Transition previews in the editor (no undo).
add_blender_to_level(a, b) Places a Scenario Blender set up with A and B.
save_viewport_image(path) Saves the current viewport as a PNG (game view).
open_panel(), show_panel_page(page), set_panel_pair(a, b) Opens the panel on a page, with A and B picked.
Function What it does
apply_scenario(world, scenario) Applies the scenario at once.
blend_to_scenario(world, scenario, options) Blends from the current lighting to the scenario.
set_scenario_blend(world, a, b, alpha, options) Sets the lighting to a point between two scenarios (0 = A, 1 = B).
stop_transitions(world, jump_to_end), is_blending(world), get_active_scenario(world) Transition state.
advance_transitions(world, delta), set_automatic_tick(world, enabled) Move transitions by hand (tests, custom clocks).
get_stagger_order(world) Labels of local lights in the order the newest transition changes them.
capture_current_lighting(world, options) Captures the current lighting into a new temporary scenario.
compare_with_level(world, scenario), compare_scenarios(a, b) Value differences.
get_resolved_actors(scenario), find_scenario_value(scenario, actor, property), read_actor_value(actor, component, property), format_value(value) Read values for scripts and tests.

On the world’s subsystem: set_scenario_volumes_enabled, get_active_scenario_volume, update_scenario_volumes(location, delta) (for custom cameras or tests), reset_scenario_volumes, get_blend_progress, and the events on_transition_started and on_transition_finished.

The runtime library functions are Blueprint nodes in the ta Lamplighter category: Blend To Scenario, Apply Scenario, Set Scenario Blend, Stop Transitions, Is Blending, Get Active Scenario, Capture Current Lighting and the others. Scenario volumes have the On Viewer Entered and On Viewer Left events; the Scenario Blender has Set Blend Alpha, Apply Blend and Restore Editor Lighting.