Skip to content

Add asset server untyped handles#336

Merged
waynemwashuma merged 3 commits into
wimaengine:devfrom
waynemwashuma:asser-server-untyped-handles
Jun 7, 2026
Merged

Add asset server untyped handles#336
waynemwashuma merged 3 commits into
wimaengine:devfrom
waynemwashuma:asser-server-untyped-handles

Conversation

@waynemwashuma

Copy link
Copy Markdown
Collaborator

Objective

Introduce untyped asset loading APIs for type-erased asset restoration and improve asset handle snapshot serialization by storing asset type IDs instead of constructors.

Solution

HandleSnapshot previously stored a constructor reference and relied on recovering the corresponding type ID during deserialization. This created an unnecessary dependency on runtime type objects and made snapshots less suitable for serialization and type-erased workflows. This changes snapshots to store the asset type ID directly and adds an untyped asset loading path to AssetServer.

Why this approach:

  • Type IDs are stable runtime identifiers and easier to serialize than constructors.
  • Snapshot data becomes independent of constructor references.
  • Enables asset restoration when only runtime type information is available.
  • Simplifies deserialization by eliminating constructor → type ID conversion.

Showcase

New type-erased loading is available:

assetServer.loadUntyped(
  typeid(Texture),
  'texture.png'
)

Migration guide

No migration required

Notes

  • Existing snapshot consumers expecting constructors must be updated.
  • Serialized snapshots are now more robust because they no longer depend on runtime constructor references.
  • Typed asset loading remains the recommended API for most application code.
  • loadUntyped() primarily exists for serialization, reflection, editor, and tooling workflows.

Checklist

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@waynemwashuma waynemwashuma self-assigned this Jun 7, 2026
@waynemwashuma waynemwashuma added the type:enhancement New feature or request label Jun 7, 2026
@waynemwashuma waynemwashuma merged commit b09c6c3 into wimaengine:dev Jun 7, 2026
7 checks passed
@waynemwashuma waynemwashuma deleted the asser-server-untyped-handles branch June 7, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:asset type:enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant