basic advanced example

This commit is contained in:
Vysyr committed 2026-10-31 23:11:57 +01:00
1 parent 6fe57915e8
commit bd8edf5afb
29 files changed
+1501 -38

No files matched your search

+39 -18
View File
@@ -9,8 +9,8 @@ if "ue_workshop" in sys.modules:
if _render_module is not None and _render_module.is_rendering():
raise RuntimeError("Poczekaj na zakonczenie renderu przed przeladowaniem biblioteki.")
# Najpierw zaleznosci, potem moduly, ktore z nich korzystaja.
for _name in ("paths", "progress", "video", "materials", "camera", "lighting", "assets",
"_gltf", "blender", "characters", "skeletal", "scene", "sequence", "render"):
for _name in ("paths", "animation_clip", "animation_catalog", "animations", "progress", "video", "materials", "camera", "lighting", "assets",
"_gltf", "blender", "characters", "skeletal", "root_motion", "scene", "sequence", "render"):
_module = sys.modules.get("ue_workshop." + _name)
if _module is not None:
importlib.reload(_module)
@@ -19,32 +19,53 @@ if "ue_workshop" in sys.modules:
from ue_workshop import Scene, Sequence, Renderer, camera, lighting, materials
from ue_workshop.paths import PROJECT
from ue_workshop.characters import FIGHTER_MODEL, CREATURE_MODEL
# POSTACIE
from ue_workshop.animations import FighterAnimations, CreatureAnimations
# 1. MODEL I SCENA. Jednostki: centymetry. Os Z wskazuje gore.
scene = Scene("MyShot")
floor = materials.color("Floor", rgb=(0.07, 0.08, 0.11))
character_fighter = scene.skeletal_model(FIGHTER_MODEL, name="Fighter", height=200)
#character_creature = scene.skeletal_model(CREATURE_MODEL, name="Creature", height=300)
character_fighter = scene.skeletal_model(FIGHTER_MODEL, name="Fighter", height=200, location=(30, -40, 0.16), rotation=(0,0,180))
character_creature = scene.skeletal_model(CREATURE_MODEL, name="Creature", height=300, location=(0,-850,0))
scene.primitive("Cube", name="Floor", location=(0, 0, -10), scale=(20, 20, 0.2), material=floor)
lighting.studio(scene, key_color=(1.0, 0.75, 0.5), fill_color=(0.3, 0.6, 1.0))
cam = camera.create(scene, location=(450, -550, 300), fov=40)
lights = [
lighting.area(scene, "Key", (200, -500, 350), color=(1.0, 0.75, 0.5)),
lighting.area(scene, "Fill", (100, 300, 250), intensity=7000, color=(0.3, 0.6, 1.0)),
lighting.area(scene, "Rim", (-200, 0, 300), intensity=15000)
]
cam = camera.create(scene, location=(200, -300, 200), target=(0, 0, 100), fov=90)
# 2. ANIMACJA. 120 klatek przy 24 FPS = 5 sekund. Ostatnia klatka ma numer 119.
shot = Sequence(scene, fps=24, frames=120)
shot = Sequence(scene, fps=30, frames=260)
# Fighter
shot.animation(character_fighter, FighterAnimations.DRAW_A_GREAT_SWORD_2, start=0)
shot.animation(character_fighter, FighterAnimations.GREAT_SWORD_IDLE, start=22, end=55)
shot.animation(character_fighter, FighterAnimations.GREAT_SWORD_BLOCKING, start=48)
shot.animation(character_fighter, FighterAnimations.GREAT_SWORD_BLOCKING_2, start=61)
shot.animation(character_fighter, FighterAnimations.GREAT_SWORD_SLASH, start=80)
shot.animation(character_fighter, FighterAnimations.GREAT_SWORD_JUMP_ATTACK, start=117, keep_end_position=True)
shot.animation(character_fighter, FighterAnimations.GREAT_SWORD_STRAFE, start=180, keep_end_position=True)
shot.animation(character_fighter, FighterAnimations.GREAT_SWORD_RUN_2, start=207, end=259, keep_end_position=True)
shot.transform_key(character_fighter,58, location=(30, -40, 0.16), interpolation="auto")
shot.transform_key(character_fighter,64, location=(30, 20, 0.16), interpolation="auto")
shot.move(character_fighter, start=134, end=146, offset=(0, -170, 0), interpolation="auto")
# Creature
shot.animation(character_creature, CreatureAnimations.MUTANT_RUN, start=0, end=60, keep_end_position=True)
shot.animation(character_creature, CreatureAnimations.MUTANT_SWIPING, start=20)
shot.animation(character_creature, CreatureAnimations.MUTANT_WALKING, start=95, end=160, keep_end_position=True, reverse=True)
shot.animation(character_creature, CreatureAnimations.MUTANT_DYING, start=130, end=259, keep_end_pose=True)
# Camera
shot.camera(cam)
r = cam.get_actor_rotation()
shot.transform_key(cam, 0, rotation=(r.roll, r.pitch, r.yaw))
shot.transform_key(cam, 10, location=(200, -300, 200), interpolation="auto")
shot.transform_key(cam, 75, location=(450, -550, 300), rotation=(0, -15, 150), interpolation="auto")
shot.animation(character_fighter, "draw_a_great_sword_1", start=0, end=60)
# shot.animation(character_fighter, "great_sword_idle", start=0, end=60)
# shot.animation(character_fighter, "great_sword_attack", start=48, end=120)
# shot.transform_key(character_fighter, 70, location=(0, 0, 0), interpolation="auto")
# shot.transform_key(character_fighter, 100, location=(0, 200, 0), interpolation="auto")
shot.save()
# 3. WYNIK. Najpierw obejrzyj animacje w Sequencerze, potem zmien RENDER na True.