Skip to content

Namespace Apogee.Content.Assets

Classes

AssetDatabase

Which file an asset's UID names, and which UID a file has. The UID of an imported file is in its .import.xml, the UID of an authored one (a scene) is in its root element (); the database reads them from the files, so it is always about what is on disk. To find a UID it first asks the project's list, imported/assets.xml (written by : one read per root), and when that has nothing (or is out of date: the file moved after the import) it scans the files of its once. It never writes: giving files UIDs is the importer's job, so a read-only root (a pack, a mod, a shipped game) is fine, and its assets with no UID just have none.

Results are remembered until (call it after an import, or when files change on disk). Safe to use from several threads.

AssetReferenceSite

One place in a document that names an asset: an attribute whose text is an (or, for a script, a string that mentions the asset).

AssetReferences

Finds the documents that refer to an asset and rewrites them when the asset is renamed or moved: what the editor's rename calls. A document is an authored file (: scenes now) or an .xml file in one of the definition folders the caller names, in any root of the . A reference is an attribute whose whole text is an (Model="res://models/car.glb|uid://4k2m9x7q1w3ze"); text inside elements is not looked at.

What counts as a reference to the asset: an attribute whose path is the asset's path (as the engine writes it: the two addresses of a package file, res://packages/id/x and mod://id/x, are the same), or whose UID is the asset's UID and whose path does not lead to some other file. That last condition is the engine's own rule, the path wins while its file exists (): a reference that carries the UID of a copied file and the path of the copy means the copy.

Rewriting changes the characters of the path part of each reference and nothing else (); a UID is never touched, so a reference keeps resolving through it even if a document is missed. It is all or nothing: every new text is made and checked before the first file is written, a file that changed in between stops the whole thing, and if a write fails the files already written are put back. Nothing here deletes or half-writes a file.

AuthoredAssets

Assets that are written by people or tools as XML, rather than imported from another format: they carry their own UID, in the uid attribute of the document's root element (<Scene version="1" uid="uid://…">, <Prefab …>), and have no .import.xml. Scenes and prefabs now; materials add their extension to when they land.

ImportSidecar

The UID in a <asset>.import.xml: the uid attribute of its <Import> root (<Import uid="uid://4k2m9x7q1w3ze" srgb="false"/>). Anything that rewrites a sidecar (a settings panel) has to keep it: ImportSidecar.SetUid(newText, ImportSidecar.ReadUid(oldText)). The import settings and the import key ignore it (), so a UID never makes an asset import again.

MoveReport

What did, or in a preview would do.

ReferenceChange

An attribute that is rewritten (or would be, in a preview): where it is and what it will say.

RewriteReport

What did, or in a preview would do.

SkippedDocument

A file the search could not use, and why: the reason is written for a person (read-only, not valid UTF-8…).