Bombsquad-Ballistica-Modded.../dist/ba_data/python/bacommon/assets.py

63 lines
1.7 KiB
Python
Raw Normal View History

2021-03-29 03:24:13 +05:30
# Released under the MIT License. See LICENSE for details.
#
"""Functionality related to cloud based assets."""
from __future__ import annotations
2021-10-26 23:32:18 +05:30
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Dict, Optional, List
2021-03-29 03:24:13 +05:30
from enum import Enum
2021-10-26 23:32:18 +05:30
from typing_extensions import Annotated
from efro.dataclassio import ioprepped, IOAttrs
2021-03-29 03:24:13 +05:30
if TYPE_CHECKING:
pass
class AssetPackageFlavor(Enum):
"""Flavors for asset package outputs for different platforms/etc."""
# DXT3/DXT5 textures
DESKTOP = 'desktop'
# ASTC textures
MOBILE = 'mobile'
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'
2021-10-26 23:32:18 +05:30
@ioprepped
@dataclass
class AssetPackageFlavorManifest:
2021-03-29 03:24:13 +05:30
"""A manifest of asset info for a specific flavor of an asset package."""
2021-10-26 23:32:18 +05:30
assetfiles: Annotated[Dict[str, str],
IOAttrs('assetfiles')] = field(default_factory=dict)
2021-03-29 03:24:13 +05:30
2021-10-26 23:32:18 +05:30
@ioprepped
@dataclass
class AssetPackageBuildState:
2021-03-29 03:24:13 +05:30
"""Contains info about an in-progress asset cloud build."""
# Asset names still being built.
2021-10-26 23:32:18 +05:30
in_progress_builds: Annotated[List[str],
IOAttrs('b')] = field(default_factory=list)
2021-03-29 03:24:13 +05:30
# The initial number of assets needing to be built.
2021-10-26 23:32:18 +05:30
initial_build_count: Annotated[int, IOAttrs('c')] = 0
2021-03-29 03:24:13 +05:30
# 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.
2021-10-26 23:32:18 +05:30
error: Annotated[Optional[str], IOAttrs('e')] = None