void DeleteLODCommand::Undo() { DAVA::RenderObject *ro = DAVA::GetRenderObject(GetEntity()); //restore lodindexes DAVA::uint32 count = ro->GetRenderBatchCount(); for(DAVA::int32 i = (DAVA::int32)count - 1; i >= 0; --i) { DAVA::int32 lodIndex = 0, switchIndex = 0; DAVA::RenderBatch *batch = ro->GetRenderBatch(i, lodIndex, switchIndex); if(lodIndex >= deletedLodIndex && (requestedSwitchIndex == switchIndex || requestedSwitchIndex == -1)) { batch->Retain(); ro->RemoveRenderBatch(i); ro->AddRenderBatch(batch, lodIndex + 1, switchIndex); batch->Release(); } } //restore batches count = (DAVA::uint32)deletedBatches.size(); for(DAVA::uint32 i = 0; i < count; ++i) { UndoInternalCommand(deletedBatches[i]); DAVA::SafeDelete(deletedBatches[i]); } deletedBatches.clear(); //restore lodlayers and disatnces lodComponent->lodLayersArray = savedDistances; }
void CommandBatch::Undo() { std::list<Command2 *>::reverse_iterator i = commandList.rbegin(); std::list<Command2 *>::reverse_iterator end = commandList.rend(); for(; i != end; i++) { UndoInternalCommand(*i); } }