assetpackage work

This commit is contained in:
Eric 2024-07-05 17:33:40 -07:00
parent 16d3681203
commit cf5fe0fcd0
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
9 changed files with 143 additions and 79 deletions

56
.efrocachemap generated
View File

@ -4038,26 +4038,26 @@
"build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1",
"build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae",
"build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "4475d67df942f8febc32936192750120",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "4d7cbd0dd9d2c268ec19f4166cdebaf6",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "36bda46c71bfa44ef4f5fff83a7cee8c",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "f8bfa90df68abd510de758df9c6ff3c1",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "f2701a0355249adfc052e0a174aa98d8",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "f209465e9c4b41982877e9607b55c69e",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "c70de98ce97a1fb381d5e2284adaf241",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "63af122be920611a51b74ab7fd2c5a64",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "7911794aa1ebb94145020ebb828fe7b7",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "dd2a9813f8640b88f96ad13f0305ae0f",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "959e785b2d9eee30355b8e3a8bfe0fc4",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "4d77bf8099c689622e08230e2465afd5",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "6d6fe5cba0bce85a081956d91cd3a679",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "9c5faabe7b2f25ffa1bded3ac6e15ab5",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "b5522b5ef88707f2a152cf622740f2aa",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "872d53a99e512f205ab7c639c4732704",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "52342bdc33fcecaf17a2e39ab072bace",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "627e5ef0e8d3b4074edd30492d1d6478",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "be00f02bc30127d88c809ba9232c9ce7",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "276a4800fd8745ad14ef728d6c7ffe53",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "984af200e5e35417de6ace1da79c1351",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "0902b446e625e001396b70ab1e567423",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "7e940b9dabe493f106c2e9d41fad32d2",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "3492bf499cbf195e311ea7587d4247c4",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "80ce3502f6ff6ae99d5a61cb746f476a",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "08f433223f802b142a64a4d7e8ff129e",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "ee89411f673161492bf8762656c8308a",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "bcb36f5a15e3fe28cbc5606b2196736d",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "fb21bde8f575ef1aaabfee5bd2651571",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "3c3ad695c496f35ca06b9b95d4ff1db7",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "f3ee8ad1b441c7788f2a76106a740f14",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "b29045a9462537f4cc4a487a0d75abc3",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "46c370f0616494816ea1ff73aa2b0d2f",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "ffb4d1ab15033abbc9a7ccdf64493b25",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "0a542a05b30e4f1d443e3e63be3406aa",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "8711c3e818a759b050cab7dcff2e1147",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "edb7277a16fb2847388b3c55447e5fbd",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "8980b84f0c39fb6f8bead208e4b794de",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "109c5e9d5a415a0c5bb81ad076680174",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "49aa40bff81a8342ff16a41c143d7917",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "f231b10895bdcb542de87b887ca181fd",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "ae936a119668ede7b36f38c8672f4bf8",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "f231b10895bdcb542de87b887ca181fd",
@ -4074,14 +4074,14 @@
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "efffc4f330e77530accd9a9f82840a6c",
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "c20363fe2af3d54e666b1c8ee67f6b76",
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "efffc4f330e77530accd9a9f82840a6c",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "1c404ba60239ba22214f9986c24be240",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "90a80a91309d545d7958c646882cbe2b",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "b31e2ca31632b7d061af0a27d9e9b4cf",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "ee015e1287d1e94628366e995e44c4d6",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "58000c92a46f163ced57a63a7de9450d",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "62fae805bb3025f4f6646e564ffadd9a",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "1b5989770bc150ba4ca5de7405d998b0",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "325a1a5fc43a7054e80ff3c360ba0b94",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "54b1fb0ff0a189a59da87f3578a1119a",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "c0e6444e540a2046b858fc4b4629f6b4",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "b44c5bb764eb9a30c49d3dc36c54d784",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "23afa2f159052928a16cc3e5bde1f864",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "40437dd15a65d97481d88e245de923bf",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "4e7a439617c2ad9d6100a7ec6e593713",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "a19afc6c611054e2c5df4dd3c07afed9",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "5156925d106a00a4602ef7204f70ab5a",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c",
"src/assets/ba_data/python/babase/_mgen/enums.py": "5548f407d97e380069f6c596c4e36cd7",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "efa61468cf098f77cc6a234461d8b86d",

View File

@ -1,4 +1,4 @@
### 1.7.36 (build 21909, api 8, 2024-07-03)
### 1.7.36 (build 21911, api 8, 2024-07-05)
- Wired up initial support for using asset-packages for bundled assets.
- bacloud workspace commands are now a bit smarter; you can now do things like
`bacloud workspace put .` or even just `bacloud workspace put` and it will

View File

@ -150,7 +150,7 @@ ASSET_TARGETS_WIN_WIN32 += $(EXTRAS_TARGETS_WIN_WIN32)
ASSET_TARGETS_WIN_X64 += $(EXTRAS_TARGETS_WIN_X64)
# Asset Packages
ASSET_TARGETS_CMAKE += $(PROJ_DIR)/.cache/assetmanifests/gui_desktop_v1
ASSET_TARGETS_CMAKE += $(PROJ_DIR)/.cache/assetmanifests/gui_desktop_v2dev1
# Note: Code below needs updating when Python version changes (currently 3.11)
define make-opt-pyc-target
@ -7510,12 +7510,10 @@ clean:
$(PROJ_DIR)/.cache/asset_package_resolved: $(PROJ_DIR)/config/projectconfig.json
@$(PCOMMAND) asset_package_resolve $@
$(PROJ_DIR)/.cache/assetmanifests/gui_desktop_v1: \
$(PROJ_DIR)/.cache/assetmanifests/gui_desktop_v2dev1: \
$(PROJ_DIR)/.cache/asset_package_resolved
@$(PCOMMAND) asset_package_assemble \
$(PROJ_DIR)/.cache/asset_package_resolved gui_desktop_v1
foo: $(PROJ_DIR)/.cache/assetmanifests/gui_desktop_v1
$(PROJ_DIR)/.cache/asset_package_resolved gui_desktop_v2dev1
# These targets don't correspond to actual files; make sure make knows that.
.PHONY: cmake win mac ios android audio audio-clean fonts fonts-clean data \

View File

@ -52,7 +52,7 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be
# using.
TARGET_BALLISTICA_BUILD = 21909
TARGET_BALLISTICA_BUILD = 21911
TARGET_BALLISTICA_VERSION = '1.7.36'

View File

@ -10,9 +10,8 @@ import babase
import _bascenev1
from bascenev1._activity import Activity
# False-positive from pylint due to our class-generics-filter.
from bascenev1._player import EmptyPlayer # pylint: disable=W0611
from bascenev1._team import EmptyTeam # pylint: disable=W0611
from bascenev1._player import EmptyPlayer
from bascenev1._team import EmptyTeam
from bascenev1._music import MusicType, setmusic

View File

@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
namespace ballistica {
// These are set automatically via script; don't modify them here.
const int kEngineBuildNumber = 21909;
const int kEngineBuildNumber = 21911;
const char* kEngineVersion = "1.7.36";
const int kEngineApiVersion = 8;

View File

@ -1,13 +1,20 @@
# Released under the MIT License. See LICENSE for details.
#
"""Defines workspace behavior."""
"""Public types for assets-v1 workspaces.
These types may only be used server-side, but they are exposed here
for reference when setting workspace config data by hand or for use
in client-side workspace modification tools. There may be advanced
settings that are not accessible through the UI/etc.
"""
from __future__ import annotations
from enum import Enum
from dataclasses import dataclass
from typing import TYPE_CHECKING, Annotated
from typing import TYPE_CHECKING, Annotated, override, assert_never
from efro.dataclassio import ioprepped, IOAttrs
from efro.dataclassio import ioprepped, IOAttrs, IOMultiType
if TYPE_CHECKING:
@ -19,16 +26,68 @@ if TYPE_CHECKING:
class AssetsV1GlobalVals:
"""Global values for an assets_v1 workspace."""
# Just dummy testing values for now.
emit: Annotated[bool, IOAttrs('emit')]
aggro: Annotated[float, IOAttrs('aggro')]
base_assets: Annotated[
str | None, IOAttrs('base_assets', store_default=False)
] = None
class AssetsV1PathValsTypeID(Enum):
"""Types of vals we can store for paths."""
TEX_V1 = 'tex_v1'
class AssetsV1PathVals(IOMultiType[AssetsV1PathValsTypeID]):
"""Top level class for path vals classes."""
@override
@classmethod
def get_type_id_storage_name(cls) -> str:
return 'type'
@override
@classmethod
def get_type_id(cls) -> AssetsV1PathValsTypeID:
# Require child classes to supply this themselves. If we
# did a full type registry/lookup here it would require us
# to import everything and would prevent lazy loading.
raise NotImplementedError()
@override
@classmethod
def get_type(
cls, type_id: AssetsV1PathValsTypeID
) -> type[AssetsV1PathVals]:
# pylint: disable=cyclic-import
out: type[AssetsV1PathVals]
t = AssetsV1PathValsTypeID
if type_id is t.TEX_V1:
out = AssetsV1PathValsTexV1
else:
# Important to make sure we provide all types.
assert_never(type_id)
return out
@ioprepped
@dataclass
class AssetsV1PathVals:
class AssetsV1PathValsTexV1(AssetsV1PathVals):
"""Path-specific values for an assets_v1 workspace path."""
class TextureQuality(Enum):
"""Quality settings for our textures."""
LOW = 'low'
MEDIUM = 'medium'
HIGH = 'high'
# Just dummy testing values for now.
width: Annotated[int, IOAttrs('width')]
height: Annotated[int, IOAttrs('height')]
texture_quality: Annotated[
TextureQuality, IOAttrs('texture_quality', store_default=False)
] = TextureQuality.MEDIUM
@override
@classmethod
def get_type_id(cls) -> AssetsV1PathValsTypeID:
return AssetsV1PathValsTypeID.TEX_V1

View File

@ -184,7 +184,7 @@ class AssetStager:
self.desc = 'cmake'
self.dst = args[-1]
self.tex_suffix = '.dds'
self.asset_package_flavor = 'gui_desktop_v1'
self.asset_package_flavor = 'gui_desktop_v2dev1'
# Link/copy in a binary *if* builddir is provided.
self.include_binary_executable = self.builddir is not None
self.executable_name = 'ballisticakit'

View File

@ -187,6 +187,7 @@ def var_annotations_filter(node: nc.NodeNG) -> nc.NodeNG:
# pylint: disable=too-many-nested-blocks
if using_future_annotations(node):
# Future behavior:
# Annotated assigns under functions are not evaluated.
# Class and module vars are normally not either. However we
@ -197,7 +198,12 @@ def var_annotations_filter(node: nc.NodeNG) -> nc.NodeNG:
fnode = node
willeval = False
while fnode is not None:
if isinstance(fnode, astroid.FunctionDef):
# Assigns within functions never eval.
break
if isinstance(fnode, astroid.ClassDef):
# Ok; the assign seems to be at the class level.
# See if its an ioprepped dataclass.
if fnode.decorators is not None:
found_ioprepped = False
for dec in fnode.decorators.nodes:
@ -226,6 +232,7 @@ def var_annotations_filter(node: nc.NodeNG) -> nc.NodeNG:
fnode = fnode.parent
else:
# Legacy behavior:
# Annotated assigns under functions are not evaluated,
# but class or module vars are.
@ -253,43 +260,43 @@ def var_annotations_filter(node: nc.NodeNG) -> nc.NodeNG:
# Stripping subscripts on some generics seems to cause
# more harm than good, so we leave some intact.
ALLOWED_GENERICS = {'Sequence'}
# ALLOWED_GENERICS = {'Sequence'}
def _is_strippable_subscript(node: nc.NodeNG) -> bool:
if isinstance(node, astroid.Subscript):
# We can strip if its not in our allowed list.
if not (
isinstance(node.value, astroid.Name)
and node.value.name in ALLOWED_GENERICS
):
return True
return False
# def _is_strippable_subscript(node: nc.NodeNG) -> bool:
# if isinstance(node, astroid.Subscript):
# # We can strip if its not in our allowed list.
# if not (
# isinstance(node.value, astroid.Name)
# and node.value.name in ALLOWED_GENERICS
# ):
# return True
# return False
def class_generics_filter(node: nc.NodeNG) -> nc.NodeNG:
"""Filter generics subscripts out of class declarations."""
# def class_generics_filter(node: nc.NodeNG) -> nc.NodeNG:
# """Filter generics subscripts out of class declarations."""
# First, quick-out if nothing here should be filtered.
found = False
for base in node.bases:
if _is_strippable_subscript(base):
found = True
# # First, quick-out if nothing here should be filtered.
# found = False
# for base in node.bases:
# if _is_strippable_subscript(base):
# found = True
if not found:
return node
# if not found:
# return node
# Now strip subscripts from base classes.
new_bases: list[nc.NodeNG] = []
for base in node.bases:
if _is_strippable_subscript(base):
new_bases.append(base.value)
base.value.parent = node
else:
new_bases.append(base)
node.bases = new_bases
# # Now strip subscripts from base classes.
# new_bases: list[nc.NodeNG] = []
# for base in node.bases:
# if _is_strippable_subscript(base):
# new_bases.append(base.value)
# base.value.parent = node
# else:
# new_bases.append(base)
# node.bases = new_bases
return node
# return node
def register_plugins(manager: astroid.Manager) -> None:
@ -328,7 +335,8 @@ def register_plugins(manager: astroid.Manager) -> None:
# I've opened a github issue related to the problems I was hitting,
# so we can revisit the need for this if that gets resolved.
# https://github.com/PyCQA/pylint/issues/3605
manager.register_transform(astroid.ClassDef, class_generics_filter)
# UPDATE: As of July 2024 this seems to be no longer necessary; hooray!
# manager.register_transform(astroid.ClassDef, class_generics_filter)
register_plugins(astroid.MANAGER)