advanced example
This commit is contained in:
1 parent
8c0a639fba
commit
6fe57915e8
99 files changed
+1329
-56
No files matched your search
@@ -0,0 +1,36 @@
|
||||
"""Real UE test of Python-authored crossfades using existing character assets."""
|
||||
import json
|
||||
|
||||
import unreal
|
||||
|
||||
from ue_workshop import Scene, Sequence, Renderer, camera, lighting
|
||||
from ue_workshop.characters import CREATURE_MODEL
|
||||
from ue_workshop.paths import PROJECT
|
||||
|
||||
scene = Scene("BlendingSmoke")
|
||||
character = scene.skeletal_model(
|
||||
CREATURE_MODEL, name="Creature", rotation=(0, 0, 180), reimport=False)
|
||||
scene.primitive("Cube", name="Floor", location=(0, 0, -10), scale=(20, 20, 0.2))
|
||||
lighting.studio(scene)
|
||||
cam = camera.create(scene, location=(450, -550, 300), fov=45)
|
||||
shot = Sequence(scene, frames=144, fps=24)
|
||||
shot.camera(cam)
|
||||
first = shot.animation(character, "mutant_idle", start=0, end=60)
|
||||
middle = shot.animation(character, "mutant_swiping", start=48, end=108)
|
||||
last = shot.animation(character, "mutant_walking", start=96, end=144)
|
||||
def keys(section):
|
||||
return [(key.get_time().frame_number.value, key.get_value())
|
||||
for key in section.get_all_channels()[0].get_keys()]
|
||||
|
||||
assert keys(first) == [(0, 1.0), (48, 1.0), (60, 0.0)]
|
||||
assert keys(middle) == [(48, 0.0), (60, 1.0), (96, 1.0), (108, 0.0)]
|
||||
assert keys(last) == [(96, 0.0), (108, 1.0)]
|
||||
shot.transform_key(character, 48, location=(0, 0, 0))
|
||||
shot.transform_key(character, 107, location=(100, 0, 0))
|
||||
shot.save(open_editor=False)
|
||||
unreal.LevelSequenceEditorBlueprintLibrary.open_level_sequence(shot.asset)
|
||||
unreal.LevelSequenceEditorBlueprintLibrary.set_current_time(54)
|
||||
unreal.LevelSequenceEditorBlueprintLibrary.refresh_current_level_sequence()
|
||||
(PROJECT / "Saved/Workshop/blending_smoke.json").write_text(
|
||||
json.dumps({"blend_display_frames": 12, "clips": 3}), encoding="utf-8")
|
||||
renderer = Renderer(width=640, height=360, samples=1, warmup=0, mp4=False)
|
||||
Reference in new issue
Block a user