MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / undo

Method undo

src/WorldUndoManager.cpp:71–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71void WorldUndoManager::undo() {
72 if(undoQueue.empty())
73 return;
74
75 world.bMan.refresh_gui_data();
76
77 bool undoFail = false;
78
79 world.send_reliable_multi_command_to_all([&]() {
80 for(auto& u : std::views::reverse(undoQueue.back())) {
81 if(!u->undo(*this)) {
82 undoFail = true;
83 break;
84 }
85 }
86 });
87
88 if(undoFail) {
89 clear();
90 Logger::get().log(Logger::LogType::INFO, "[WorldUndoManager::undo] Undo failed");
91 }
92 else {
93 push_redo(std::move(undoQueue.back()));
94 undoQueue.pop_back();
95 }
96
97 set_world_has_unsaved_local_changes();
98
99 world.main.g.gui.set_to_layout();
100}
101
102void WorldUndoManager::redo() {
103 if(redoQueue.empty())

Callers

nothing calls this directly

Calls 8

clearFunction · 0.85
logMethod · 0.80
set_to_layoutMethod · 0.80
getFunction · 0.50
emptyMethod · 0.45
refresh_gui_dataMethod · 0.45
pop_backMethod · 0.45

Tested by

no test coverage detected