bacommon.workspace package

Functionality related to ballistica.net workspaces.

Submodules

bacommon.workspace.assetsv1 module

Public types for assets-v1 workspaces.

While this module is currently only used server-side, its source code can be useful as 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.

bacommon.workspace.assetsv1.AUDIO_PLAY_GROUP_NAME_MAX_LENGTH = 64

Longest play group name (matches the engine’s limit).

class bacommon.workspace.assetsv1.AlphaPriority(*values)[source]

Bases: Enum

How much a texture’s alpha matters relative to its color.

Both encoders spread a fixed bit budget across color and alpha; this shifts the balance. Raising it sharpens alpha edges (silhouettes, soft fades) at some cost in color accuracy, and vice versa. It has no effect on a texture without alpha.

Consulted only when a format’s texture_quality is CUSTOM; automatic quality always uses DEFAULT. That is deliberate: the automatic search already protects alpha by its own means (a texture limited by its alpha edge gets a higher-quality setting), whereas guessing a priority per texture and guessing wrong would cost color silently.

DEFAULT = 'default'
HIGH = 'high'
LOW = 'low'
class bacommon.workspace.assetsv1.AssetsV1AprefFile[source]

Bases: IOMultiType[AssetsV1AprefFileTypeID]

Top level class for our multitype.

An <name>.apref source in an assets_v1 workspace is an asset-package reference: a pin to a published asset-package version. String briefs can then reference the pinned package’s translations via cross-package term refs ({@<apref-logical-path>:<entry-path>}).

classmethod get_type(type_id: AssetsV1AprefFileTypeID) → type[AssetsV1AprefFile][source]

Return the subclass for each of our type-ids.

classmethod get_type_id() → AssetsV1AprefFileTypeID[source]

Return the type-id for this subclass.

classmethod get_type_id_storage_name() → str[source]

Return the key used to store type id in serialized data.

The default is a short obscure value so that it is unlikely to conflict with members of individual type attrs, but in some cases one might prefer to serialize it to something simpler like ‘type’ by overriding this call. One just needs to make sure that no encompassed types serialize anything to that same name themself (dataclassio will error if they do).

class bacommon.workspace.assetsv1.AssetsV1AprefFileTypeID(*values)[source]

Bases: Enum

Type ID for each of our subclasses.

V1 = 'v1'
class bacommon.workspace.assetsv1.AssetsV1AprefFileV1(apverid: str)[source]

Bases: AssetsV1AprefFile

Our initial version of asset-package-ref file data.

apverid: str

The pinned asset-package-version id (<account>.<package>.<version-segment>). Always a concrete version — including on the dev track (a specific devN segment, never the bare dev pseudo-id); pins only move via the explicit update/switch-track actions in the workspace UI.

classmethod get_type_id() → AssetsV1AprefFileTypeID[source]

Return the type-id for this subclass.

class bacommon.workspace.assetsv1.AssetsV1GlobalVals(base_assets: str | None = None, base_assets_filter: str = '', docs: str = '', dev_team: str | None = None, asset_package_name: str | None = None, conventions: ConventionsMode = ConventionsMode.RELAXED, visibility: PackageVisibility = PackageVisibility.PUBLIC, source_sharing: PackageSourceSharing = PackageSourceSharing.PRIVATE, credit_on_copies: bool = True)[source]

Bases: IOExtendedData

Global values for an assets_v1 workspace.

asset_package_name: str | None = None

The asset-package name this workspace publishes under. None means it is derived from the workspace’s display name (see derive_asset_package_name()); set explicitly to decouple the published name from the display name (e.g. to keep a package lineage across a workspace rename, or to have a new workspace take over publishing an existing package name).

base_assets: str | None = None
base_assets_filter: str = ''
conventions: ConventionsMode = 'relaxed'

Conventions-check enforcement level (see ConventionsMode). First-party workspaces set strict (see the asset-packages design doc). Set by hand in workspace.json – deliberately not exposed in the UI. Unknown stored values fall back to relaxed so older servers never over-enforce.

credit_on_copies: bool = True

Whether copies made from this package’s shared sources name its owner in their credit (the CC BY 4.0 attribution shown with them). An owner may ask not to be credited, a right CC BY 4.0 gives; copies then show a credit without the name.

dev_team: str | None = None

Dev-team id granting resolve access to this workspace’s dev/test asset-package versions. None (unset) means owner-only access — matching the semantics of the asset-package doc’s dev_team_id (see AssetPackage.account_has_access).

docs: str = ''

Optional free-form workspace documentation, appended to the generated wrapper module’s docstring (after the auto-generated summary line). Empty string means none.

source_sharing: PackageSourceSharing = 'private'

Who may start a workspace of their own from this package’s source (see PackageSourceSharing). Package-wide policy, resolved live – it moved here from a per-version field in 2026-07-27, which republishing silently reset each time.

visibility: PackageVisibility = 'public'

Whether clients may have this package at all (see PackageVisibility). Set by hand in workspace.json – deliberately not exposed in the UI, same as conventions, since its use is limited to server-side packages. Unknown stored values fall back to public: failing closed here would break asset resolves for every client. (The key was resolve_access until 2026-11; will_input() still reads that.)

classmethod will_input(data: dict) → None[source]

Called on data before a class instance is created from it.

Can be overridden to migrate old data formats to new, etc. Fires on every dataclass-shaped dict in the input (not just the top level), in top-down order. Mutations to data are applied in place and are visible to the caller.

class bacommon.workspace.assetsv1.AssetsV1PathVals[source]

Bases: IOMultiType[AssetsV1PathValsTypeID]

Top level class for path vals classes.

classmethod get_type(type_id: AssetsV1PathValsTypeID) → type[AssetsV1PathVals][source]

Return a specific subclass given a type-id.

Should be overridden by child classes. Generally, users of the class should call get_type_cached() instead of this, as it is more efficient.

classmethod get_type_id() → AssetsV1PathValsTypeID[source]

Return the type-id for this subclass.

classmethod get_type_id_storage_name() → str[source]

Return the key used to store type id in serialized data.

The default is a short obscure value so that it is unlikely to conflict with members of individual type attrs, but in some cases one might prefer to serialize it to something simpler like ‘type’ by overriding this call. One just needs to make sure that no encompassed types serialize anything to that same name themself (dataclassio will error if they do).

class bacommon.workspace.assetsv1.AssetsV1PathValsAprefV1(keep_up_to_date: bool = True)[source]

Bases: AssetsV1PathVals

Path-specific values for an .apref asset-package ref.

Keyed in workspace.json’s path dict by the .apref file’s path. Carries per-pin settings that are not part of the pin itself – the pinned apverid lives in the .apref file, since that is content the workspace owns and syncs.

NOTE: adding a member to AssetsV1PathValsTypeID is a wire change with a cross-repo rollout. Workspace compiles parse this map via WorkspaceCompileInput.parse_path_config_data, which raises PermanentBuildError on an entry it cannot decode – and those compiles run on basn nodes carrying their own copy of this file. So a node that predates this type hard-fails any build of a workspace using it. Rolling one out means: define here -> make efrosync -> deploy basn -> bump CLOUD_BUILD_MIN_BASN_VERSION -> only then let bamaster start writing it.

classmethod get_type_id() → AssetsV1PathValsTypeID[source]

Return the type-id for this subclass.

keep_up_to_date: bool = True

Whether pending updates should include bumping this pin to the newest version on its own track. See docs/initiatives/pin_keep_up_to_date.md.

On by default, to encourage modders to keep what they depend on current. With store_default=False that means the absence of this field reads as enabled, so every existing workspace inherits the behavior with no migration and the common case costs no bytes. The trade is that “never set” and “explicitly enabled” are indistinguishable – fine here, but it does mean an explicit opt-out is the only thing that leaves a trace.

class bacommon.workspace.assetsv1.AssetsV1PathValsAudioV1(audio_role: AudioRole = AudioRole.DEFAULT, audio_quality: AudioQuality = AudioQuality.DEFAULT, play_group: AudioPlayGroupMode = AudioPlayGroupMode.AUTO, custom_play_group: str = '', priority: AudioPriority = AudioPriority.DEFAULT, docs: str = '')[source]

Bases: AssetsV1PathVals

Path-specific values for an audio source in an assets_v1 workspace.

The per-sound authoring knobs (AudioRole, AudioQuality, AudioPlayGroupMode, AudioPriority) are module-level types in this module.

audio_quality: AudioQuality = 'default'
audio_role: AudioRole = 'default'
custom_play_group: str = ''

The group name for AudioPlayGroupMode.CUSTOM (ignored otherwise).

docs: str = ''

Optional free-form documentation for this asset, surfaced as a comment above the asset in generated wrapper modules (and in the Sphinx docs). Empty string means no docs.

classmethod get_type_id() → AssetsV1PathValsTypeID[source]

Return the type-id for this subclass.

play_group: AudioPlayGroupMode = 'auto'
play_group_tag() → str[source]

Our play group setting as the engine reads it from a sound.

Empty for AudioPlayGroupMode.AUTO (the engine’s default, so nothing needs saying), unique, or custom:<name>. A custom group with no usable name counts as auto.

priority: AudioPriority = 'default'
priority_tag() → str[source]

Our priority as the engine reads it from a sound.

Empty for the default (nothing needs saying).

class bacommon.workspace.assetsv1.AssetsV1PathValsCubeMapV1(docs: str = '')[source]

Bases: AssetsV1PathVals

Path-specific values for a cube map (.cubemap dir) in a workspace.

Cube maps have no build-time settings (decision #24), so this currently carries only optional docs. Keyed in workspace.json’s path dict by the .cubemap directory path.

docs: str = ''

Optional free-form documentation for this asset, surfaced as a comment above the asset in generated wrapper modules (and in the Sphinx docs). Empty string means no docs.

classmethod get_type_id() → AssetsV1PathValsTypeID[source]

Return the type-id for this subclass.

class bacommon.workspace.assetsv1.AssetsV1PathValsGroupV1(docs: str = '')[source]

Bases: AssetsV1PathVals

Path-specific values for a group (directory) in a workspace.

A group builds no asset of its own; this exists purely to carry optional docs (decision #28) that become the generated wrapper group class’s docstring. Keyed in workspace.json’s path dict by the directory path (e.g. textures or mydir/subdir).

docs: str = ''

Optional free-form documentation for this group, used as the generated wrapper group class’s docstring (a trailing “See source for the full asset list.” is always appended). Empty string means fall back to the auto-generated docstring.

classmethod get_type_id() → AssetsV1PathValsTypeID[source]

Return the type-id for this subclass.

class bacommon.workspace.assetsv1.AssetsV1PathValsMeshV1(mesh_role: MeshRole = MeshRole.DEFAULT, docs: str = '', thumbnail_priority: int = 0)[source]

Bases: AssetsV1PathVals

Path-specific values for a mesh source in an assets_v1 workspace.

The per-mesh authoring knob (MeshRole) is a module-level type in this module.

docs: str = ''

Optional free-form documentation for this asset, surfaced as a comment above the asset in generated wrapper modules (and in the Sphinx docs). Empty string means no docs.

classmethod get_type_id() → AssetsV1PathValsTypeID[source]

Return the type-id for this subclass.

mesh_role: MeshRole = 'default'
thumbnail_priority: int = 0

How strongly to prefer this mesh for its package’s thumbnail: higher goes first, ties keep contents order, and a negative value never appears there.

class bacommon.workspace.assetsv1.AssetsV1PathValsStrV1(up_to_date_state: str | None = None, state: AssetsV1StrState | None = None, wrap: WrapParams | None = None, deps: AssetsV1StrTermDeps | None = None, conv: AssetsV1StrConvCache | None = None, failures: dict[~bacommon.locale.Locale, ~bacommon.workspace.assetsv1.AssetsV1StrTranslateFailure]=<factory>, traces: dict[~bacommon.locale.Locale, str]=<factory>, reservations: dict[~bacommon.locale.Locale, str]=<factory>)[source]

Bases: AssetsV1PathVals

Path-specific values for an assets_v1 workspace path.

conv: AssetsV1StrConvCache | None = None

Retired – cached conventions findings, now held in a content-addressed Valkey group instead (assetsv1conventions.conv_findings_group). Same reasoning as deps above; it was a further ~16%.

deps: AssetsV1StrTermDeps | None = None

Retired – cached term-ref info, now held in a content-addressed Valkey group instead (assetsv1str.term_deps_group). Kept only so stored records carrying it still parse; never read or written. It moved because a cache keyed by immutable content needs no home in the snapshot – and living here meant only write paths could fill it, since a path-vals write mints a snapshot and races user saves. It was also ~23% of a large workspace’s workspace.json.

failures: dict[Locale, AssetsV1StrTranslateFailure]

Locales whose most recent translation failed (see AssetsV1StrTranslateFailure). Maintained by the master’s translate runs; shown in the workspace UI.

classmethod get_type_id() → AssetsV1PathValsTypeID[source]

Return the type-id for this subclass.

reservations: dict[Locale, str]

Locales whose current output was shipped with reservations. Every attempt was rejected and the master’s final review used the best it could find while judging it not fully right. Maps the locale to that review’s note (plain English, for maintainers). Cleared when the locale is next translated without reservations.

state: AssetsV1StrState | None = None

Per-locale up-to-date state (see AssetsV1StrState). Stamped by the translate / mark-clean paths for exactly the locales they brought current; a locale absent here (or whose stamp no longer matches a fresh calc) needs regenerating.

traces: dict[Locale, str]

Per-locale id of the translation trace (the master’s step-by-step record of the model calls and checks) that produced that locale’s current output. Maintained by the master’s translate runs; traces expire after a while, so an id here may no longer resolve.

up_to_date_state: str | None = None

Retired – the single whole-entry up-to-date state, superseded by the per-locale state below. Kept only so stored records carrying it still parse; never read, and cleared on the next stamp. Never populate it.

(Historical note: string author docs briefly lived here as a docs path-val to avoid restaling translations; they moved into the .bstr itself once docs began feeding the translation prompt, with the UI’s mark-translations-clean action as the no-regeneration-needed escape hatch.)

wrap: WrapParams | None = None

Optional definition-time line-wrapping hints (decision D-t in the language-string-context initiative): applied automatically at evaluation everywhere this string displays. Locale-invariant. Lives HERE (not in the .bstr) deliberately: the .bstr is by definition the translation input, so its content hash is the translation-staleness key, and display-side metadata like this must not restale translations (the same reasoning as the docs history above, in reverse – wrap does not feed the translation prompt).

class bacommon.workspace.assetsv1.AssetsV1PathValsTexV1(texture_quality: TextureQuality = TextureQuality.DEFAULT, texture_role: Role = Role.DEFAULT, texture_wrapping_h: TextureWrapping = TextureWrapping.CLAMP, texture_wrapping_v: TextureWrapping = TextureWrapping.CLAMP, astc_settings: AstcSettings = <factory>, bc7_settings: Bc7Settings = <factory>, docs: str = '', thumbnail_priority: int = 0, fallback_high_res: bool = False, texture_alpha: TextureAlpha = TextureAlpha.AUTO)[source]

Bases: AssetsV1PathVals

Path-specific values for an assets_v1 workspace path.

The per-texture quality knobs (TextureQuality, Role, AstcSettings, Bc7Settings) are module-level types in this module.

astc_settings: AstcSettings

Per-format encode settings, consulted only when texture_quality is CUSTOM. Fully defaulted so a texture never has to store them explicitly.

bc7_settings: Bc7Settings
docs: str = ''

Optional free-form documentation for this asset, surfaced as a comment above the asset in generated wrapper modules (and in the Sphinx docs). Empty string means no docs.

fallback_high_res: bool = False

Halve the fallback flavor’s level0 downsize divisor (2 instead of 4) so this asset’s fallback carries a higher-res top mip. For the rare asset whose fallback bytes get consumed directly rather than just serving as a universal render fallback – e.g. the engine cursor texture feeding OS hardware cursors, which wants a retina-res mip. Deliberately not exposed in the workspace web UI (it would be noise there); edit workspace.json directly for the odd asset that needs it.

classmethod get_type_id() → AssetsV1PathValsTypeID[source]

Return the type-id for this subclass.

normalize() → None[source]

Reset redundant/unused settings to defaults, in place.

A pure tidiness pass to run before storing: it never changes the resolved result, only drops dead data so store_default=False can strip it from workspace.json. Resolution consults the per-format settings only when the top-level texture_quality is CUSTOM, and a format’s explicit values (both tiers’ sets) only when that format’s own texture_quality is CUSTOM – so anything outside those paths is unused and gets cleared here.

texture_alpha: TextureAlpha = 'auto'

Whether this texture’s alpha channel is meaningful (see TextureAlpha). Like fallback_high_res this is deliberately not exposed in the workspace web UI; edit workspace.json directly to answer a stray-alpha conventions finding.

texture_quality: TextureQuality = 'default'
texture_role: Role = 'default'
texture_wrapping_h: TextureWrapping = 'clamp'

Horizontal (u/s axis) wrapping. See TextureWrapping – this feeds mip filtering, the KTX2 key/value data, and the engine’s GL_TEXTURE_WRAP_S.

texture_wrapping_v: TextureWrapping = 'clamp'

Vertical (v/t axis) wrapping. See TextureWrapping – this feeds mip filtering, the KTX2 key/value data, and the engine’s GL_TEXTURE_WRAP_T.

thumbnail_priority: int = 0

How strongly to prefer this texture for its package’s thumbnail: higher goes first, ties keep contents order, and a negative value never appears there (handy for masks and other data textures).

class bacommon.workspace.assetsv1.AssetsV1PathValsTypeID(*values)[source]

Bases: Enum

Types of vals we can store for paths.

APREF_V1 = 'apref_v1'
AUDIO_V1 = 'audio_v1'
CUBE_MAP_V1 = 'cube_map_v1'
GROUP_V1 = 'group_v1'
MESH_V1 = 'mesh_v1'
STR_V1 = 'str_v1'
TEX_V1 = 'tex_v1'
class bacommon.workspace.assetsv1.AssetsV1StrConvCache(state: str, findings: list[str] = <factory>, notices: list[str] = <factory>)[source]

Bases: object

Cached conventions findings for a .bstr, keyed to its inputs.

Per-entry conventions findings are a pure function of the .bstr file’s content plus the workspace’s cross-package term environment (its .apref files’ content-ids) plus the checks’ own version – all folded into state. Consumers (the conventions lint) use it to skip reading the file; on mismatch they fall back to reading and re-checking that one entry. Maintained automatically by the string save/translate paths; do not hand-edit (wrong findings with a matching state would be trusted).

findings: list[str]

The entry’s findings (human-readable one-liners), empty if clean.

notices: list[str]

The entry’s notices – things worth knowing that never block (which languages have Review off). A record written before these existed has none, which is right for it: what a notice reports is set by fields that postdate it, and setting one changes the file and so the state.

state: str

Token pinning the inputs these findings were computed from (see class docs). Opaque; produced by the conventions module.

class bacommon.workspace.assetsv1.AssetsV1StrState(uniform: str | None = None, per_locale: dict[~bacommon.locale.Locale, str]=<factory>)[source]

Bases: object

A .bstr’s up-to-date state, resolved per locale.

A locale’s output is a pure function of the entry’s own content plus, for each {@…} term it references, that term’s translated value for that locale in the pinned version. So staleness is per-locale: fixing one locale of a shared term must cost its dependents that one locale, not all ~41.

Two shapes, because per-locale resolution is only ever needed by the minority of entries that reference terms:

  • uniform – one state covering every locale. Used when the entry has no term refs, so nothing about its translation inputs varies by locale.

  • per_locale – one state per locale. Used when it does.

Storing per-locale for everything would be far larger than the rest of workspace.json combined (BaClassicAssets: 32 of 1128 entries carry refs), hence the split. Read through for_locale(), which hides it.

for_locale(locale: Locale) → str | None[source]

This entry’s state for one locale, or None if unstamped.

locales_stamped() → bool[source]

Whether anything is stamped at all.

per_locale: dict[Locale, str]

Per-locale states (entries with term refs).

uniform: str | None = None

State shared by every locale (entries with no term refs).

class bacommon.workspace.assetsv1.AssetsV1StrTermDeps(file_id: str, inputs_digest: str = '', local: list[str] = <factory>, cross: list[str] = <factory>, kinds: list[str] | None = None, exact_pending: dict[str, str] | None=None)[source]

Bases: object

Cached term-ref info for a .bstr, keyed to its content.

Term refs ({@term} / {@pkg:term} in the brief) are a pure function of the .bstr file’s content, which is pinned by its content-addressed file_id – so this record stays valid exactly as long as file_id matches the entry’s current file. Consumers (dep-aware staleness calcs) use it to skip reading the file; on mismatch they fall back to reading that one file. Maintained automatically by the string save/translate paths; do not hand-edit (a wrong local/cross list with a matching file_id would be trusted).

cross: list[str]

Term-ref targets, whole (<apref-path>:<entry-path>, no extensions) – consumers key staleness on the individual referenced term, not just its package. (Historical note: this briefly held bare apref paths; consumers ignore any entry lacking the : half and re-extract from the file.)

exact_pending: dict[str, str] | None = None

Languages whose exact value in the brief (a [Language: "text"] line; see bacommon.strbrief.brief_exact_values()) is not yet the file’s stored translation for them, as locale value -> a short hash of that text. Such a language is due until the text has passed the checks and been stored; one whose stored translation already equals its exact value is absent (clean depends on the text, not where it came from). None on records predating the field, which consumers treat as a cache miss; a file with none pending stores {}. (Stored key ‘x’ briefly held every exact value’s hash, 2026-11-10; don’t reuse it.)

file_id: str

Content-id of the .bstr file these refs were extracted from.

inputs_digest: str = ''

Digest of the entry’s translation inputs (brief, docs, style and layout presets) – everything that shapes what the model produces, and nothing else. Notably NOT the entry’s own outputs or modtimes: staleness folds this in per locale, so including outputs would mean writing one locale’s translation restaled every other locale. Empty on records predating the field, which consumers treat as a cache miss.

kinds: list[str] | None = None

Sorted unique display-param kinds this entry’s brief uses ('bytes' etc.; the union over display_param_kinds_for_brief()). What the master consults to decide which formatter components a package build must embed, without reading the file. None on records predating the field, which consumers treat as a cache miss so the record gets repaired (mirroring inputs_digest); an extracted brief using no spec’d params stores [].

local: list[str]

Retired – same-package term refs, which no longer exist. Kept only so stored records carrying it still parse; a non-empty value means the record predates the removal, and consumers treat that as a cache miss and re-extract. Never populate it.

class bacommon.workspace.assetsv1.AssetsV1StrTranslateFailure(kind: str, reason: str, time: datetime, state: str | None = None, trace: str | None = None)[source]

Bases: object

One locale’s most recent failed translation of a .bstr.

Written by the master’s translate runs when a locale could not be completed, and cleared when that locale next translates. It only applies while state still matches the locale’s current up-to-date state: editing the brief (or anything else feeding the translation) makes a stale failure moot without anyone clearing it.

kind: str

needs_input (the checks kept rejecting it; the brief needs work) or retryable (a temporary service problem). A plain string rather than an enum so kinds added later never break an older reader of stored data.

reason: str

Person-facing English explanation (for a rejected translation, what the output reads back as and why that is wrong).

state: str | None = None

The locale’s up-to-date state (see AssetsV1StrState) the failed attempt was working from.

time: datetime

When the failure happened.

trace: str | None = None

Id of the master’s translation trace for the failed attempt (see AssetsV1PathValsStrV1.traces), if one was recorded.

class bacommon.workspace.assetsv1.AssetsV1StringFile[source]

Bases: IOMultiType[AssetsV1StringFileTypeID]

Top level class for our multitype.

classmethod get_type(type_id: AssetsV1StringFileTypeID) → type[AssetsV1StringFile][source]

Return the subclass for each of our type-ids.

classmethod get_type_id() → AssetsV1StringFileTypeID[source]

Return the type-id for this subclass.

classmethod get_type_id_storage_name() → str[source]

Return the key used to store type id in serialized data.

The default is a short obscure value so that it is unlikely to conflict with members of individual type attrs, but in some cases one might prefer to serialize it to something simpler like ‘type’ by overriding this call. One just needs to make sure that no encompassed types serialize anything to that same name themself (dataclassio will error if they do).

class bacommon.workspace.assetsv1.AssetsV1StringFileTypeID(*values)[source]

Bases: Enum

Type ID for each of our subclasses.

V1 = 'v1'
class bacommon.workspace.assetsv1.AssetsV1StringFileV1(input: str, input_modtime: datetime.datetime, string_type: StringType = StringType.REGULAR, style_preset: StylePreset = StylePreset.NONE, docs: str = '', layout_preset: LayoutPreset = LayoutPreset.NONE, translation_effort: TranslationEffort = TranslationEffort.AUTO, english_exact: str = '', default_translation_mode: TranslationMode = TranslationMode.AUTOMATIC, language_modes: dict[Locale, TranslationMode]=<factory>, unreviewed_languages: list[Locale] = <factory>, translate_automatically: bool = True, review_translations: bool = True, mention_phrases: list[str] = <factory>, outputs: dict[Locale, Output]=<factory>)[source]

Bases: AssetsV1StringFile

Our initial version of string file data.

class LayoutPreset(*values)[source]

Bases: Enum

What kind of slot a string occupies, and how it may size.

(Named FitPreset until 2026-07-27; the stored key stays fit_preset. Renamed because the values describe the slot – a narrow tab, a standard button, a body paragraph – and only some of them are a size constraint at all.)

Mirrors StylePreset: passed to the translator with UI context, so localized output respects both the space available and the register the slot implies. The CHARS_* budgets are display-width in Latin characters – wide-glyph scripts (CJK) target roughly half the character count – and are aims, never outranking meaning: a translation past its budget is asked for a shorter version that says everything, and ships long if there is none. Text past 1.5 times the budget never ships; the string goes back to its author.

CHARS_20 = 'chars_20'

Aim for ~20 characters - narrow buttons, tabs, column headings.

CHARS_40 = 'chars_40'

Aim for ~40 characters - standard buttons and labels.

CHARS_80 = 'chars_80'

Aim for ~80 characters / one concise line - transient messages, status lines, and the like.

NONE = 'none'

Unset – no slot declared and no size constraint. Note this is the absence of a choice, which is why the authoring check nags on a long English string that is still NONE: use PROSE to say “unbounded on purpose”.

PROSE = 'prose'

Body prose - paragraphs in a document or web page. No size constraint, but unlike NONE that is a deliberate statement, and it tells the translator to write flowing multi-sentence text rather than terse UI wording.

property char_budget: int | None

The preset’s rough character budget (None if unbounded).

class Output(modtime: datetime, value: str | StringSelector = '')[source]

Bases: object

Represents a single localized output.

modtime: datetime

When this output was last changed.

value: str | StringSelector = ''

The localized output – a plain string, or a render-time StringSelector (plural/select) whose final form is chosen at display time. (A type-disjoint dataclassio union; selectors ride the wire as dicts.)

class StringType(*values)[source]

Bases: Enum

What kind of string an entry is.

Most are REGULAR: text shown somewhere. The rest declare the entry a term: a word or name other strings refer to ({@terms:...}) instead of each translating it afresh. A term’s type says what the thing is, which decides how each language writes it: both the form its own translation takes (always as written in the middle of a sentence) and how the strings that use it case and inflect it.

REGULAR = 'regular'

An ordinary string; not a term.

TERM_ACTION = 'term_action'

An action (a verb), stored in its base form.

TERM_NAME = 'term_name'

A name the game gives one of its own things (a product, a currency).

TERM_THING = 'term_thing'

An ordinary word or phrase for a kind of thing; not a name.

is_term() → bool[source]

Whether this type declares a term.

class StylePreset(*values)[source]

Bases: Enum

Preset for general styling in translated strings.

Tells the translator what kind of text a string is, so every locale styles it the way that kind of text is written there.

LABEL = 'title'

A standalone UI label – a button, a window or section heading, a menu item, a tab, an entry in a list or popup (a language name in a language picker, say). Not text that sits inside a sentence. English uses Title Case; most other languages capitalize just the first word, even ones that write the same word in lowercase mid-sentence (Spanish ‘Sueco’ as a list entry, ‘sueco’ in a sentence). (Stored as ‘title’: the preset’s original name, kept so existing strings are untouched.)

LOUD = 'loud'

Intense, eye-catching text. English uses ALL CAPS.

NONE = 'none'

Running text – sentences, messages, body copy. No styling guidance; the brief may add its own.

SOFT = 'soft'

Soft, understated text. English uses all lowercase.

class TranslationEffort(*values)[source]

Bases: Enum

How much model effort a string’s translations warrant.

Deliberately describes intent, not a model or a vendor setting: the server maps these onto whatever (model, thinking level) pair is current, so retuning that never touches stored .bstr data or restales translations.

AUTO is the right answer for nearly every string – short UI labels translate identically at any effort. It runs cheap first and escalates on its own when the brief looks structurally hard or when a generated attempt fails validation. Reach for HIGH only for semantic subtlety no heuristic can see: wordplay, brand voice, a line whose tone has to land.

AUTO = 'auto'

Server decides – cheap by default, escalating when warranted.

HIGH = 'high'

Always translate at maximum effort.

class TranslationMode(*values)[source]

Bases: Enum

How a language of an entry gets its text.

AUTOMATIC = 'automatic'

Translated by the pipeline from the brief.

MANUAL = 'manual'

Written by a person, on the language’s exact-value line in the brief ([German: "..."]); never generated.

default_translation_mode: TranslationMode = 'automatic'

The mode of a language that has neither a text of its own in the brief nor an entry in language_modes; that includes a language added to the game later. MANUAL is for an entry whose every text is written by a person (another company’s product name as that company writes it in each language, say): a language without a text is then an error until someone supplies it, never a machine translation. Not part of the translation digest: changing it makes only the languages it leaves without a text due.

docs: str = ''

Optional free-form usage docs describing where this string appears and how it is used. Feeds both the generated wrapper accessor’s docstring and the translation prompt (as usage context). Lives in the .bstr itself so edits restale translations via the file’s content-id; when an edit doesn’t warrant regeneration, use the UI’s mark-translations-clean action.

english_exact: str = ''

The exact English text of this string, when the wording is fixed (empty = not stated). The English output is checked against it (modulo the style preset’s casing) and regenerated on a mismatch. The structured successor to writing In English this is exactly: "..." in the brief, which is still honoured. Like translation_effort, folded into the translation digest only when set, so adding the field restaled nothing.

classmethod get_type_id() → AssetsV1StringFileTypeID[source]

Return the type-id for this subclass.

input: str
input_modtime: datetime.datetime
language_modes: dict[Locale, TranslationMode]

Languages given a mode of their own, for what a line in the brief cannot say: MANUAL with no text yet, or AUTOMATIC although the default is manual. A language with a text on its brief line is manual whatever this holds.

layout_preset: LayoutPreset = 'none'

Which kind of slot this string occupies (see LayoutPreset). The stored key remains fit_preset from before the rename – values on disk must not move. Passed to the translator so localized output respects the UI space available.

mention_phrases: list[str]

the phrases whose literal appearance in a consuming brief means “this should be a {@...} ref to me” (empty = the term’s own English text, which is right for most terms). Set it when that English is a common word with other senses – the profile-icon term renders as just “icon”, but a power-up’s icon or a button icon is not it, so it lists profile icon and player icon instead. Authoring-lint metadata only: it never reaches the translator, so it is not part of the translation digest and editing it restales nothing.

Type:

For a shared term

outputs: dict[Locale, Output]
review_translations: bool = True

off, together with translate_automatically off, means no language of the entry is reviewed. Still read; folded into the entry’s translation digest while in effect, as it always was. Nothing sets it any more.

Type:

Older form of unreviewed_languages

string_type: StringType = 'regular'

What kind of string this is; anything but REGULAR makes it a term.

style_preset: StylePreset = 'none'
translate_automatically: bool = True

off means a manual default. Still read (entries stored with it keep working); nothing sets it any more.

Type:

Older form of default_translation_mode

translation_effort: TranslationEffort = 'auto'

How much model effort this string’s translations warrant (see TranslationEffort). Unlike the other presets this is folded into the translation digest only when it is not AUTO, so adding the field left every existing entry’s digest byte-identical rather than restaling the whole corpus.

unreviewed_languages: list[Locale]

Manual languages whose text no model reviews – they are held to the mechanical checks only (one line, substitutions, writing system and the like). For text a model cannot judge, or that its author vouches for. Means nothing for an automatic language, which is always reviewed. Part of that language’s own state, so switching it makes that language due and no other.

class bacommon.workspace.assetsv1.AstcBlockSize(*values)[source]

Bases: Enum

ASTC square block size — the mobile bitrate lever.

Smaller block = more bits per texel = higher quality + larger output. Consulted only when an AstcSettings has its texture_quality set to CUSTOM; otherwise the blanket LOW/DEFAULT/HIGH map to a value in this range (LOW = TWELVE_BY_TWELVE, HIGH = FOUR_BY_FOUR).

This is every 2D block size ASTC defines. Every block is 128 bits whatever its shape, so bits per texel is 128 / (width * height) and the non-square sizes are simply finer steps along the same size/quality scale.

Members are ordered from highest quality (most bits per texel) to lowest; keep them that way. The automatic quality search walks them in definition order as its ladder.

EIGHT_BY_EIGHT = '8x8'
EIGHT_BY_FIVE = '8x5'
EIGHT_BY_SIX = '8x6'
FIVE_BY_FIVE = '5x5'
FIVE_BY_FOUR = '5x4'
FOUR_BY_FOUR = '4x4'
SIX_BY_FIVE = '6x5'
SIX_BY_SIX = '6x6'
TEN_BY_EIGHT = '10x8'
TEN_BY_FIVE = '10x5'
TEN_BY_SIX = '10x6'
TEN_BY_TEN = '10x10'
TWELVE_BY_TEN = '12x10'
TWELVE_BY_TWELVE = '12x12'
class bacommon.workspace.assetsv1.AstcEffort(*values)[source]

Bases: Enum

How hard the ASTC encoder works per block (its search preset).

More effort = better quality at the same block size (so the same output size), paid for in build time only. Consulted only when an AstcSettings has its texture_quality set to CUSTOM; otherwise the texture tier picks it (regular = MEDIUM, ultra = THOROUGH).

FAST = 'fast'
FASTEST = 'fastest'
MEDIUM = 'medium'
THOROUGH = 'thorough'
VERY_THOROUGH = 'verythorough'
class bacommon.workspace.assetsv1.AstcSettings(texture_quality: TextureQuality = TextureQuality.DEFAULT, block_size: AstcBlockSize = AstcBlockSize.SIX_BY_SIX, effort: AstcEffort = AstcEffort.MEDIUM, alpha_priority: AlphaPriority = AlphaPriority.DEFAULT, ultra_block_size: AstcBlockSize = AstcBlockSize.FOUR_BY_FOUR, ultra_effort: AstcEffort = AstcEffort.THOROUGH, ultra_alpha_priority: AlphaPriority = AlphaPriority.DEFAULT)[source]

Bases: object

Per-texture ASTC (mobile) encode settings.

Consulted only when the texture’s top-level texture_quality is CUSTOM. Its own texture_quality may in turn be CUSTOM to use explicit values; otherwise LOW/DEFAULT/HIGH select an automatic quality target, the same way at every texture tier. Fully defaulted so a texture never has to store it explicitly.

The explicit values come in two independent sets, one per texture tier: block_size/effort/alpha_priority for regular and the ultra_-prefixed equivalents for ultra. The ultra set’s block size and effort default to maximum quality, so hand-tuning the regular values can never leave ultra looking worse than regular by accident.

alpha_priority: AlphaPriority = 'default'
block_size: AstcBlockSize = '6x6'
effort: AstcEffort = 'medium'
texture_quality: TextureQuality = 'default'
ultra_alpha_priority: AlphaPriority = 'default'
ultra_block_size: AstcBlockSize = '4x4'
ultra_effort: AstcEffort = 'thorough'
class bacommon.workspace.assetsv1.AudioPlayGroupMode(*values)[source]

Bases: Enum

Which play group a sound’s plays count toward.

The game plays only so many sounds at once, and only a few of any one play group; past that, a new play of a group cuts off the group’s oldest. Groups are named, and names are shared across all asset packages.

  • AUTO — named for the sound’s file, less any trailing number: explosion01 and explosion02 (in any package) are both in explosion. Numbered variations of a sound thus limit each other as one sound would.

  • UNIQUE — a group of the sound’s own. For a numbered sound that is not a variation of its neighbors.

  • CUSTOM — the group named by AssetsV1PathValsAudioV1.custom_play_group.

AUTO = 'auto'
CUSTOM = 'custom'
UNIQUE = 'unique'
class bacommon.workspace.assetsv1.AudioPriority(*values)[source]

Bases: Enum

How much a sound matters when more want to play than can.

With everything busy, a new sound cuts off the oldest playing sound of the lowest priority at or below its own (looping sounds are never cut off).

DEFAULT = 'default'
HIGH = 'high'
HIGHER = 'higher'
LOW = 'low'
LOWER = 'lower'
class bacommon.workspace.assetsv1.AudioQuality(*values)[source]

Bases: Enum

Per-sound authoring quality knob (asset-packages decision #25).

Mirrors the texture knob’s LOW/DEFAULT/HIGH pattern. Defined from day one as the escape hatch for content whose default encode budget doesn’t fit (e.g. a short pre-mixed UI sound sharing music’s bitrate), but nothing consumes it yet — the recipe carries it in its cache key only, so wiring it up later rebuilds correctly.

DEFAULT = 'default'
HIGH = 'high'
LOW = 'low'
class bacommon.workspace.assetsv1.AudioRole(*values)[source]

Bases: Enum

A sound’s channel/encode contract (asset-packages decision #25).

Names the technical contract, not a content category — “music” deliberately does not exist as a build-time concept (volume routing stays a runtime play-flag; streaming is a length-derived engine policy).

  • DEFAULT — spatialization-ready: downmixed to mono at encode (OpenAL only spatializes mono; a hard requirement, not a size optimization). The vast majority of sounds.

  • PRE_MIXED — an authored mix: channels preserved (≤2) and the sound always plays listener-space. The recipe stamps a BA_ROLE=pre_mixed vorbis comment tag so the engine knows at load time (channel count alone can’t carry the bit — a mono pre-mixed source stays mono). Music, plus any intentionally stereo (or otherwise authored-mix) sound.

DEFAULT = 'default'
PRE_MIXED = 'pre_mixed'
class bacommon.workspace.assetsv1.Bc7Effort(*values)[source]

Bases: Enum

How hard the BC7 encoder works per block (its ‘uber’ level).

Paid for in build time only. Consulted only when a Bc7Settings has its texture_quality set to CUSTOM; otherwise every tier uses ZERO.

ZERO is the default everywhere because, measured against the metrics the quality search judges by, more effort does not reliably buy anything: across 17 first-party textures the higher levels stayed within about 1% of ZERO on average at every rdo setting, with individual textures swinging a few percent either way, for 1.2x-3x the encode time (2026-10). The odd texture does respond (one character body improved ~20%), which is what this knob remains for. TWO and THREE produce identical output.

FOUR = '4'
ONE = '1'
THREE = '3'
TWO = '2'
ZERO = '0'
class bacommon.workspace.assetsv1.Bc7Rdo(*values)[source]

Bases: Enum

BC7 RDO (rate-distortion optimization) lambda — the desktop lever.

BC7 is a fixed 8bpp block format, so its size lever is RDO: higher lambda steers the encoder toward more zlib/LZ-compressible output (smaller on-disk) at the cost of quality. OFF disables RDO (best quality, largest). Consulted only when a Bc7Settings has its texture_quality set to CUSTOM; otherwise the blanket LOW/DEFAULT/HIGH map to a value in this range (LOW = FOUR, HIGH = OFF).

Members are declared weakest to strongest; the automatic quality search walks them in that order, so keep it. Each doubling has one value in between: measured on 60 catalog textures (2026-10-06), that let the search land closer to its error cap and cut opaque textures’ download size by about 9% at low and default quality (1% at high; next to nothing for textures with alpha, where RDO only touches the fully opaque blocks).

FOUR = '4'
OFF = 'off'
ONE = '1'
ONE_POINT_FIVE = '1.5'
THREE = '3'
TWO = '2'
ZERO_POINT_FIVE = '0.5'
ZERO_POINT_ONE_EIGHT_SEVEN_FIVE = '0.1875'
ZERO_POINT_ONE_TWO_FIVE = '0.125'
ZERO_POINT_SEVEN_FIVE = '0.75'
ZERO_POINT_THREE_SEVEN_FIVE = '0.375'
ZERO_POINT_TWO_FIVE = '0.25'
class bacommon.workspace.assetsv1.Bc7Settings(texture_quality: TextureQuality = TextureQuality.DEFAULT, rdo: Bc7Rdo = Bc7Rdo.ONE, effort: Bc7Effort = Bc7Effort.ZERO, alpha_priority: AlphaPriority = AlphaPriority.DEFAULT, ultra_rdo: Bc7Rdo = Bc7Rdo.OFF, ultra_effort: Bc7Effort = Bc7Effort.ZERO, ultra_alpha_priority: AlphaPriority = AlphaPriority.DEFAULT)[source]

Bases: object

Per-texture BC7 (desktop) encode settings.

Consulted only when the texture’s top-level texture_quality is CUSTOM. Its own texture_quality may in turn be CUSTOM to use explicit values; otherwise LOW/DEFAULT/HIGH select an automatic quality target, the same way at every texture tier. Fully defaulted so a texture never has to store it explicitly.

As with AstcSettings, the explicit values come in a regular set (rdo/effort/alpha_priority) and an independent ultra_-prefixed set whose rdo defaults to maximum quality (off). Effort defaults to ZERO in both; see Bc7Effort for why.

alpha_priority: AlphaPriority = 'default'
effort: Bc7Effort = '0'
rdo: Bc7Rdo = '1'
texture_quality: TextureQuality = 'default'
ultra_alpha_priority: AlphaPriority = 'default'
ultra_effort: Bc7Effort = '0'
ultra_rdo: Bc7Rdo = 'off'
class bacommon.workspace.assetsv1.ConventionsMode(*values)[source]

Bases: Enum

Conventions-check enforcement level for an assets_v1 workspace.

STRICT blocks test/prod publishes while conventions findings exist (dev-track resolves are never gated); RELAXED (the default) surfaces findings as informational hints only.

RELAXED = 'relaxed'
STRICT = 'strict'
class bacommon.workspace.assetsv1.MeshRole(*values)[source]

Bases: Enum

What a mesh .obj source builds (asset-packages decision #26).

  • DEFAULT — a display mesh: compiled to the engine’s binary .bob format (welded/quantized verts, vertex-cache-optimized index order) and served from the flavor-varying meshes bucket (headless builds get none).

  • COLLISION — a collision mesh: compiled to the engine’s binary .cob format (positions + indices for the physics trimesh) and served from the flavor-invariant constant bucket — every build including headless gets it, and the bytes are identical across all flavors (networked sims/replays must agree on collision geometry).

COLLISION = 'collision'
DEFAULT = 'default'
class bacommon.workspace.assetsv1.PackageSourceSharing(*values)[source]

Bases: Enum

Who can start a new workspace from a package’s source.

Governs source availability only – who may copy the exporting workspace’s snapshot as the starting point for a workspace of their own. It says nothing about who can use the published assets; that’s the track plus PackageVisibility.

Package-wide (not per-version): sharing intent belongs to the package, and a per-version value meant every republish silently reset it.

DEV_TEAM_ONLY = 'devteam'
PRIVATE = 'private'
PUBLIC = 'public'
property pretty: str

Human-facing display name (use in UIs; not wire values).

class bacommon.workspace.assetsv1.PackageVisibility(*values)[source]

Bases: Enum

Whether a package is out in the world at all.

Orthogonal to the version track: a track says how released a version is, this says whether clients may have the package at all.

PUBLIC is the default and what every package had before this existed: prod versions resolve for anyone, dev/test versions for the owner and dev team.

UNLISTED is public for use and private for browsing: clients resolve and download it exactly as a public package (any code may require it), but it’s left out of public package listings, and its web pages (version page, contents, asset pages, previews) are for its owner, dev team and admins only. Like an unlisted video: not findable, not secret – its contents reach every client that uses it.

SERVER_ONLY is for packages nothing fetches at runtime – content the master evaluates itself, or build-time sources embedded into other packages. No client may resolve any version of it, on any track, whatever its account (the owner’s included, so nothing can come to depend on it by accident and work only for them). The server’s own uses (pins in the owner’s and dev team’s workspaces, builds, the owner’s web pages) are unaffected. Such packages are also left out of public package listings.

Gates the resolve, not the content. A server-only package’s entries can still reach clients verbatim – formatter components are embedded by value into each consuming package’s language blobs at build time – so this says “nothing fetches this package at runtime”, never “these strings are secret”.

SERVER_ONLY is stored as 'private', the value it had as the old PackageResolveAccess.PRIVATE, so stored and cached records (shared by every fleet) read the same on old and new code; the name 'server_only' is accepted on input too (workspace.json is written by hand).

PUBLIC = 'public'
SERVER_ONLY = 'private'
UNLISTED = 'unlisted'
property client_usable: bool

Whether clients may resolve the package (public or unlisted).

property pretty: str

Human-facing display name (use in UIs; not wire values).

class bacommon.workspace.assetsv1.Role(*values)[source]

Bases: Enum

What a texture is for (its authoring intent).

Drives mip-filtering math and encoder flags (asset-packages initiative decisions #19/#23). Intent-based rather than a bundle of low-level mechanical flags — the recipe maps each role to a concrete filtering/encoding behavior. normal_map is a reserved slot for when such content lands.

DATA = 'data'

Not a picture. Each channel is an independent value a shader reads on its own (colorize / tint masks and the like). Nothing is premultiplied, mips filter every channel independently on the stored values (no render_space transfer), the encoders weight all channels equally instead of perceptually, and the automatic quality search scores plain per-channel error instead of a perceptual color difference. Ships in the same container formats as color, so it needs nothing from the client.

DEFAULT = 'default'

sRGB color with straight opacity alpha. The pipeline premultiplies it by its alpha for storage (decision #23): premult-weighted, halo-free mip filtering in the requested render_space, premult output bytes, ALPHA_PREMULTIPLIED DFD flag set. The common case for color sprites. Renders correctly only with premult-blend (the renderer wiring lands in a later step; until then DEFAULT output shows darkened edges under the legacy straight-blend path).

PREMULTIPLIED_DATA = 'premultiplied_data'

Data whose channels a shader scales by the texture’s own alpha (frame masks: a cutout’s coverage plus the tint and highlight drawn around it). Built exactly like DATA except that the pipeline first multiplies the other channels by alpha and sets the ALPHA_PREMULTIPLIED DFD flag, so the client uses them as stored. Doing that multiply before filtering is the point: left to the shader it happens after the sampler has blended each channel on its own, which at an edge where a channel rises as alpha falls gives a bright fringe.

SOURCE_PREMULTIPLIED = 'source_premultiplied'

sRGB color whose SOURCE RGB is already premultiplied by its alpha (e.g. glow sprites — they carry additive RGB > alpha values that straight alpha cannot represent). The pipeline does NOT re-multiply; mips filter the premultiplied RGB directly (in the requested render_space) and the flag is set. Renders identically to DEFAULT (both premult-blend); they differ only in whether the pipeline applies the multiply.

STRAIGHT_ALPHA = 'straight_alpha'

sRGB color with straight alpha whose RGB channels carry meaningful color even in transparent regions, so they must be preserved (decision #23). The pipeline does NOT premultiply: mips filter RGB and alpha INDEPENDENTLY (color still filtered in the requested render_space, but with no premult round-trip, which would zero — and fail to recover — the transparent-region color). Straight output bytes; ALPHA_PREMULTIPLIED flag clear. Renders with ordinary straight-alpha blending.

bacommon.workspace.assetsv1.STRING_NOT_TRANSLATED = '<NOT-TRANSLATED>'

Placeholder value for a string with no generated output in its own locale or in English. We deliberately do NOT fall back to the brief input here: that’s the author’s description of what the string should say (a translator prompt), often a long-winded sentence – not display text – so rendering it is worse than an obvious “untranslated” marker.

class bacommon.workspace.assetsv1.TextureAlpha(*values)[source]

Bases: Enum

Whether a texture’s alpha channel is meaningful.

Exists because stray transparency is easy to ship by accident: a few unpainted texels in an otherwise opaque texture make the whole thing build as a transparent one (losing the opaque-only encoder weighting and making the quality search guard an alpha edge nobody sees).

AUTO = 'auto'

Detect from the pixels. Any texel with alpha below 255 makes the texture transparent. A texture whose transparency looks accidental gets a conventions finding asking for an explicit choice.

NO = 'no'

The texture is opaque; any transparency in the source is discarded (alpha forced to fully opaque) when building.

YES = 'yes'

The transparency is intentional; keep it and never flag it.

class bacommon.workspace.assetsv1.TextureQuality(*values)[source]

Bases: Enum

Per-texture authoring quality knob (decision #19).

DEFAULT is the normal case (the vast majority of textures); LOW and HIGH are deliberate per-texture overrides for special cases (e.g. HIGH for a hero texture that must stay crisp, LOW for one that can afford to be cheap). Named DEFAULT rather than MEDIUM to communicate that — it’s the baseline, not a middle setting you’d routinely reach past.

LOW/DEFAULT/HIGH are blanket settings that map to a sensible value for whichever encoder a profile uses (ASTC block size on mobile, BC7 RDO lambda on desktop). CUSTOM instead defers to the per-format AstcSettings / Bc7Settings so a texture can be tuned independently per encoder (e.g. ASTC HIGH while BC7 DEFAULT). Distinct from the bucket-level TextureTier.

CUSTOM = 'custom'
DEFAULT = 'default'
HIGH = 'high'
LOW = 'low'
class bacommon.workspace.assetsv1.TextureWrapping(*values)[source]

Bases: Enum

How a texture’s sampling behaves past its edge, per axis.

This is authoring intent, not just sampler state: it is a build input. Mip levels are filtered with a kernel that wraps (or mirrors) at the edge for the repeating modes and clamps for CLAMP, so changing it changes the built pixels – a texture’s wrapping is part of its identity, not an annotation on top of it. It also travels to the engine in the KTX2 key/value data and becomes the GL wrap mode for its axis.

CLAMP is the default and the only mode that permits non-power-of-two dimensions on its axis: the repeating modes halve their way down the mip chain, and an odd intermediate size puts each level’s texel grid out of phase with its parent, which breaks edge continuity precisely where a repeating texture needs it.

CLAMP = 'clamp'

Sample the edge texel for anything past the edge (GL_CLAMP_TO_EDGE). Mips filter with a clamped kernel.

MIRRORED_REPEAT = 'mirrored_repeat'

Tile with every other copy flipped (GL_MIRRORED_REPEAT). Seamless by construction; mips filter with a mirrored kernel.

REPEAT = 'repeat'

Tile (GL_REPEAT). Mips filter with a kernel that wraps around to the opposite edge, so the tiling seam stays continuous at every level.

class bacommon.workspace.assetsv1.WrapperType(*values)[source]

Bases: Enum

Python wrapper-module flavor for an asset-package version.

Selects which feature-set’s loader API the generated wrapper delegates to. Members today correspond 1:1 with feature-sets, but the type is deliberately named WrapperType (not WrapperFeatureset) to leave room for non-featureset-shaped variants (e.g. tooling-only or future loader APIs) without a rename.

BABASE = 'babase'

Strings-and-sounds wrapper for the babase layer. String leaves emit the same native babase.LangStr accessors as the featureset forms; sound leaves emit SimpleSoundHandle, whose .get() loads a babase.SimpleSound – the one classic asset loader API babase has (there is no babase texture or mesh equivalent, so those kinds are skipped). Exists so pre-featureset machinery (e.g. construct-mode’s bring-up UI, and the app/plugin/account paths that play ui feedback sounds before any feature-set is up) can consume package strings and sounds.

BASCENEV1 = 'bascenev1'
BAUIV1 = 'bauiv1'
bacommon.workspace.assetsv1.complete_locale_values(string_files: dict[str, AssetsV1StringFileV1], locale: Locale) → dict[str, str | StringSelector][source]

English-completed per-locale values for a set of string files.

Maps each string’s logical name to its value for locale: the locale’s own output, else the English output, else the STRING_NOT_TRANSLATED placeholder. So every locale’s map carries the complete key set with graceful English fallback – an untranslated string still renders (in English where available, else an obvious <NOT-TRANSLATED> marker) rather than failing, and every locale’s key set is identical. The brief input is intentionally never used as a value: it’s the author’s prompt/description, not display text.

The shared value-selection both the asset-build string recipe and the langstr vendor command route through (paired with serialize_language_blob()) so the built and vendored blobs can’t drift.

bacommon.workspace.assetsv1.derive_asset_package_name(workspace_name: str) → str[source]

Derive a default asset-package name from a workspace name.

Lowercases and strips spaces (‘My Awesome Assets’ -> ‘myawesomeassets’). The single source for this rule — publish paths, collision checks, and UI previews must all route through it. Note the result is not guaranteed to be a valid asset-package name (the workspace name may contain characters with no valid mapping); consumers validate at point of use.

bacommon.workspace.assetsv1.display_param_kinds(string_files: dict[str, AssetsV1StringFileV1]) → dict[str, dict[str, str]][source]

Per-string {param: kind} for params the display side must know.

A spec’d brief param ({size|data_size}) renders through logic the translated text cannot describe – the text holds only a {size} token – so its kind has to travel to the evaluator in the language blob. Plain text subs and the plural pivot are omitted: text is the default, and the pivot is not a named output token at all (it renders as the ICU # count placeholder inside each form).

Entries with nothing to declare are absent, so a package using no spec’d params serializes byte-identically to before this existed.

The shared derivation both the asset-build string recipe and the langstr vendor command route through, alongside complete_locale_values(), so the built and vendored blobs can’t drift on this either. Briefs that don’t parse contribute nothing rather than failing the build – consistent with how broken briefs degrade everywhere else.

bacommon.workspace.assetsv1.display_param_kinds_for_brief(brief: str) → dict[str, str][source]

Per-param display kinds for a single brief.

The one-entry unit display_param_kinds() aggregates; see it for what qualifies as a display kind. Values are display-kind expressions: the bare kind for an argless spec, else the kind plus its spec args in canonical form ('bytes(compact=true)') – see display_kind. Raises on a malformed brief – callers that must degrade softly (listing renders, builds) wrap it, matching how broken briefs degrade everywhere else.

bacommon.workspace.assetsv1.normalize_audio_play_group_name(name: str) → str[source]

Return a play group name as the engine will see it.

Trimmed and lowercased (so names differing only that way are one group) and held to AUDIO_PLAY_GROUP_NAME_MAX_LENGTH.