Merge pull request #411 from aws-lumberyard-dev/nvsickle/FixBoxSelect
Fix viewport box selection
This commit is contained in:
+2
-2
@@ -769,12 +769,12 @@ namespace AzToolsFramework
|
||||
|
||||
template<typename Vertex>
|
||||
void EditorVertexSelectionBase<Vertex>::DisplayViewport2d(
|
||||
const AzFramework::ViewportInfo& /*viewportInfo*/,
|
||||
const AzFramework::ViewportInfo& viewportInfo,
|
||||
AzFramework::DebugDisplayRequests& debugDisplay)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
|
||||
m_editorBoxSelect.Display2d(debugDisplay);
|
||||
m_editorBoxSelect.Display2d(viewportInfo, debugDisplay);
|
||||
}
|
||||
|
||||
template<typename Vertex>
|
||||
|
||||
+11
-7
@@ -13,6 +13,7 @@
|
||||
#include "EditorBoxSelect.h"
|
||||
|
||||
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
@@ -72,7 +73,7 @@ namespace AzToolsFramework
|
||||
m_previousModifiers = mouseInteraction.m_mouseInteraction.m_keyboardModifiers;
|
||||
}
|
||||
|
||||
void EditorBoxSelect::Display2d(AzFramework::DebugDisplayRequests& debugDisplay)
|
||||
void EditorBoxSelect::Display2d(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
|
||||
@@ -82,12 +83,15 @@ namespace AzToolsFramework
|
||||
debugDisplay.SetLineWidth(s_boxSelectLineWidth);
|
||||
debugDisplay.SetColor(s_boxSelectColor);
|
||||
|
||||
debugDisplay.DrawWireBox(
|
||||
AZ::Vector3(
|
||||
static_cast<float>(m_boxSelectRegion->x()), static_cast<float>(m_boxSelectRegion->y()), 0.0f),
|
||||
AZ::Vector3(
|
||||
static_cast<float>(m_boxSelectRegion->x()) + static_cast<float>(m_boxSelectRegion->width()),
|
||||
static_cast<float>(m_boxSelectRegion->y()) + static_cast<float>(m_boxSelectRegion->height()), 0.0f));
|
||||
AZ::Vector2 viewportSize = AzToolsFramework::GetCameraState(viewportInfo.m_viewportId).m_viewportSize;
|
||||
|
||||
debugDisplay.DrawWireQuad2d(
|
||||
AZ::Vector2(
|
||||
aznumeric_cast<float>(m_boxSelectRegion->x()), aznumeric_cast<float>(m_boxSelectRegion->y())) / viewportSize,
|
||||
AZ::Vector2(
|
||||
aznumeric_cast<float>(m_boxSelectRegion->x()) + aznumeric_cast<float>(m_boxSelectRegion->width()),
|
||||
aznumeric_cast<float>(m_boxSelectRegion->y()) + aznumeric_cast<float>(m_boxSelectRegion->height())) / viewportSize,
|
||||
0.f);
|
||||
|
||||
debugDisplay.DepthTestOn();
|
||||
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ namespace AzToolsFramework
|
||||
const ViewportInteraction::MouseInteractionEvent& mouseInteraction);
|
||||
|
||||
/// Responsible for drawing the 2d box representing the selection in screen space.
|
||||
void Display2d(AzFramework::DebugDisplayRequests& debugDisplay);
|
||||
void Display2d(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay);
|
||||
|
||||
/// Custom drawing behavior to happen during a box select.
|
||||
void DisplayScene(
|
||||
|
||||
+1
-1
@@ -3494,7 +3494,7 @@ namespace AzToolsFramework
|
||||
|
||||
DrawAxisGizmo(viewportInfo, debugDisplay);
|
||||
|
||||
m_boxSelect.Display2d(debugDisplay);
|
||||
m_boxSelect.Display2d(viewportInfo, debugDisplay);
|
||||
}
|
||||
|
||||
void EditorTransformComponentSelection::RefreshSelectedEntityIds()
|
||||
|
||||
@@ -416,9 +416,7 @@ namespace AtomToolsFramework
|
||||
}
|
||||
AzFramework::ScreenPoint position = AzFramework::WorldToScreen(
|
||||
worldPosition,
|
||||
currentView->GetViewToWorldMatrix(),
|
||||
currentView->GetViewToClipMatrix(),
|
||||
AZ::Vector2{aznumeric_cast<float>(width()), aznumeric_cast<float>(height())}
|
||||
GetCameraState()
|
||||
);
|
||||
return {position.m_x, position.m_y};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user