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
@@ -254,11 +254,6 @@ namespace AzToolsFramework
virtual bool ShowingWorldSpace() = 0;
//! Return the widget to use as the parent for the viewport context menu.
virtual QWidget* GetWidgetForViewportContextMenu() = 0;
//! Set the render context for the viewport.
virtual void BeginWidgetContext() = 0;
//! End the render context for the viewport.
//! Return to previous context before Begin was called.
virtual void EndWidgetContext() = 0;
protected:
~MainEditorViewportInteractionRequests() = default;
@@ -297,28 +292,6 @@ namespace AzToolsFramework
//! Type to inherit to implement MainEditorViewportInteractionRequests.
using ViewportMouseCursorRequestBus = AZ::EBus<ViewportMouseCursorRequests, ViewportEBusTraits>;
//! A helper to wrap Begin/EndWidgetContext.
class WidgetContextGuard
{
public:
explicit WidgetContextGuard(const int viewportId)
: m_viewportId(viewportId)
{
MainEditorViewportInteractionRequestBus::Event(
viewportId, &MainEditorViewportInteractionRequestBus::Events::BeginWidgetContext);
}
~WidgetContextGuard()
{
MainEditorViewportInteractionRequestBus::Event(
m_viewportId, &MainEditorViewportInteractionRequestBus::Events::EndWidgetContext);
}
private:
int m_viewportId; //!< The viewport id the widget context is being set on.
};
} // namespace ViewportInteraction
//! Utility function to return EntityContextId.