Editor model · class
EditorHost
class EditorHostimport { EditorHost } from '@driftengine/editor';Constructor
new
constructor(bound?: EditorWorld | null)| Parameter | Type | Description |
|---|---|---|
bound? | EditorWorld | null |
Properties
| Name | Type | Description |
|---|---|---|
treereadonly | SceneTree | |
inspectorreadonly | Inspector | |
gizmoreadonly | Gizmo | |
shouldSimulate | () => boolean | Hand this to startLoop as shouldSimulate.MoreIt 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
| Name | Type | Description |
|---|---|---|
modeget | EditorMode | |
entityget | Entity | null | The entity selected, or null. Cleared by a stop that did not restore it. |
Methods
select
select(node: SceneNode | null): voidSelect a node, point the gizmo at it, and show its transform.
| Parameter | Type | Description |
|---|---|---|
node | SceneNode | null |
selectEntity
selectEntity(entity: Entity | null): voidSelect an entity, and remember where it sits in the snapshot if one is open.
| Parameter | Type | Description |
|---|---|---|
entity | Entity | 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(): voidMove the gizmo onto the selection. A selection of nothing leaves it where it was.
applyGizmo
applyGizmo(): voidWrite 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(): booleanEnter 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(): voidstep
step(): voidOne tick, then paused. Does nothing outside play mode, where there is nothing to step.
stop
stop(): booleanLeave 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.