Merge pull request #2059 from Bloodknight/SaharaUndo

#define AUTOPAINT_UNDO
This commit is contained in:
Areloch 2018-01-10 09:47:24 -06:00 committed by GitHub
commit f43bb6b565

View file

@ -2857,14 +2857,21 @@ DefineConsoleMethod( TerrainEditor, setSlopeLimitMaxAngle, F32, (F32 angle), , "
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinSlope, F32 mMaxSlope, F32 mCoverage ) void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinSlope, F32 mMaxSlope, F32 mCoverage )
{ {
if (!mActiveTerrain)
#define AUTOPAINT_UNDO
if (!mActiveTerrain)
return; return;
S32 mat = getPaintMaterialIndex(); S32 mat = getPaintMaterialIndex();
if (mat == -1) if (mat == -1)
return; return;
mUndoSel = new Selection;
#ifndef AUTOPAINT_UNDO
mUndoSel = new Selection;
#endif
U32 terrBlocks = mActiveTerrain->getBlockSize(); U32 terrBlocks = mActiveTerrain->getBlockSize();
for (U32 y = 0; y < terrBlocks; y++) for (U32 y = 0; y < terrBlocks; y++)
@ -2906,19 +2913,23 @@ void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinS
if (norm.z < mSin(mDegToRad(90.0f - mMaxSlope))) if (norm.z < mSin(mDegToRad(90.0f - mMaxSlope)))
continue; continue;
gi.mMaterialChanged = true; gi.mMaterialChanged = true;
mUndoSel->add(gi); #ifndef AUTOPAINT_UNDO
mUndoSel->add(gi);
#endif
gi.mMaterial = mat; gi.mMaterial = mat;
setGridInfo(gi); setGridInfo(gi);
} }
} }
#ifndef AUTOPAINT_UNDO
if(mUndoSel->size()) if(mUndoSel->size())
submitUndo( mUndoSel ); submitUndo( mUndoSel );
else else
delete mUndoSel; delete mUndoSel;
mUndoSel = 0; mUndoSel = 0;
#endif
scheduleMaterialUpdate(); scheduleMaterialUpdate();
} }