32 lines
1.4 KiB
Python
32 lines
1.4 KiB
Python
"""Check native pose retention and render a frame after the dying clip."""
|
|
|
|
import unreal
|
|
|
|
from ue_workshop import Scene, Sequence, Renderer, camera, lighting
|
|
from ue_workshop.animations import CreatureAnimations as C
|
|
from ue_workshop.characters import CREATURE_MODEL
|
|
|
|
scene = Scene("KeepPoseSmoke")
|
|
actor = scene.skeletal_model(CREATURE_MODEL, name="Creature", height=300)
|
|
child, imported = scene._skeletal_models[actor.get_path_name()]
|
|
component = child.skeletal_mesh_component
|
|
scene.primitive("Cube", name="Floor", location=(0, 0, -10), scale=(20, 20, 0.2))
|
|
lighting.studio(scene)
|
|
cam = camera.create(scene, location=(500, -650, 400), target=(0, 0, 80), fov=60)
|
|
shot = Sequence(scene, fps=30, frames=300)
|
|
shot.camera(cam)
|
|
section = shot.animation(actor, C.MUTANT_DYING, start=0, keep_end_pose=True)
|
|
assert section.get_completion_mode() == unreal.MovieSceneCompletionMode.KEEP_STATE
|
|
shot.save(open_editor=False)
|
|
clip = imported.animations[C.MUTANT_DYING.key]
|
|
changed = False
|
|
for bone in unreal.AnimationLibrary.get_animation_track_names(clip):
|
|
first = unreal.AnimationLibrary.get_bone_pose_for_time(clip, bone, 0, False)
|
|
last = unreal.AnimationLibrary.get_bone_pose_for_time(clip, bone, clip.get_play_length(), False)
|
|
if not first.rotation.equals(last.rotation, 0.001):
|
|
changed = True
|
|
break
|
|
assert changed, "Dying source has no pose change"
|
|
assert section.get_end_frame() < 299
|
|
renderer = Renderer(width=640, height=360, samples=1, warmup=0, mp4=False)
|