mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 18:09:39 +00:00
use enum for brush shapes
This commit is contained in:
parent
388edfd8cc
commit
c031543420
2 changed files with 17 additions and 9 deletions
|
@ -393,7 +393,7 @@ void CSVRender::TerrainShapeMode::editTerrainShapeGrid(const std::pair<int, int>
|
||||||
|
|
||||||
if(allowLandShapeEditing(cellId)==true)
|
if(allowLandShapeEditing(cellId)==true)
|
||||||
{
|
{
|
||||||
if (mBrushShape == 0)
|
if (mBrushShape == BrushShape_Point)
|
||||||
{
|
{
|
||||||
int x = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(vertexCoords.first);
|
int x = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(vertexCoords.first);
|
||||||
int y = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(vertexCoords.second);
|
int y = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(vertexCoords.second);
|
||||||
|
@ -403,7 +403,7 @@ void CSVRender::TerrainShapeMode::editTerrainShapeGrid(const std::pair<int, int>
|
||||||
if (mShapeEditTool == 4) flattenHeight(cellCoords, x, y, mShapeEditToolStrength, mTargetHeight);
|
if (mShapeEditTool == 4) flattenHeight(cellCoords, x, y, mShapeEditToolStrength, mTargetHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mBrushShape == 1)
|
if (mBrushShape == BrushShape_Square)
|
||||||
{
|
{
|
||||||
for(int i = vertexCoords.first - r; i <= vertexCoords.first + r; ++i)
|
for(int i = vertexCoords.first - r; i <= vertexCoords.first + r; ++i)
|
||||||
{
|
{
|
||||||
|
@ -421,7 +421,7 @@ void CSVRender::TerrainShapeMode::editTerrainShapeGrid(const std::pair<int, int>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mBrushShape == 2)
|
if (mBrushShape == BrushShape_Circle)
|
||||||
{
|
{
|
||||||
for(int i = vertexCoords.first - r; i <= vertexCoords.first + r; ++i)
|
for(int i = vertexCoords.first - r; i <= vertexCoords.first + r; ++i)
|
||||||
{
|
{
|
||||||
|
@ -447,7 +447,7 @@ void CSVRender::TerrainShapeMode::editTerrainShapeGrid(const std::pair<int, int>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mBrushShape == 3)
|
if (mBrushShape == BrushShape_Custom)
|
||||||
{
|
{
|
||||||
if(!mCustomBrushShape.empty())
|
if(!mCustomBrushShape.empty())
|
||||||
{
|
{
|
||||||
|
@ -1037,12 +1037,12 @@ void CSVRender::TerrainShapeMode::selectTerrainShapes(const std::pair<int, int>&
|
||||||
int r = mBrushSize / 2;
|
int r = mBrushSize / 2;
|
||||||
std::vector<std::pair<int, int>> selections;
|
std::vector<std::pair<int, int>> selections;
|
||||||
|
|
||||||
if (mBrushShape == 0)
|
if (mBrushShape == BrushShape_Point)
|
||||||
{
|
{
|
||||||
selections.emplace_back(vertexCoords);
|
selections.emplace_back(vertexCoords);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mBrushShape == 1)
|
if (mBrushShape == BrushShape_Square)
|
||||||
{
|
{
|
||||||
for(int i = vertexCoords.first - r; i <= vertexCoords.first + r; ++i)
|
for(int i = vertexCoords.first - r; i <= vertexCoords.first + r; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1053,7 +1053,7 @@ void CSVRender::TerrainShapeMode::selectTerrainShapes(const std::pair<int, int>&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mBrushShape == 2)
|
if (mBrushShape == BrushShape_Circle)
|
||||||
{
|
{
|
||||||
for(int i = vertexCoords.first - r; i <= vertexCoords.first + r; ++i)
|
for(int i = vertexCoords.first - r; i <= vertexCoords.first + r; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1067,7 +1067,7 @@ void CSVRender::TerrainShapeMode::selectTerrainShapes(const std::pair<int, int>&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mBrushShape == 3)
|
if (mBrushShape == BrushShape_Custom)
|
||||||
{
|
{
|
||||||
if(!mCustomBrushShape.empty())
|
if(!mCustomBrushShape.empty())
|
||||||
{
|
{
|
||||||
|
@ -1196,7 +1196,7 @@ void CSVRender::TerrainShapeMode::setBrushShape(int brushShape)
|
||||||
mBrushShape = brushShape;
|
mBrushShape = brushShape;
|
||||||
|
|
||||||
//Set custom brush shape
|
//Set custom brush shape
|
||||||
if (mBrushShape == 3 && !mTerrainShapeSelection->getTerrainSelection().empty())
|
if (mBrushShape == BrushShape_Custom && !mTerrainShapeSelection->getTerrainSelection().empty())
|
||||||
{
|
{
|
||||||
auto terrainSelection = mTerrainShapeSelection->getTerrainSelection();
|
auto terrainSelection = mTerrainShapeSelection->getTerrainSelection();
|
||||||
int selectionCenterX = 0;
|
int selectionCenterX = 0;
|
||||||
|
|
|
@ -46,6 +46,14 @@ namespace CSVRender
|
||||||
InteractionType_None
|
InteractionType_None
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum BrushShape
|
||||||
|
{
|
||||||
|
BrushShape_Point = 1,
|
||||||
|
BrushShape_Square = 2,
|
||||||
|
BrushShape_Circle = 3,
|
||||||
|
BrushShape_Custom = 4
|
||||||
|
};
|
||||||
|
|
||||||
/// Editmode for terrain shape grid
|
/// Editmode for terrain shape grid
|
||||||
TerrainShapeMode(WorldspaceWidget*, osg::Group* parentNode, QWidget* parent = nullptr);
|
TerrainShapeMode(WorldspaceWidget*, osg::Group* parentNode, QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue