API ReferenceSandbox.Helpers

UndoSystemclass

A system that aims to wrap the main reusable functionality of an `Sandbox.Helpers.IUndoSystem`.

object→UndoSystem
Namespace
Sandbox.Helpers
Assembly
Sandbox.Tools
Declaration
public class Sandbox.Helpers.UndoSystem

Constructors1

Showing 1 constructors

Methods6

Showing 6 methods

public void Initialize()PUBLIC

Clear the history and take an initial snapshot. You should call this right after a load, or a new project.

Returns:void—

public Sandbox.Helpers.UndoSystem.Entry Insert(string title, System.Action undo, System.Action redo = null)PUBLIC

Insert a new undo entry

ParameterTypeDescription
titlestring—
undoAction—
redo = nullAction—
Returns:Entry—

public virtual sealed bool Redo()PUBLICVIRTUAL

Instigate a redo, returns true if we found a successful undo

Returns:bool—

public void SetSnapshotFunction(System.Func`1<System.Action> snapshot)PUBLICOBSOLETE

Obsolete: Auto Snapshotting is obsolete and no longer working. If you really want to use snapshotting for Undo, create/restore the snapshots manually in the undo/redo actions provided to UndoSystem.Insert

ParameterTypeDescription
snapshotFunc<Action>—
Returns:void—

public void Snapshot(string changeTitle)PUBLICOBSOLETE

Should be called after you make a change to your project. The snapshot system is good for self contained projects that can be serialized and deserialized quickly.

Obsolete: Auto Snapshotting is obsolete and no longer working. If you really want to use snapshotting for Undo, create/restore the snapshots manually in the undo/redo actions provided to UndoSystem.Insert

ParameterTypeDescription
changeTitlestring—
Returns:void—

public virtual sealed bool Undo()PUBLICVIRTUAL

Instigate an undo. Return true if we found a successful undo

Returns:bool—

Properties2

Showing 2 properties

public System.Collections.Generic.Stack`1<Sandbox.Helpers.UndoSystem.Entry> Sandbox.Helpers.UndoSystem.Forward { get; set; }PUBLICGETSET

Forwards stack, gets cleared when a new undo is added

Returns:Stack<Entry>—

On this page