Skip to main content

Editor.Model.BaseChangesStream

Class

Base class for streams that track and apply model changes.

Index

Example

const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const scene = model.project.scene;

// project.history is a BaseChangesStream — use executeAsGroup()
// to batch multiple mutations into a single undo/redo entry
const history = model.project.history as Editor.Model.BaseChangesStream;

const obj1 = scene.createSceneObject('ObjectA');
const obj2 = scene.createSceneObject('ObjectB');

// Group renames into one undo step
history.executeAsGroup('Rename objects', () => {
obj1.name = 'RenamedA';
obj2.name = 'RenamedB';
});
console.log(`After grouped rename: "${obj1.name}", "${obj2.name}"`);
// Ctrl+Z will undo both renames at once

Extends

Methods

executeAsGroup()

executeAsGroup(name, change): void

Executes a set of changes grouped under a named operation for undo/redo purposes.

Parameters

ParameterType
namestring
change() => void

Returns

void


getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


isSame()

isSame(other): boolean

Returns true if this object refers to the same instance as the given object.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame