mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-06 14:00:39 +00:00
copy paste support for terrains
This commit is contained in:
parent
262ff405fa
commit
561c201b88
4 changed files with 75 additions and 1 deletions
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "gui/core/guiCanvas.h"
|
||||
|
||||
TerrainScratchPad gTerrainScratchPad;
|
||||
//------------------------------------------------------------------------------
|
||||
bool TerrainAction::isValid(GridInfo tile)
|
||||
{
|
||||
|
|
@ -857,6 +858,34 @@ void HydraulicErosionAction::process(Selection* sel, const Gui3DMouseEvent&, boo
|
|||
|
||||
}
|
||||
|
||||
void copyAction::process(Selection* sel, const Gui3DMouseEvent&, bool selChanged, Type type)
|
||||
{
|
||||
gTerrainScratchPad.clear();
|
||||
for (U32 i=0;i<sel->size();i++)
|
||||
{
|
||||
if (isValid((*sel)[i]))
|
||||
gTerrainScratchPad.addTile((*sel)[i].mHeight, (*sel)[i].mMaterial);
|
||||
else
|
||||
gTerrainScratchPad.addTile(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void pasteAction::process(Selection* sel, const Gui3DMouseEvent&, bool selChanged, Type type)
|
||||
{
|
||||
for (U32 i = 0; i < sel->size(); i++)
|
||||
{
|
||||
if (isValid((*sel)[i]))
|
||||
{
|
||||
mTerrainEditor->getUndoSel()->add((*sel)[i]);
|
||||
(*sel)[i].mHeight = gTerrainScratchPad[i]->mHeight;
|
||||
(*sel)[i].mMaterial = gTerrainScratchPad[i]->mMaterial;
|
||||
mTerrainEditor->setGridInfo((*sel)[i]);
|
||||
}
|
||||
}
|
||||
mTerrainEditor->scheduleGridUpdate();
|
||||
mTerrainEditor->scheduleMaterialUpdate();
|
||||
}
|
||||
|
||||
IMPLEMENT_CONOBJECT( TerrainSmoothAction );
|
||||
|
||||
ConsoleDocClass( TerrainSmoothAction,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue