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,32 @@
|
||||
"""Import a model under a student name and verify its enum is generated automatically."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from ue_workshop import Scene, Sequence
|
||||
from ue_workshop import animation_catalog, skeletal
|
||||
from ue_workshop.characters import FIGHTER_MODEL, _clips
|
||||
from ue_workshop.paths import PROJECT
|
||||
|
||||
scene = Scene("AutomaticCatalogSmoke")
|
||||
clips = _clips(FIGHTER_MODEL)
|
||||
output = PROJECT / "build/AutomaticCatalogSmoke/animations.py"
|
||||
update = animation_catalog.update_catalog
|
||||
with patch.object(skeletal, "update_catalog", side_effect=lambda name, data, **options:
|
||||
update(name, data, output=output, **options)):
|
||||
actor = scene.skeletal_model(
|
||||
FIGHTER_MODEL, name="StudentCatalogSmoke", reimport=False,
|
||||
animations={key: clips[key] for key in ("great_sword_idle", "great_sword_attack")})
|
||||
|
||||
namespace = {"__name__": "ue_workshop._generated_smoke", "__package__": "ue_workshop"}
|
||||
exec(compile(output.read_text(encoding="utf-8"), str(output), "exec"), namespace)
|
||||
catalog = namespace["StudentCatalogSmokeAnimations"]
|
||||
assert len(catalog) == 2
|
||||
attack = catalog.GREAT_SWORD_ATTACK
|
||||
assert attack.seconds > 0
|
||||
shot = Sequence(scene, frames=120)
|
||||
section = shot.animation(actor, attack, start=0)
|
||||
assert section.get_end_frame() == attack.frames(shot.fps)
|
||||
shot.save(open_editor=False)
|
||||
|
||||
# Check the normal hook updates the real existing catalog and preserves models.
|
||||
skeletal.import_model(FIGHTER_MODEL, name="Fighter", reimport=False)
|
||||
skeletal.import_model(PROJECT / "source_assets/character/creature/Maw J Laygo.fbx", name="Creature", reimport=False)
|
||||
Reference in new issue
Block a user