Editor model · class

EditorHost

class EditorHost
import { EditorHost } from '@driftengine/editor';

Constructor

new

constructor(bound?: EditorWorld | null)
ParameterTypeDescription
bound?EditorWorld | null

Properties

NameTypeDescription
treereadonlySceneTree
inspectorreadonlyInspector
gizmoreadonlyGizmo
shouldSimulate() => booleanHand this to startLoop as shouldSimulate.
More

It has a side effect and that is the point: a pending step is consumed here, so exactly one tick runs and the next call answers false. A step expressed as a duration would advance a variable number of ticks depending on which frame it landed in, which is the opposite of what stepping is for.

Accessors

NameTypeDescription
modegetEditorMode
entitygetEntity | nullThe entity selected, or null. Cleared by a stop that did not restore it.

Methods

select

select(node: SceneNode | null): void

Select a node, point the gizmo at it, and show its transform.

ParameterTypeDescription
nodeSceneNode | null

selectEntity

selectEntity(entity: Entity | null): void

Select an entity, and remember where it sits in the snapshot if one is open.

ParameterTypeDescription
entityEntity | null
More

The index is taken now rather than at stop, because at stop the entity may already be gone and there would be nothing left to look it up by.

syncGizmo

syncGizmo(): void

Move the gizmo onto the selection. A selection of nothing leaves it where it was.

applyGizmo

applyGizmo(): void

Write the gizmo's transform onto the selection, and refresh what the inspector shows.

More

Through the node's setters, for the reason inspector.ts gives: writing the arrays leaves the world matrix stale and the node draws where it used to be.

play

play(): boolean

Enter play, taking a snapshot first. false when there is no world bound to snapshot.

More

Playing from paused resumes without re-snapshotting, so pausing does not throw away the state stop would have returned to.

pause

pause(): void

step

step(): void

One tick, then paused. Does nothing outside play mode, where there is nothing to step.

stop

stop(): boolean

Leave play and put the world back. false when there is nothing to put back.

More

See the header for why this is a clear and then a load rather than a load.