Merge branch 'development' into cmake/SPEC-7179
This commit is contained in:
@@ -243,7 +243,7 @@ namespace Editor
|
||||
}
|
||||
|
||||
EditorQtApplication::EditorQtApplication(int& argc, char** argv)
|
||||
: QApplication(argc, argv)
|
||||
: AzQtApplication(argc, argv)
|
||||
, m_inWinEventFilter(false)
|
||||
, m_stylesheet(new AzQtComponents::O3DEStylesheet(this))
|
||||
, m_idleTimer(new QTimer(this))
|
||||
@@ -253,8 +253,6 @@ namespace Editor
|
||||
setWindowIcon(QIcon(":/Application/res/o3de_editor.ico"));
|
||||
|
||||
// set the default key store for our preferences:
|
||||
setOrganizationName("O3DE");
|
||||
setOrganizationDomain("o3de.org");
|
||||
setApplicationName("O3DE Editor");
|
||||
|
||||
connect(m_idleTimer, &QTimer::timeout, this, &EditorQtApplication::maybeProcessIdle);
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QApplication>
|
||||
#include <QAbstractNativeEventFilter>
|
||||
#include <QColor>
|
||||
#include <QMap>
|
||||
@@ -20,6 +19,7 @@
|
||||
#include <AzCore/PlatformDef.h>
|
||||
#include <AzCore/UserSettings/UserSettingsProvider.h>
|
||||
#include <IEditor.h>
|
||||
#include <AzQtComponents/Application/AzQtApplication.h>
|
||||
#endif
|
||||
|
||||
class QFileInfo;
|
||||
@@ -48,7 +48,7 @@ namespace Editor
|
||||
void ScanDirectories(QFileInfoList& directoryList, const QStringList& filters, QFileInfoList& files, ScanDirectoriesUpdateCallBack updateCallback = nullptr);
|
||||
|
||||
class EditorQtApplication
|
||||
: public QApplication
|
||||
: public AzQtComponents::AzQtApplication
|
||||
, public QAbstractNativeEventFilter
|
||||
, public IEditorNotifyListener
|
||||
, public AZ::UserSettingsOwnerRequestBus::Handler
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
AZ_CVAR(
|
||||
bool, ed_visibility_logTiming, false, nullptr, AZ::ConsoleFunctorFlags::Null, "Output the timing of the new IVisibilitySystem query");
|
||||
AZ_CVAR(bool, ed_useNewCameraSystem, true, nullptr, AZ::ConsoleFunctorFlags::Null, "Use the new Editor camera system");
|
||||
AZ_CVAR(bool, ed_showCursorCameraLook, false, nullptr, AZ::ConsoleFunctorFlags::Null, "Show the cursor when using free look with the new camera system");
|
||||
AZ_CVAR(bool, ed_showCursorCameraLook, true, nullptr, AZ::ConsoleFunctorFlags::Null, "Show the cursor when using free look with the new camera system");
|
||||
|
||||
namespace SandboxEditor
|
||||
{
|
||||
|
||||
@@ -130,7 +130,11 @@ namespace AZ
|
||||
//So for each plane, we can test compare the center-to-plane distance to this interval to see which side of the plane the AABB is on.
|
||||
//The AABB is not overlapping if it is fully behind any of the planes, otherwise it is overlapping.
|
||||
const Vector3 center = aabb.GetCenter();
|
||||
const Vector3 extents = 0.5f * aabb.GetExtents();
|
||||
|
||||
//If the AABB contains FLT_MAX at either (or both) extremes, it would be easy to overflow here by using "0.5f * GetExtents()"
|
||||
//or "0.5f * (GetMax() - GetMin())". By separating into two separate multiplies before the subtraction, we can ensure
|
||||
//that we don't overflow.
|
||||
const Vector3 extents = (0.5f * aabb.GetMax()) - (0.5f * aabb.GetMin());
|
||||
|
||||
for (Frustum::PlaneId planeId = Frustum::PlaneId::Near; planeId < Frustum::PlaneId::MAX; ++planeId)
|
||||
{
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace UnitTest
|
||||
AZ::Aabb unitBox = AZ::Aabb::CreateCenterHalfExtents(AZ::Vector3::CreateZero(), AZ::Vector3(1.f, 1.f, 1.f));
|
||||
AZ::Aabb aabb = AZ::Aabb::CreateCenterHalfExtents(AZ::Vector3(10.f, 10.f, 10.f), AZ::Vector3(1.f, 1.f, 1.f));
|
||||
AZ::Aabb aabb1 = AZ::Aabb::CreateCenterHalfExtents(AZ::Vector3(10.f, 10.f, 10.f), AZ::Vector3(100.f, 100.f, 100.f));
|
||||
AZ::Aabb maxSizeAabb = AZ::Aabb::CreateFromMinMax(AZ::Vector3(-AZ::Constants::FloatMax), AZ::Vector3(AZ::Constants::FloatMax));
|
||||
|
||||
AZ::Vector3 point(0.f, 0.f, 0.f);
|
||||
AZ::Vector3 point1(10.f, 10.f, 10.f);
|
||||
@@ -73,6 +74,10 @@ namespace UnitTest
|
||||
EXPECT_TRUE(AZ::ShapeIntersection::Overlaps(frustum, aabb1));
|
||||
EXPECT_TRUE(AZ::ShapeIntersection::Overlaps(sphere1, far_value));
|
||||
|
||||
// Verify that an AABB that covers the max floating point range successfully overlaps with a frustum and doesn't hit any
|
||||
// floating-point math overflows.
|
||||
EXPECT_TRUE(AZ::ShapeIntersection::Overlaps(frustum, maxSizeAabb));
|
||||
|
||||
EXPECT_FALSE(AZ::ShapeIntersection::Overlaps(frustum, aabb));
|
||||
EXPECT_FALSE(AZ::ShapeIntersection::Overlaps(unitSphere, aabb));
|
||||
EXPECT_FALSE(AZ::ShapeIntersection::Overlaps(unitSphere, sphere2));
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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 <AzQtComponents/Application/AzQtApplication.h>
|
||||
|
||||
#include <AzCore/PlatformIncl.h> // This should be the first include to make sure Windows.h is defined with NOMINMAX
|
||||
#include <AzQtComponents/Utilities/QtPluginPaths.h>
|
||||
|
||||
namespace AzQtComponents
|
||||
{
|
||||
|
||||
AzQtApplication::AzQtApplication(int& argc, char** argv)
|
||||
: QApplication(argc, argv)
|
||||
{
|
||||
// Use a common Qt settings path for applications that don't register their own application name
|
||||
QApplication::setOrganizationName("O3DE");
|
||||
QApplication::setOrganizationDomain("o3de.org");
|
||||
QApplication::setApplicationName("O3DE Tools Application");
|
||||
|
||||
AzQtComponents::PrepareQtPaths();
|
||||
|
||||
QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
|
||||
}
|
||||
|
||||
void AzQtApplication::InitializeDpiScaling()
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
|
||||
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
AzQtComponents::Utilities::HandleDpiAwareness(AzQtComponents::Utilities::SystemDpiAware);
|
||||
}
|
||||
} // namespace AzQtComponents
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include <AzQtComponents/Utilities/HandleDpiAwareness.h>
|
||||
|
||||
namespace AzQtComponents
|
||||
{
|
||||
//! Base class for O3DE Tools Applications
|
||||
class AZ_QT_COMPONENTS_API AzQtApplication
|
||||
: public QApplication
|
||||
{
|
||||
public:
|
||||
AzQtApplication(int& argc, char** argv);
|
||||
|
||||
//! Initializes Qt DPI scaling to handle displays with high display densities, such as Retina displays.
|
||||
//! Currently, this uses Qt's system DPI awareness, in which a common device scaling factor will be
|
||||
//! calculated across all attached screens.
|
||||
//! \warning This must be called before this AzQtApplication instance is initialized.
|
||||
static void InitializeDpiScaling();
|
||||
};
|
||||
|
||||
} // namespace AzQtComponents
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
set(FILES
|
||||
AzQtComponentsAPI.h
|
||||
Application/AzQtApplication.cpp
|
||||
Application/AzQtApplication.h
|
||||
Buses/DragAndDrop.h
|
||||
Buses/ShortcutDispatch.h
|
||||
DragAndDrop/MainWindowDragAndDrop.h
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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 <AzToolsFramework/Logger/TraceLogger.h>
|
||||
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
TraceLogger::TraceLogger()
|
||||
{
|
||||
AZ::Debug::TraceMessageBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
TraceLogger::~TraceLogger()
|
||||
{
|
||||
AZ::Debug::TraceMessageBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
bool TraceLogger::OnOutput(const char* window, const char* message)
|
||||
{
|
||||
if (m_logFile)
|
||||
{
|
||||
m_logFile->AppendLog(AzFramework::LogFile::SEV_NORMAL, window, message);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_startupLogSink.push_back({ window, message });
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void TraceLogger::WriteStartupLog(const AZStd::string& logFileName)
|
||||
{
|
||||
using namespace AzFramework;
|
||||
|
||||
AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
|
||||
AZ_Assert(fileIO != nullptr, "FileIO should be running at this point");
|
||||
|
||||
// There is no log system online so we have to create your own log file.
|
||||
char resolveBuffer[AZ_MAX_PATH_LEN] = { 0 };
|
||||
fileIO->ResolvePath("@user@", resolveBuffer, AZ_MAX_PATH_LEN);
|
||||
|
||||
// Note: @log@ hasn't been set at this point
|
||||
AZStd::string logDirectory;
|
||||
StringFunc::Path::Join(resolveBuffer, "log", logDirectory);
|
||||
fileIO->SetAlias("@log@", logDirectory.c_str());
|
||||
|
||||
fileIO->CreatePath("@root@");
|
||||
fileIO->CreatePath("@user@");
|
||||
fileIO->CreatePath("@log@");
|
||||
|
||||
AZStd::string logPath;
|
||||
StringFunc::Path::Join(logDirectory.c_str(), logFileName.c_str(), logPath);
|
||||
|
||||
m_logFile.reset(aznew LogFile(logPath.c_str()));
|
||||
if (m_logFile)
|
||||
{
|
||||
m_logFile->SetMachineReadable(false);
|
||||
for (const LogMessage& message : m_startupLogSink)
|
||||
{
|
||||
m_logFile->AppendLog(LogFile::SEV_NORMAL, message.window.c_str(), message.message.c_str());
|
||||
}
|
||||
m_startupLogSink = {};
|
||||
m_logFile->FlushLog();
|
||||
}
|
||||
}
|
||||
} // namespace AzToolsFramework
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Debug/TraceMessageBus.h>
|
||||
#include <AzFramework/Logging/LogFile.h>
|
||||
#include <AzToolsFramework/API/EditorPythonConsoleBus.h>
|
||||
#include <AzFramework/Asset/AssetSystemBus.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
//! Connects and disconnects TraceMessageBus and allows for logging for O3DE Tools Applications
|
||||
class TraceLogger
|
||||
: public AZ::Debug::TraceMessageBus::Handler
|
||||
{
|
||||
public:
|
||||
TraceLogger();
|
||||
~TraceLogger();
|
||||
|
||||
//! Intalize logging for O3DEToolsApplications
|
||||
void WriteStartupLog(const AZStd::string& logFileName);
|
||||
|
||||
protected:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AZ::Debug::TraceMessageBus::Handler overrides...
|
||||
bool OnOutput(const char* window, const char* message) override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct LogMessage
|
||||
{
|
||||
public:
|
||||
AZStd::string window;
|
||||
AZStd::string message;
|
||||
};
|
||||
AZStd::vector<LogMessage> m_startupLogSink;
|
||||
AZStd::unique_ptr<AzFramework::LogFile> m_logFile;
|
||||
};
|
||||
} // namespace AzToolsFramework
|
||||
@@ -237,7 +237,6 @@ namespace AzToolsFramework
|
||||
|
||||
if (m_containerEntity)
|
||||
{
|
||||
m_instanceEntityMapper->UnregisterEntity(m_containerEntity->GetId());
|
||||
m_containerEntity.reset(aznew AZ::Entity());
|
||||
RegisterEntity(m_containerEntity->GetId(), GenerateEntityAlias());
|
||||
}
|
||||
@@ -265,6 +264,11 @@ namespace AzToolsFramework
|
||||
|
||||
void Instance::ClearEntities()
|
||||
{
|
||||
if (m_containerEntity)
|
||||
{
|
||||
m_instanceEntityMapper->UnregisterEntity(m_containerEntity->GetId());
|
||||
}
|
||||
|
||||
for (const auto&[entityAlias, entity] : m_entities)
|
||||
{
|
||||
if (entity)
|
||||
|
||||
-1
@@ -168,7 +168,6 @@ namespace AzToolsFramework
|
||||
|
||||
if (instance->m_containerEntity)
|
||||
{
|
||||
instance->m_instanceEntityMapper->UnregisterEntity(instance->m_containerEntity->GetId());
|
||||
instance->m_containerEntity.reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -147,6 +147,8 @@ set(FILES
|
||||
Entity/SliceEditorEntityOwnershipServiceBus.h
|
||||
Fingerprinting/TypeFingerprinter.h
|
||||
Fingerprinting/TypeFingerprinter.cpp
|
||||
Logger/TraceLogger.cpp
|
||||
Logger/TraceLogger.h
|
||||
Manipulators/AngularManipulator.cpp
|
||||
Manipulators/AngularManipulator.h
|
||||
Manipulators/BaseManipulator.cpp
|
||||
|
||||
Reference in New Issue
Block a user