ποΈ Content#
Intermediate data representation.
Base#
Content representation containers.
- class ModelContent(meta=<factory>, scene=<factory>)[source]#
Bases:
BaseContentContent representation of 3D model.
-
scene:
ModelScene#
-
scene:
- class TextureContent(width=0, height=0, meta=<factory>, texture=<factory>)[source]#
Bases:
BaseContentContent representation of texture.
-
width:
int= 0#
-
height:
int= 0#
-
meta:
TextureMeta#
- property mipmap_count: Any#
- property format: Any#
- property path_hash: Any#
- property is_cubemap: bool#
- property is_compressed: bool#
- property fourcc: bytes#
-
width:
- class ImageContent(image=<factory>)[source]#
Bases:
BaseContentContent representation of image.
-
image:
bytes#
-
image:
- class ArchiveContent(entries=<factory>)[source]#
Bases:
BaseContentContent representation of archive.
-
entries:
list[TypeAliasType]#
-
entries:
- class DocumentContent(value=None)[source]#
Bases:
BaseContentContent representation of structured document.
-
value:
TypeAliasType= None#
-
value:
- class RegionContent(x=0, z=0, offsets=<factory>, counts=<factory>, uuids=<factory>, chunks=<factory>)[source]#
Bases:
BaseContentContent representation of world region.
-
x:
int= 0#
-
z:
int= 0#
-
offsets:
list[int]#
-
counts:
list[int]#
-
uuids:
list[bytes]#
-
chunks:
list[RegionChunk]#
- property rx: Any#
- property rz: Any#
- property sector_offsets: Any#
- property sector_counts: Any#
-
x:
- type DocumentPrimitive#
int | float | bytes | str
- type DocumentValue#
None | DocumentPrimitive | list[DocumentValue] | dict[str, DocumentValue]
- type ArchiveEntry#
tuple[str, bytes]
Models#
3D scene representation.
Scene#
Scene structures.
- ROOT_BONE_ID = -1#
Default parent ID for root bones.
- class SkeletonBone(id=0, name='bone', parent_id=-1, position=<factory>, rotation=<factory>, tail=<factory>)[source]#
Bone with transform data.
-
id:
int= 0#
-
name:
str= 'bone'#
-
parent_id:
int= -1#
-
position:
TypeAliasType#
-
rotation:
TypeAliasType#
-
tail:
TypeAliasType#
- property is_root: bool#
- property quaternion: Quaternion#
- property slug: str#
-
id:
- class ModelSkeleton(bones=<factory>, space=SkeletonSpace.GLOBAL)[source]#
Skeleton bones container.
-
bones:
list[SkeletonBone]#
-
space:
SkeletonSpace= 'global'#
- property roots: list[SkeletonBone]#
-
bones:
- class AnimationClip(name='clip', frames=0, rate=0.33, translations=<factory>, rotations=<factory>, morph_weights=<factory>)[source]#
Keyframed bone and morph animation clip.
-
name:
str= 'clip'#
-
frames:
int= 0#
-
rate:
float= 0.33#
-
translations:
TypeAliasType#
-
rotations:
TypeAliasType#
-
morph_weights:
TypeAliasType#
- property times: AnimationTimes#
-
name:
- class ModelAnimation(clips=<factory>, morph_channels=<factory>, translation=AnimationTranslation.DELTA, rotation=AnimationRotation.QUATERNION)[source]#
Animation clips container.
-
clips:
list[AnimationClip]#
-
morph_channels:
list[str]#
-
translation:
AnimationTranslation= 'delta'#
-
rotation:
AnimationRotation= 'quaternion'#
-
clips:
- class SceneScales(position=1.0, uv=1.0, uv2=1.0)[source]#
Scale multipliers for scene data.
-
position:
float= 1.0#
-
uv:
float= 1.0#
-
uv2:
float= 1.0#
-
position:
- class ModelSkin(bind_matrices)[source]#
Bind matrices used by meshes in an assembled scene.
-
bind_matrices:
TypeAliasType#
-
bind_matrices:
- class ModelScene(scale=<factory>, meshes=<factory>, skins=<factory>, skeleton=<factory>, animation=<factory>)[source]#
Container for meshes, skeleton, and animation.
-
scale:
SceneScales#
-
skeleton:
ModelSkeleton#
-
animation:
ModelAnimation#
- property total_vertices: int#
- property total_polygons: int#
-
scale:
Mesh#
Mesh structures.
- class MeshBounds(min=<factory>, max=<factory>, radius=0.0)[source]#
Mesh bounding box.
-
min:
TypeAliasType#
-
max:
TypeAliasType#
-
radius:
float= 0.0#
-
min:
- class BlendShape(name='name', deltas=<factory>, channel=None)[source]#
Mesh deformation target.
-
name:
str= 'name'#
-
deltas:
TypeAliasType#
-
channel:
str|None= None#
-
name:
- class ModelMesh(name='name', material='material', bounds=<factory>, polygon_quads=False, has_blend_shapes=False, mip_factor=0.1, bones=<factory>, skin=None, vertices=<factory>, uv1=<factory>, uv2=<factory>, normals=<factory>, tangents=<factory>, colors=<factory>, blend_vertex_map=<factory>, blend_shapes=<factory>, links_ids=<factory>, links_weights=<factory>, polygons=<factory>, link_space=LinkSpace.GLOBAL, uv_origin=UVOrigin.TOP_LEFT, uv_sign=UVSign.POSITIVE)[source]#
Mesh geometry container.
-
name:
str= 'name'#
-
material:
str= 'material'#
-
bounds:
MeshBounds#
-
polygon_quads:
bool= False#
-
has_blend_shapes:
bool= False#
-
mip_factor:
float= 0.1#
-
bones:
TypeAliasType#
-
skin:
int|None= None#
-
vertices:
TypeAliasType#
-
uv1:
TypeAliasType#
-
uv2:
TypeAliasType#
-
normals:
TypeAliasType#
-
tangents:
TypeAliasType#
-
colors:
TypeAliasType#
-
blend_vertex_map:
TypeAliasType#
-
blend_shapes:
list[BlendShape]#
-
links_ids:
TypeAliasType#
-
links_weights:
TypeAliasType#
-
polygons:
TypeAliasType#
- property max_influences: int#
-
name:
Meta#
Model source metadata.
- class ModelCounts(meshes=0, bones=0, channels=0, clips=0)[source]#
Declared model counts.
-
meshes:
int= 0#
-
bones:
int= 0#
-
channels:
int= 0#
-
clips:
int= 0#
-
meshes:
Matrices#
Matrix transformations.
- create_rotation_matrix(rotation)[source]#
Convert euler angles (XYZ) to 3Γ3 rotation matrix.
- Return type:
TypeAliasType
- create_transform_matrix(translation, rotation)[source]#
Convert translation and rotation (R * T) to 4Γ4 transform matrix.
- Return type:
TypeAliasType
Transforms#
Scene transformation functions.
- scene_transforms(*transforms)[source]#
Adapt scene transformations to model content.
- Return type:
tuple[TypeAliasType,...]
- global_transforms(skeleton)[source]#
Compute global transformation matrices for a valid skeleton.
- Return type:
TypeAliasType
- inverse_bind_matrices(skeleton, *, transpose=False)[source]#
Compute inverse bind matrices for a valid skeleton.
- Return type:
TypeAliasType
- animation_to_absolute(scene)[source]#
Add rest pose positions to animation deltas (DELTA β ABSOLUTE).
- Return type:
- apply_fp_animation(animation, *models)[source]#
Combine model geometry with animation rig.
- Return type:
- extend_fp_skeleton(animation, *models)[source]#
Add model bones missing from a first-person animation skeleton.
- Return type:
- apply_skins(scene, animation, *models)[source]#
Apply source bind poses to the assembled scene.
- Return type:
- apply_fp_models(animation, *models)[source]#
Apply first-person models to the animation scene.
- Return type:
- apply_skeletal_animation(animation, model)[source]#
Apply index-mapped skeletal animation clips to model.
- Return type:
- apply_morph_animation(animation, model)[source]#
Apply morph animation clips to compatible model blend shapes.
- Return type:
- type SceneTransform#
Callable[[ModelScene], ModelScene]
- type ModelTransform#
Callable[['ModelContent'], 'ModelContent']
- type AnimationTransform#
Callable[[ModelScene, ModelScene], ModelScene]
Enums#
Model enumerations.
- class Feature(*values)[source]#
Bases:
StrEnumOptional model feature.
- UV = 'uv'#
- UV2 = 'uv2'#
- NORMALS = 'normals'#
- TANGENTS = 'tangents'#
- COLORS = 'colors'#
- SKELETON = 'skeleton'#
- BLEND_SHAPES = 'blend_shapes'#
- ANIMATION = 'animation'#
- BONE_ANIMATION = 'bone_animation'#
- MORPH_ANIMATION = 'morph_animation'#
- class ModelUnits(*values)[source]#
Bases:
IntEnumModel structure element counts.
- POSITIONS = 4#
- TEXTURES = 2#
- NORMALS = 4#
- TANGENTS = 4#
- TRIANGLES = 3#
- QUADS = 4#
- LINKS = 4#
- BONES = 6#
- FRAMES = 7#
- class UVOrigin(*values)[source]#
Bases:
StrEnumUV coordinate origin.
- TOP_LEFT = 'top_left'#
- BOTTOM_LEFT = 'bottom_left'#
- class UVSign(*values)[source]#
Bases:
StrEnumUV coordinate sign.
- POSITIVE = 'positive'#
- NEGATIVE = 'negative'#
- class LinkSpace(*values)[source]#
Bases:
StrEnumVertex link coordinate space.
- GLOBAL = 'global'#
- LOCAL = 'local'#
- class SkeletonSpace(*values)[source]#
Bases:
StrEnumSkeleton bones coordinate space.
- GLOBAL = 'global'#
- LOCAL = 'local'#
Types#
Model data types.
- class LocalBoneId#
Bone index within mesh.
alias of
int
- class SkeletonBoneId#
Bone index within skeleton.
alias of
int
- type Features#
tuple[Feature, ...]Model feature collection.
- type FeatureFlags#
dict[Feature, bool]Feature flags declared by source model.
- type BonesMapping#
dict[LocalBoneId, SkeletonBoneId]Mapping from mesh local to skeleton bone indices.
- type Vector2D#
Annotated[NDArray[np.float32], (..., 2)]2D float32 vector.
- type Vector3D#
Annotated[NDArray[np.float32], (..., 3)]3D float32 vector.
- type Vector4D#
Annotated[NDArray[np.float32], (..., 4)]4D float32 vector.
- type LinksIds#
Annotated[NDArray[np.uint8], (..., 4)]Bone indices per vertex.
- type LinksWeights#
Annotated[NDArray[np.float32], (..., 4)]Bone weights per vertex.
- type Links#
tuple[LinksIds, LinksWeights]Bone indices and weights pair.
- type Polygons#
Annotated[NDArray[np.uint32], (..., 3)]Triangle indices.
- type BlendVertexMap#
Annotated[NDArray[np.uint16], (...,)]Blend shape base vertex index per mesh vertex.
- type Colors#
Annotated[NDArray[np.uint8], (..., 4)]RGBA vertex colors.
- type EulerAngles#
Annotated[NDArray[np.float32], (..., 3)]Euler angles in degrees (XYZ intrinsic).
- type Quaternion#
Annotated[NDArray[np.float32], (..., 4)]Quaternion rotation (XYZW).
- type RotationMatrix#
Annotated[NDArray[np.float32], (3, 3)]3x3 rotation matrix.
- type TransformMatrix#
Annotated[NDArray[np.float32], (4, 4)]4Γ4 transformation matrix.
- type BindPose#
list[TransformMatrix]Global transform per bone.
- type InverseBindMatrices#
Annotated[NDArray[np.float32], (..., 4, 4)]Inverse bind matrices per bone.
- type AnimationTranslations#
Annotated[NDArray[np.float32], (..., 3)]Animation translations per frame.
- type AnimationRotations#
Annotated[NDArray[np.float32], (..., 4)]Animation rotations per frame.
- type AnimationTimes#
Annotated[NDArray[np.float32], ...]Animation times per frame.
- type MorphWeights#
NDArray[np.float32]Morph channel weights per frame.
Regions#
World region structures.
- class ChunkHeader(record_size=0, section_mask=0, add_mask=0, terrain_size=0, compressed_size=0)[source]#
Header of compressed world chunk.
-
record_size:
int= 0#
-
section_mask:
int= 0#
-
add_mask:
int= 0#
-
terrain_size:
int= 0#
-
compressed_size:
int= 0#
-
record_size:
- class ChunkSection(y=0, blocks=<factory>, metadata=<factory>, additions=<factory>)[source]#
Vertical section of world chunk.
-
y:
int= 0#
-
blocks:
memoryview#
-
metadata:
memoryview#
-
additions:
memoryview#
-
y:
- class RegionChunk(index=0, header=<factory>, payload=<factory>, sections=(), lighting=<factory>, biomes=<factory>, records=<factory>)[source]#
Decompressed world chunk.
-
index:
int= 0#
-
header:
ChunkHeader#
-
payload:
bytes#
-
sections:
tuple[ChunkSection,...] = ()#
-
lighting:
memoryview#
-
biomes:
memoryview#
-
records:
memoryview#
-
index:
Textures#
Texture structures.
- CUBEMAP_FACES = ('+x', '-x', '+y', '-y', '+z', '-z')#
Cubemap face order.
- CUBEMAP_FACE_COUNT = 6#
Number of faces in a cubemap.
- class TextureMeta(mipmap_count=0, format=<factory>, path_hash=<factory>)[source]#
Texture source metadata.
-
mipmap_count:
int= 0#
-
format:
bytes#
-
path_hash:
bytes#
-
mipmap_count:
- class Texture[source]#
Bases:
ABCBase class for texture data.
- abstract property mipmap_count: int#
- abstract property image: bytes#
- abstract property linear_size: int#
- class DefaultTexture(uncompressed=<factory>, compressed=<factory>, mipmaps=<factory>)[source]#
Bases:
TextureStandard 2D texture with mipmaps.
-
uncompressed:
list[int]#
-
compressed:
list[int]#
-
mipmaps:
list[bytes]#
- property mipmap_count: int#
- property image: bytes#
- property linear_size: int#
-
uncompressed:
- class CubemapTexture(uncompressed=<factory>, compressed=<factory>, faces=<factory>)[source]#
Bases:
TextureCubemap texture with face separated mipmaps.
-
uncompressed:
list[list[int]]#
-
compressed:
list[list[int]]#
-
faces:
list[list[bytes]]#
- property mipmap_count: int#
- property image: bytes#
- property linear_size: int#
-
uncompressed: