SceneDocument class

The in-memory .fscene document: a GPU-free, encoding-independent description of a scene that the encoders serialize and the realizer turns into a live Node graph.

A document owns one global documentId and id-keyed pools of nodes, resources, skins, animations, and payloads, plus the scene-wide stage settings. Ids are minted from allocator; references between entities are by LocalId. This type holds the data only; encoding (JSON and packed binary), composition (prefab overrides), and realization live in separate layers.

Constructors

SceneDocument({DocumentId? documentId, IdAllocator? allocator, StageMetadata? stage})
Creates an empty document. A new documentId and allocator (with a fresh session salt) are generated unless supplied.

Properties

allocator → IdAllocator
Mints ids for this editing session. Continuing a loaded document uses a new allocator with a fresh session salt.
final
animations → Map<LocalId, AnimationSpec>
Animations, keyed by id.
final
documentId → DocumentId
The document's global id, minted once at creation.
final
featuresRequired → Set<String>
Features a loader must support to load this document; missing one means it must refuse rather than load partially.
final
featuresUsed → Set<String>
Features this document uses. Informational unless also in featuresRequired.
final
formatVersion ↔ int
The coarse format version this document targets.
getter/setter pair
generator ↔ String?
A human-readable producer string (for example the importer version).
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
nodes → Map<LocalId, NodeSpec>
Scene-graph nodes, keyed by id.
final
payloads → Map<LocalId, PayloadSpec>
The binary chunk manifest, keyed by id.
final
payloadSource ↔ String?
A relative .fsceneb asset that supplies bytes for manifest-only payloads. Editors and build tools resolve it beside the .fscene file.
getter/setter pair
resources → Map<LocalId, ResourceSpec>
Shared resources (geometry, materials, textures), keyed by id.
final
rootNodes → Iterable<NodeSpec>
The root nodes, resolved from roots (skipping any dangling id).
no setter
roots → List<LocalId>
The document's root node ids, in order.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
skins → Map<LocalId, SkinSpec>
Skins, keyed by id.
final
stage ↔ StageMetadata
Scene-wide, non-spatial render settings.
getter/setter pair
views → List<RenderViewSpec>
Serialized render views, in order. Each binds a camera node to a target (a RenderTextureResource id, or null for the screen).
final

Methods

addAnimation(AnimationSpec animation) → AnimationSpec
Registers a pre-built animation and returns it.
addNode(NodeSpec node, {bool root = false}) → NodeSpec
Registers node in the document, optionally as a root, and returns it.
addPayload(PayloadSpec payload) → PayloadSpec
Registers a pre-built payload and returns it.
addResource<T extends ResourceSpec>(T resource) → T
Registers a pre-built resource and returns it (preserving its type).
addSkin(SkinSpec skin) → SkinSpec
Registers a pre-built skin and returns it.
animation(LocalId id) → AnimationSpec?
The animation with id, or null.
createNode({String name = '', TransformSpec? transform, List<ComponentSpec>? components, int layers = 1, bool root = false}) → NodeSpec
Creates a node with a fresh id, registers it (optionally as a root), and returns it.
newId() → LocalId
Mints a fresh, document-unique LocalId from allocator.
node(LocalId id) → NodeSpec?
The node with id, or null.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
payload(LocalId id) → PayloadSpec?
The payload with id, or null.
resource(LocalId id) → ResourceSpec?
The resource with id, or null.
skin(LocalId id) → SkinSpec?
The skin with id, or null.
toString() → String
A string representation of this object.
inherited
usedSessions() → Set<int>
The distinct session salts present across every id in the document.

Operators

operator ==(Object other) → bool
The equality operator.
inherited