basic advanced example
This commit is contained in:
1 parent
6fe57915e8
commit
bd8edf5afb
29 files changed
+1501
-38
No files matched your search
@@ -0,0 +1,30 @@
|
||||
"""Reverse a walking clip and replace baked travel with an explicit retreat."""
|
||||
import math
|
||||
|
||||
from ue_workshop import Scene, Sequence
|
||||
from ue_workshop.animations import CreatureAnimations as C
|
||||
from ue_workshop.characters import CREATURE_MODEL
|
||||
|
||||
scene = Scene("ReverseWalkingSmoke")
|
||||
creature = scene.skeletal_model(CREATURE_MODEL, name="Creature", height=300, location=(0, -850, 0))
|
||||
shot = Sequence(scene, fps=30, frames=180)
|
||||
shot.animation(creature, C.MUTANT_RUN, start=0, end=60, keep_end_position=True)
|
||||
shot.animation(creature, C.MUTANT_SWIPING, start=20)
|
||||
walk = shot.animation(creature, C.MUTANT_WALKING, start=80, end=120,
|
||||
keep_end_position=True, reverse=True)
|
||||
assert walk.get_editor_property("params").get_editor_property("reverse")
|
||||
before = shot.position(creature, 80)
|
||||
natural_end = shot.position(creature, 120)
|
||||
assert natural_end[1] < before[1] - 10, (before, natural_end)
|
||||
# A later authored key should retain its relative movement after replacement.
|
||||
shot.transform_key(creature, 150, location=(natural_end[0], natural_end[1] + 30, natural_end[2]))
|
||||
target = shot.move(creature, start=80, end=120, offset=(0, -200, 0))
|
||||
assert math.dist(shot.position(creature, 80), before) < 0.001
|
||||
assert math.dist(shot.position(creature, 120), target) < 0.001
|
||||
assert abs(target[1] - before[1] + 200) < 0.001
|
||||
middle = shot.position(creature, 100)
|
||||
assert target[1] < middle[1] < before[1], middle
|
||||
assert abs(shot.position(creature, 150)[1] - target[1] - 30) < 0.001
|
||||
channels = shot._transforms[creature.get_path_name()]
|
||||
assert all(not 80 < key.get_time().frame_number.value < 120 for key in channels[1].get_keys())
|
||||
shot.save(open_editor=False)
|
||||
Reference in new issue
Block a user