1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2026-01-17 03:00:55 +00:00
openmw/apps/opencs/view/render/commands.cpp

54 lines
1.6 KiB
C++

#include "commands.hpp"
#include <QPointer>
#include <components/debug/debuglog.hpp>
#include <components/esm/loadland.hpp>
#include "editmode.hpp"
#include "terrainselection.hpp"
#include "terrainshapemode.hpp"
#include "terraintexturemode.hpp"
#include "worldspacewidget.hpp"
CSVRender::DrawTerrainSelectionCommand::DrawTerrainSelectionCommand(WorldspaceWidget* worldspaceWidget, QUndoCommand* parent)
: mWorldspaceWidget(worldspaceWidget)
{ }
void CSVRender::DrawTerrainSelectionCommand::redo()
{
if (mWorldspaceWidget)
{
if (CSVRender::TerrainShapeMode* terrainMode = dynamic_cast<CSVRender::TerrainShapeMode *> (mWorldspaceWidget->getEditMode()) )
{
terrainMode->getTerrainSelection()->update();
return;
}
else
{
Log(Debug::Verbose) << "Can't update terrain selection in current EditMode";
return;
}
}
else
Log(Debug::Verbose) << "Can't update terrain selection, no WorldspaceWidget found!";
}
void CSVRender::DrawTerrainSelectionCommand::undo()
{
if (mWorldspaceWidget)
{
if (CSVRender::TerrainShapeMode* terrainMode = dynamic_cast<CSVRender::TerrainShapeMode *> (mWorldspaceWidget->getEditMode()) )
{
terrainMode->getTerrainSelection()->update();
return;
}
else
{
Log(Debug::Verbose) << "Can't undo terrain selection in current EditMode";
return;
}
}
else
Log(Debug::Verbose) << "Can't undo terrain selection, no WorldspaceWidget found!";
}