Merge branch 'development' into hultonha_LYN-1866_viewport-ui-focus

Signed-off-by: hultonha <hultonha@amazon.co.uk>
This commit is contained in:
hultonha
2021-07-21 14:01:43 +01:00
2255 changed files with 19205 additions and 157541 deletions
@@ -89,15 +89,6 @@ namespace AZ
result.Combine(componentLoadResult);
}
{
JSR::ResultCode dependencyReadyLoadResult =
ContinueLoadingFromJsonObjectField(&entityInstance->m_isDependencyReady,
azrtti_typeid<decltype(entityInstance->m_isDependencyReady)>(),
inputValue, "IsDependencyReady", context);
result.Combine(dependencyReadyLoadResult);
}
{
JSR::ResultCode runtimeActiveLoadResult =
ContinueLoadingFromJsonObjectField(&entityInstance->m_isRuntimeActiveByDefault,
@@ -184,20 +175,6 @@ namespace AZ
result.Combine(resultComponents);
}
{
AZ::ScopedContextPath subPathDependencyReady(context, "m_isDependencyReady");
const bool* dependencyReady = &entityInstance->m_isDependencyReady;
const bool* dependencyReadyDefault =
defaultEntityInstance ? &defaultEntityInstance->m_isDependencyReady : nullptr;
JSR::ResultCode resultDependencyReady =
ContinueStoringToJsonObjectField(outputValue, "IsDependencyReady",
dependencyReady, dependencyReadyDefault,
azrtti_typeid<decltype(entityInstance->m_isDependencyReady)>(), context);
result.Combine(resultDependencyReady);
}
{
AZ::ScopedContextPath subPathRuntimeActive(context, "m_isRuntimeActiveByDefault");
const bool* runtimeActive = &entityInstance->m_isRuntimeActiveByDefault;
+2 -1
View File
@@ -9,11 +9,12 @@
#pragma once
#include <AzCore/base.h>
#include <AzCore/RTTI/TypeInfo.h>
#include <AzCore/Casting/numeric_cast.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/containers/stack.h>
#include <AzCore/std/function/function_fwd.h>
#include <AzCore/std/function/function_template.h>
namespace AZ
{
@@ -14,6 +14,7 @@
#include <AzCore/Math/Transform.h>
#include <AzCore/Math/Plane.h>
#include <AzCore/Math/SimdMath.h>
#include <AzCore/std/containers/array.h>
namespace AZ
{
@@ -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)
{
@@ -13,9 +13,32 @@
#include <AzCore/Math/Obb.h>
#include <AzCore/Math/Vector2.h>
#include <AzCore/Math/MathScriptHelpers.h>
#include <AzCore/Serialization/SerializeContext.h>
namespace AZ
{
namespace
{
class TransformSerializer
: public SerializeContext::IDataSerializer
{
public:
// number of floats in the serialized representation, 4 for rotation, 1 for scale and 3 for translation
static constexpr int NumFloats = 8;
// number of floats in version 1, which used 4 for rotation, 3 for scale and 3 for translation
static constexpr int NumFloatsVersion1 = 10;
// number of floats in version 0, which stored a 3x4 matrix
static constexpr int NumFloatsVersion0 = 12;
size_t Save(const void* classPtr, IO::GenericStream& stream, bool isDataBigEndian) override;
size_t DataToText(IO::GenericStream& in, IO::GenericStream& out, bool isDataBigEndian) override;
size_t TextToData(const char* text, unsigned int textVersion, IO::GenericStream& stream, bool isDataBigEndian) override;
bool Load(void* classPtr, IO::GenericStream& stream, unsigned int version, bool isDataBigEndian) override;
bool CompareValueData(const void* lhs, const void* rhs) override;
};
}
namespace Internal
{
void TransformDefaultConstructor(Transform* thisPtr)
@@ -13,30 +13,9 @@
#include <AzCore/Math/Vector4.h>
#include <AzCore/Math/Quaternion.h>
#include <AzCore/Math/MathUtils.h>
#include <AzCore/Serialization/SerializeContext.h>
namespace AZ
{
class TransformSerializer
: public SerializeContext::IDataSerializer
{
public:
// number of floats in the serialized representation, 4 for rotation, 1 for scale and 3 for translation
static constexpr int NumFloats = 8;
// number of floats in version 1, which used 4 for rotation, 3 for scale and 3 for translation
static constexpr int NumFloatsVersion1 = 10;
// number of floats in version 0, which stored a 3x4 matrix
static constexpr int NumFloatsVersion0 = 12;
size_t Save(const void* classPtr, IO::GenericStream& stream, bool isDataBigEndian) override;
size_t DataToText(IO::GenericStream& in, IO::GenericStream& out, bool isDataBigEndian) override;
size_t TextToData(const char* text, unsigned int textVersion, IO::GenericStream& stream, bool isDataBigEndian) override;
bool Load(void* classPtr, IO::GenericStream& stream, unsigned int version, bool isDataBigEndian) override;
bool CompareValueData(const void* lhs, const void* rhs) override;
};
//! Limits for transform scale values.
//! The scale should not be zero to avoid problems with inverting.
//! @{
@@ -10,7 +10,6 @@
#include <AzCore/Math/Internal/MathTypes.h>
#include <AzCore/RTTI/TypeInfo.h>
#include <AzCore/std/algorithm.h>
namespace AZ
{
@@ -10,6 +10,7 @@
#include <AzCore/std/function/function_base.h>
#include <AzCore/std/function/invoke.h>
#include <AzCore/std/typetraits/remove_cvref.h>
#include <AzCore/std/allocator.h>
#if defined(AZ_COMPILER_MSVC)
# pragma warning( push )
@@ -9,3 +9,16 @@
#pragma once
#include <unistd.h>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
// types like AZ::u64 require an usigned long long, but inttypes.h has it as unsigned long
#undef PRIX64
#undef PRIx64
#undef PRId64
#undef PRIu64
#define PRIX64 "llX"
#define PRIx64 "llx"
#define PRId64 "lld"
#define PRIu64 "llu"
@@ -8,6 +8,7 @@
#pragma once
#include "time_UnixLike.h"
#include <AzCore/std/chrono/clocks.h>
/**
* This file is to be included from the semaphore.h only. It should NOT be included by the user.
@@ -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));
@@ -15,6 +15,11 @@
namespace AZ::IO
{
size_t ArchiveFileIteratorHash::operator()(const AZ::IO::ArchiveFileIterator& iter) const
{
return iter.GetHash();
}
bool AZStdStringLessCaseInsensitive::operator()(AZStd::string_view left, AZStd::string_view right) const
{
// If one or both strings are 0-length, return true if the left side is smaller, false if they're equal or left is larger.
@@ -68,11 +73,21 @@ namespace AZ::IO
return operator++();
}
bool ArchiveFileIterator::operator==(const AZ::IO::ArchiveFileIterator& rhs) const
{
return GetHash() == rhs.GetHash();
}
ArchiveFileIterator::operator bool() const
{
return m_findData && m_lastFetchValid;
}
size_t ArchiveFileIterator::GetHash() const
{
return AZStd::hash<AZ::IO::PathView>{}(m_filename.c_str());
}
void FindData::Scan(IArchive* archive, AZStd::string_view szDir, bool bAllowUseFS, bool bScanZips)
{
// get the priority into local variable to avoid it changing in the course of
@@ -113,14 +128,12 @@ namespace AZ::IO
}
AZ::IO::FileIOBase::GetDirectInstance()->FindFiles(searchDirectory.c_str(), pattern.c_str(), [&](const char* filePath) -> bool
{
AZ::IO::ArchiveFileIterator fileIterator;
fileIterator.m_filename = AZ::IO::PathView(filePath).Filename().Native();
fileIterator.m_fileDesc.nAttrib = {};
AZ::IO::ArchiveFileIterator fileIterator{ nullptr, AZ::IO::PathView(filePath).Filename().Native(), {} };
if (AZ::IO::FileIOBase::GetDirectInstance()->IsDirectory(filePath))
{
fileIterator.m_fileDesc.nAttrib = fileIterator.m_fileDesc.nAttrib | AZ::IO::FileDesc::Attribute::Subdirectory;
m_fileStack.emplace_back(AZStd::move(fileIterator));
m_fileSet.emplace(AZStd::move(fileIterator));
}
else
{
@@ -136,7 +149,7 @@ namespace AZ::IO
// These times are not supported by our file interface
fileIterator.m_fileDesc.tAccess = fileIterator.m_fileDesc.tWrite;
fileIterator.m_fileDesc.tCreate = fileIterator.m_fileDesc.tWrite;
m_fileStack.emplace_back(AZStd::move(fileIterator));
m_fileSet.emplace(AZStd::move(fileIterator));
}
return true;
});
@@ -167,7 +180,7 @@ namespace AZ::IO
fileDesc.nAttrib = AZ::IO::FileDesc::Attribute::ReadOnly | AZ::IO::FileDesc::Attribute::Archive;
fileDesc.nSize = fileEntry->desc.lSizeUncompressed;
fileDesc.tWrite = fileEntry->GetModificationTime();
m_fileStack.emplace_back(AZ::IO::ArchiveFileIterator{ this, fname, fileDesc });
m_fileSet.emplace(AZ::IO::ArchiveFileIterator{ this, fname, fileDesc });
}
ZipDir::FindDir findDirectoryEntry(zipCache);
@@ -180,7 +193,7 @@ namespace AZ::IO
}
AZ::IO::FileDesc fileDesc;
fileDesc.nAttrib = AZ::IO::FileDesc::Attribute::ReadOnly | AZ::IO::FileDesc::Attribute::Archive | AZ::IO::FileDesc::Attribute::Subdirectory;
m_fileStack.emplace_back(AZ::IO::ArchiveFileIterator{ this, fname, fileDesc });
m_fileSet.emplace(AZ::IO::ArchiveFileIterator{ this, fname, fileDesc });
}
};
@@ -249,7 +262,7 @@ namespace AZ::IO
if (!bindRootIter->empty() && AZStd::wildcard_match(sourcePathRemainder.Native(), bindRootIter->Native()))
{
AZ::IO::FileDesc fileDesc{ AZ::IO::FileDesc::Attribute::ReadOnly | AZ::IO::FileDesc::Attribute::Archive | AZ::IO::FileDesc::Attribute::Subdirectory };
m_fileStack.emplace_back(AZ::IO::ArchiveFileIterator{ this, bindRootIter->Native(), fileDesc });
m_fileSet.emplace(AZ::IO::ArchiveFileIterator{ this, bindRootIter->Native(), fileDesc });
}
}
else
@@ -265,7 +278,7 @@ namespace AZ::IO
AZ::IO::ArchiveFileIterator FindData::Fetch()
{
if (m_fileStack.empty())
if (m_fileSet.empty())
{
AZ::IO::ArchiveFileIterator emptyFileIterator;
emptyFileIterator.m_lastFetchValid = false;
@@ -274,10 +287,10 @@ namespace AZ::IO
}
// Remove Fetched item from the FindData map so that the iteration continues
AZ::IO::ArchiveFileIterator fileIterator{ m_fileStack.back() };
AZ::IO::ArchiveFileIterator fileIterator{ *m_fileSet.begin() };
fileIterator.m_lastFetchValid = true;
fileIterator.m_findData = this;
m_fileStack.pop_back();
m_fileSet.erase(m_fileSet.begin());
return fileIterator;
}
}
@@ -8,6 +8,7 @@
#pragma once
#include <AzCore/std/containers/unordered_set.h>
#include <AzCore/std/smart_ptr/intrusive_base.h>
#include <AzCore/std/string/fixed_string.h>
@@ -44,8 +45,12 @@ namespace AZ::IO
ArchiveFileIterator operator++();
ArchiveFileIterator operator++(int);
bool operator==(const AZ::IO::ArchiveFileIterator& rhs) const;
explicit operator bool() const;
size_t GetHash() const;
inline static constexpr size_t FilenameMaxLength = 256;
AZStd::fixed_string<FilenameMaxLength> m_filename;
FileDesc m_fileDesc;
@@ -56,6 +61,11 @@ namespace AZ::IO
bool m_lastFetchValid{};
};
struct ArchiveFileIteratorHash
{
size_t operator()(const AZ::IO::ArchiveFileIterator& iter) const;
};
struct AZStdStringLessCaseInsensitive
{
bool operator()(AZStd::string_view left, AZStd::string_view right) const;
@@ -75,7 +85,7 @@ namespace AZ::IO
void ScanFS(IArchive* archive, AZStd::string_view path);
void ScanZips(IArchive* archive, AZStd::string_view path);
using FileStack = AZStd::vector<ArchiveFileIterator>;
FileStack m_fileStack;
using FileSet = AZStd::unordered_set<ArchiveFileIterator, ArchiveFileIteratorHash>;
FileSet m_fileSet;
};
}
@@ -67,6 +67,17 @@ namespace AzPhysics
}
}
// class for exposing free functions to script
class SceneQueries
{
public:
AZ_TYPE_INFO(SceneQueries, "{4EFA3DA5-C0E3-4753-8C55-202228CA527E}");
AZ_CLASS_ALLOCATOR(SceneQueries, AZ::SystemAllocator, 0);
SceneQueries() = default;
~SceneQueries() = default;
};
/*static*/ void SceneQueryRequest::Reflect(AZ::ReflectContext* context)
{
if (auto* serializeContext = azdynamic_cast<AZ::SerializeContext*>(context))
@@ -96,6 +107,7 @@ namespace AzPhysics
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "physics")
->Attribute(AZ::Script::Attributes::Category, "PhysX")
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
->Property("Collision", BehaviorValueProperty(&SceneQueryRequest::m_collisionGroup))
// Until enum class support for behavior context is done, expose this as an int
->Property("QueryType", [](const SceneQueryRequest& self) { return static_cast<int>(self.m_queryType); },
@@ -134,11 +146,28 @@ namespace AzPhysics
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "physics")
->Attribute(AZ::Script::Attributes::Category, "PhysX")
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
->Property("Distance", BehaviorValueProperty(&RayCastRequest::m_distance))
->Property("Start", BehaviorValueProperty(&RayCastRequest::m_start))
->Property("Direction", BehaviorValueProperty(&RayCastRequest::m_direction))
->Property("ReportMultipleHits", BehaviorValueProperty(&RayCastRequest::m_reportMultipleHits))
;
behaviorContext->Class<SceneQueries>("SceneQueries")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "physics")
->Attribute(AZ::Script::Attributes::Category, "PhysX")
->Method(
"CreateRayCastRequest",
[](const AZ::Vector3& start, const AZ::Vector3& direction, float distance, const AZStd::string& collisionGroup)
{
RayCastRequest request;
request.m_start = start;
request.m_direction = direction;
request.m_distance = distance;
request.m_collisionGroup = CollisionGroup(collisionGroup);
return request;
});
}
}
@@ -162,6 +191,7 @@ namespace AzPhysics
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "physics")
->Attribute(AZ::Script::Attributes::Category, "PhysX")
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
->Property("Distance", BehaviorValueProperty(&ShapeCastRequest::m_distance))
->Property("Start", BehaviorValueProperty(&ShapeCastRequest::m_start))
->Property("Direction", BehaviorValueProperty(&ShapeCastRequest::m_direction))
@@ -175,7 +205,6 @@ namespace AzPhysics
return ShapeCastRequestHelpers::CreateSphereCastRequest(
radius, startPose, direction, distance, queryType, collisionGroup, nullptr);
});
behaviorContext->Method(
"CreateBoxCastRequest",
[](const AZ::Vector3& boxDimensions, const AZ::Transform& startPose, const AZ::Vector3& direction, float distance,
@@ -184,7 +213,6 @@ namespace AzPhysics
return ShapeCastRequestHelpers::CreateBoxCastRequest(
boxDimensions, startPose, direction, distance, queryType, collisionGroup, nullptr);
});
behaviorContext->Method(
"CreateCapsuleCastRequest",
[](float capsuleRadius, float capsuleHeight, const AZ::Transform& startPose, const AZ::Vector3& direction, float distance,
@@ -267,6 +295,7 @@ namespace AzPhysics
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "physics")
->Attribute(AZ::Script::Attributes::Category, "PhysX")
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
->Property("Pose", BehaviorValueProperty(&OverlapRequest::m_pose))
;
@@ -349,6 +378,7 @@ namespace AzPhysics
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "physics")
->Attribute(AZ::Script::Attributes::Category, "PhysX")
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
->Property("Distance", BehaviorValueProperty(&SceneQueryHit::m_distance))
->Property("Position", BehaviorValueProperty(&SceneQueryHit::m_position))
->Property("Normal", BehaviorValueProperty(&SceneQueryHit::m_normal))
@@ -7,6 +7,7 @@
*/
#pragma once
#include <AzCore/Component/EntityId.h>
#include <AzCore/Math/Transform.h>
#include <AzCore/Math/Vector3.h>
#include <AzCore/Memory/Memory.h>
@@ -13,6 +13,9 @@
namespace Physics
{
class ShapeConfiguration;
class MaterialSelection;
/// Listens to requests for physics materials.
class PhysicsMaterialRequests
: public AZ::EBusTraits
@@ -51,7 +51,10 @@ namespace AzPhysics
->Method("GetOnPostsimulateEvent", getOnPostsimulateEvent)
->Attribute(AZ::Script::Attributes::AzEventDescription, postsimulateEventDescription)
->Method("GetSceneHandle", &SystemInterface::GetSceneHandle)
->Method("GetScene", &SystemInterface::GetScene);
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
->Method("GetScene", &SystemInterface::GetScene)
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
;
behaviorContext->Method(
"GetPhysicsSystem",
@@ -7,6 +7,8 @@
*/
#pragma once
#include <AzCore/std/containers/stack.h>
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
namespace UnitTest
@@ -8,6 +8,7 @@
#include <AzFramework/Visibility/OctreeSystemComponent.h>
#include <AzCore/Math/ShapeIntersection.h>
#include <AzCore/Serialization/SerializeContext.h>
namespace AzFramework
{
@@ -9,7 +9,12 @@
#pragma once
#include <AzCore/base.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/std/string/string.h>
namespace AZ
{
class ReflectContext;
} // namespace Az
////////////////////////////////////////////////////////////////////////////////////////////////////
namespace AzFramework
@@ -6,6 +6,7 @@
*
*/
#include <AzCore/Console/IConsole.h>
#include <AzCore/PlatformIncl.h>
#include <AzCore/IO/Path/Path.h>
#include <AzCore/IO/SystemFile.h>
@@ -13,6 +14,9 @@
#include <Psapi.h>
AZ_CVAR(bool, ap_tether_lifetime, false, nullptr, AZ::ConsoleFunctorFlags::Null,
"If enabled, a parent process that launches the AP will terminate the AP on exit");
namespace AzFramework::AssetSystem::Platform
{
void AllowAssetProcessorToForeground()
@@ -100,6 +104,21 @@ namespace AzFramework::AssetSystem::Platform
fullLaunchCommand += '"';
}
// Create or retrieve the job handle associated with the asset processor
HANDLE apJob = nullptr;
if (ap_tether_lifetime)
{
apJob = ::CreateJobObjectA(nullptr, "AssetProcessorJob");
if (apJob && GetLastError() != ERROR_ALREADY_EXISTS)
{
// We're creating the job for the first time. Configure it to close child processes when this process exits.
JOBOBJECT_EXTENDED_LIMIT_INFORMATION info = {};
info.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
::SetInformationJobObject(apJob, JobObjectExtendedLimitInformation, &info, sizeof(info));
}
}
STARTUPINFO si;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
@@ -107,6 +126,14 @@ namespace AzFramework::AssetSystem::Platform
si.wShowWindow = SW_MINIMIZE;
PROCESS_INFORMATION pi;
return ::CreateProcessA(nullptr, fullLaunchCommand.data(), nullptr, nullptr, FALSE, 0, nullptr, AZ::IO::FixedMaxPathString{ executableDirectory }.c_str(), &si, &pi) != 0;
bool createResult = ::CreateProcessA(nullptr, fullLaunchCommand.data(), nullptr, nullptr, FALSE, 0, nullptr, AZ::IO::FixedMaxPathString{ executableDirectory }.c_str(), &si, &pi) != 0;
if (ap_tether_lifetime && apJob && createResult)
{
// Save process and thread handle to terminate AP when the parent process exits
::AssignProcessToJobObject(apJob, pi.hProcess);
}
return createResult;
}
}
@@ -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
@@ -5,10 +5,8 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <stdlib.h>
#include <windows.h>
#include <sysinfoapi.h>
#include <fileapi.h>
#include <AzCore/PlatformIncl.h>
#include <AzCore/IO/Path/Path.h>
#include <AzCore/std/functional.h>
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzToolsFramework/Asset/AssetProcessorMessages.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Component/ComponentApplicationBus.h>
@@ -6,8 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzCore/IO/FileIO.h>
#include <AzFramework/Asset/AssetProcessorMessages.h>
@@ -17,6 +17,9 @@ class QString;
namespace AzToolsFramework::AssetUtils
{
static constexpr const char* AssetImporterSettingsKey{ "/O3DE/SceneAPI/AssetImporter" };
static constexpr const char* AssetImporterSupportedFileTypeKey{ "SupportedFileTypeExtensions" };
//! Reads the "/Amazon/AssetProcessor/Settings/Platforms" entry from the settings registry
//! to retrieve all enabled platforms
void ReadEnabledPlatformsFromSettingsRegistry(AZ::SettingsRegistryInterface& settingsRegistry,
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzToolsFramework/AssetBrowser/AssetSelectionModel.h>
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
@@ -210,12 +210,12 @@ namespace AzToolsFramework
const AZStd::string& AssetBrowserEntry::GetRelativePath() const
{
return m_relativePath;
return m_relativePath.Native();
}
const AZStd::string& AssetBrowserEntry::GetFullPath() const
{
return m_fullPath;
return m_fullPath.Native();
}
const AssetBrowserEntry* AssetBrowserEntry::GetChild(int index) const
@@ -10,6 +10,7 @@
#if !defined(Q_MOC_RUN)
#include <AzCore/std/string/string.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/IO/Path/Path.h>
#include <AzCore/Math/Uuid.h>
#include <AzToolsFramework/Thumbnails/Thumbnail.h>
@@ -133,8 +134,8 @@ namespace AzToolsFramework
AZStd::string m_name;
QString m_displayName;
QString m_displayPath;
AZStd::string m_relativePath;
AZStd::string m_fullPath;
AZ::IO::Path m_relativePath;
AZ::IO::Path m_fullPath;
AZStd::vector<AssetBrowserEntry*> m_children;
AssetBrowserEntry* m_parentAssetEntry = nullptr;
@@ -38,9 +38,9 @@ namespace AzToolsFramework
void FolderAssetBrowserEntry::UpdateChildPaths(AssetBrowserEntry* child) const
{
child->m_relativePath = m_relativePath + AZ_CORRECT_DATABASE_SEPARATOR + child->m_name;
child->m_relativePath = m_relativePath / child->m_name;
child->m_displayPath = QString::fromUtf8(child->m_relativePath.c_str());
child->m_fullPath = m_fullPath + AZ_CORRECT_DATABASE_SEPARATOR + child->m_name;
child->m_fullPath = m_fullPath / child->m_name;
AssetBrowserEntry::UpdateChildPaths(child);
}
@@ -11,6 +11,7 @@
#include <AzFramework/StringFunc/StringFunc.h>
#include <AzCore/IO/FileIO.h>
#include <AzCore/IO/Path/Path.h>
#include <AzToolsFramework/AssetBrowser/Entries/RootAssetBrowserEntry.h>
#include <AzToolsFramework/AssetBrowser/Entries/FolderAssetBrowserEntry.h>
@@ -25,8 +26,6 @@ namespace AzToolsFramework
{
namespace AssetBrowser
{
const char* GEMS_FOLDER_NAME = "Gems";
RootAssetBrowserEntry::RootAssetBrowserEntry()
: AssetBrowserEntry()
{
@@ -54,13 +53,7 @@ namespace AzToolsFramework
EntryCache::GetInstance()->Clear();
m_enginePath = enginePath;
// there is no "Gems" scan folder registered in db, create one manually
auto gemFolder = aznew FolderAssetBrowserEntry();
gemFolder->m_name = m_enginePath + AZ_CORRECT_DATABASE_SEPARATOR + GEMS_FOLDER_NAME;
gemFolder->m_displayName = GEMS_FOLDER_NAME;
gemFolder->m_isGemsFolder = true;
AddChild(gemFolder);
m_fullPath = enginePath;
}
bool RootAssetBrowserEntry::IsInitialUpdate() const
@@ -81,8 +74,17 @@ namespace AzToolsFramework
if (AZ::IO::FileIOBase::GetInstance()->IsDirectory(scanFolderDatabaseEntry.m_scanFolder.c_str()))
{
const auto scanFolder = CreateFolders(scanFolderDatabaseEntry.m_scanFolder.c_str(), this);
scanFolder->m_displayName = QString::fromUtf8(scanFolderDatabaseEntry.m_displayName.c_str());
const auto scanFolder = CreateFolders(scanFolderDatabaseEntry.m_scanFolder, this);
// Append an "[External]" to the display if the Scan Folder is NOT relative to the Engine Root path
if (!AZ::IO::PathView(scanFolderDatabaseEntry.m_scanFolder).IsRelativeTo(m_enginePath))
{
scanFolder->m_displayName += " [External]";
}
else
{
scanFolder->m_displayName = QString::fromUtf8(scanFolderDatabaseEntry.m_displayName.c_str());
}
EntryCache::GetInstance()->m_scanFolderIdMap[scanFolderDatabaseEntry.m_scanFolderID] = scanFolder;
}
}
@@ -122,38 +124,34 @@ namespace AzToolsFramework
return;
}
const char* filePath = fileDatabaseEntry.m_fileName.c_str();
AZ::IO::FixedMaxPath absoluteFilePath = AZ::IO::FixedMaxPath(AZStd::string_view{ scanFolder->GetFullPath() })
/ fileDatabaseEntry.m_fileName.c_str();
AssetBrowserEntry* file;
// file can be either folder or actual file
if (fileDatabaseEntry.m_isFolder)
{
file = CreateFolders(filePath, scanFolder);
file = CreateFolders(absoluteFilePath.Native(), scanFolder);
}
else
{
AZStd::string sourcePath;
AZStd::string sourceName;
AZStd::string sourceExtension;
StringFunc::Path::Split(filePath, nullptr, &sourcePath, &sourceName, &sourceExtension);
// if missing create folders leading to file's location and get immediate parent
// (we don't need to have fileIds for any folders created yet, they will be added later)
auto parent = CreateFolders(sourcePath.c_str(), scanFolder);
auto parent = CreateFolders(absoluteFilePath.ParentPath().Native(), scanFolder);
// for simplicity in AB, files are represented as sources, but they are missing SourceDatabaseEntry-specific information such as SourceUuid
auto source = aznew SourceAssetBrowserEntry();
source->m_name = (sourceName + sourceExtension).c_str();
source->m_name = absoluteFilePath.Filename().Native();
source->m_fileId = fileDatabaseEntry.m_fileID;
source->m_displayName = QString::fromUtf8(source->m_name.c_str());
source->m_scanFolderId = fileDatabaseEntry.m_scanFolderPK;
source->m_extension = sourceExtension.c_str();
source->m_extension = absoluteFilePath.Extension().Native();
parent->AddChild(source);
file = source;
}
EntryCache::GetInstance()->m_fileIdMap[fileDatabaseEntry.m_fileID] = file;
AZStd::string fullPath = file->m_fullPath;
AzFramework::StringFunc::Path::Normalize(fullPath);
EntryCache::GetInstance()->m_absolutePathToFileId[fullPath] = fileDatabaseEntry.m_fileID;
AZStd::string filePath = AZ::IO::PathView(file->m_fullPath).LexicallyNormal().String();
EntryCache::GetInstance()->m_absolutePathToFileId[filePath] = fileDatabaseEntry.m_fileID;
}
bool RootAssetBrowserEntry::RemoveFile(const AZ::s64& fileId) const
@@ -309,116 +307,95 @@ namespace AzToolsFramework
}
}
FolderAssetBrowserEntry* RootAssetBrowserEntry::CreateFolder(const char* folderName, AssetBrowserEntry* parent)
AssetBrowserEntry* RootAssetBrowserEntry::GetNearestAncestor(AZ::IO::PathView absolutePathView, AssetBrowserEntry* parent,
AZStd::unordered_set<AssetBrowserEntry*>& visitedSet)
{
auto IsPathRelativeToEntry = [absolutePathView](AssetBrowserEntry* assetBrowserEntry)
{
auto& childPath = assetBrowserEntry->m_fullPath;
return absolutePathView.IsRelativeTo(AZ::IO::PathView(childPath));
};
if (visitedSet.contains(parent))
{
return {};
}
visitedSet.insert(parent);
AssetBrowserEntry* nearestAncestor{};
for (AssetBrowserEntry* childBrowserEntry : parent->m_children)
{
if (IsPathRelativeToEntry(childBrowserEntry))
{
// Walk the AssetBrowserEntry Tree looking for a nearer ancestor to the absolute path
// If one is not found in the recursive call to GetNearestAncestor, then the childBrowserEntry
// is the current best candidate
AssetBrowserEntry* candidateAncestor = GetNearestAncestor(absolutePathView, childBrowserEntry, visitedSet);
candidateAncestor = candidateAncestor != nullptr ? candidateAncestor : childBrowserEntry;
AZ::IO::PathView candidatePathView(candidateAncestor->m_fullPath);
// If the candidate is relative to the current nearest ancestor, then it is even nearer to the path
if (!nearestAncestor || candidatePathView.IsRelativeTo(nearestAncestor->m_fullPath))
{
nearestAncestor = candidateAncestor;
// If the full path compares equal to the AssetBrowserEntry path, then no need to proceed any further
if (AZ::IO::PathView(nearestAncestor->m_fullPath) == absolutePathView)
{
break;
}
}
}
}
return nearestAncestor;
}
FolderAssetBrowserEntry* RootAssetBrowserEntry::CreateFolder(AZStd::string_view folderName, AssetBrowserEntry* parent)
{
auto it = AZStd::find_if(parent->m_children.begin(), parent->m_children.end(), [folderName](AssetBrowserEntry* entry)
{
if (!azrtti_istypeof<FolderAssetBrowserEntry*>(entry))
{
return false;
}
return AzFramework::StringFunc::Equal(entry->m_name.c_str(), folderName);
});
{
if (!azrtti_istypeof<FolderAssetBrowserEntry*>(entry))
{
return false;
}
return AZ::IO::PathView(entry->m_name) == AZ::IO::PathView(folderName);
});
if (it != parent->m_children.end())
{
return azrtti_cast<FolderAssetBrowserEntry*>(*it);
}
const auto folder = aznew FolderAssetBrowserEntry();
folder->m_name = folderName;
folder->m_displayName = folderName;
folder->m_displayName = QString::fromUtf8(folderName.data(), aznumeric_caster(folderName.size()));
parent->AddChild(folder);
return folder;
}
AssetBrowserEntry* RootAssetBrowserEntry::CreateFolders(const char* relativePath, AssetBrowserEntry* parent)
AssetBrowserEntry* RootAssetBrowserEntry::CreateFolders(AZStd::string_view absolutePath, AssetBrowserEntry* parent)
{
auto children(parent->m_children);
int n = 0;
AZ::IO::PathView absolutePathView(absolutePath);
// Find the nearest ancestor path to the absolutePath
AZStd::unordered_set<AssetBrowserEntry*> visitedSet;
// check if folder with the same name already exists
// step through every character in relativePath and compare to each child's relative path of suggested parent
// if a character @n in child's rel path mismatches character at n in relativePath, remove that child from further search
while (!children.empty() && relativePath[n])
if (AssetBrowserEntry* nearestAncestor = GetNearestAncestor(absolutePathView, parent, visitedSet);
nearestAncestor != nullptr)
{
AZStd::vector<AssetBrowserEntry*> toRemove;
for (auto child : children)
{
auto& childPath = azrtti_istypeof<RootAssetBrowserEntry*>(parent) ? child->m_fullPath : child->m_relativePath;
// child's path mismatched, remove it from search candidates
if (childPath.length() == n || childPath[n] != relativePath[n])
{
toRemove.push_back(child);
// it is possible that child may be a closer parent, substitute it as new potential parent
// e.g. child->m_relativePath = 'Gems', relativePath = 'Gems/Assets', old parent = root, new parent = Gems
if (childPath.length() == n && relativePath[n] == AZ_CORRECT_DATABASE_SEPARATOR)
{
parent = child;
relativePath += n; // advance relative path n characters since the parent has changed
n = 0; // Once the relative path pointer is advanced, reset n
}
}
}
for (auto entry : toRemove)
{
children.erase(AZStd::remove(children.begin(), children.end(), entry), children.end());
}
n++;
parent = nearestAncestor;
}
// filter out the remaining children that don't end with '/' or '\0'
// for example if folderName = "foo", while children may still remain with names like "foo123",
// which is not the same folder
AZStd::vector<AssetBrowserEntry*> toRemove;
for (auto child : children)
// If the nearest ancestor is the absolutePath, then it is already crated
if (absolutePathView == AZ::IO::PathView(parent->GetFullPath()))
{
auto& childPath = azrtti_istypeof<RootAssetBrowserEntry*>(parent) ? child->m_fullPath : child->m_relativePath;
// check if there are non-null characters remaining @n
if (childPath.length() > n)
{
toRemove.push_back(child);
}
}
for (auto entry : toRemove)
{
children.erase(AZStd::remove(children.begin(), children.end(), entry), children.end());
return parent;
}
// at least one child remains, this means the folder with this name already exists, return it
if (!children.empty())
// create all missing folders
auto proximateToPath = absolutePathView.IsRelativeTo(parent->m_fullPath)
? absolutePathView.LexicallyProximate(parent->m_fullPath)
: AZ::IO::FixedMaxPath(absolutePathView);
for (AZ::IO::FixedMaxPath scanFolderSegment : proximateToPath)
{
parent = children.front();
}
// if it's a scanfolder, then do not create folders leading to it
// e.g. instead of 'C:\dev\SampleProject' just create 'SampleProject'
else if (parent->GetEntryType() == AssetEntryType::Root)
{
AZStd::string folderName;
AzFramework::StringFunc::Path::Split(relativePath, nullptr, nullptr, &folderName);
parent = CreateFolder(folderName.c_str(), parent);
parent->m_fullPath = relativePath;
}
// otherwise create all missing folders
else
{
n = 0;
AZStd::string folderName(strlen(relativePath) + 1, '\0');
// iterate through relativePath until the first '/'
while (relativePath[n] && relativePath[n] != AZ_CORRECT_DATABASE_SEPARATOR)
{
folderName[n] = relativePath[n];
n++;
}
if (n > 0)
{
parent = CreateFolder(folderName.c_str(), parent);
}
// n+1 also skips the '/' character
if (relativePath[n] && relativePath[n + 1])
{
parent = CreateFolders(relativePath + n + 1, parent);
}
parent = CreateFolder(scanFolderSegment.c_str(), parent);
}
return parent;
}
@@ -9,6 +9,7 @@
#include <AzCore/std/string/string.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/IO/Path/Path.h>
#include <AzCore/Math/Uuid.h>
#include <AzToolsFramework/AssetBrowser/Entries/AssetBrowserEntry.h>
@@ -78,12 +79,15 @@ namespace AzToolsFramework
private:
AZ_DISABLE_COPY_MOVE(RootAssetBrowserEntry);
AZStd::string m_enginePath;
AZ::IO::Path m_enginePath;
//! Create folder entry child
FolderAssetBrowserEntry* CreateFolder(const char* folderName, AssetBrowserEntry* parent);
//! Recursively create folder structure leading to relative path from parent
AssetBrowserEntry* CreateFolders(const char* relativePath, AssetBrowserEntry* parent);
FolderAssetBrowserEntry* CreateFolder(AZStd::string_view folderName, AssetBrowserEntry* parent);
//! Recursively create folder structure leading to path from parent
AssetBrowserEntry* CreateFolders(AZStd::string_view absolutePath, AssetBrowserEntry* parent);
// Retrieves the nearest ancestor AssetBrowserEntry from the absolutePath
static AssetBrowserEntry* GetNearestAncestor(AZ::IO::PathView absolutePath, AssetBrowserEntry* parent,
AZStd::unordered_set<AssetBrowserEntry*>& visitedSet);
bool m_isInitialUpdate = false;
};
@@ -27,9 +27,7 @@ namespace AzToolsFramework
if (EntryCache* cache = EntryCache::GetInstance())
{
cache->m_fileIdMap.erase(m_fileId);
AZStd::string fullPath = m_fullPath;
AzFramework::StringFunc::Path::Normalize(fullPath);
cache->m_absolutePathToFileId.erase(fullPath);
cache->m_absolutePathToFileId.erase(m_fullPath.LexicallyNormal().Native());
if (m_sourceId != -1)
{
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzToolsFramework/AssetDatabase/AssetDatabaseConnection.h>
#include <sqlite3.h>
@@ -11,6 +11,7 @@
#include <AzCore/UserSettings/UserSettings.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/std/containers/unordered_map.h>
#include <AzCore/Serialization/SerializeContext.h>
namespace AZ { namespace Data { class AssetData; } }
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "AssetEditorHeader.h"
@@ -9,6 +9,7 @@
#include <AzQtComponents/AzQtComponentsAPI.h>
#include <AzQtComponents/Components/Widgets/ElidingLabel.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <QWidget>
#include <QTimer>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "AssetEditorWidget.h"
@@ -1,29 +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
*
*/
#pragma once
#include <AzCore/Memory/Memory.h>
#include <AzCore/Component/Component.h>
// QT
AZ_PUSH_DISABLE_WARNING(4127, "-Wunknown-warning-option") // conditional expression is constant
#include <QtWidgets/QWidget>
AZ_POP_DISABLE_WARNING
#include <QtCore/QEvent>
#include <QtWidgets/QLabel>
#include <QtWidgets/QApplication>
#include <QtWidgets/QScrollArea>
#if defined(AZ_PLATFORM_APPLE_OSX) || defined(AZ_PLATFORM_LINUX)
typedef void* HWND;
typedef void* HMODULE;
typedef quint32 DWORD;
#define _MAX_PATH 260
#define MAX_PATH 260
#endif
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "BaseSliceCommand.h"
#include <AzToolsFramework/Entity/SliceEditorEntityOwnershipServiceBus.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "CreateSliceCommand.h"
#include <AzCore/Asset/AssetManager.h>
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include "DetachSubSliceInstanceCommand.h"
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "EntityStateCommand.h"
#include <AzCore/Component/Entity.h>
#include <AzCore/Component/ComponentApplicationBus.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#if 0
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzCore/Component/ComponentApplicationBus.h>
#include <AzCore/Debug/Profiler.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "PushToSliceCommand.h"
#include <AzCore/Component/TransformBus.h>
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include "SelectionCommand.h"
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include "SliceDetachEntityCommand.h"
namespace AzToolsFramework
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzToolsFramework/Entity/EditorEntityContextComponent.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzCore/RTTI/RTTI.h>
#include <AzToolsFramework/Entity/EditorEntityFixupComponent.h>
#include <AzToolsFramework/ToolsComponents/GenericComponentWrapper.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "EditorEntityModel.h"
#include "EditorEntitySortBus.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
@@ -8,6 +8,7 @@
#pragma once
#include <AzCore/Math/Transform.h>
#include <AzCore/Memory/SystemAllocator.h>
namespace AZ
{
@@ -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)
@@ -168,7 +168,6 @@ namespace AzToolsFramework
if (instance->m_containerEntity)
{
instance->m_instanceEntityMapper->UnregisterEntity(instance->m_containerEntity->GetId());
instance->m_containerEntity.reset();
}
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "SliceDataFlagsCommand.h"
#include <AzToolsFramework/Entity/EditorEntityHelpers.h>
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzCore/Component/Entity.h>
#include <AzCore/Slice/SliceMetadataInfoBus.h>
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzFramework/IO/FileOperations.h>
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzCore/Asset/AssetManager.h>
#include <AzCore/Debug/Profiler.h>
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzCore/Component/ComponentApplication.h>
#include <AzCore/Component/EntityUtils.h>
#include <AzCore/IO/FileIO.h>
@@ -62,6 +61,7 @@
#include <AzToolsFramework/Slice/SliceMetadataEntityContextBus.h>
AZ_PUSH_DISABLE_WARNING(4251 4244, "-Wunknown-warning-option") // 4251: class '...' needs to have dll-interface to be used by clients of class '...'
// 4244: 'argument': conversion from 'int' to 'float', possible loss of data
#include <QtWidgets/QApplication>
#include <QtWidgets/QWidget>
#include <QtWidgets/QWidgetAction>
#include <QtWidgets/QMenu>
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzToolsFramework/SourceControl/LocalFileSCComponent.h>
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzToolsFramework/SourceControl/PerforceComponent.h>
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzToolsFramework/SourceControl/PerforceConnection.h>
#include <AzFramework/Process/ProcessWatcher.h>
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzToolsFramework/SourceControl/QtSourceControlNotificationHandler.h>
#include <AzCore/std/string/string.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "ComponentAssetMimeDataContainer.h"
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Component/Component.h>
@@ -14,6 +14,8 @@
#include <AzCore/RTTI/RTTI.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <QtCore/QString>
namespace AZ
{
struct ClassDataReflection;
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "EditorAssetMimeDataContainer.h"
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Component/Component.h>
@@ -14,6 +14,8 @@
#include <AzCore/RTTI/RTTI.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <QtCore/QString>
namespace AZ
{
struct ClassDataReflection;
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "EditorAssetReference.h"
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "EditorComponentBase.h"
#include "TransformComponent.h"
#include "SelectionComponent.h"
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "EditorDisabledCompositionComponent.h"
#include <AzCore/Serialization/EditContext.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "EditorEntityIconComponent.h"
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "EditorEntityIdContainer.h"
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Component/Component.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "EditorLayerComponent.h"
#include <AzCore/IO/FileIO.h>
#include <AzCore/RTTI/ReflectContext.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "EditorLockComponent.h"
#include <AzCore/Serialization/EditContext.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzToolsFramework/ToolsComponents/EditorOnlyEntityComponent.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "EditorPendingCompositionComponent.h"
#include <AzCore/Serialization/EditContext.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "EditorSelectionAccentSystemComponent.h"
#include <AzCore/Debug/Profiler.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "EditorVisibilityComponent.h"
#include <AzCore/Serialization/EditContext.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Component/ComponentApplicationBus.h>
#include <AzCore/Component/ComponentExport.h>
@@ -6,10 +6,10 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include "LayerResult.h"
#include <QString>
#include <AzCore/Debug/Trace.h>
namespace AzToolsFramework
{
@@ -7,6 +7,8 @@
*/
#pragma once
#include <QtCore/QString>
namespace AzToolsFramework
{
namespace Layers
@@ -7,7 +7,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzToolsFramework/ToolsComponents/ScriptEditorComponent.h>
#include <AzCore/Script/ScriptSystemBus.h>
#include <AzCore/EBus/Results.h>
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "SelectionComponent.h"
#include <AzCore/Serialization/EditContext.h>
#include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include "TransformComponent.h"
#include <AzCore/Component/ComponentApplicationBus.h>
@@ -67,14 +67,6 @@ namespace AzToolsFramework
result.Combine(isStaticLoadResult);
}
{
JSR::ResultCode netSyncEnabledLoadResult = ContinueLoadingFromJsonObjectField(
&transformComponentInstance->m_netSyncEnabled, azrtti_typeid<decltype(transformComponentInstance->m_netSyncEnabled)>(),
inputValue, "Sync Enabled", context);
result.Combine(netSyncEnabledLoadResult);
}
{
JSR::ResultCode interpolatePositionLoadResult = ContinueLoadingFromJsonObjectField(
&transformComponentInstance->m_interpolatePosition, azrtti_typeid<decltype(transformComponentInstance->m_interpolatePosition)>(),
@@ -172,18 +164,6 @@ namespace AzToolsFramework
result.Combine(resultIsStatic);
}
{
AZ::ScopedContextPath subPathName(context, "m_netSyncEnabled");
const bool* netSyncEnabled = &transformComponentInstance->m_netSyncEnabled;
const bool* defaultNetSyncEnabled = defaultTransformComponentInstance ? &defaultTransformComponentInstance->m_netSyncEnabled : nullptr;
JSR::ResultCode resultNetSyncEnabled = ContinueStoringToJsonObjectField(
outputValue, "Sync Enabled", netSyncEnabled, defaultNetSyncEnabled, azrtti_typeid<decltype(transformComponentInstance->m_netSyncEnabled)>(),
context);
result.Combine(resultNetSyncEnabled);
}
{
AZ::ScopedContextPath subPathName(context, "m_interpolatePosition");
const AZ::InterpolationMode* interpolatePosition = &transformComponentInstance->m_interpolatePosition;
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include "ComponentPaletteModel.hxx"
namespace AzToolsFramework
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include "ComponentPaletteModelFilter.hxx"
#include <AzCore/Serialization/SerializeContext.h>
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include "ComponentPaletteUtil.hxx"
#include <AzCore/Debug/Profiler.h>
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include "ComponentPaletteModel.hxx"
#include "ComponentPaletteUtil.hxx"
@@ -6,6 +6,7 @@
*
*/
#include <AzCore/PlatformIncl.h>
#include <AzToolsFramework/UI/Docking/DockWidgetUtils.h>
AZ_PUSH_DISABLE_WARNING(4251 4244 4458, "-Wunknown-warning-option") // 4251: 'QTextStream::d_ptr': class 'QScopedPointer<QTextStreamPrivate,QScopedPointerDeleter<T>>' needs to have dll-interface to be used by clients of class 'QTextStream'
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AzToolsFramework_precompiled.h"
#include "AddToLayerMenu.h"
#include <AzCore/Component/TransformBus.h>
@@ -22,6 +21,7 @@ AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // 'QLayoutItem::align
#include <QMenu>
#include <QWidgetAction>
AZ_POP_DISABLE_WARNING
#include <QtWidgets/QLabel>
namespace AzToolsFramework
{
@@ -6,12 +6,13 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Component/ComponentApplication.h>
#include "EditorFrameworkAPI.h"
#include <QtCore/QString>
namespace LegacyFramework
{
const char* appName()
@@ -6,16 +6,15 @@
*
*/
#ifndef EditorFrameworkAPI_H
#define EditorFrameworkAPI_H
#pragma once
#include <AzCore/base.h>
#include <AzCore/Math/Uuid.h>
#include <AzCore/EBus/EBus.h>
#include <AzCore/PlatformIncl.h>
#include <AzCore/Component/EntityId.h>
#include <AzFramework/CommandLine/CommandLine.h>
#pragma once
// this file contains the API for the buses that the framework communicates on to NON-GUI-CLIENTS
// note that this does not include UI messaging, this is for non-ui parts of it!
@@ -24,10 +23,6 @@ namespace AZ
class SerializeContext;
}
#ifdef AZ_PLATFORM_WINDOWS
typedef HINSTANCE HMODULE;
#endif
namespace LegacyFramework
{
// we agree that an entity list is a list of entity IDs
@@ -220,9 +215,7 @@ namespace LegacyFramework
/** (Windows) retrieves the main module of the executable.
* This is always going to be the main executable except in the situation where the framework may be running as a DLL belonging to another process or program.
*/
#ifdef AZ_PLATFORM_WINDOWS
virtual HMODULE GetMainModule() = 0;
#endif
virtual void* GetMainModule() = 0;
virtual const char* GetApplicationName() = 0;
virtual const char* GetApplicationModule() = 0;
@@ -329,5 +322,3 @@ namespace LegacyFramework
typedef AZ::EBus<IPCCommandAPI> IPCCommandBus;
};
#endif
@@ -6,7 +6,6 @@
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzCore/PlatformIncl.h>
#include "EditorFrameworkApplication.h"
@@ -54,11 +53,12 @@ AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // 'QFileInfo::d_ptr':
AZ_POP_DISABLE_OVERRIDE_WARNING
#include <QSharedMemory>
#include <QStandardPaths>
#include <QtWidgets/QApplication>
namespace LegacyFramework
{
ApplicationDesc::ApplicationDesc(const char* name, int argc, char** argv)
: m_applicationModule(NULL)
: m_applicationModule(nullptr)
, m_enableGridmate(true)
, m_enablePerforce(true)
, m_enableGUI(true)
@@ -71,7 +71,7 @@ namespace LegacyFramework
m_applicationName[0] = 0;
if (name)
{
azstrcpy(m_applicationName, _MAX_PATH, name);
azstrcpy(m_applicationName, AZ_MAX_PATH_LEN, name);
}
}
@@ -91,7 +91,7 @@ namespace LegacyFramework
m_enableGUI = other.m_enableGUI;
m_enableGridmate = other.m_enableGridmate;
m_enablePerforce = other.m_enablePerforce;
azstrcpy(m_applicationName, _MAX_PATH, other.m_applicationName);
azstrcpy(m_applicationName, AZ_MAX_PATH_LEN, other.m_applicationName);
m_enableProjectManager = other.m_enableProjectManager;
m_shouldRunAssetProcessor = other.m_shouldRunAssetProcessor;
m_saveUserSettings = other.m_saveUserSettings;
@@ -105,12 +105,12 @@ namespace LegacyFramework
m_isPrimary = true;
m_desiredExitCode = 0;
m_abortRequested = false;
m_applicationEntity = NULL;
m_ptrSystemEntity = NULL;
m_applicationEntity = nullptr;
m_ptrSystemEntity = nullptr;
m_applicationModule[0] = 0;
}
HMODULE Application::GetMainModule()
void* Application::GetMainModule()
{
return m_desc.m_applicationModule;
}
@@ -372,7 +372,7 @@ namespace LegacyFramework
applicationFilePath.append("_app.xml");
AZ_Assert(applicationFilePath.size() <= _MAX_PATH, "Application path longer than expected");
AZ_Assert(applicationFilePath.size() <= AZ_MAX_PATH_LEN, "Application path longer than expected");
qstrcpy(m_applicationFilePath, applicationFilePath.c_str());
// load all application entities, if present:
@@ -25,7 +25,7 @@ namespace LegacyFramework
{
struct ApplicationDesc
{
HMODULE m_applicationModule; // only necessary if you want to attach your application as a DLL plugin to another application, hosting it
void* m_applicationModule; // only necessary if you want to attach your application as a DLL plugin to another application, hosting it
bool m_enableGUI; // false if you want none of the QT or GUI functionality to exist. You cannot use project manager if you do this.
bool m_enableGridmate; // false if you want to not activate the network communications module.
bool m_enablePerforce; // false if you want to not activate perforce SCM integration. note that this will eventually become a plugin anyway
@@ -36,7 +36,7 @@ namespace LegacyFramework
int m_argc;
char** m_argv;
char m_applicationName[_MAX_PATH];
char m_applicationName[AZ_MAX_PATH_LEN];
ApplicationDesc(const char* name = "Application", int argc = 0, char** argv = nullptr);
ApplicationDesc(const ApplicationDesc& other);
@@ -66,7 +66,7 @@ namespace LegacyFramework
virtual bool IsRunningInGUIMode() { return m_desc.m_enableGUI; }
virtual bool RequiresGameProject() { return m_desc.m_enableProjectManager; }
virtual bool ShouldRunAssetProcessor() { return m_desc.m_shouldRunAssetProcessor; }
virtual HMODULE GetMainModule();
virtual void* GetMainModule();
virtual const char* GetApplicationName();
virtual const char* GetApplicationModule();
virtual const char* GetApplicationDirectory();
@@ -132,11 +132,11 @@ namespace LegacyFramework
void CreateApplicationComponent();
void SaveApplicationEntity();
char m_applicationModule[_MAX_PATH];
char m_applicationModule[AZ_MAX_PATH_LEN];
int m_desiredExitCode;
bool m_isPrimary;
volatile bool m_abortRequested; // if you CTRL+C in a console app, this becomes true. its up to you to check...
char m_applicationFilePath[_MAX_PATH];
char m_applicationFilePath[AZ_MAX_PATH_LEN];
ApplicationDesc m_desc;
AzFramework::CommandLine* m_ptrCommandLineParser;
};

Some files were not shown because too many files have changed in this diff Show More