32 lines
1.5 KiB
Python
32 lines
1.5 KiB
Python
"""Check local FBX characters, automatic fitting, stable pivots and MRQ."""
|
|
import unreal
|
|
|
|
from ue_workshop import Scene, Sequence, Renderer, camera, lighting
|
|
from ue_workshop.paths import PROJECT
|
|
|
|
scene = Scene("ImportedModelsSmoke")
|
|
characters = []
|
|
for name, file in (("RobotSmoke", "DemoAssets/RobotPolice/RobotPolice.fbx"),
|
|
("PilotSmoke", "DemoAssets/pilot/pilot.fbx")):
|
|
root = scene.model(PROJECT / file, name=name, height=200)
|
|
child = root.get_attached_actors()[0]
|
|
origin, extent = child.get_actor_bounds(False)
|
|
assert abs(2 * extent.z - 200) < 0.1, (name, origin, extent)
|
|
assert abs(origin.z - extent.z) < 0.1, (name, origin, extent)
|
|
assert abs(origin.x) < 0.1 and abs(origin.y) < 0.1
|
|
mesh = child.static_mesh_component.static_mesh
|
|
assert len(mesh.static_materials) > 0
|
|
assert all(slot.material_interface for slot in mesh.static_materials)
|
|
assert all(slot.material_interface.get_name() == "M_" + name + "Imported" for slot in mesh.static_materials)
|
|
characters.append(root)
|
|
characters[1].set_actor_location(unreal.Vector(0, 160, 0), False, False)
|
|
scene.primitive("Cube", name="Floor", location=(0, 0, -10), scale=(20, 20, 0.2))
|
|
lighting.studio(scene)
|
|
cam = camera.create(scene, location=(600, -850, 400), target=(0, 70, 100))
|
|
shot = Sequence(scene, frames=2)
|
|
shot.camera(cam)
|
|
for character in characters:
|
|
shot.transform_key(character, 0, rotation=(0, 0, 0))
|
|
shot.transform_key(character, 1, rotation=(0, 0, 45))
|
|
Renderer(width=640, height=360, samples=2, warmup=8).render(shot)
|