void undo() { if (_undoStack.empty()) { rMessage() << "Undo: no undo available" << std::endl; } else { Operation* operation = _undoStack.back(); rMessage() << "Undo: " << operation->_command << std::endl; startRedo(); trackersUndo(); operation->_snapshot.restore(); finishRedo(operation->_command.c_str()); _undoStack.pop_back(); for (Observers::iterator i = _observers.begin(); i != _observers.end(); /* in-loop */) { Observer* observer = *(i++); observer->postUndo(); } // Trigger the onPostUndo event on all scene nodes PostUndoWalker walker; GlobalSceneGraph().root()->traverse(walker); GlobalSceneGraph().sceneChanged(); } }
void undo(){ if ( m_undo_stack.empty() ) { globalOutputStream() << "Undo: no undo available\n"; } else { Operation* operation = m_undo_stack.back(); globalOutputStream() << "Undo: " << operation->m_command.c_str() << "\n"; startRedo(); trackersUndo(); operation->m_snapshot.restore(); finishRedo( operation->m_command.c_str() ); m_undo_stack.pop_back(); } }