Structures

Contents

Structures#

Internal data handler module. Provides dataclass-based structures representation.

🧮 Flags#

Enum for 3D scene flags.

class Flag(value)[source]#

Bases: IntEnum

SKELETON = 0#
UV = 1#
NORMALS = 2#
UNKNOWN_4 = 3#
UNKNOWN_5 = 4#
UNKNOWN_6 = 5#
to_named_dict(flags)[source]#

🏞️ Scene#

Dataclasses for scene of 3D models.

class SceneScales(position=1.0, texture=1.0, unknown=1.0, filtering=0.1)[source]#

Multiplier values for scene components.

position: float = 1.0#
texture: float = 1.0#
unknown: float = 1.0#
filtering: float = 0.1#
class SceneCounts(meshes=0, bones=0, clips=0)[source]#

Quantifying of scene elements.

meshes: int = 0#
bones: int = 0#
clips: int = 0#
class ModelScene(scale=<factory>, count=<factory>, meshes=<factory>, skeleton=<factory>, animation=<factory>)[source]#

Complete 3D model container with geometry, skeleton and animation.

scale: SceneScales#
count: SceneCounts#
meshes: list[ModelMesh]#
skeleton: ModelSkeleton#
animation: ModelAnimation#
property total_vertices#
property total_polygons#
ensure_unique_names()[source]#
invert_v_textures()[source]#
flip_v_textures()[source]#

🕸️ Mesh#

Dataclasses for 3D model geometry.

class MeshCounts(vertices=0, polygons=0, links=0, bones=0)[source]#

Quantifying of mesh elements.

vertices: int = 0#
polygons: int = 0#
bones: int = 0#
class MeshOrigin(position=<factory>, rotation=<factory>, scale=0.0)[source]#
position: Annotated[ndarray[tuple[Any, ...], dtype[float32]]]#
rotation: Annotated[ndarray[tuple[Any, ...], dtype[float32]]]#
scale: float = 0.0#
class ModelMesh(name='name', material='material', count=<factory>, origin=<factory>, bones=<factory>, positions=<factory>, textures=<factory>, normals=<factory>, links_ids=<factory>, links_weights=<factory>, polygons=<factory>)[source]#

3D mesh geometry container.

name: str = 'name'#
material: str = 'material'#
count: MeshCounts#
origin: MeshOrigin#
bones: dict[NewType(LocalBoneId, int), NewType(SkeletonBoneId, int)]#
positions: Annotated[ndarray[tuple[Any, ...], dtype[float32]]]#
textures: Annotated[ndarray[tuple[Any, ...], dtype[float32]]]#
normals: Annotated[ndarray[tuple[Any, ...], dtype[float32]]]#
polygons: Annotated[ndarray[tuple[Any, ...], dtype[uint32]]]#

🦴 Skeleton#

Dataclasses for 3D model armature.

class SkeletonBone(id=0, name='bone', parent_id=-1, position=<factory>, rotation=<factory>, children=<factory>)[source]#

Single skeleton bone with transform data.

id: int = 0#
name: str = 'bone'#
parent_id: int = -1#
position: Annotated[ndarray[tuple[Any, ...], dtype[float32]]]#
rotation: Annotated[ndarray[tuple[Any, ...], dtype[float32]]]#
children: List[Self]#
property is_root: bool#
property quaternion: Annotated[ndarray[tuple[Any, ...], dtype[float32]], Ellipsis, 4]#
class ModelSkeleton(bones=<factory>)[source]#

Skeleton bones container.

bones: List[SkeletonBone]#
property roots: List[SkeletonBone]#
convert_to_local()[source]#
Return type:

None

build_hierarchy()[source]#
Return type:

None

calculate_global_transforms()[source]#
Return type:

list[ndarray]

inverse_bind_matrices(transpose)[source]#
Return type:

ndarray

create_rotation_matrix(rotation)[source]#
Return type:

ndarray

create_transform_matrix(position, rotation)[source]#
Return type:

ndarray

euler_to_quat(rotation, degrees=True)[source]#
Return type:

ndarray[tuple[Any, ...], dtype[float32]]

🎬 Animation#

Dataclasses for skeletal animation (clips/actions).

class AnimationClip(name='clip', frames=0, rate=0.33, transforms=<factory>)[source]#

Single animation clip with timing and transformation data.

name: str = 'clip'#
frames: int = 0#
rate: float = 0.33#
transforms: ndarray#
property times#
class ModelAnimation(clips=<factory>)[source]#

Animation clips container.

clips: list[AnimationClip]#
convert_to_local(skeleton)[source]#

🧱 Texture#

Dataclasses for game specific textures.

class Texture[source]#

Bases: ABC

Base dataclass representing texture.

abstract property image: bytes#
abstract property linear_size: int#
class DefaultTexture(uncompressed=<factory>, compressed=<factory>, mipmaps=<factory>)[source]#

Bases: Texture

Standard 2D texture with mipmaps.

uncompressed: list[int]#
compressed: list[int]#
mipmaps: list[bytes]#
property image#
property linear_size#
class CubemapTexture(uncompressed=<factory>, compressed=<factory>, faces=<factory>)[source]#

Bases: Texture

Cube map texture with face separated mipmaps.

uncompressed: list[list[int]]#
compressed: list[list[int]]#
faces: list[list[bytes]]#
property image#
property linear_size#