Source code for bacommon.assets
# Released under the MIT License. See LICENSE for details.
#
"""Functionality related to cloud based assets."""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Annotated
from enum import Enum
from efro.dataclassio import ioprepped, IOAttrs
if TYPE_CHECKING:
pass
[docs]
class AssetPackageFlavor(Enum):
"""Flavors for asset package outputs for different platforms/etc."""
# DXT3/DXT5 textures
DESKTOP = 'desktop'
# ASTC textures
MOBILE = 'mobile'
[docs]
class AssetType(Enum):
"""Types for individual assets within a package."""
TEXTURE = 'texture'
CUBE_TEXTURE = 'cube_texture'
SOUND = 'sound'
DATA = 'data'
MESH = 'mesh'
COLLISION_MESH = 'collision_mesh'
[docs]
@ioprepped
@dataclass
class AssetPackageFlavorManifest:
"""A manifest of asset info for a specific flavor of an asset package."""
cloudfiles: dict[str, str] = field(
default_factory=dict
)
[docs]
@ioprepped
@dataclass
class AssetPackageBuildState:
"""Contains info about an in-progress asset cloud build."""
# Asset names still being built.
in_progress_builds: list[str] = field(
default_factory=list
)
# The initial number of assets needing to be built.
initial_build_count: int = 0
# Build error string. If this is present, it should be presented
# to the user and they should required to explicitly restart the build
# in some way if desired.
error: str | None = None
# Docs-generation hack; import some stuff that we likely only forward-declared
# in our actual source code so that docs tools can find it.
from typing import (Coroutine, Any, Literal, Callable,
Generator, Awaitable, Sequence, Self)
import asyncio
from concurrent.futures import Future
from pathlib import Path
from enum import Enum