Merge branch 'development' into optimization/unused_files
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> # Conflicts: # Gems/LmbrCentral/Code/Tests/lmbrcentral_editor_tests_files.cmake
This commit is contained in:
@@ -89,6 +89,7 @@
|
||||
#include <LmbrCentral/Rendering/EditorCameraCorrectionBus.h>
|
||||
|
||||
// Atom
|
||||
#include <Atom/RPI.Public/RenderPipeline.h>
|
||||
#include <Atom/RPI.Public/View.h>
|
||||
#include <Atom/RPI.Public/ViewportContextManager.h>
|
||||
#include <Atom/RPI.Public/ViewProviderBus.h>
|
||||
@@ -584,7 +585,7 @@ void EditorViewportWidget::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
m_renderViewport->SetScene(nullptr);
|
||||
break;
|
||||
|
||||
case eNotify_OnEndSceneOpen:
|
||||
case eNotify_OnEndLoad:
|
||||
UpdateScene();
|
||||
SetDefaultCamera();
|
||||
break;
|
||||
@@ -2324,7 +2325,26 @@ void EditorViewportWidget::UpdateScene()
|
||||
{
|
||||
AZ::RPI::SceneNotificationBus::Handler::BusDisconnect();
|
||||
m_renderViewport->SetScene(mainScene);
|
||||
AZ::RPI::SceneNotificationBus::Handler::BusConnect(m_renderViewport->GetViewportContext()->GetRenderScene()->GetId());
|
||||
auto viewportContext = m_renderViewport->GetViewportContext();
|
||||
AZ::RPI::SceneNotificationBus::Handler::BusConnect(viewportContext->GetRenderScene()->GetId());
|
||||
|
||||
// Don't enable the render pipeline until a level has been loaded
|
||||
// Also show/hide the RenderViewportWidget accordingly so that we get the
|
||||
// expected gradient background when no level is loaded
|
||||
auto renderPipeline = viewportContext->GetCurrentPipeline();
|
||||
if (renderPipeline)
|
||||
{
|
||||
if (GetIEditor()->IsLevelLoaded())
|
||||
{
|
||||
m_renderViewport->show();
|
||||
renderPipeline->AddToRenderTick();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_renderViewport->hide();
|
||||
renderPipeline->RemoveFromRenderTick();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1046,7 +1046,12 @@ void CTrackViewDialog::OnAddSequence()
|
||||
AzToolsFramework::ScopedUndoBatch undoBatch("Create TrackView Director Node");
|
||||
sequenceManager->CreateSequence(sequenceName, sequenceType);
|
||||
CTrackViewSequence* newSequence = sequenceManager->GetSequenceByName(sequenceName);
|
||||
AZ_Assert(newSequence, "Creating new sequence failed.");
|
||||
|
||||
if (!newSequence)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
undoBatch.MarkEntityDirty(newSequence->GetSequenceComponentEntityId());
|
||||
|
||||
// make it the currently selected sequence
|
||||
|
||||
@@ -19,13 +19,16 @@
|
||||
#include <AzToolsFramework/API/ComponentEntityObjectBus.h>
|
||||
#include <AzToolsFramework/API/EntityCompositionRequestBus.h>
|
||||
#include <AzToolsFramework/Commands/EntityStateCommand.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityHelpers.h>
|
||||
#include <AzToolsFramework/Entity/ReadOnly/ReadOnlyEntityInterface.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabFocusPublicInterface.h>
|
||||
#include <AzToolsFramework/PropertyTreeEditor/PropertyTreeEditor.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorDisabledCompositionBus.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorPendingCompositionBus.h>
|
||||
#include <AzToolsFramework/UI/ComponentPalette/ComponentPaletteUtil.hxx>
|
||||
#include <AzToolsFramework/UI/UICore/WidgetHelpers.h>
|
||||
#include <AzToolsFramework/Undo/UndoSystem.h>
|
||||
#include <IEditor.h>
|
||||
|
||||
@@ -37,6 +40,7 @@
|
||||
|
||||
// Qt
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
#include <QStringList>
|
||||
#include <QTimer>
|
||||
#include <QVBoxLayout>
|
||||
@@ -448,6 +452,8 @@ namespace LandscapeCanvasEditor
|
||||
return config;
|
||||
}
|
||||
|
||||
AzFramework::EntityContextId MainWindow::s_editorEntityContextId = AzFramework::EntityContextId::CreateNull();
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent)
|
||||
: GraphModelIntegration::EditorMainWindow(GetDefaultConfig(), parent)
|
||||
{
|
||||
@@ -470,9 +476,15 @@ namespace LandscapeCanvasEditor
|
||||
AZ::ComponentApplicationBus::BroadcastResult(m_serializeContext, &AZ::ComponentApplicationRequests::GetSerializeContext);
|
||||
AZ_Assert(m_serializeContext, "Failed to acquire application serialize context.");
|
||||
|
||||
AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(
|
||||
s_editorEntityContextId, &AzToolsFramework::EditorEntityContextRequests::GetEditorEntityContextId);
|
||||
|
||||
m_prefabFocusPublicInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabFocusPublicInterface>::Get();
|
||||
AZ_Assert(m_prefabFocusPublicInterface, "LandscapeCanvas - could not get PrefabFocusPublicInterface on construction.");
|
||||
|
||||
m_readOnlyEntityPublicInterface = AZ::Interface<AzToolsFramework::ReadOnlyEntityPublicInterface>::Get();
|
||||
AZ_Assert(m_readOnlyEntityPublicInterface, "LandscapeCanvas - could not get ReadOnlyEntityPublicInterface on construction.");
|
||||
|
||||
const GraphCanvas::EditorId& editorId = GetEditorId();
|
||||
|
||||
// Register unique color palettes for our connections (data types)
|
||||
@@ -837,6 +849,26 @@ namespace LandscapeCanvasEditor
|
||||
{
|
||||
using namespace AzFramework::Terrain;
|
||||
|
||||
// Detect if it's possible to create a new entity in the current context
|
||||
AZ::EntityId focusRootEntityId = m_prefabFocusPublicInterface->GetFocusedPrefabContainerEntityId(s_editorEntityContextId);
|
||||
if (m_readOnlyEntityPublicInterface->IsReadOnly(focusRootEntityId))
|
||||
{
|
||||
// Abort
|
||||
CloseEditor(dockWidget->GetDockWidgetId());
|
||||
|
||||
QWidget* activeWindow = AzToolsFramework::GetActiveWindow();
|
||||
|
||||
QMessageBox::warning(
|
||||
activeWindow,
|
||||
QString("Landscape Canvas Asset Creation Error"),
|
||||
QString("Could not create new Landscape Canvas asset under read-only entity."),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::Ok
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Invoke the GraphCanvas base instead of the GraphModelIntegration::EditorMainWindow so that we
|
||||
// can do our own custom handling when opening an existing graph
|
||||
GraphCanvas::AssetEditorMainWindow::OnEditorOpened(dockWidget);
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
class ReadOnlyEntityPublicInterface;
|
||||
|
||||
namespace Prefab
|
||||
{
|
||||
class PrefabFocusPublicInterface;
|
||||
@@ -261,7 +263,9 @@ namespace LandscapeCanvasEditor
|
||||
|
||||
AZ::SerializeContext* m_serializeContext = nullptr;
|
||||
|
||||
static AzFramework::EntityContextId s_editorEntityContextId;
|
||||
AzToolsFramework::Prefab::PrefabFocusPublicInterface* m_prefabFocusPublicInterface = nullptr;
|
||||
AzToolsFramework::ReadOnlyEntityPublicInterface* m_readOnlyEntityPublicInterface = nullptr;
|
||||
|
||||
bool m_ignoreGraphUpdates = false;
|
||||
bool m_prefabPropagationInProgress = false;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <AzFramework/Viewport/ViewportColors.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
|
||||
#include <AzToolsFramework/Viewport/VertexContainerDisplay.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportSettings.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
|
||||
|
||||
#include "MathConversion.h"
|
||||
@@ -357,6 +358,20 @@ namespace LmbrCentral
|
||||
return (static_cast<float>(rayIntersectData.m_distanceSq) < powf(s_lineWidth * screenToWorldScale, 2.0f));
|
||||
}
|
||||
|
||||
bool EditorSplineComponent::SupportsEditorRayIntersect()
|
||||
{
|
||||
return AzToolsFramework::HelpersVisible();
|
||||
}
|
||||
|
||||
bool EditorSplineComponent::SupportsEditorRayIntersectViewport(const AzFramework::ViewportInfo& viewportInfo)
|
||||
{
|
||||
bool helpersVisible = false;
|
||||
AzToolsFramework::ViewportInteraction::ViewportSettingsRequestBus::EventResult(
|
||||
helpersVisible, viewportInfo.m_viewportId,
|
||||
&AzToolsFramework::ViewportInteraction::ViewportSettingsRequestBus::Events::HelpersVisible);
|
||||
return helpersVisible;
|
||||
}
|
||||
|
||||
void EditorSplineComponent::OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& world)
|
||||
{
|
||||
m_cachedUniformScaleTransform = AzToolsFramework::TransformUniformScale(world);
|
||||
|
||||
@@ -62,7 +62,8 @@ namespace LmbrCentral
|
||||
bool EditorSelectionIntersectRayViewport(
|
||||
const AzFramework::ViewportInfo& viewportInfo,
|
||||
const AZ::Vector3& src, const AZ::Vector3& dir, float& distance) override;
|
||||
bool SupportsEditorRayIntersect() override { return true; };
|
||||
bool SupportsEditorRayIntersect() override;
|
||||
bool SupportsEditorRayIntersectViewport(const AzFramework::ViewportInfo& viewportInfo) override;
|
||||
|
||||
// EditorComponentSelectionNotificationsBus overrides ...
|
||||
void OnAccentTypeChanged(AzToolsFramework::EntityAccentType accent) override { m_accentType = accent; }
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzManipulatorTestFramework/AzManipulatorTestFrameworkTestHelpers.h>
|
||||
#include <AzTest/AzTest.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityHelpers.h>
|
||||
#include <AzToolsFramework/UnitTest/AzToolsFrameworkTestHelpers.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportSettings.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportTypes.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
|
||||
|
||||
#include "Shape/EditorSphereShapeComponent.h"
|
||||
#include "Shape/EditorSplineComponent.h"
|
||||
|
||||
namespace LmbrCentral
|
||||
{
|
||||
using AzToolsFramework::ViewportInteraction::BuildMouseButtons;
|
||||
using AzToolsFramework::ViewportInteraction::BuildMouseInteraction;
|
||||
using AzToolsFramework::ViewportInteraction::BuildMousePick;
|
||||
|
||||
class EditorIntersectionComponentFixture : public UnitTest::ToolsApplicationFixture
|
||||
{
|
||||
public:
|
||||
void SetUpEditorFixtureImpl() override
|
||||
{
|
||||
AZ::SerializeContext* serializeContext = nullptr;
|
||||
AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationBus::Events::GetSerializeContext);
|
||||
|
||||
m_editorSphereShapeComponentDescriptor =
|
||||
AZStd::unique_ptr<AZ::ComponentDescriptor>(EditorSphereShapeComponent::CreateDescriptor());
|
||||
m_editorSphereShapeComponentDescriptor->Reflect(serializeContext);
|
||||
m_editorSplineComponentDescriptor = AZStd::unique_ptr<AZ::ComponentDescriptor>(EditorSplineComponent::CreateDescriptor());
|
||||
m_editorSplineComponentDescriptor->Reflect(serializeContext);
|
||||
|
||||
m_entityId1 = UnitTest::CreateDefaultEditorEntity("Entity1");
|
||||
}
|
||||
|
||||
void TearDownEditorFixtureImpl() override
|
||||
{
|
||||
bool entityDestroyed = false;
|
||||
AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(
|
||||
entityDestroyed, &AzToolsFramework::EditorEntityContextRequestBus::Events::DestroyEditorEntity, m_entityId1);
|
||||
|
||||
m_editorSplineComponentDescriptor.reset();
|
||||
m_editorSphereShapeComponentDescriptor.reset();
|
||||
}
|
||||
|
||||
AZ::EntityId m_entityId1;
|
||||
AZStd::unique_ptr<AZ::ComponentDescriptor> m_editorSphereShapeComponentDescriptor;
|
||||
AZStd::unique_ptr<AZ::ComponentDescriptor> m_editorSplineComponentDescriptor;
|
||||
};
|
||||
|
||||
struct IntersectionQueryOutcome
|
||||
{
|
||||
bool m_helpersVisible;
|
||||
bool m_expectedIntersection;
|
||||
};
|
||||
|
||||
using EditorComponentIndirectCallManipulatorViewportInteractionFixture =
|
||||
UnitTest::IndirectCallManipulatorViewportInteractionFixtureMixin<EditorIntersectionComponentFixture>;
|
||||
|
||||
class EditorComponentIndirectCallManipulatorViewportInteractionFixtureParam
|
||||
: public EditorComponentIndirectCallManipulatorViewportInteractionFixture
|
||||
, public ::testing::WithParamInterface<IntersectionQueryOutcome>
|
||||
{
|
||||
public:
|
||||
virtual void CreateEditorComponent(AZ::Entity* entity) = 0;
|
||||
virtual void SetupEditorComponent(AZ::EntityId entityId) = 0;
|
||||
|
||||
void SetUpEditorFixtureImpl() override
|
||||
{
|
||||
EditorComponentIndirectCallManipulatorViewportInteractionFixture::SetUpEditorFixtureImpl();
|
||||
|
||||
auto* entity1 = AzToolsFramework::GetEntityById(m_entityId1);
|
||||
AZ_Assert(entity1, "Entity1 could not be found");
|
||||
entity1->Deactivate();
|
||||
CreateEditorComponent(entity1);
|
||||
entity1->Activate();
|
||||
|
||||
AZ::TransformBus::Event(
|
||||
m_entityId1, &AZ::TransformBus::Events::SetWorldTM, AZ::Transform::CreateTranslation(AZ::Vector3(0.0f, 2.0f, 0.0f)));
|
||||
|
||||
SetupEditorComponent(m_entityId1);
|
||||
|
||||
m_cameraState = AzFramework::CreateDefaultCamera(AZ::Transform::CreateIdentity(), AZ::Vector2(1024.0f, 768.0f));
|
||||
}
|
||||
|
||||
void VerifySelectionIntersection()
|
||||
{
|
||||
// given
|
||||
m_viewportManipulatorInteraction->GetViewportInteraction().SetHelpersVisible(GetParam().m_helpersVisible);
|
||||
|
||||
const auto entity1ScreenPosition =
|
||||
AzFramework::WorldToScreen(AzToolsFramework::GetWorldTranslation(m_entityId1), m_cameraState);
|
||||
const auto viewportId = m_viewportManipulatorInteraction->GetViewportInteraction().GetViewportId();
|
||||
const auto mouseInteraction = BuildMouseInteraction(
|
||||
BuildMousePick(m_cameraState, entity1ScreenPosition),
|
||||
BuildMouseButtons(AzToolsFramework::ViewportInteraction::MouseButton::None),
|
||||
AzToolsFramework::ViewportInteraction::InteractionId(AZ::EntityId(), viewportId),
|
||||
AzToolsFramework::ViewportInteraction::KeyboardModifiers());
|
||||
|
||||
// mimic mouse move
|
||||
m_actionDispatcher->CameraState(m_cameraState)->MousePosition(entity1ScreenPosition);
|
||||
|
||||
// when
|
||||
float closestDistance = AZStd::numeric_limits<float>::max();
|
||||
const bool entityPicked = AzToolsFramework::PickEntity(m_entityId1, mouseInteraction, closestDistance, viewportId);
|
||||
|
||||
// then
|
||||
EXPECT_THAT(entityPicked, ::testing::Eq(GetParam().m_expectedIntersection));
|
||||
}
|
||||
};
|
||||
|
||||
class ShapeEditorComponentIndirectCallManipulatorViewportInteractionFixtureParam
|
||||
: public EditorComponentIndirectCallManipulatorViewportInteractionFixtureParam
|
||||
{
|
||||
public:
|
||||
void CreateEditorComponent(AZ::Entity* entity) override
|
||||
{
|
||||
entity->CreateComponent<EditorSphereShapeComponent>();
|
||||
}
|
||||
|
||||
void SetupEditorComponent(AZ::EntityId entityId) override
|
||||
{
|
||||
LmbrCentral::SphereShapeComponentRequestsBus::Event(
|
||||
entityId, &LmbrCentral::SphereShapeComponentRequestsBus::Events::SetRadius, 1.0f);
|
||||
}
|
||||
};
|
||||
|
||||
class SplineEditorComponentIndirectCallManipulatorViewportInteractionFixtureParam
|
||||
: public EditorComponentIndirectCallManipulatorViewportInteractionFixtureParam
|
||||
{
|
||||
public:
|
||||
void CreateEditorComponent(AZ::Entity* entity) override
|
||||
{
|
||||
entity->CreateComponent<EditorSplineComponent>();
|
||||
}
|
||||
|
||||
void SetupEditorComponent([[maybe_unused]] AZ::EntityId entityId) override
|
||||
{
|
||||
// unused
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(ShapeEditorComponentIndirectCallManipulatorViewportInteractionFixtureParam, ShapeIntersectionOnlyHappensWithHelpersEnabled)
|
||||
{
|
||||
VerifySelectionIntersection();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
All,
|
||||
ShapeEditorComponentIndirectCallManipulatorViewportInteractionFixtureParam,
|
||||
testing::Values(IntersectionQueryOutcome{ true, true }, IntersectionQueryOutcome{ false, false }));
|
||||
|
||||
TEST_P(SplineEditorComponentIndirectCallManipulatorViewportInteractionFixtureParam, SplineIntersectionOnlyHappensWithHelpersEnabled)
|
||||
{
|
||||
VerifySelectionIntersection();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
All,
|
||||
SplineEditorComponentIndirectCallManipulatorViewportInteractionFixtureParam,
|
||||
testing::Values(IntersectionQueryOutcome{ true, true }, IntersectionQueryOutcome{ false, false }));
|
||||
} // namespace LmbrCentral
|
||||
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzManipulatorTestFramework/AzManipulatorTestFrameworkTestHelpers.h>
|
||||
#include <AzTest/AzTest.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityHelpers.h>
|
||||
#include <AzToolsFramework/UnitTest/AzToolsFrameworkTestHelpers.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportSettings.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportTypes.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
|
||||
|
||||
#include "Shape/EditorSphereShapeComponent.h"
|
||||
|
||||
namespace LmbrCentral
|
||||
{
|
||||
using AzToolsFramework::ViewportInteraction::BuildMouseButtons;
|
||||
using AzToolsFramework::ViewportInteraction::BuildMouseInteraction;
|
||||
using AzToolsFramework::ViewportInteraction::BuildMousePick;
|
||||
|
||||
class EditorSphereShapeComponentFixture : public UnitTest::ToolsApplicationFixture
|
||||
{
|
||||
public:
|
||||
void SetUpEditorFixtureImpl() override
|
||||
{
|
||||
AZ::SerializeContext* serializeContext = nullptr;
|
||||
AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationBus::Events::GetSerializeContext);
|
||||
|
||||
m_editorSphereShapeComponentDescriptor =
|
||||
AZStd::unique_ptr<AZ::ComponentDescriptor>(EditorSphereShapeComponent::CreateDescriptor());
|
||||
m_editorSphereShapeComponentDescriptor->Reflect(serializeContext);
|
||||
|
||||
m_entityId1 = UnitTest::CreateDefaultEditorEntity("Entity1");
|
||||
}
|
||||
|
||||
void TearDownEditorFixtureImpl() override
|
||||
{
|
||||
bool entityDestroyed = false;
|
||||
AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(
|
||||
entityDestroyed, &AzToolsFramework::EditorEntityContextRequestBus::Events::DestroyEditorEntity, m_entityId1);
|
||||
|
||||
m_editorSphereShapeComponentDescriptor.reset();
|
||||
}
|
||||
|
||||
AZ::EntityId m_entityId1;
|
||||
AZStd::unique_ptr<AZ::ComponentDescriptor> m_editorSphereShapeComponentDescriptor;
|
||||
};
|
||||
|
||||
struct IntersectionQueryOutcome
|
||||
{
|
||||
bool m_helpersVisible;
|
||||
bool m_expectedIntersection;
|
||||
};
|
||||
|
||||
using ShapeComponentIndirectCallManipulatorViewportInteractionFixture =
|
||||
UnitTest::IndirectCallManipulatorViewportInteractionFixtureMixin<EditorSphereShapeComponentFixture>;
|
||||
|
||||
class ShapeComponentIndirectCallManipulatorViewportInteractionFixtureParam
|
||||
: public ShapeComponentIndirectCallManipulatorViewportInteractionFixture
|
||||
, public ::testing::WithParamInterface<IntersectionQueryOutcome>
|
||||
{
|
||||
public:
|
||||
void SetUpEditorFixtureImpl() override
|
||||
{
|
||||
ShapeComponentIndirectCallManipulatorViewportInteractionFixture::SetUpEditorFixtureImpl();
|
||||
|
||||
auto* entity1 = AzToolsFramework::GetEntityById(m_entityId1);
|
||||
AZ_Assert(entity1, "Entity1 could not be found");
|
||||
entity1->Deactivate();
|
||||
entity1->CreateComponent<EditorSphereShapeComponent>();
|
||||
entity1->Activate();
|
||||
|
||||
AZ::TransformBus::Event(
|
||||
m_entityId1, &AZ::TransformBus::Events::SetWorldTM, AZ::Transform::CreateTranslation(AZ::Vector3(0.0f, 2.0f, 0.0f)));
|
||||
LmbrCentral::SphereShapeComponentRequestsBus::Event(
|
||||
m_entityId1, &LmbrCentral::SphereShapeComponentRequestsBus::Events::SetRadius, 1.0f);
|
||||
|
||||
m_cameraState = AzFramework::CreateDefaultCamera(AZ::Transform::CreateIdentity(), AZ::Vector2(1024.0f, 768.0f));
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(ShapeComponentIndirectCallManipulatorViewportInteractionFixtureParam, ShapeIntersectionOnlyHappensWithHelpersEnabled)
|
||||
{
|
||||
// given
|
||||
m_viewportManipulatorInteraction->GetViewportInteraction().SetHelpersVisible(GetParam().m_helpersVisible);
|
||||
|
||||
const auto entity1ScreenPosition = AzFramework::WorldToScreen(AzToolsFramework::GetWorldTranslation(m_entityId1), m_cameraState);
|
||||
const auto viewportId = m_viewportManipulatorInteraction->GetViewportInteraction().GetViewportId();
|
||||
const auto mouseInteraction = BuildMouseInteraction(
|
||||
BuildMousePick(m_cameraState, entity1ScreenPosition),
|
||||
BuildMouseButtons(AzToolsFramework::ViewportInteraction::MouseButton::None),
|
||||
AzToolsFramework::ViewportInteraction::InteractionId(AZ::EntityId(), viewportId),
|
||||
AzToolsFramework::ViewportInteraction::KeyboardModifiers());
|
||||
|
||||
// mimic mouse move
|
||||
m_actionDispatcher->CameraState(m_cameraState)->MousePosition(entity1ScreenPosition);
|
||||
|
||||
// when
|
||||
float closestDistance = AZStd::numeric_limits<float>::max();
|
||||
const bool entityPicked = AzToolsFramework::PickEntity(m_entityId1, mouseInteraction, closestDistance, viewportId);
|
||||
|
||||
// then
|
||||
EXPECT_THAT(entityPicked, ::testing::Eq(GetParam().m_expectedIntersection));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
All,
|
||||
ShapeComponentIndirectCallManipulatorViewportInteractionFixtureParam,
|
||||
testing::Values(IntersectionQueryOutcome{ true, true }, IntersectionQueryOutcome{ false, false }));
|
||||
} // namespace LmbrCentral
|
||||
@@ -9,7 +9,7 @@
|
||||
set(FILES
|
||||
LmbrCentralEditorTest.cpp
|
||||
LmbrCentralReflectionTest.h
|
||||
EditorShapeComponentIntersectionTests.cpp
|
||||
EditorComponentIntersectionTests.cpp
|
||||
EditorBoxShapeComponentTests.cpp
|
||||
EditorSphereShapeComponentTests.cpp
|
||||
EditorCapsuleShapeComponentTests.cpp
|
||||
|
||||
+5
@@ -10,6 +10,11 @@
|
||||
"glob": "*.pxheightfield",
|
||||
"params": "copy",
|
||||
"productAssetType": "{B61189FE-B2D7-4AF1-8951-CB5C0F7834FC}"
|
||||
},
|
||||
"RC PhysXMeshAsset": {
|
||||
"glob": "*.pxmesh",
|
||||
"params": "copy",
|
||||
"productAssetType": "{7A2871B9-5EAB-4DE0-A901-B0D2C6920DDB}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -480,17 +480,6 @@
|
||||
"glob": "*.der",
|
||||
"params": "copy"
|
||||
},
|
||||
"RC PhysXMeshAsset": {
|
||||
"glob": "*.pxmesh",
|
||||
"params": "copy",
|
||||
"productAssetType": "{7A2871B9-5EAB-4DE0-A901-B0D2C6920DDB}"
|
||||
},
|
||||
// Copy over cooked PhysX heightfield
|
||||
"RC PhysX HeightField": {
|
||||
"glob": "*.pxheightfield",
|
||||
"params": "copy",
|
||||
"productAssetType": "{B61189FE-B2D7-4AF1-8951-CB5C0F7834FC}"
|
||||
},
|
||||
"RC filetag": {
|
||||
"glob": "*.filetag",
|
||||
"params": "copy",
|
||||
|
||||
Reference in New Issue
Block a user