Merge branch 'development' into cmake/SPEC-2513_w4244
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> # Conflicts: # Code/Editor/CryEditDoc.cpp # Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp # Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp # Gems/PhysXDebug/Code/Source/SystemComponent.cpp
This commit is contained in:
@@ -242,6 +242,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
Legacy::CryCommon
|
||||
AZ::AzToolsFramework
|
||||
AZ::AzToolsFramework.Tests
|
||||
AZ::AzFrameworkTestShared
|
||||
AZ::AzToolsFrameworkTestCommon
|
||||
Legacy::EditorLib
|
||||
Gem::AtomToolsFramework.Static
|
||||
|
||||
@@ -1047,7 +1047,7 @@ static bool TryRenameFile(const QString& oldPath, const QString& newPath, int re
|
||||
|
||||
bool CCryEditDoc::SaveLevel(const QString& filename)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
QWaitCursor wait;
|
||||
|
||||
CAutoCheckOutDialogEnableForAll enableForAll;
|
||||
@@ -1067,7 +1067,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
|
||||
|
||||
{
|
||||
|
||||
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "CCryEditDoc::SaveLevel BackupBeforeSave");
|
||||
AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel BackupBeforeSave");
|
||||
BackupBeforeSave();
|
||||
}
|
||||
|
||||
@@ -1178,7 +1178,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
|
||||
CPakFile pakFile;
|
||||
|
||||
{
|
||||
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "CCryEditDoc::SaveLevel Open PakFile");
|
||||
AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel Open PakFile");
|
||||
if (!pakFile.Open(tempSaveFile.toUtf8().data(), false))
|
||||
{
|
||||
gEnv->pLog->LogWarning("Unable to open pack file %s for writing", tempSaveFile.toUtf8().data());
|
||||
@@ -1209,7 +1209,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
|
||||
|
||||
AZ::IO::ByteContainerStream<AZStd::vector<char>> entitySaveStream(&entitySaveBuffer);
|
||||
{
|
||||
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "CCryEditDoc::SaveLevel Save Entities To Stream");
|
||||
AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel Save Entities To Stream");
|
||||
EBUS_EVENT_RESULT(
|
||||
savedEntities, AzToolsFramework::EditorEntityContextRequestBus, SaveToStreamForEditor, entitySaveStream, layerEntities,
|
||||
instancesInLayers);
|
||||
@@ -1223,7 +1223,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
|
||||
|
||||
if (savedEntities)
|
||||
{
|
||||
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "CCryEditDoc::SaveLevel Updated PakFile levelEntities.editor_xml");
|
||||
AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel Updated PakFile levelEntities.editor_xml");
|
||||
pakFile.UpdateFile("LevelEntities.editor_xml", entitySaveBuffer.begin(), static_cast<int>(entitySaveBuffer.size()));
|
||||
|
||||
// Save XML archive to pak file.
|
||||
|
||||
@@ -31,6 +31,8 @@ namespace SandboxEditor
|
||||
constexpr AZStd::string_view CameraPanSpeedSetting = "/Amazon/Preferences/Editor/Camera/PanSpeed";
|
||||
constexpr AZStd::string_view CameraRotateSmoothnessSetting = "/Amazon/Preferences/Editor/Camera/RotateSmoothness";
|
||||
constexpr AZStd::string_view CameraTranslateSmoothnessSetting = "/Amazon/Preferences/Editor/Camera/TranslateSmoothness";
|
||||
constexpr AZStd::string_view CameraTranslateSmoothingSetting = "/Amazon/Preferences/Editor/Camera/TranslateSmoothing";
|
||||
constexpr AZStd::string_view CameraRotateSmoothingSetting = "/Amazon/Preferences/Editor/Camera/RotateSmoothing";
|
||||
constexpr AZStd::string_view CameraTranslateForwardIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateForwardId";
|
||||
constexpr AZStd::string_view CameraTranslateBackwardIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateBackwardId";
|
||||
constexpr AZStd::string_view CameraTranslateLeftIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateLeftId";
|
||||
@@ -259,6 +261,26 @@ namespace SandboxEditor
|
||||
SetRegistry(CameraTranslateSmoothnessSetting, smoothness);
|
||||
}
|
||||
|
||||
bool CameraRotateSmoothingEnabled()
|
||||
{
|
||||
return GetRegistry(CameraRotateSmoothingSetting, true);
|
||||
}
|
||||
|
||||
void SetCameraRotateSmoothingEnabled(const bool enabled)
|
||||
{
|
||||
SetRegistry(CameraRotateSmoothingSetting, enabled);
|
||||
}
|
||||
|
||||
bool CameraTranslateSmoothingEnabled()
|
||||
{
|
||||
return GetRegistry(CameraTranslateSmoothingSetting, true);
|
||||
}
|
||||
|
||||
void SetCameraTranslateSmoothingEnabled(const bool enabled)
|
||||
{
|
||||
SetRegistry(CameraTranslateSmoothingSetting, enabled);
|
||||
}
|
||||
|
||||
AzFramework::InputChannelId CameraTranslateForwardChannelId()
|
||||
{
|
||||
return AzFramework::InputChannelId(
|
||||
|
||||
@@ -80,6 +80,12 @@ namespace SandboxEditor
|
||||
SANDBOX_API float CameraTranslateSmoothness();
|
||||
SANDBOX_API void SetCameraTranslateSmoothness(float smoothness);
|
||||
|
||||
SANDBOX_API bool CameraRotateSmoothingEnabled();
|
||||
SANDBOX_API void SetCameraRotateSmoothingEnabled(bool enabled);
|
||||
|
||||
SANDBOX_API bool CameraTranslateSmoothingEnabled();
|
||||
SANDBOX_API void SetCameraTranslateSmoothingEnabled(bool enabled);
|
||||
|
||||
SANDBOX_API AzFramework::InputChannelId CameraTranslateForwardChannelId();
|
||||
SANDBOX_API void SetCameraTranslateForwardChannelId(AZStd::string_view cameraTranslateForwardId);
|
||||
|
||||
|
||||
@@ -132,12 +132,11 @@ namespace AZ::ViewportHelpers
|
||||
{
|
||||
static const char TextCantCreateCameraNoLevel[] = "Cannot create camera when no level is loaded.";
|
||||
|
||||
class EditorEntityNotifications
|
||||
: public AzToolsFramework::EditorEntityContextNotificationBus::Handler
|
||||
class EditorEntityNotifications : public AzToolsFramework::EditorEntityContextNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
EditorEntityNotifications(EditorViewportWidget& renderViewport)
|
||||
: m_renderViewport(renderViewport)
|
||||
EditorEntityNotifications(EditorViewportWidget& editorViewportWidget)
|
||||
: m_editorViewportWidget(editorViewportWidget)
|
||||
{
|
||||
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
|
||||
}
|
||||
@@ -147,22 +146,24 @@ namespace AZ::ViewportHelpers
|
||||
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
// AzToolsFramework::EditorEntityContextNotificationBus
|
||||
// AzToolsFramework::EditorEntityContextNotificationBus overrides ...
|
||||
void OnStartPlayInEditor() override
|
||||
{
|
||||
m_renderViewport.OnStartPlayInEditor();
|
||||
m_editorViewportWidget.OnStartPlayInEditor();
|
||||
}
|
||||
|
||||
void OnStopPlayInEditor() override
|
||||
{
|
||||
m_renderViewport.OnStopPlayInEditor();
|
||||
m_editorViewportWidget.OnStopPlayInEditor();
|
||||
}
|
||||
|
||||
void OnStartPlayInEditorBegin() override
|
||||
{
|
||||
m_renderViewport.OnStartPlayInEditorBegin();
|
||||
m_editorViewportWidget.OnStartPlayInEditorBegin();
|
||||
}
|
||||
|
||||
private:
|
||||
EditorViewportWidget& m_renderViewport;
|
||||
EditorViewportWidget& m_editorViewportWidget;
|
||||
};
|
||||
} // namespace AZ::ViewportHelpers
|
||||
|
||||
@@ -1033,10 +1034,16 @@ bool EditorViewportWidget::ShowingWorldSpace()
|
||||
}
|
||||
|
||||
AZStd::shared_ptr<AtomToolsFramework::ModularViewportCameraController> CreateModularViewportCameraController(
|
||||
AzFramework::ViewportId viewportId)
|
||||
const AzFramework::ViewportId viewportId)
|
||||
{
|
||||
auto controller = AZStd::make_shared<AtomToolsFramework::ModularViewportCameraController>();
|
||||
|
||||
controller->SetCameraViewportContextBuilderCallback(
|
||||
[viewportId](AZStd::unique_ptr<AtomToolsFramework::ModularCameraViewportContext>& cameraViewportContext)
|
||||
{
|
||||
cameraViewportContext = AZStd::make_unique<AtomToolsFramework::ModularCameraViewportContextImpl>(viewportId);
|
||||
});
|
||||
|
||||
controller->SetCameraPriorityBuilderCallback(
|
||||
[](AtomToolsFramework::CameraControllerPriorityFn& cameraControllerPriorityFn)
|
||||
{
|
||||
@@ -1055,6 +1062,16 @@ AZStd::shared_ptr<AtomToolsFramework::ModularViewportCameraController> CreateMod
|
||||
{
|
||||
return SandboxEditor::CameraTranslateSmoothness();
|
||||
};
|
||||
|
||||
cameraProps.m_rotateSmoothingEnabledFn = []
|
||||
{
|
||||
return SandboxEditor::CameraRotateSmoothingEnabled();
|
||||
};
|
||||
|
||||
cameraProps.m_translateSmoothingEnabledFn = []
|
||||
{
|
||||
return SandboxEditor::CameraTranslateSmoothingEnabled();
|
||||
};
|
||||
});
|
||||
|
||||
controller->SetCameraListBuilderCallback(
|
||||
@@ -1956,7 +1973,7 @@ QPoint EditorViewportWidget::WorldToViewParticleEditor(const Vec3& wp, int width
|
||||
Vec3 EditorViewportWidget::ViewToWorld(
|
||||
const QPoint& vp, bool* collideWithTerrain, bool onlyTerrain, bool bSkipVegetation, bool bTestRenderMesh, bool* collideWithObject) const
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
AZ_UNUSED(collideWithTerrain)
|
||||
AZ_UNUSED(onlyTerrain)
|
||||
@@ -1991,7 +2008,7 @@ Vec3 EditorViewportWidget::ViewToWorldNormal(const QPoint& vp, bool onlyTerrain,
|
||||
AZ_UNUSED(onlyTerrain)
|
||||
AZ_UNUSED(bTestRenderMesh)
|
||||
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
return Vec3(0, 0, 1);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,8 @@ namespace AZ::ViewportHelpers
|
||||
namespace AtomToolsFramework
|
||||
{
|
||||
class RenderViewportWidget;
|
||||
}
|
||||
class ModularViewportCameraController;
|
||||
} // namespace AtomToolsFramework
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
@@ -389,3 +390,7 @@ private:
|
||||
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
|
||||
//! Creates a modular camera controller in the configuration used by the editor viewport.
|
||||
SANDBOX_API AZStd::shared_ptr<AtomToolsFramework::ModularViewportCameraController> CreateModularViewportCameraController(
|
||||
const AzFramework::ViewportId viewportId);
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* 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 <AtomToolsFramework/Viewport/ModularViewportCameraController.h>
|
||||
#include <AzFramework/Viewport/ViewportControllerList.h>
|
||||
#include <AzToolsFramework/Input/QtEventToAzInputManager.h>
|
||||
#include <AzToolsFramework/UnitTest/AzToolsFrameworkTestHelpers.h>
|
||||
#include <EditorViewportWidget.h>
|
||||
#include <Mocks/MockWindowRequests.h>
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
const QSize WidgetSize = QSize(1920, 1080);
|
||||
|
||||
using AzToolsFramework::ViewportInteraction::MouseInteractionEvent;
|
||||
|
||||
class ModularViewportCameraControllerFixture : public AllocatorsTestFixture
|
||||
{
|
||||
public:
|
||||
static const AzFramework::ViewportId TestViewportId;
|
||||
|
||||
void SetUp() override
|
||||
{
|
||||
AllocatorsTestFixture::SetUp();
|
||||
|
||||
m_rootWidget = AZStd::make_unique<QWidget>();
|
||||
m_rootWidget->setFixedSize(WidgetSize);
|
||||
|
||||
m_controllerList = AZStd::make_shared<AzFramework::ViewportControllerList>();
|
||||
m_controllerList->RegisterViewportContext(TestViewportId);
|
||||
|
||||
m_inputChannelMapper = AZStd::make_unique<AzToolsFramework::QtEventToAzInputMapper>(m_rootWidget.get(), TestViewportId);
|
||||
}
|
||||
|
||||
void TearDown()
|
||||
{
|
||||
m_inputChannelMapper.reset();
|
||||
|
||||
m_controllerList->UnregisterViewportContext(TestViewportId);
|
||||
m_controllerList.reset();
|
||||
m_rootWidget.reset();
|
||||
|
||||
AllocatorsTestFixture::TearDown();
|
||||
}
|
||||
|
||||
AZStd::unique_ptr<QWidget> m_rootWidget;
|
||||
AzFramework::ViewportControllerListPtr m_controllerList;
|
||||
AZStd::unique_ptr<AzToolsFramework::QtEventToAzInputMapper> m_inputChannelMapper;
|
||||
};
|
||||
|
||||
const AzFramework::ViewportId ModularViewportCameraControllerFixture::TestViewportId = AzFramework::ViewportId(0);
|
||||
|
||||
class TestModularCameraViewportContextImpl : public AtomToolsFramework::ModularCameraViewportContext
|
||||
{
|
||||
public:
|
||||
AZ::Transform GetCameraTransform() const override
|
||||
{
|
||||
return m_cameraTransform;
|
||||
}
|
||||
|
||||
void SetCameraTransform(const AZ::Transform& transform) override
|
||||
{
|
||||
m_cameraTransform = transform;
|
||||
}
|
||||
|
||||
void ConnectViewMatrixChangedHandler(AZ::RPI::ViewportContext::MatrixChangedEvent::Handler&) override
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
private:
|
||||
AZ::Transform m_cameraTransform = AZ::Transform::CreateIdentity();
|
||||
};
|
||||
|
||||
TEST_F(ModularViewportCameraControllerFixture, Mouse_movement_does_not_accumulate_excessive_drift_in_modular_viewport_camera)
|
||||
{
|
||||
AzFramework::NativeWindowHandle nativeWindowHandle = nullptr;
|
||||
|
||||
const float deltaTime = 1.0f / 60.0f; // mimic 60fps
|
||||
|
||||
// Given
|
||||
// listen for events signaled from QtEventToAzInputMapper and forward to the controller list
|
||||
QObject::connect(
|
||||
m_inputChannelMapper.get(), &AzToolsFramework::QtEventToAzInputMapper::InputChannelUpdated, m_rootWidget.get(),
|
||||
[this, nativeWindowHandle](const AzFramework::InputChannel* inputChannel, [[maybe_unused]] QEvent* event)
|
||||
{
|
||||
m_controllerList->HandleInputChannelEvent(
|
||||
AzFramework::ViewportControllerInputEvent{ TestViewportId, nativeWindowHandle, *inputChannel });
|
||||
});
|
||||
|
||||
using ::testing::NiceMock;
|
||||
using ::testing::Return;
|
||||
|
||||
NiceMock<MockWindowRequests> mockWindowRequests;
|
||||
mockWindowRequests.Connect(nativeWindowHandle);
|
||||
|
||||
// note: WindowRequests is used internally by ModularViewportCameraController, this ensures it returns the viewport size we want
|
||||
ON_CALL(mockWindowRequests, GetClientAreaSize())
|
||||
.WillByDefault(Return(AzFramework::WindowSize(WidgetSize.width(), WidgetSize.height())));
|
||||
|
||||
// create editor modular camera
|
||||
auto controller = CreateModularViewportCameraController(TestViewportId);
|
||||
|
||||
// set some overrides for the test
|
||||
AtomToolsFramework::ModularCameraViewportContext* cameraViewportContextView = nullptr;
|
||||
controller->SetCameraViewportContextBuilderCallback(
|
||||
[&cameraViewportContextView](AZStd::unique_ptr<AtomToolsFramework::ModularCameraViewportContext>& cameraViewportContext)
|
||||
{
|
||||
cameraViewportContext = AZStd::make_unique<TestModularCameraViewportContextImpl>();
|
||||
cameraViewportContextView = cameraViewportContext.get();
|
||||
});
|
||||
|
||||
controller->SetCameraPropsBuilderCallback(
|
||||
[](AzFramework::CameraProps& cameraProps)
|
||||
{
|
||||
cameraProps.m_rotateSmoothingEnabledFn = []
|
||||
{
|
||||
return false;
|
||||
};
|
||||
|
||||
cameraProps.m_translateSmoothingEnabledFn = []
|
||||
{
|
||||
return false;
|
||||
};
|
||||
});
|
||||
|
||||
m_controllerList->Add(controller);
|
||||
|
||||
// move to the center of the screen
|
||||
auto start = QPoint(WidgetSize.width() / 2, WidgetSize.height() / 2);
|
||||
MouseMove(m_rootWidget.get(), start, QPoint(0, 0));
|
||||
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
|
||||
|
||||
// When
|
||||
// move mouse diagonally to top right, then to bottom left and back repeatedly
|
||||
auto current = start;
|
||||
auto halfDelta = QPoint(200, -200);
|
||||
const int iterationsPerDiagonal = 50;
|
||||
for (int diagonals = 0; diagonals < 80; ++diagonals)
|
||||
{
|
||||
for (int i = 0; i < iterationsPerDiagonal; ++i)
|
||||
{
|
||||
MousePressAndMove(m_rootWidget.get(), current, halfDelta / iterationsPerDiagonal, Qt::MouseButton::RightButton);
|
||||
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
|
||||
current += halfDelta / iterationsPerDiagonal;
|
||||
}
|
||||
|
||||
if (diagonals % 2 == 0)
|
||||
{
|
||||
halfDelta.setX(halfDelta.x() * -1);
|
||||
halfDelta.setY(halfDelta.y() * -1);
|
||||
}
|
||||
}
|
||||
|
||||
QTest::mouseRelease(m_rootWidget.get(), Qt::MouseButton::RightButton, Qt::KeyboardModifier::NoModifier, current);
|
||||
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
|
||||
|
||||
// Then
|
||||
// ensure the camera rotation is the identity (no significant drift has occurred as we moved the mouse)
|
||||
const AZ::Transform cameraRotation = cameraViewportContextView->GetCameraTransform();
|
||||
EXPECT_THAT(cameraRotation.GetRotation(), IsClose(AZ::Quaternion::CreateIdentity()));
|
||||
|
||||
mockWindowRequests.Disconnect();
|
||||
}
|
||||
} // namespace UnitTest
|
||||
@@ -274,7 +274,7 @@ Matrix34 CAxisGizmo::GetTransformation(RefCoordSys coordSys, IDisplayViewport* v
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAxisGizmo::MouseCallback(CViewport* view, EMouseEvent event, QPoint& point, [[maybe_unused]] int nFlags)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
if (event == eMouseLDown)
|
||||
{
|
||||
|
||||
@@ -1233,7 +1233,7 @@ float CBaseObject::GetCameraVisRatio(const CCamera& camera)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CBaseObject::MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
if (event == eMouseMove || event == eMouseLDown)
|
||||
{
|
||||
@@ -1928,7 +1928,7 @@ bool CBaseObject::HitTestRectBounds(HitContext& hc, const AABB& box)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CBaseObject::HitTestRect(HitContext& hc)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity);
|
||||
AZ_PROFILE_FUNCTION(Entity);
|
||||
|
||||
AABB box;
|
||||
|
||||
@@ -1965,7 +1965,7 @@ bool CBaseObject::HitHelperTest(HitContext& hc)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CBaseObject::HitHelperAtTest(HitContext& hc, const Vec3& pos)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity);
|
||||
AZ_PROFILE_FUNCTION(Entity);
|
||||
|
||||
bool bResult = false;
|
||||
|
||||
|
||||
@@ -497,7 +497,7 @@ bool CEntityObject::HitTestRect(HitContext& hc)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CEntityObject::MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
if (event == eMouseMove || event == eMouseLDown)
|
||||
{
|
||||
|
||||
@@ -368,7 +368,7 @@ CBaseObject* CObjectManager::NewObject(const QString& typeName, CBaseObject* pre
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CObjectManager::DeleteObject(CBaseObject* obj)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
if (m_currEditObject == obj)
|
||||
{
|
||||
EndEditParams();
|
||||
@@ -414,7 +414,7 @@ void CObjectManager::DeleteObject(CBaseObject* obj)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CObjectManager::DeleteSelection(CSelectionGroup* pSelection)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
if (pSelection == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -478,7 +478,7 @@ void CObjectManager::DeleteSelection(CSelectionGroup* pSelection)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CObjectManager::DeleteAllObjects()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
EndEditParams();
|
||||
|
||||
@@ -519,7 +519,7 @@ void CObjectManager::DeleteAllObjects()
|
||||
|
||||
CBaseObject* CObjectManager::CloneObject(CBaseObject* obj)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
assert(obj);
|
||||
//CRuntimeClass *cls = obj->GetRuntimeClass();
|
||||
//CBaseObject *clone = (CBaseObject*)cls->CreateObject();
|
||||
@@ -1112,7 +1112,7 @@ void CObjectManager::SerializeNameSelection(XmlNodeRef& rootNode, bool bLoading)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CObjectManager::ClearSelection()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
// Make sure to unlock selection.
|
||||
GetIEditor()->LockSelection(false);
|
||||
@@ -1165,7 +1165,7 @@ int CObjectManager::ClearSelection()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CObjectManager::InvertSelection()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
int selCount = 0;
|
||||
// iterate all objects.
|
||||
@@ -1189,7 +1189,7 @@ int CObjectManager::InvertSelection()
|
||||
|
||||
void CObjectManager::SetSelection(const QString& name)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr);
|
||||
if (selection)
|
||||
{
|
||||
@@ -1202,7 +1202,7 @@ void CObjectManager::SetSelection(const QString& name)
|
||||
|
||||
void CObjectManager::RemoveSelection(const QString& name)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
QString selName = name;
|
||||
CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr);
|
||||
@@ -1221,7 +1221,7 @@ void CObjectManager::RemoveSelection(const QString& name)
|
||||
|
||||
void CObjectManager::SelectCurrent()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
for (int i = 0; i < m_currSelection->GetCount(); i++)
|
||||
{
|
||||
CBaseObject* obj = m_currSelection->GetObject(i);
|
||||
@@ -1236,7 +1236,7 @@ void CObjectManager::SelectCurrent()
|
||||
|
||||
void CObjectManager::UnselectCurrent()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
// Make sure to unlock selection.
|
||||
GetIEditor()->LockSelection(false);
|
||||
@@ -1260,7 +1260,7 @@ void CObjectManager::UnselectCurrent()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CObjectManager::Display(DisplayContext& dc)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
int currentHideMask = GetIEditor()->GetDisplaySettings()->GetObjectHideMask();
|
||||
if (m_lastHideMask != currentHideMask)
|
||||
@@ -1320,7 +1320,7 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]]
|
||||
return;
|
||||
}
|
||||
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
CBaseObjectsCache* pDispayedViewObjects = dc.view->GetVisibleObjectsCache();
|
||||
@@ -1451,7 +1451,7 @@ void CObjectManager::EndEditParams([[maybe_unused]] int flags)
|
||||
//! Select objects within specified distance from given position.
|
||||
int CObjectManager::SelectObjects(const AABB& box, bool bUnselect)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
int numSel = 0;
|
||||
|
||||
AABB objBounds;
|
||||
@@ -1551,7 +1551,7 @@ bool CObjectManager::IsObjectDeletionAllowed(CBaseObject* pObject)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CObjectManager::DeleteSelection()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
// Make sure to unlock selection.
|
||||
GetIEditor()->LockSelection(false);
|
||||
@@ -1581,7 +1581,7 @@ void CObjectManager::DeleteSelection()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CObjectManager::HitTestObject(CBaseObject* obj, HitContext& hc)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
if (obj->IsFrozen())
|
||||
{
|
||||
@@ -1648,7 +1648,7 @@ bool CObjectManager::HitTestObject(CBaseObject* obj, HitContext& hc)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CObjectManager::HitTest(HitContext& hitInfo)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
hitInfo.object = nullptr;
|
||||
hitInfo.dist = FLT_MAX;
|
||||
@@ -1766,7 +1766,7 @@ bool CObjectManager::HitTest(HitContext& hitInfo)
|
||||
}
|
||||
void CObjectManager::FindObjectsInRect(CViewport* view, const QRect& rect, std::vector<GUID>& guids)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
if (rect.width() < 1 || rect.height() < 1)
|
||||
{
|
||||
@@ -1795,7 +1795,7 @@ void CObjectManager::FindObjectsInRect(CViewport* view, const QRect& rect, std::
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CObjectManager::SelectObjectsInRect(CViewport* view, const QRect& rect, bool bSelect)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
// Ignore too small rectangles.
|
||||
if (rect.width() < 1 || rect.height() < 1)
|
||||
@@ -2363,7 +2363,7 @@ bool CObjectManager::ConvertToType(CBaseObject* pObject, const QString& typeName
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CObjectManager::SetObjectSelected(CBaseObject* pObject, bool bSelect)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
// Only select/unselect once.
|
||||
if ((pObject->IsSelected() && bSelect) || (!pObject->IsSelected() && !bSelect))
|
||||
{
|
||||
|
||||
@@ -204,7 +204,7 @@ CUndoBaseObjectBulkSelect::CUndoBaseObjectBulkSelect(const AZStd::unordered_set<
|
||||
|
||||
void CUndoBaseObjectBulkSelect::Undo(bool bUndo)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
if (!bUndo)
|
||||
{
|
||||
return;
|
||||
@@ -217,7 +217,7 @@ void CUndoBaseObjectBulkSelect::Undo(bool bUndo)
|
||||
|
||||
void CUndoBaseObjectBulkSelect::Redo()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
AzToolsFramework::ToolsApplicationRequestBus::Broadcast(
|
||||
&AzToolsFramework::ToolsApplicationRequests::MarkEntitiesSelected,
|
||||
@@ -256,7 +256,7 @@ CUndoBaseObjectClearSelection::CUndoBaseObjectClearSelection(const CSelectionGro
|
||||
|
||||
void CUndoBaseObjectClearSelection::Undo(bool bUndo)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
if (!bUndo)
|
||||
{
|
||||
@@ -270,7 +270,7 @@ void CUndoBaseObjectClearSelection::Undo(bool bUndo)
|
||||
|
||||
void CUndoBaseObjectClearSelection::Redo()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
AzToolsFramework::ToolsApplicationRequestBus::Broadcast(
|
||||
&AzToolsFramework::ToolsApplicationRequests::SetSelectedEntities,
|
||||
|
||||
@@ -679,7 +679,7 @@ bool CComponentEntityObject::HitHelperTest(HitContext& hc)
|
||||
|
||||
bool CComponentEntityObject::HitTest(HitContext& hc)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity);
|
||||
AZ_PROFILE_FUNCTION(Entity);
|
||||
|
||||
if (m_iconOnlyHitTest)
|
||||
{
|
||||
@@ -705,7 +705,7 @@ bool CComponentEntityObject::HitTest(HitContext& hc)
|
||||
[&hc, &closestDistance, &rayIntersection, &preciseSelectionRequired, viewportId](
|
||||
AzToolsFramework::EditorComponentSelectionRequests* handler) -> bool
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity);
|
||||
AZ_PROFILE_FUNCTION(Entity);
|
||||
|
||||
if (handler->SupportsEditorRayIntersect())
|
||||
{
|
||||
@@ -768,7 +768,7 @@ bool CComponentEntityObject::HitTest(HitContext& hc)
|
||||
|
||||
void CComponentEntityObject::GetBoundBox(AABB& box)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity);
|
||||
AZ_PROFILE_FUNCTION(Entity);
|
||||
|
||||
box.Reset();
|
||||
|
||||
|
||||
@@ -472,7 +472,7 @@ void SandboxIntegrationManager::EntityParentChanged(
|
||||
const AZ::EntityId newParentId,
|
||||
const AZ::EntityId oldParentId)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
|
||||
if (m_unsavedEntities.find(entityId) != m_unsavedEntities.end())
|
||||
{
|
||||
@@ -646,16 +646,27 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu, con
|
||||
|
||||
QAction* action = nullptr;
|
||||
|
||||
action = menu->addAction(QObject::tr("Create entity"));
|
||||
QObject::connect(action, &QAction::triggered, action, [this] { ContextMenu_NewEntity(); });
|
||||
|
||||
if (selected.size() == 1)
|
||||
// when nothing is selected, entity is created at root level
|
||||
if (selected.size() == 0)
|
||||
{
|
||||
action = menu->addAction(QObject::tr("Create child entity"));
|
||||
QObject::connect(action, &QAction::triggered, action, [selected]
|
||||
{
|
||||
EBUS_EVENT(AzToolsFramework::EditorRequests::Bus, CreateNewEntityAsChild, selected.front());
|
||||
});
|
||||
action = menu->addAction(QObject::tr("Create entity"));
|
||||
QObject::connect(
|
||||
action, &QAction::triggered, action,
|
||||
[this]
|
||||
{
|
||||
ContextMenu_NewEntity();
|
||||
});
|
||||
}
|
||||
// when a single entity is selected, entity is created as its child
|
||||
else if (selected.size() == 1)
|
||||
{
|
||||
action = menu->addAction(QObject::tr("Create entity"));
|
||||
QObject::connect(
|
||||
action, &QAction::triggered, action,
|
||||
[selected]
|
||||
{
|
||||
EBUS_EVENT(AzToolsFramework::EditorRequests::Bus, CreateNewEntityAsChild, selected.front());
|
||||
});
|
||||
}
|
||||
|
||||
bool prefabSystemEnabled = false;
|
||||
@@ -847,7 +858,7 @@ void SandboxIntegrationManager::SetupLayerContextMenu(QMenu* menu)
|
||||
|
||||
void SandboxIntegrationManager::SetupSliceContextMenu(QMenu* menu)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
AzToolsFramework::EntityIdList selectedEntities;
|
||||
GetSelectedOrHighlightedEntities(selectedEntities);
|
||||
|
||||
@@ -949,7 +960,7 @@ void SandboxIntegrationManager::SetupSliceContextMenu(QMenu* menu)
|
||||
|
||||
void SandboxIntegrationManager::SetupSliceContextMenu_Modify(QMenu* menu, const AzToolsFramework::EntityIdList& selectedEntities, [[maybe_unused]] const AZ::u32 numEntitiesInSlices)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
using namespace AzToolsFramework;
|
||||
|
||||
// Gather the set of relevant entities from the selected entities and all descendants
|
||||
@@ -1072,7 +1083,7 @@ void SandboxIntegrationManager::CreateEditorRepresentation(AZ::Entity* entity)
|
||||
|
||||
bool SandboxIntegrationManager::DestroyEditorRepresentation(AZ::EntityId entityId, bool deleteAZEntity)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
|
||||
IEditor* editor = GetIEditor();
|
||||
if (editor->GetObjectManager())
|
||||
@@ -1084,7 +1095,7 @@ bool SandboxIntegrationManager::DestroyEditorRepresentation(AZ::EntityId entityI
|
||||
{
|
||||
static_cast<CComponentEntityObject*>(object)->AssignEntity(nullptr, deleteAZEntity);
|
||||
{
|
||||
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SandboxIntegrationManager::DestroyEditorRepresentation:ObjManagerDeleteObject");
|
||||
AZ_PROFILE_SCOPE(AzToolsFramework, "SandboxIntegrationManager::DestroyEditorRepresentation:ObjManagerDeleteObject");
|
||||
editor->GetObjectManager()->DeleteObject(object);
|
||||
}
|
||||
return true;
|
||||
@@ -1206,7 +1217,7 @@ void SandboxIntegrationManager::ClearRedoStack()
|
||||
|
||||
void SandboxIntegrationManager::CloneSelection(bool& handled)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
|
||||
AzToolsFramework::EntityIdList entities;
|
||||
AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(
|
||||
@@ -1839,7 +1850,7 @@ AZStd::string SandboxIntegrationManager::GetComponentEditorIcon(const AZ::Uuid&
|
||||
AZStd::string SandboxIntegrationManager::GetComponentIconPath(const AZ::Uuid& componentType,
|
||||
AZ::Crc32 componentIconAttrib, AZ::Component* component)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
if (componentIconAttrib != AZ::Edit::Attributes::Icon
|
||||
&& componentIconAttrib != AZ::Edit::Attributes::ViewportIcon
|
||||
&& componentIconAttrib != AZ::Edit::Attributes::HideIcon)
|
||||
|
||||
@@ -1054,7 +1054,7 @@ bool OutlinerListModel::dropMimeDataEntities(const QMimeData* data, Qt::DropActi
|
||||
|
||||
bool OutlinerListModel::CanReparentEntities(const AZ::EntityId& newParentId, const AzToolsFramework::EntityIdList &selectedEntityIds) const
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
if (selectedEntityIds.empty())
|
||||
{
|
||||
return false;
|
||||
@@ -1143,7 +1143,7 @@ bool OutlinerListModel::CanReparentEntities(const AZ::EntityId& newParentId, con
|
||||
|
||||
bool OutlinerListModel::ReparentEntities(const AZ::EntityId& newParentId, const AzToolsFramework::EntityIdList &selectedEntityIds, const AZ::EntityId& beforeEntityId)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
if (!CanReparentEntities(newParentId, selectedEntityIds))
|
||||
{
|
||||
return false;
|
||||
@@ -1233,7 +1233,7 @@ bool OutlinerListModel::ReparentEntities(const AZ::EntityId& newParentId, const
|
||||
|
||||
QMimeData* OutlinerListModel::mimeData(const QModelIndexList& indexes) const
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
AZ::TypeId uuid1 = AZ::AzTypeInfo<AZ::Entity>::Uuid();
|
||||
AZ::TypeId uuid2 = AZ::AzTypeInfo<AzToolsFramework::EditorEntityIdContainer>::Uuid();
|
||||
|
||||
@@ -1323,7 +1323,7 @@ public:
|
||||
|
||||
void OutlinerListModel::ProcessEntityUpdates()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
m_entityChangeQueued = false;
|
||||
if (m_layoutResetQueued)
|
||||
{
|
||||
@@ -1331,7 +1331,7 @@ void OutlinerListModel::ProcessEntityUpdates()
|
||||
}
|
||||
|
||||
{
|
||||
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "OutlinerListModel::ProcessEntityUpdates:ExpandQueue");
|
||||
AZ_PROFILE_SCOPE(Editor, "OutlinerListModel::ProcessEntityUpdates:ExpandQueue");
|
||||
for (auto entityId : m_entityExpandQueue)
|
||||
{
|
||||
emit ExpandEntity(entityId, IsExpanded(entityId));
|
||||
@@ -1340,7 +1340,7 @@ void OutlinerListModel::ProcessEntityUpdates()
|
||||
}
|
||||
|
||||
{
|
||||
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "OutlinerListModel::ProcessEntityUpdates:SelectQueue");
|
||||
AZ_PROFILE_SCOPE(Editor, "OutlinerListModel::ProcessEntityUpdates:SelectQueue");
|
||||
for (auto entityId : m_entitySelectQueue)
|
||||
{
|
||||
emit SelectEntity(entityId, AzToolsFramework::IsSelected(entityId));
|
||||
@@ -1350,7 +1350,7 @@ void OutlinerListModel::ProcessEntityUpdates()
|
||||
|
||||
if (!m_entityChangeQueue.empty())
|
||||
{
|
||||
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "OutlinerListModel::ProcessEntityUpdates:ChangeQueue");
|
||||
AZ_PROFILE_SCOPE(Editor, "OutlinerListModel::ProcessEntityUpdates:ChangeQueue");
|
||||
|
||||
// its faster to just do a bulk data change than to carefully pick out indices
|
||||
// so we'll just merge all ranges into a single range rather than try to make gaps
|
||||
@@ -1383,7 +1383,7 @@ void OutlinerListModel::ProcessEntityUpdates()
|
||||
}
|
||||
|
||||
{
|
||||
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "OutlinerListModel::ProcessEntityUpdates:LayoutChanged");
|
||||
AZ_PROFILE_SCOPE(Editor, "OutlinerListModel::ProcessEntityUpdates:LayoutChanged");
|
||||
if (m_entityLayoutQueued)
|
||||
{
|
||||
emit layoutAboutToBeChanged();
|
||||
@@ -1393,7 +1393,7 @@ void OutlinerListModel::ProcessEntityUpdates()
|
||||
}
|
||||
|
||||
{
|
||||
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "OutlinerListModel::ProcessEntityUpdates:InvalidateFilter");
|
||||
AZ_PROFILE_SCOPE(Editor, "OutlinerListModel::ProcessEntityUpdates:InvalidateFilter");
|
||||
if (m_isFilterDirty)
|
||||
{
|
||||
InvalidateFilter();
|
||||
@@ -1416,7 +1416,7 @@ void OutlinerListModel::OnEntityInfoResetEnd()
|
||||
|
||||
void OutlinerListModel::ProcessEntityInfoResetEnd()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
m_layoutResetQueued = false;
|
||||
m_entityChangeQueued = false;
|
||||
m_entityChangeQueue.clear();
|
||||
@@ -1437,7 +1437,7 @@ void OutlinerListModel::OnEntityInfoUpdatedAddChildBegin(AZ::EntityId parentId,
|
||||
void OutlinerListModel::OnEntityInfoUpdatedAddChildEnd(AZ::EntityId parentId, AZ::EntityId childId)
|
||||
{
|
||||
(void)parentId;
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
endInsertRows();
|
||||
|
||||
//expand ancestors if a new descendant is already selected
|
||||
@@ -1475,7 +1475,7 @@ void OutlinerListModel::OnEntityInfoUpdatedRemoveChildBegin(AZ::EntityId parentI
|
||||
void OutlinerListModel::OnEntityInfoUpdatedRemoveChildEnd(AZ::EntityId parentId, AZ::EntityId childId)
|
||||
{
|
||||
(void)childId;
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
|
||||
endResetModel();
|
||||
|
||||
@@ -1494,7 +1494,7 @@ void OutlinerListModel::OnEntityInfoUpdatedOrderBegin(AZ::EntityId parentId, AZ:
|
||||
|
||||
void OutlinerListModel::OnEntityInfoUpdatedOrderEnd(AZ::EntityId parentId, AZ::EntityId childId, AZ::u64 index)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
(void)index;
|
||||
m_entityLayoutQueued = true;
|
||||
QueueEntityUpdate(parentId);
|
||||
@@ -1565,7 +1565,7 @@ QString OutlinerListModel::GetSliceAssetName(const AZ::EntityId& entityId) const
|
||||
|
||||
QModelIndex OutlinerListModel::GetIndexFromEntity(const AZ::EntityId& entityId, int column) const
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
|
||||
if (entityId.IsValid())
|
||||
{
|
||||
@@ -1727,7 +1727,7 @@ void OutlinerListModel::OnEditorEntityDuplicated(const AZ::EntityId& oldEntity,
|
||||
|
||||
void OutlinerListModel::ExpandAncestors(const AZ::EntityId& entityId)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
//typically to reveal selected entities, expand all parent entities
|
||||
if (entityId.IsValid())
|
||||
{
|
||||
@@ -1932,7 +1932,7 @@ bool OutlinerListModel::HasSelectedDescendant(const AZ::EntityId& entityId) cons
|
||||
|
||||
bool OutlinerListModel::AreAllDescendantsSameLockState(const AZ::EntityId& entityId) const
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
//TODO result can be cached in mutable map and cleared when any descendant changes to avoid recursion in deep hierarchies
|
||||
bool isLocked = false;
|
||||
AzToolsFramework::EditorEntityInfoRequestBus::EventResult(isLocked, entityId, &AzToolsFramework::EditorEntityInfoRequestBus::Events::IsJustThisEntityLocked);
|
||||
@@ -1953,7 +1953,7 @@ bool OutlinerListModel::AreAllDescendantsSameLockState(const AZ::EntityId& entit
|
||||
|
||||
bool OutlinerListModel::AreAllDescendantsSameVisibleState(const AZ::EntityId& entityId) const
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
//TODO result can be cached in mutable map and cleared when any descendant changes to avoid recursion in deep hierarchies
|
||||
|
||||
bool isVisible = AzToolsFramework::IsEntitySetToBeVisible(entityId);
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace
|
||||
|
||||
void SortEntityChildren(AZ::EntityId entityId, const EntityIdCompareFunc& comparer, AzToolsFramework::EntityOrderArray* newEntityOrder = nullptr)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
|
||||
AzToolsFramework::EntityOrderArray entityOrderArray = AzToolsFramework::GetEntityChildOrder(entityId);
|
||||
AZStd::sort(entityOrderArray.begin(), entityOrderArray.end(), comparer);
|
||||
@@ -110,7 +110,7 @@ namespace
|
||||
|
||||
void SortEntityChildrenRecursively(AZ::EntityId entityId, const EntityIdCompareFunc& comparer)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
|
||||
AzToolsFramework::EntityOrderArray entityOrderArray;
|
||||
SortEntityChildren(entityId, comparer, &entityOrderArray);
|
||||
@@ -303,7 +303,7 @@ void OutlinerWidget::OnSelectionChanged(const QItemSelection& selected, const QI
|
||||
return;
|
||||
}
|
||||
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
|
||||
AzToolsFramework::EntityIdList newlySelected;
|
||||
ExtractEntityIdsFromSelection(selected, newlySelected);
|
||||
@@ -450,7 +450,7 @@ void OutlinerWidget::UpdateSelection()
|
||||
{
|
||||
if (m_selectionChangeQueued)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
|
||||
m_selectionChangeInProgress = true;
|
||||
|
||||
@@ -458,7 +458,7 @@ void OutlinerWidget::UpdateSelection()
|
||||
{
|
||||
// Calling Deselect for a large number of items is very slow,
|
||||
// use a single ClearAndSelect call instead.
|
||||
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:ClearAndSelect");
|
||||
AZ_PROFILE_SCOPE(AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:ClearAndSelect");
|
||||
|
||||
AzToolsFramework::EntityIdList selectedEntities;
|
||||
AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(selectedEntities, &AzToolsFramework::ToolsApplicationRequests::Bus::Events::GetSelectedEntities);
|
||||
@@ -469,12 +469,12 @@ void OutlinerWidget::UpdateSelection()
|
||||
else
|
||||
{
|
||||
{
|
||||
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:Deselect");
|
||||
AZ_PROFILE_SCOPE(AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:Deselect");
|
||||
m_gui->m_objectTree->selectionModel()->select(
|
||||
BuildSelectionFromEntities(m_entitiesToDeselect), QItemSelectionModel::Deselect);
|
||||
}
|
||||
{
|
||||
AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:Select");
|
||||
AZ_PROFILE_SCOPE(AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:Select");
|
||||
m_gui->m_objectTree->selectionModel()->select(
|
||||
BuildSelectionFromEntities(m_entitiesToSelect), QItemSelectionModel::Select);
|
||||
}
|
||||
@@ -497,7 +497,7 @@ void OutlinerWidget::UpdateSelection()
|
||||
template <class EntityIdCollection>
|
||||
QItemSelection OutlinerWidget::BuildSelectionFromEntities(const EntityIdCollection& entityIds)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
QItemSelection selection;
|
||||
|
||||
for (const auto& entityId : entityIds)
|
||||
@@ -517,7 +517,7 @@ QItemSelection OutlinerWidget::BuildSelectionFromEntities(const EntityIdCollecti
|
||||
|
||||
void OutlinerWidget::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
bool isDocumentOpen = false;
|
||||
EBUS_EVENT_RESULT(isDocumentOpen, AzToolsFramework::EditorRequests::Bus, IsLevelDocumentOpen);
|
||||
@@ -1272,7 +1272,7 @@ void OutlinerWidget::ExtractEntityIdsFromSelection(const QItemSelection& selecti
|
||||
|
||||
void OutlinerWidget::OnSearchTextChanged(const QString& activeTextFilter)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
AZStd::string filterString = activeTextFilter.toUtf8().data();
|
||||
|
||||
m_listModel->SearchStringChanged(filterString);
|
||||
@@ -1388,7 +1388,7 @@ void OutlinerWidget::QueueContentUpdateSort(const AZ::EntityId& entityId)
|
||||
|
||||
void OutlinerWidget::SortContent()
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
|
||||
m_sortContentQueued = false;
|
||||
|
||||
@@ -1424,7 +1424,7 @@ void OutlinerWidget::OnSortModeChanged(EntityOutliner::DisplaySortMode sortMode)
|
||||
|
||||
if (sortMode != EntityOutliner::DisplaySortMode::Manually)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
AZ_PROFILE_FUNCTION(AzToolsFramework);
|
||||
auto comparer = AZStd::bind(&CompareEntitiesForSorting, AZStd::placeholders::_1, AZStd::placeholders::_2, sortMode);
|
||||
SortEntityChildrenRecursively(AZ::EntityId(), comparer);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ AssetImporterDocument::AssetImporterDocument()
|
||||
|
||||
bool AssetImporterDocument::LoadScene(const AZStd::string& sceneFullPath)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
namespace SceneEvents = AZ::SceneAPI::Events;
|
||||
SceneEvents::SceneSerializationBus::BroadcastResult(m_scene, &SceneEvents::SceneSerializationBus::Events::LoadScene, sceneFullPath, AZ::Uuid::CreateNull());
|
||||
return !!m_scene;
|
||||
|
||||
@@ -45,7 +45,7 @@ AZ::SceneAPI::UI::ManifestWidget* ImporterRootDisplay::GetManifestWidget()
|
||||
|
||||
void ImporterRootDisplay::SetSceneDisplay(const QString& headerText, const AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene>& scene)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
if (!scene)
|
||||
{
|
||||
AZ_Assert(scene, "No scene provided to display.");
|
||||
@@ -62,7 +62,7 @@ void ImporterRootDisplay::SetSceneDisplay(const QString& headerText, const AZStd
|
||||
|
||||
void ImporterRootDisplay::HandleSceneWasReset(const AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene>& scene)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
// Don't accept updates while the widget is being filled in.
|
||||
BusDisconnect();
|
||||
m_manifestWidget->BuildFromScene(scene);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/Debug/Profiler.h>
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
@@ -37,7 +38,7 @@ namespace AZ
|
||||
AZStd::shared_ptr<SceneAPI::Containers::Scene> SceneSerializationHandler::LoadScene(
|
||||
const AZStd::string& filePath, Uuid sceneSourceGuid)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
namespace Utilities = AZ::SceneAPI::Utilities;
|
||||
using AZ::SceneAPI::Events::AssetImportRequest;
|
||||
|
||||
|
||||
@@ -969,7 +969,7 @@ void QtViewport::MakeConstructionPlane(int axis)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
Vec3 QtViewport::MapViewToCP(const QPoint& point, int axis)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
if (axis == AXIS_TERRAIN)
|
||||
{
|
||||
@@ -1336,7 +1336,7 @@ bool QtViewport::GetAdvancedSelectModeFlag()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool QtViewport::MouseCallback(EMouseEvent event, const QPoint& point, Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
AZ_PROFILE_FUNCTION(Editor);
|
||||
|
||||
// Ignore any mouse events in game mode.
|
||||
if (GetIEditor()->IsInGameMode())
|
||||
|
||||
@@ -21,6 +21,7 @@ set(FILES
|
||||
Lib/Tests/test_ViewportTitleDlgPythonBindings.cpp
|
||||
Lib/Tests/test_DisplaySettingsPythonBindings.cpp
|
||||
Lib/Tests/test_ViewportManipulatorController.cpp
|
||||
Lib/Tests/test_ModularViewportCameraController.cpp
|
||||
DisplaySettingsPythonFuncs.cpp
|
||||
DisplaySettingsPythonFuncs.h
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user