mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-27 06:55:54 -04:00
Update selection during transient edit, clear to a single function.
This commit is contained in:
parent
678d2e6e7d
commit
d186bcb46f
@ -44,10 +44,10 @@ namespace CSVRender
|
|||||||
|
|
||||||
std::vector<std::pair<int, int>> getTerrainSelection() const;
|
std::vector<std::pair<int, int>> getTerrainSelection() const;
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
void drawShapeSelection(const osg::ref_ptr<osg::Vec3Array> vertices);
|
void drawShapeSelection(const osg::ref_ptr<osg::Vec3Array> vertices);
|
||||||
void drawTextureSelection(const osg::ref_ptr<osg::Vec3Array> vertices);
|
void drawTextureSelection(const osg::ref_ptr<osg::Vec3Array> vertices);
|
||||||
|
|
||||||
|
@ -112,12 +112,7 @@ void CSVRender::TerrainShapeMode::primaryEditPressed(const WorldspaceHitResult&
|
|||||||
selectTerrainShapes(CSMWorld::CellCoordinates::toVertexCoords(hit.worldPos), 1, true);
|
selectTerrainShapes(CSMWorld::CellCoordinates::toVertexCoords(hit.worldPos), 1, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CSVRender::PagedWorldspaceWidget *paged =
|
clearTransientEdits();
|
||||||
dynamic_cast<CSVRender::PagedWorldspaceWidget *> (&getWorldspaceWidget()))
|
|
||||||
{
|
|
||||||
paged->resetAllAlteredHeights();
|
|
||||||
mTotalDiffY = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVRender::TerrainShapeMode::primarySelectPressed(const WorldspaceHitResult& hit)
|
void CSVRender::TerrainShapeMode::primarySelectPressed(const WorldspaceHitResult& hit)
|
||||||
@ -214,28 +209,15 @@ void CSVRender::TerrainShapeMode::dragCompleted(const QPoint& pos)
|
|||||||
{
|
{
|
||||||
if (mDragMode == InteractionType_PrimaryEdit)
|
if (mDragMode == InteractionType_PrimaryEdit)
|
||||||
{
|
{
|
||||||
if (mIsEditing)
|
|
||||||
{
|
|
||||||
mTotalDiffY = 0;
|
|
||||||
mIsEditing = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
applyTerrainEditChanges();
|
applyTerrainEditChanges();
|
||||||
|
clearTransientEdits();
|
||||||
if (CSVRender::PagedWorldspaceWidget *paged = dynamic_cast<CSVRender::PagedWorldspaceWidget *> (&getWorldspaceWidget()))
|
|
||||||
paged->resetAllAlteredHeights();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CSVRender::TerrainShapeMode::dragAborted()
|
void CSVRender::TerrainShapeMode::dragAborted()
|
||||||
{
|
{
|
||||||
if (CSVRender::PagedWorldspaceWidget *paged =
|
clearTransientEdits();
|
||||||
dynamic_cast<CSVRender::PagedWorldspaceWidget *> (&getWorldspaceWidget()))
|
|
||||||
{
|
|
||||||
paged->resetAllAlteredHeights();
|
|
||||||
mTotalDiffY = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVRender::TerrainShapeMode::dragWheel (int diff, double speedFactor)
|
void CSVRender::TerrainShapeMode::dragWheel (int diff, double speedFactor)
|
||||||
@ -266,17 +248,22 @@ void CSVRender::TerrainShapeMode::sortAndLimitAlteredCells()
|
|||||||
if (passes > 2)
|
if (passes > 2)
|
||||||
{
|
{
|
||||||
Log(Debug::Warning) << "Warning: User edit exceeds accepted slope steepness. Automatic limiting has failed, edit has been discarded.";
|
Log(Debug::Warning) << "Warning: User edit exceeds accepted slope steepness. Automatic limiting has failed, edit has been discarded.";
|
||||||
if (CSVRender::PagedWorldspaceWidget *paged =
|
clearTransientEdits();
|
||||||
dynamic_cast<CSVRender::PagedWorldspaceWidget *> (&getWorldspaceWidget()))
|
return;
|
||||||
{
|
|
||||||
paged->resetAllAlteredHeights();
|
|
||||||
mAlteredCells.clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVRender::TerrainShapeMode::clearTransientEdits()
|
||||||
|
{
|
||||||
|
mTotalDiffY = 0;
|
||||||
|
mIsEditing = false;
|
||||||
|
mAlteredCells.clear();
|
||||||
|
if (CSVRender::PagedWorldspaceWidget *paged = dynamic_cast<CSVRender::PagedWorldspaceWidget *> (&getWorldspaceWidget()))
|
||||||
|
paged->resetAllAlteredHeights();
|
||||||
|
mTerrainShapeSelection->update();
|
||||||
|
}
|
||||||
|
|
||||||
void CSVRender::TerrainShapeMode::applyTerrainEditChanges()
|
void CSVRender::TerrainShapeMode::applyTerrainEditChanges()
|
||||||
{
|
{
|
||||||
CSMDoc::Document& document = getWorldspaceWidget().getDocument();
|
CSMDoc::Document& document = getWorldspaceWidget().getDocument();
|
||||||
@ -385,7 +372,7 @@ void CSVRender::TerrainShapeMode::applyTerrainEditChanges()
|
|||||||
pushNormalsEditToCommand(landNormalsNew, document, landTable, cellId);
|
pushNormalsEditToCommand(landNormalsNew, document, landTable, cellId);
|
||||||
}
|
}
|
||||||
undoStack.endMacro();
|
undoStack.endMacro();
|
||||||
mAlteredCells.clear();
|
clearTransientEdits();
|
||||||
}
|
}
|
||||||
|
|
||||||
float CSVRender::TerrainShapeMode::calculateBumpShape(float distance, int radius, float height)
|
float CSVRender::TerrainShapeMode::calculateBumpShape(float distance, int radius, float height)
|
||||||
@ -498,6 +485,7 @@ void CSVRender::TerrainShapeMode::editTerrainShapeGrid(const std::pair<int, int>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mTerrainShapeSelection->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVRender::TerrainShapeMode::setFlattenToolTargetHeight(const WorldspaceHitResult& hit)
|
void CSVRender::TerrainShapeMode::setFlattenToolTargetHeight(const WorldspaceHitResult& hit)
|
||||||
|
@ -95,6 +95,9 @@ namespace CSVRender
|
|||||||
/// Remove duplicates and sort mAlteredCells, then limitAlteredHeights forward and reverse
|
/// Remove duplicates and sort mAlteredCells, then limitAlteredHeights forward and reverse
|
||||||
void sortAndLimitAlteredCells();
|
void sortAndLimitAlteredCells();
|
||||||
|
|
||||||
|
/// Reset everything in the current edit
|
||||||
|
void clearTransientEdits();
|
||||||
|
|
||||||
/// Move pending alteredHeights changes to omwgame/omwaddon -data
|
/// Move pending alteredHeights changes to omwgame/omwaddon -data
|
||||||
void applyTerrainEditChanges();
|
void applyTerrainEditChanges();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user