You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Add EditorUndoRedoManager singleton
This commit is contained in:
@@ -39,6 +39,8 @@
|
||||
#include "editor/editor_node.h"
|
||||
#include "scene/main/node.h"
|
||||
|
||||
EditorUndoRedoManager *EditorUndoRedoManager::singleton = nullptr;
|
||||
|
||||
EditorUndoRedoManager::History &EditorUndoRedoManager::get_or_create_history(int p_idx) {
|
||||
if (!history_map.has(p_idx)) {
|
||||
History history;
|
||||
@@ -503,6 +505,16 @@ void EditorUndoRedoManager::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(INVALID_HISTORY);
|
||||
}
|
||||
|
||||
EditorUndoRedoManager *EditorUndoRedoManager::get_singleton() {
|
||||
return singleton;
|
||||
}
|
||||
|
||||
EditorUndoRedoManager::EditorUndoRedoManager() {
|
||||
if (!singleton) {
|
||||
singleton = this;
|
||||
}
|
||||
}
|
||||
|
||||
EditorUndoRedoManager::~EditorUndoRedoManager() {
|
||||
for (const KeyValue<int, History> &E : history_map) {
|
||||
discard_history(E.key, false);
|
||||
|
||||
Reference in New Issue
Block a user