bacommon.assets

Functionality related to cloud based assets.

 1# Released under the MIT License. See LICENSE for details.
 2#
 3"""Functionality related to cloud based assets."""
 4
 5from __future__ import annotations
 6
 7from dataclasses import dataclass, field
 8from typing import TYPE_CHECKING, Annotated
 9from enum import Enum
10
11from efro.dataclassio import ioprepped, IOAttrs
12
13if TYPE_CHECKING:
14    pass
15
16
17class AssetPackageFlavor(Enum):
18    """Flavors for asset package outputs for different platforms/etc."""
19
20    # DXT3/DXT5 textures
21    DESKTOP = 'desktop'
22
23    # ASTC textures
24    MOBILE = 'mobile'
25
26
27class AssetType(Enum):
28    """Types for individual assets within a package."""
29
30    TEXTURE = 'texture'
31    CUBE_TEXTURE = 'cube_texture'
32    SOUND = 'sound'
33    DATA = 'data'
34    MESH = 'mesh'
35    COLLISION_MESH = 'collision_mesh'
36
37
38@ioprepped
39@dataclass
40class AssetPackageFlavorManifest:
41    """A manifest of asset info for a specific flavor of an asset package."""
42
43    cloudfiles: Annotated[dict[str, str], IOAttrs('cloudfiles')] = field(
44        default_factory=dict
45    )
46
47
48@ioprepped
49@dataclass
50class AssetPackageBuildState:
51    """Contains info about an in-progress asset cloud build."""
52
53    # Asset names still being built.
54    in_progress_builds: Annotated[list[str], IOAttrs('b')] = field(
55        default_factory=list
56    )
57
58    # The initial number of assets needing to be built.
59    initial_build_count: Annotated[int, IOAttrs('c')] = 0
60
61    # Build error string. If this is present, it should be presented
62    # to the user and they should required to explicitly restart the build
63    # in some way if desired.
64    error: Annotated[str | None, IOAttrs('e')] = None
class AssetPackageFlavor(enum.Enum):
18class AssetPackageFlavor(Enum):
19    """Flavors for asset package outputs for different platforms/etc."""
20
21    # DXT3/DXT5 textures
22    DESKTOP = 'desktop'
23
24    # ASTC textures
25    MOBILE = 'mobile'

Flavors for asset package outputs for different platforms/etc.

DESKTOP = <AssetPackageFlavor.DESKTOP: 'desktop'>
MOBILE = <AssetPackageFlavor.MOBILE: 'mobile'>
Inherited Members
enum.Enum
name
value
class AssetType(enum.Enum):
28class AssetType(Enum):
29    """Types for individual assets within a package."""
30
31    TEXTURE = 'texture'
32    CUBE_TEXTURE = 'cube_texture'
33    SOUND = 'sound'
34    DATA = 'data'
35    MESH = 'mesh'
36    COLLISION_MESH = 'collision_mesh'

Types for individual assets within a package.

TEXTURE = <AssetType.TEXTURE: 'texture'>
CUBE_TEXTURE = <AssetType.CUBE_TEXTURE: 'cube_texture'>
SOUND = <AssetType.SOUND: 'sound'>
DATA = <AssetType.DATA: 'data'>
MESH = <AssetType.MESH: 'mesh'>
COLLISION_MESH = <AssetType.COLLISION_MESH: 'collision_mesh'>
Inherited Members
enum.Enum
name
value
@ioprepped
@dataclass
class AssetPackageFlavorManifest:
39@ioprepped
40@dataclass
41class AssetPackageFlavorManifest:
42    """A manifest of asset info for a specific flavor of an asset package."""
43
44    cloudfiles: Annotated[dict[str, str], IOAttrs('cloudfiles')] = field(
45        default_factory=dict
46    )

A manifest of asset info for a specific flavor of an asset package.

AssetPackageFlavorManifest( cloudfiles: Annotated[dict[str, str], <efro.dataclassio._base.IOAttrs object>] = <factory>)
cloudfiles: Annotated[dict[str, str], <efro.dataclassio._base.IOAttrs object at 0x107e6d820>]
@ioprepped
@dataclass
class AssetPackageBuildState:
49@ioprepped
50@dataclass
51class AssetPackageBuildState:
52    """Contains info about an in-progress asset cloud build."""
53
54    # Asset names still being built.
55    in_progress_builds: Annotated[list[str], IOAttrs('b')] = field(
56        default_factory=list
57    )
58
59    # The initial number of assets needing to be built.
60    initial_build_count: Annotated[int, IOAttrs('c')] = 0
61
62    # Build error string. If this is present, it should be presented
63    # to the user and they should required to explicitly restart the build
64    # in some way if desired.
65    error: Annotated[str | None, IOAttrs('e')] = None

Contains info about an in-progress asset cloud build.

AssetPackageBuildState( in_progress_builds: Annotated[list[str], <efro.dataclassio._base.IOAttrs object>] = <factory>, initial_build_count: Annotated[int, <efro.dataclassio._base.IOAttrs object>] = 0, error: Annotated[str | None, <efro.dataclassio._base.IOAttrs object>] = None)
in_progress_builds: Annotated[list[str], <efro.dataclassio._base.IOAttrs object at 0x107e6e270>]
initial_build_count: Annotated[int, <efro.dataclassio._base.IOAttrs object at 0x107e6dbb0>] = 0
error: Annotated[str | None, <efro.dataclassio._base.IOAttrs object at 0x107e6dcd0>] = None