ModuleAssets

Manages the editor asset system: scanning, import, identification, references, metadata, and dependencies.

Overview

Editor build: AssetScanner refresh on init, ContentRegistry, import via ImporterRegistry, AssetIndex, in-memory AssetCache, PrefabManager, deferred AssetFileDialog flush on postRender.

Release build: scanner/registry/dialog stripped; prefab manager remains; loading via library/index paths used by runtime.

Provides templated load<T>(AssetId&), save, import, dependency registration, fixAllAssetReferences (re-bake pipeline), and UID→AssetId resolution.

Importers include glTF (ImporterGltf + tinygltf) producing prefabs, meshes, materials, animations, skins.

Editor asset browser showing prefab assets in the project library
Editor asset browser showing prefab assets in the project library

How it works

  • init() builds subsystems; editor rescans disk.
  • Import: pick importer by extension → typed asset → library binary + index entry.
  • load pulls from cache or deserializes container, resolves AssetId references.

Internal architecture

ModuleAssets
├── AssetIndex (UID, hash, type, paths)
├── ImporterRegistry → ImporterGltf, etc.
├── AssetCache
├── PrefabManager
├── [Editor] AssetScanner, ContentRegistry, AssetFileDialog
└── persistAsset / registerSubAsset / dependency graph

Relationships

  • ModuleScene load/save uses scene assets.
  • ModuleResources materializes GPU data from assets.
  • ModuleFont loads FontAsset. ModuleMusic loads sound banks.

Technical features

  • Editor scan/import/cache pipeline with AssetIndex and importers.
  • glTF import via tinygltf.
  • Dependency graph and reference fixup (fixAllAssetReferences).
  • Large editor-only paths gated with #ifndef GAME_RELEASE.

Implementation notes

  • Verified: editor scan/import/cache pipeline.
  • Verified: large parts #ifndef GAME_RELEASE gated.