Skip to content

Python

Everything the panel does is available from Python and from Editor Utility Blueprints and Widgets through the editor subsystem TALimnerSubsystem (Blueprint category ta Limner). Enable Unreal’s Python Editor Script Plugin to use it from Python.

import unreal
limner = unreal.get_editor_subsystem(unreal.TALimnerSubsystem)
board = limner.create_board("/Game/ArtDirection/LB_Forest", "/Game/Maps/L_Forest")
ref = limner.add_image_file(board, "C:/Concepts/forest_dusk.png", unreal.Vector2D(0, 0), True)
limner.extract_palette(board, ref, 6)
limner.save_board(board)

Items on a board are identified by their id, a string. Functions return an empty string, False or an invalid result when they fail, and log a warning in the LogTALimner category.

Function Returns Does
create_board(asset_path, level="") TALimnerBoard Creates and saves a board. level is the package path of the level it opens with, for example "/Game/Maps/L_Forest".
save_board(board) bool Saves the board asset.
set_active_board(board) Makes it the board of the panel and the overlay.
get_active_board() TALimnerBoard The active board, or None.
find_board_for_level(level_package) TALimnerBoard The board that belongs to a level, or None.
Function Returns Does
add_image_file(board, file_path, position, auto_place=True) id Adds an image file. With auto_place, the position is ignored and the image goes to the right of the content.
add_texture(board, texture, position, auto_place=True) id Adds a texture’s source image.
add_note(board, text, position, color=...) id Adds a sticky note.
add_group(board, title, position, size, color=...) id Adds a group frame.
add_viewport_capture_to_board(board) id Adds a capture of the viewport as it looks now.
remove_item(board, item_id) bool Removes an item.
set_item_rect(board, item_id, position, size) bool Moves and resizes an item. A zero size keeps the current size.
set_item_text(board, item_id, title, text) bool Sets the title and the text (a note’s text, an image’s caption).
set_item_fit(board, item_id, fit) bool TALimnerFit.FIT, FILL or STRETCH.
get_items(board) list of TALimnerItem Every item of the board.
get_item_id(item) id The id of a TALimnerItem.

Positions and sizes are unreal.Vector2D in board units. Colours are unreal.LinearColor in linear space, so LinearColor(0.95, 0.82, 0.38, 1) looks paler than the same numbers picked in the panel.

Function Returns Does
link_camera(board, item_id, camera_actor) bool Links a reference to a camera actor; None removes the link.
link_bookmark(board, item_id, bookmark) bool Links a reference to a level bookmark 0 to 9; -1 removes the link.
pin_reference(item_id) bool Shows a reference of the active board over the viewport. An empty id hides it.
get_active_reference() id The reference shown over the viewport.
set_overlay(mode, opacity=0.5, wipe=0.5) TALimnerOverlayMode.OFF, OPACITY (Overlay in the panel), DIFFERENCE, ONION_SKIN or WIPE.
set_view_filter(filter, bands=3) TALimnerViewFilter.NORMAL (Color), GRAYSCALE (Values), NOTAN or OFF_PALETTE.
save_viewport_image(file_path) bool Saves the viewport as a clean PNG: game view, without the overlay or a view filter.
save_viewport_with_overlay(file_path) bool Saves the viewport as you see it, with the overlay and the view.
Function Returns Does
extract_palette(board, item_id, count=6) list of TALimnerSwatch Extracts an image’s palette and stores it on the item.
set_board_palette(board, colors) Sets the key palette; an empty list clears it.
compare_viewport(item_id="", bands=0) TALimnerComparison Renders the viewport and compares it with a reference. An empty id uses the active reference; bands=0 uses the panel’s band count.
compare_image_files(reference_file, scene_file, fit, bands, palette, palette_size=6, tolerance=22.0) TALimnerComparison Compares two image files. Needs no viewport. An empty palette extracts one from the reference.
extract_palette_from_file(file_path, count=6) list of TALimnerSwatch The palette of an image file. Needs no viewport.
write_value_image(source_file, output_file, bands) bool Writes a grayscale (bands=0) or notan (2 to 5) PNG of an image file. Needs no viewport.
Function Returns Does
build_color_script(source, sequence=None) TALimnerColorScript TALimnerScriptSource.SEQUENCE, CAMERAS or BOOKMARKS. sequence is a Level Sequence, or None for the one open in Sequencer.
export_color_script(folder="") path Exports the last color script as PNG and JSON. An empty folder uses the Export Folder setting. Returns the PNG’s path.
add_color_script_to_board(board) id Places the strip on the board.
go_to_color_script_shot(index) bool Goes back to a frame of the last color script.
Function Does
open_panel() Opens the Limner panel.
show_panel_page(page) TALimnerPage.BOARD, COMPARE or COLOR_SCRIPT.
select_in_panel(item_ids) Selects items on the board and frames them.
frame_all_in_panel() Frames every item.
compare_in_panel() Runs Compare viewport in the panel.
match_colors_in_panel(apply=False) Runs Solve on the panel’s Match colours card (with its switches, strength and target), and Apply with apply=True.

New in version 1.1. See Match colours, Colour vision preview and Composition guides.

Function Returns Does
solve_color_match(item_id, options) TALimnerColorMatch Matches the viewport’s colours to a reference (empty id: the active reference): renders the scene, suggests post process values, previews them and corrects them over a few rendered passes. The best pass stays in the preview.
solve_color_match_from_files(reference_file, scene_file, fit, options) TALimnerColorMatch The first estimate from two image files, without a viewport (build machines, tests).
set_color_match_preview(match, on) Shows the suggested change in the viewport (nothing is written to the level), or turns the preview off.
is_color_match_preview_on() bool True while a colour match preview is shown in the viewport.
get_color_match_targets() list of TALimnerMatchTargetInfo Where Match colours can write to, the default marked.
apply_color_match(match, target, target_actor, strength=-1.0) actor Writes the suggested values in one undoable step. target_actor picks a camera or volume (None: the default of that kind). Strength 0 to 1 (negative: Project Settings). Returns the camera or volume written to, or None.
export_color_match_lut(match, path, as_texture) path Writes a LUT for what the settings cannot do: a .cube file (path is a file), or a LUT texture asset (path is an asset path; empty: the LUT folder of the Project Settings). Returns the written file or asset path, or an empty string.
apply_color_match_lut(lut, target, target_actor, intensity=1.0) bool Sets a LUT texture with an intensity (0 to 1) as the colour grading LUT of a camera or volume (undoable).
get_grade_of(target_actor) TALimnerGrade The values Match colours works with, as set on a camera or volume (engine defaults where not overridden).
set_color_vision(vision, severity=1.0, also_board=True) Simulates a colour vision deficiency in the viewport (severity 0 to 1); also_board also covers board images and palettes.
get_color_vision(), get_color_vision_severity() The preview in effect.
simulate_color(color, vision, severity=1.0) LinearColor A linear colour as seen with a colour vision deficiency (Machado et al. 2009).
simulate_color_vision_file(source_file, output_file, vision, severity=1.0) bool Writes an image file as seen with a colour vision deficiency (PNG).
check_palette_vision(colors) list of TALimnerVisionWarning Pairs of colours that look alike with protanopia, deuteranopia or tritanopia (thresholds from Project Settings).
delta_e2000(lab_a, lab_b) float CIEDE2000 colour difference of two CIE L*a*b* colours (X = L*, Y = a*, Z = b*).
set_guides(guides) Sets the viewport guides (kept per user). Guides saved for a camera or bookmark take over while looking through it.
get_guides() TALimnerGuides The viewport guides.
get_active_guides() TALimnerGuides The guides drawn right now (saved for the camera or bookmark the viewport looks through, else the viewport guides).
save_guides_for_camera(board, camera, guides) bool Saves guides in the board for a camera: they switch on whenever the viewport looks through it.
save_guides_for_bookmark(board, bookmark, guides) bool Saves guides in the board for a level bookmark (0 to 9).
clear_saved_guides(board, camera, bookmark=-1) bool Removes the guides saved for a camera (or, with None as the camera, for a bookmark).
get_guide_lines(view_size, guides, camera_aspect=0.0) TALimnerGuideGeometry The guides laid out for a view size, as lines, masks and labels (no viewport needed). camera_aspect above 0: a constrained camera frame.
write_guides_image(source_file, output_file, guides) bool Draws the guides into a copy of an image file (PNG), as Show in captures does.

TALimnerComparison: valid, bands, reference and scene (each a TALimnerValueStats), value_match and palette_score (0 to 100), palette, scene_use (the share of the scene nearest to each palette colour), scene_palette and hints.

TALimnerValueStats: mean_l, contrast, darkest, brightest, band_areas and histogram.

TALimnerHint: kind, message and positive.

TALimnerSwatch: color, weight (its share, 0 to 1) and hex.

TALimnerColorScript: source, source_name, shots and error. Each TALimnerScriptShot has name, frame, duration, average_color, palette and mean_l.

TALimnerItem: kind (IMAGE, NOTE or GROUP), position, size, title, text, color, linked_camera, linked_bookmark, fit, palette and palette_weights.

TALimnerBoard: items, level, palette (the key palette) and description (The look).

TALimnerColorMatchOptions: exposure, white_balance, saturation and contrast (on by default), shadows_highlights and make_lut (off by default), and passes (0: Project Settings).

TALimnerColorMatch: valid, item_id, options, current (the values in effect), change, suggested (TALimnerGrade), reference, scene_before and scene_after (each a TALimnerLook), difference_before, difference_after, passes, converged and notes.

TALimnerGrade: exposure, temperature, tint, saturation, contrast, gamma, gain and offset.

TALimnerVisionWarning: index_a, index_b, color_a, color_b, hex_a, hex_b, vision, delta_e (as seen), normal_delta_e and message.

TALimnerGuides: thirds, golden_sections, golden_spiral, spiral_corner, diagonals, reciprocal_diagonals, center_cross, action_safe, title_safe, safe_frames, aspect_mask and the line and mask settings.

import unreal
limner = unreal.get_editor_subsystem(unreal.TALimnerSubsystem)
board = limner.create_board("/Game/ArtDirection/LB_Forest", "/Game/Maps/L_Forest")
ref = limner.add_image_file(board, "C:/Concepts/forest_dusk.png", unreal.Vector2D(0, 0), True)
limner.add_note(board, "Warm rim light, cool fog", unreal.Vector2D(600, 0))
actors = unreal.get_editor_subsystem(unreal.EditorActorSubsystem).get_all_level_actors()
cam = [a for a in actors if a.get_actor_label() == "Cam_Hero"][0]
limner.link_camera(board, ref, cam)
swatches = limner.extract_palette(board, ref, 6)
limner.set_board_palette(board, [s.color for s in swatches])
limner.save_board(board)
limner.set_active_board(board)
limner.pin_reference(ref)
limner.set_overlay(unreal.TALimnerOverlayMode.ONION_SKIN, 0.8, 0.5)
result = limner.compare_viewport(ref, 3)
if result.valid:
print(f"values {result.value_match:.0f}%, palette {result.palette_score:.0f}%")
for hint in result.hints:
print(("OK " if hint.positive else "FIX ") + hint.message)
sequence = unreal.load_asset("/Game/Cinematics/LS_Trailer")
script = limner.build_color_script(unreal.TALimnerScriptSource.SEQUENCE, sequence)
if not script.error:
for shot in script.shots:
print(shot.name, round(shot.mean_l, 1))
print(limner.export_color_script(""))
result = limner.compare_image_files("Concepts/sh010.png", "Renders/sh010.png",
unreal.TALimnerFit.FIT, 3, [], 6, 22.0)
print(result.value_match, result.palette_score)
limner.write_value_image("Renders/sh010.png", "Renders/sh010_notan.png", 3)
match = limner.solve_color_match(ref, unreal.TALimnerColorMatchOptions())
print(match.difference_before, match.difference_after, match.suggested.exposure)
limner.apply_color_match(match, unreal.TALimnerMatchTarget.VOLUME, None, 1.0)
limner.set_color_vision(unreal.TALimnerVision.DEUTERANOPIA, 1.0, True)
print([w.message for w in limner.check_palette_vision([s.color for s in limner.extract_palette(board, ref, 6)])])
guides = unreal.TALimnerGuides()
guides.set_editor_property("thirds", True)
guides.set_editor_property("aspect_mask", unreal.TALimnerAspectMask.RATIO239)
limner.set_guides(guides)