Remove redundant API calls from EditorViewportWidget and use new WorldToScreen call (#4022)

* remove redundant API calls from EditorViewportWidget and use new WorldToScreen call

Signed-off-by: hultonha <hultonha@amazon.co.uk>

* remove additional pre/post widget render calls that are no longer required

Signed-off-by: hultonha <hultonha@amazon.co.uk>
This commit is contained in:
hultonha
2021-09-13 09:36:34 +01:00
committed by GitHub
parent 51ce59e240
commit 28d45891f2
12 changed files with 42 additions and 186 deletions
-27
View File
@@ -43,12 +43,7 @@
void QtViewport::BuildDragDropContext(AzQtComponents::ViewportDragContext& context, const QPoint& pt)
{
context.m_hitLocation = AZ::Vector3::CreateZero();
PreWidgetRendering(); // required so that the current render cam is set.
context.m_hitLocation = GetHitLocation(pt);
PostWidgetRendering();
}
@@ -1352,28 +1347,6 @@ bool QtViewport::MouseCallback(EMouseEvent event, const QPoint& point, Qt::Keybo
return true;
}
// RAII wrapper for Pre / PostWidgetRendering calls.
// It also tracks the times a mouse callback potentially created a new viewport context.
struct ScopedProcessingMouseCallback
{
explicit ScopedProcessingMouseCallback(QtViewport* viewport)
: m_viewport(viewport)
{
m_viewport->m_processingMouseCallbacksCounter++;
m_viewport->PreWidgetRendering();
}
~ScopedProcessingMouseCallback()
{
m_viewport->PostWidgetRendering();
m_viewport->m_processingMouseCallbacksCounter--;
}
QtViewport* m_viewport;
};
ScopedProcessingMouseCallback scopedProcessingMouseCallback(this);
//////////////////////////////////////////////////////////////////////////
// Hit test gizmo objects.
//////////////////////////////////////////////////////////////////////////