Skip to content

Commit

Permalink
#4846: Fix the manipulation pivot being stuck in a position when the …
Browse files Browse the repository at this point in the history
…user cancels the move, preventing it from recalculating its position on selection change or even changing the manipulator.
  • Loading branch information
codereader committed Feb 5, 2021
1 parent 4c6e85e commit 89e5a1c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions radiantcore/selection/ManipulationPivot.cpp
Expand Up @@ -96,6 +96,12 @@ void ManipulationPivot::endOperation()
_operationActive = false;
}

void ManipulationPivot::cancelOperation()
{
revertToStart();
_operationActive = false;
}

void ManipulationPivot::applyTranslation(const Vector3& translation)
{
// We apply translations on top of the starting point
Expand Down
3 changes: 3 additions & 0 deletions radiantcore/selection/ManipulationPivot.h
Expand Up @@ -76,6 +76,9 @@ class ManipulationPivot

void endOperation();

// Operation cancelled, this reverts the pivot to where we started
void cancelOperation();

void applyTranslation(const Vector3& translation);

// Rescans the selection and calculates the pivot afresh,
Expand Down
3 changes: 2 additions & 1 deletion radiantcore/selection/RadiantSelectionSystem.cpp
Expand Up @@ -853,6 +853,8 @@ void RadiantSelectionSystem::onManipulationCancelled()
GlobalSceneGraph().root()->traverse(faceSelector);
}

_pivot.cancelOperation();

pivotChanged();
}

Expand All @@ -861,7 +863,6 @@ void RadiantSelectionSystem::renderWireframe(RenderableCollector& collector, con
renderSolid(collector, volume);
}

// Lets the recalculatePivot2World() method do the work and returns the result that is stored in the member variable
const Matrix4& RadiantSelectionSystem::getPivot2World()
{
return _pivot.getMatrix4();
Expand Down

0 comments on commit 89e5a1c

Please sign in to comment.