ledcube3d/Content/Python/init_unreal.py

24 lines
894 B
Python

import os
import runpy
import unreal
if os.environ.get("LED_VOLUME_CREATE_RC_PRESET") == "1":
project_dir = unreal.Paths.project_dir()
script_path = os.path.join(project_dir, "Scripts", "CreateLedVolumeRemotePreset.py")
unreal.log(f"LED volume startup preset build: {script_path}")
runpy.run_path(script_path, run_name="__main__")
if os.environ.get("LED_VOLUME_OPEN_DEMO") == "1":
tick_handle = None
def open_led_demo_map(delta_seconds):
global tick_handle
if tick_handle is not None:
unreal.unregister_slate_post_tick_callback(tick_handle)
tick_handle = None
unreal.EditorLevelLibrary.load_level("/Game/LedVolume/Maps/L_LedVolume_Demo_Single")
unreal.log("LED volume startup opened /Game/LedVolume/Maps/L_LedVolume_Demo_Single")
tick_handle = unreal.register_slate_post_tick_callback(open_led_demo_map)