32 lines
1.4 KiB
Python
32 lines
1.4 KiB
Python
"""Integration check run inside a full UE editor by run_workshop.py."""
|
|
import unreal
|
|
|
|
from ue_workshop import Sequence, render
|
|
from ue_workshop.paths import PROJECT
|
|
|
|
def build():
|
|
# Respect student edits on disk, but let this test own the render.
|
|
code = (PROJECT / "exercises/my_shot.py").read_text(encoding="utf-8")
|
|
namespace = {"__name__": "__main__"}
|
|
exec(compile(code.replace("RENDER = True", "RENDER = False"), "my_shot.py", "exec"), namespace)
|
|
return namespace
|
|
|
|
|
|
# Execute twice: no duplicate actors, bindings or transform tracks.
|
|
first = build()
|
|
actor_subsystem = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)
|
|
count = len(actor_subsystem.get_all_level_actors())
|
|
second = build()
|
|
assert count == len(actor_subsystem.get_all_level_actors()), "Duplicate actors after rerun"
|
|
assert len(second["shot"].asset.get_bindings()) == 2
|
|
assert len(second["shot"].asset.find_tracks_by_type(unreal.MovieSceneCameraCutTrack)) == 1
|
|
short = Sequence(second["scene"], "Smoke", fps=24, frames=2)
|
|
short.camera(second["cam"])
|
|
if second["character"].get_path_name() in second["scene"]._skeletal_models:
|
|
clip = second["ANIMATION"] if second["MODEL"] in ("fighter", "creature") else (
|
|
"custom" if second["ANIMATION_FILE"] else None)
|
|
short.animation(second["character"], clip)
|
|
short.transform_key(second["character"], 0, rotation=(0, 0, 0))
|
|
short.transform_key(second["character"], 1, rotation=(0, 0, 30))
|
|
render.start(short, mp4=True)
|