EditorSession¶
- An EditorSession contains the entire state and behavior of the world editor for a single
- world. It contains references to the current selection, undo history, the UI widgets, and the WorldEditor instance underlying the session.
Undo History¶
The session’s undo history is managed as a stack of QUndoCommands. The revision system
provided by worldeditor is used to manage changes to the world’s data. Simple
access to the revision system is provided by the beginSimpleCommand
method of the
EditorSession
This method returns an object to be used in a with
statement. Any changes to the
WorldEditor within the with
statement’s block are captured by a new revision in the
revision system, and a new entry is added to the session’s undo history. For example:
def changeOneBlock():
with editorSession.beginSimpleCommand("Change One Block"):
editorSession.currentDimension.setBlock(1, 2, 3, "minecraft:dirt")