Skip to content
This repository was archived by the owner on Oct 4, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion dev/Code/Sandbox/Editor/VegetationTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ bool CVegetationTool::OnLButtonUp(CViewport* view, UINT nFlags, const QPoint& po

// Reset selected region.
view->ResetSelectionRegion();

// reset aggregated manipulator offset
m_manipulatorOffset = ZERO;

return true;
}

Expand Down Expand Up @@ -1406,8 +1410,13 @@ void CVegetationTool::OnManipulatorDrag(CViewport* view, ITransformManipulator*
// get current axis constrains.
if (editMode == eEditModeMove)
{
// The offset value passed to this function is the value since the manipulator was started dragging (i.e. when LMB is pressed)
// but MoveSelected will apply this offset to the current position. We compute the desired offset based on previous applied manipulator drags
Vec3 offsetThisDrag = value - m_manipulatorOffset;
m_manipulatorOffset = value;

GetIEditor()->RestoreUndo();
MoveSelected(view, value, true);
MoveSelected(view, offsetThisDrag, true);
}
if (editMode == eEditModeRotate)
{
Expand Down
1 change: 1 addition & 0 deletions dev/Code/Sandbox/Editor/VegetationTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class CVegetationTool
QPoint m_mousePos;
QPoint m_prevMousePos;
Vec3 m_pointerPos;
Vec3 m_manipulatorOffset = ZERO;
bool m_mouseOverPaintableSurface;
static float m_brushRadius;

Expand Down