Editor.Model.BaseChangesStream
ClassBase 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
| Parameter | Type |
|---|---|
name | string |
change | () => void |
Returns
void
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean