Integrating up through commit 90f050496

This commit is contained in:
alexpete
2021-04-07 14:03:29 -07:00
parent 8f2ed080a9
commit c2cbd430fe
2694 changed files with 285622 additions and 176874 deletions
@@ -107,15 +107,9 @@ namespace AZ
result = ContinueLoading(&id, azrtti_typeid<AssetId>(), it->value, context);
if (!id.m_guid.IsNull())
{
if (instance->Create(id))
{
result.Combine(context.Report(result, "Successfully created Asset<T>."));
}
else
{
result.Combine(context.Report(JSR::Tasks::Convert, JSR::Outcomes::Unknown,
"The asset id was successfully read, but creating an Asset<T> instance from it failed."));
}
*instance = Asset<AssetData>(id, instance->GetType());
result.Combine(context.Report(result, "Successfully created Asset<T> with id."));
}
else if (result.GetProcessing() == JSR::Processing::Completed)
{
@@ -48,6 +48,7 @@
#include <AzCore/Module/ModuleManager.h>
#include <AzCore/IO/FileIO.h>
#include <AzCore/IO/Path/Path_fwd.h>
#include <AzCore/IO/SystemFile.h>
#include <AzCore/Driller/Driller.h>
@@ -434,6 +435,7 @@ namespace AZ
// Merge the bootstrap.cfg file into the Settings Registry as soon as the OSAllocator has been created.
SettingsRegistryMergeUtils::MergeSettingsToRegistry_Bootstrap(*m_settingsRegistry);
SettingsRegistryMergeUtils::MergeSettingsToRegistry_O3deUserRegistry(*m_settingsRegistry, AZ_TRAIT_OS_PLATFORM_CODENAME, {});
SettingsRegistryMergeUtils::MergeSettingsToRegistry_CommandLine(*m_settingsRegistry, m_commandLine, executeRegDumpCommands);
SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*m_settingsRegistry);
@@ -888,17 +890,19 @@ namespace AZ
SettingsRegistryMergeUtils::MergeSettingsToRegistry_TargetBuildDependencyRegistry(registry,
AZ_TRAIT_OS_PLATFORM_CODENAME, specializations, &scratchBuffer);
#if defined(AZ_DEBUG_BUILD) || defined(AZ_PROFILE_BUILD)
// In development builds apply the developer registry and the command line to allow early overrides. This will
// In development builds apply the o3de registry and the command line to allow early overrides. This will
// allow developers to override things like default paths or Asset Processor connection settings. Any additional
// values will be replaced by later loads, so this step will happen again at the end of loading.
SettingsRegistryMergeUtils::MergeSettingsToRegistry_UserRegistry(registry, AZ_TRAIT_OS_PLATFORM_CODENAME, specializations, &scratchBuffer);
SettingsRegistryMergeUtils::MergeSettingsToRegistry_O3deUserRegistry(registry, AZ_TRAIT_OS_PLATFORM_CODENAME, specializations, &scratchBuffer);
SettingsRegistryMergeUtils::MergeSettingsToRegistry_ProjectUserRegistry(registry, AZ_TRAIT_OS_PLATFORM_CODENAME, specializations, &scratchBuffer);
SettingsRegistryMergeUtils::MergeSettingsToRegistry_CommandLine(registry, m_commandLine, false);
#endif
SettingsRegistryMergeUtils::MergeSettingsToRegistry_EngineRegistry(registry, AZ_TRAIT_OS_PLATFORM_CODENAME, specializations, &scratchBuffer);
SettingsRegistryMergeUtils::MergeSettingsToRegistry_GemRegistries(registry, AZ_TRAIT_OS_PLATFORM_CODENAME, specializations, &scratchBuffer);
SettingsRegistryMergeUtils::MergeSettingsToRegistry_ProjectRegistry(registry, AZ_TRAIT_OS_PLATFORM_CODENAME, specializations, &scratchBuffer);
#if defined(AZ_DEBUG_BUILD) || defined(AZ_PROFILE_BUILD)
SettingsRegistryMergeUtils::MergeSettingsToRegistry_UserRegistry(registry, AZ_TRAIT_OS_PLATFORM_CODENAME, specializations, &scratchBuffer);
SettingsRegistryMergeUtils::MergeSettingsToRegistry_O3deUserRegistry(registry, AZ_TRAIT_OS_PLATFORM_CODENAME, specializations, &scratchBuffer);
SettingsRegistryMergeUtils::MergeSettingsToRegistry_ProjectUserRegistry(registry, AZ_TRAIT_OS_PLATFORM_CODENAME, specializations, &scratchBuffer);
SettingsRegistryMergeUtils::MergeSettingsToRegistry_CommandLine(registry, m_commandLine, true);
#endif
}
@@ -1455,6 +1459,8 @@ namespace AZ
PolygonPrismReflect(context);
// reflect name dictionary.
Name::Reflect(context);
// reflect path
IO::PathReflection::Reflect(context);
// reflect the SettingsRegistryInterface, SettignsRegistryImpl and the global Settings Registry
// instance (AZ::SettingsRegistry::Get()) into the Behavior Context
@@ -96,6 +96,11 @@ namespace AZ
}
Entity::~Entity()
{
Reset();
}
void Entity::Reset()
{
AZ_Assert(m_state != State::Activating && m_state != State::Deactivating && m_state != State::Initializing, "Unsafe to delete an entity during its state transition.");
if (m_state == State::Active)
@@ -116,6 +121,8 @@ namespace AZ
delete *it;
}
m_components.clear();
if (m_state == State::Init)
{
EBUS_EVENT(EntitySystemBus, OnEntityDestroyed, m_id);
@@ -751,6 +758,8 @@ namespace AZ
->Field("IsRuntimeActive", &Entity::m_isRuntimeActiveByDefault)
;
serializeContext->RegisterGenericType<AZStd::unordered_map<AZStd::string, AZ::Component*>>();
serializeContext->Class<EntityId>()
->Version(1, &EntityIdConverter)
->Field("id", &EntityId::m_id);
@@ -118,6 +118,9 @@ namespace AZ
//! If the entity is in a transition state, this function asserts.
virtual ~Entity();
//! Resets the state to default
void Reset();
//! Gets the ID of the entity.
//! @return The ID of the entity.
EntityId GetId() const { return m_id; }
@@ -10,6 +10,7 @@
*
*/
#include <AzCore/std/containers/map.h>
#include <AzCore/Component/Entity.h>
#include <AzCore/Component/EntityIdSerializer.h>
#include <AzCore/Component/EntitySerializer.h>
@@ -62,11 +63,17 @@ namespace AZ
}
{
AZStd::unordered_map<AZStd::string, AZ::Component*> componentMap;
JSR::ResultCode componentLoadResult =
ContinueLoadingFromJsonObjectField(&entityInstance->m_components,
azrtti_typeid<decltype(entityInstance->m_components)>(),
ContinueLoadingFromJsonObjectField(&componentMap,
azrtti_typeid<decltype(componentMap)>(),
inputValue, "Components", context);
for (auto& [componentKey, component] : componentMap)
{
entityInstance->m_components.emplace_back(component);
}
result.Combine(componentLoadResult);
}
@@ -145,9 +152,21 @@ namespace AZ
const AZ::Entity::ComponentArrayType* defaultComponents =
defaultEntityInstance ? &defaultEntityInstance->m_components : nullptr;
AZStd::unordered_map<AZStd::string, AZ::Component*> componentMap;
AZStd::unordered_map<AZStd::string, AZ::Component*> defaultComponentMap;
ConvertComponentVectorToMap(*components, componentMap);
if (defaultComponents)
{
ConvertComponentVectorToMap(*defaultComponents, defaultComponentMap);
}
JSR::ResultCode resultComponents =
ContinueStoringToJsonObjectField(outputValue, "Components",
components, defaultComponents, azrtti_typeid<decltype(entityInstance->m_components)>(), context);
&componentMap,
defaultComponents ? &defaultComponentMap : nullptr,
azrtti_typeid<decltype(componentMap)>(), context);
result.Combine(resultComponents);
}
@@ -183,4 +202,16 @@ namespace AZ
result.GetProcessing() == JSR::Processing::Halted ? "Successfully stored Entity information." :
"Failed to store Entity information.");
}
void JsonEntitySerializer::ConvertComponentVectorToMap(const AZ::Entity::ComponentArrayType& components,
AZStd::unordered_map<AZStd::string, AZ::Component*>& componentMapOut)
{
for (AZ::Component* component : components)
{
if (component)
{
componentMapOut.emplace(AZStd::string::format("Component_[%llu]", component->GetId()), component);
}
}
}
}
@@ -29,5 +29,9 @@ namespace AZ
JsonSerializationResult::Result Store(rapidjson::Value& outputValue, const void* inputValue, const void* defaultValue, const Uuid& valueTypeId,
JsonSerializerContext& context) override;
private:
void ConvertComponentVectorToMap(const AZ::Entity::ComponentArrayType& components,
AZStd::unordered_map<AZStd::string, AZ::Component*>& componentMapOut);
};
}
@@ -196,7 +196,7 @@ namespace AZ
return nullptr;
}
AZStd::string Console::AutoCompleteCommand(const char* command)
AZStd::string Console::AutoCompleteCommand(const char* command, AZStd::vector<AZStd::string>* matches)
{
const size_t commandLength = strlen(command);
@@ -219,6 +219,10 @@ namespace AZ
{
AZLOG_INFO("- %s : %s\n", curr->m_name, curr->m_desc);
commandSubset.push_back(curr->m_name);
if (matches)
{
matches->push_back(curr->m_name);
}
}
}
@@ -283,6 +287,12 @@ namespace AZ
AZ_Assert(false, "Mismatched console functor types registered under the same name");
return;
}
// Discard duplicate functors if the 'DontDuplicate' flag has been set
if ((front->GetFlags() & ConsoleFunctorFlags::DontDuplicate) != ConsoleFunctorFlags::Null)
{
return;
}
}
}
m_commands[lowerName].emplace_back(functor);
@@ -62,7 +62,7 @@ namespace AZ
void ExecuteCommandLine(const AZ::CommandLine& commandLine) override;
bool HasCommand(const char* command) override;
ConsoleFunctorBase* FindCommand(const char* command) override;
AZStd::string AutoCompleteCommand(const char* command) override;
AZStd::string AutoCompleteCommand(const char* command, AZStd::vector<AZStd::string>* matches = nullptr) override;
void VisitRegisteredFunctors(const FunctorVisitor& visitor) override;
void RegisterFunctor(ConsoleFunctorBase* functor) override;
void UnregisterFunctor(ConsoleFunctorBase* functor) override;
@@ -17,6 +17,7 @@
#include <AzCore/Console/IConsoleTypes.h>
#include <AzCore/EBus/Event.h>
#include <AzCore/RTTI/RTTI.h>
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/functional.h>
namespace AZ
@@ -103,10 +104,13 @@ namespace AZ
//! @return non-null pointer to the console command if found
virtual ConsoleFunctorBase* FindCommand(const char* command) = 0;
//! Prints all commands of which the input is a prefix.
//! @param command the prefix string to dump all matching commands for
//! @return boolean true on success, false otherwise
virtual AZStd::string AutoCompleteCommand(const char* command) = 0;
//! Finds all commands where the input command is a prefix and returns
//! the longest matching substring prefix the results have in common.
//! @param command The prefix string to find all matching commands for.
//! @param matches The list of all commands that match the input prefix.
//! @return The longest matching substring prefix the results have in common.
virtual AZStd::string AutoCompleteCommand(const char* command,
AZStd::vector<AZStd::string>* matches = nullptr) = 0;
//! Retrieves the value of the requested cvar.
//! @param command the name of the cvar to find and retrieve the current value of
@@ -233,7 +237,7 @@ static constexpr AZ::ThreadSafety ConsoleThreadSafety<_TYPE, std::enable_if_t<st
//! @param _FLAGS a set of AzFramework::ConsoleFunctorFlags used to mutate behaviour
//! @param _DESC a description of the cvar
#define AZ_CONSOLEFREEFUNC_3(_FUNCTION, _FLAGS, _DESC) \
inline AZ::ConsoleFunctor<void, false> Functor##_FUNCTION(#_FUNCTION, _DESC, _FLAGS, AZ::TypeId::CreateNull(), &_FUNCTION)
inline AZ::ConsoleFunctor<void, false> Functor##_FUNCTION(#_FUNCTION, _DESC, _FLAGS | AZ::ConsoleFunctorFlags::DontDuplicate, AZ::TypeId::CreateNull(), &_FUNCTION)
//! Implements a console functor for a non-member function.
//!
@@ -243,6 +247,6 @@ static constexpr AZ::ThreadSafety ConsoleThreadSafety<_TYPE, std::enable_if_t<st
//! @param _FLAGS a set of AzFramework::ConsoleFunctorFlags used to mutate behaviour
//! @param _DESC a description of the cvar
#define AZ_CONSOLEFREEFUNC_4(_NAME, _FUNCTION, _FLAGS, _DESC) \
inline AZ::ConsoleFunctor<void, false> Functor##_FUNCTION(#_FUNCTION, _DESC, _FLAGS, AZ::TypeId::CreateNull(), &_FUNCTION)
inline AZ::ConsoleFunctor<void, false> Functor##_FUNCTION(#_FUNCTION, _DESC, _FLAGS | AZ::ConsoleFunctorFlags::DontDuplicate, AZ::TypeId::CreateNull(), &_FUNCTION)
#define AZ_CONSOLEFREEFUNC(...) AZ_MACRO_SPECIALIZE(AZ_CONSOLEFREEFUNC_, AZ_VA_NUM_ARGS(__VA_ARGS__), (__VA_ARGS__))
@@ -55,6 +55,7 @@ namespace AZ
, IsDeprecated = (1 << 5) // Command is deprecated, show a warning when invoked
, NeedsReload = (1 << 6) // Level should be reloaded after executing this command
, AllowClientSet = (1 << 7) // Allow clients to modify this cvar even in release (this alters the cvar for all connected servers and clients, be VERY careful enabling this flag)
, DontDuplicate = (1 << 8) // Discard functors with the same name as another that has already been registered instead of duplicating them (which is the default behavior)
};
AZ_DEFINE_ENUM_BITWISE_OPERATORS(ConsoleFunctorFlags);
@@ -11,6 +11,7 @@
*/
#include <AzCore/IO/Path/Path.h>
#include <AzCore/Serialization/SerializeContext.h>
// Explicit instantations of our support Path classes
namespace AZ::IO
@@ -53,4 +54,13 @@ namespace AZ::IO
const PathIterator<Path>& rhs);
template bool operator!=<FixedMaxPath>(const PathIterator<FixedMaxPath>& lhs,
const PathIterator<FixedMaxPath>& rhs);
void PathReflection::Reflect(AZ::ReflectContext* context)
{
if (auto* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<AZ::IO::Path>()
->Field("m_path", &AZ::IO::Path::m_path);
}
}
}
@@ -300,6 +300,7 @@ namespace AZ::IO
using const_iterator = const PathIterator<BasicPath>;
using iterator = const_iterator;
friend PathIterator<BasicPath>;
friend struct PathReflection;
// constructors and destructor
constexpr BasicPath() = default;
@@ -631,6 +632,11 @@ namespace AZ::IO
constexpr BasicPath<StringType> operator/(const BasicPath<StringType>& lhs, const typename BasicPath<StringType>::value_type* rhs);
}
namespace AZ
{
AZ_TYPE_INFO_SPECIALIZE(AZ::IO::Path, "{88E0A40F-3085-4CAB-8B11-EF5A2659C71A}");
}
namespace AZ::IO
{
//! Path iterator that allows traversal of the path elements
@@ -31,6 +31,11 @@ namespace AZStd
struct hash;
}
namespace AZ
{
class ReflectContext;
}
namespace AZ::IO
{
//! Path Constants
@@ -56,6 +61,11 @@ namespace AZ::IO
// It depends on the path type
template <typename PathType>
class PathIterator;
struct PathReflection
{
static void Reflect(AZ::ReflectContext* context);
};
}
namespace AZStd
@@ -68,9 +68,11 @@ namespace AZ
bool useAllHardware = true;
settingsRegistry->Get(useAllHardware, "/Amazon/AzCore/Streamer/UseAllHardware");
bool reportHardware = true;
settingsRegistry->Get(reportHardware, "/Amazon/AzCore/Streamer/ReportHardware");
AZ::IO::HardwareInformation hardwareInfo;
if (!AZ::IO::CollectIoHardwareInformation(hardwareInfo, useAllHardware))
if (!AZ::IO::CollectIoHardwareInformation(hardwareInfo, useAllHardware, reportHardware))
{
AZ_Assert(false, "Unable to collect information on available IO hardware.");
return CreateSimpleStreamerStack();
@@ -42,8 +42,8 @@ namespace AZ::IO
AZStd::string m_profile{"Default"};
size_t m_maxPhysicalSectorSize{ AZCORE_GLOBAL_NEW_ALIGNMENT };
size_t m_maxLogicalSectorSize{ AZCORE_GLOBAL_NEW_ALIGNMENT };
size_t m_maxPageSize{ 0 };
size_t m_maxTransfer{ 0 };
size_t m_maxPageSize{ AZCORE_GLOBAL_NEW_ALIGNMENT };
size_t m_maxTransfer{ AZCORE_GLOBAL_NEW_ALIGNMENT };
};
class IStreamerStackConfig
@@ -73,7 +73,8 @@ namespace AZ::IO
//! @param includeAllHardware Includes all available hardware that can be used by AZ::IO::Streamer. If set to false
//! only hardware is listed that is known to be used. This may be more performant, but can result is file
//! requests failing if they use an previously unknown path.
extern bool CollectIoHardwareInformation(HardwareInformation& info, bool includeAllHardware);
//! @param reportHardware If true, hardware information will be printed to the log if available.
extern bool CollectIoHardwareInformation(HardwareInformation& info, bool includeAllHardware, bool reportHardware);
extern void ReflectNative(ReflectContext* context);
//! Constant used to denote "file not found" in StreamStackEntry processing.
@@ -29,6 +29,7 @@
#include <AzCore/Math/ColorSerializer.h>
#include <AzCore/Math/Quaternion.h>
#include <AzCore/Math/Transform.h>
#include <AzCore/Math/TransformSerializer.h>
#include <AzCore/Math/Matrix3x3.h>
#include <AzCore/Math/Matrix3x4.h>
#include <AzCore/Math/Matrix4x4.h>
@@ -370,6 +371,7 @@ namespace AZ
context.Serializer<JsonVector3Serializer>()->HandlesType<Vector3>();
context.Serializer<JsonVector4Serializer>()->HandlesType<Vector4>();
context.Serializer<JsonQuaternionSerializer>()->HandlesType<Quaternion>();
context.Serializer<JsonTransformSerializer>()->HandlesType<Transform>();
}
void MathReflect(ReflectContext* context)
@@ -0,0 +1,143 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Math/Transform.h>
#include <AzCore/Math/TransformSerializer.h>
namespace AZ
{
AZ_CLASS_ALLOCATOR_IMPL(JsonTransformSerializer, AZ::SystemAllocator, 0);
JsonSerializationResult::Result JsonTransformSerializer::Load(
void* outputValue, [[maybe_unused]] const Uuid& outputValueTypeId, const rapidjson::Value& inputValue,
JsonDeserializerContext& context)
{
namespace JSR = JsonSerializationResult;
if (azrtti_typeid<AZ::Transform>() != outputValueTypeId)
{
return context.Report(
JSR::Tasks::ReadField, JSR::Outcomes::Unsupported,
"Unable to deserialize Transform from json because the outputValueTypeId isn't a Transform type.");
}
AZ::Transform* transformInstance = reinterpret_cast<AZ::Transform*>(outputValue);
AZ_Assert(transformInstance, "Output value for JsonTransformSerializer can't be null.");
JSR::ResultCode result(JSR::Tasks::ReadField);
{
AZ::Vector3 translation = transformInstance->GetTranslation();
JSR::ResultCode loadResult = ContinueLoadingFromJsonObjectField(
&translation, azrtti_typeid<decltype(translation)>(), inputValue, TranslationTag, context);
result.Combine(loadResult);
transformInstance->SetTranslation(translation);
}
{
AZ::Quaternion rotation = transformInstance->GetRotation();
JSR::ResultCode loadResult =
ContinueLoadingFromJsonObjectField(&rotation, azrtti_typeid<decltype(rotation)>(), inputValue, RotationTag, context);
result.Combine(loadResult);
transformInstance->SetRotation(rotation);
}
{
// Scale is transitioning to a single uniform scale value, but since it's still internally represented as a Vector3,
// we need to pick one number to use for load/store operations.
float scale = transformInstance->GetScale().GetMaxElement();
JSR::ResultCode loadResult =
ContinueLoadingFromJsonObjectField(&scale, azrtti_typeid<decltype(scale)>(), inputValue, ScaleTag, context);
result.Combine(loadResult);
transformInstance->SetScale(AZ::Vector3(scale));
}
return context.Report(
result,
result.GetProcessing() != JSR::Processing::Halted ? "Succesfully loaded Transform information."
: "Failed to load Transform information.");
}
JsonSerializationResult::Result JsonTransformSerializer::Store(
rapidjson::Value& outputValue, const void* inputValue, const void* defaultValue, [[maybe_unused]] const Uuid& valueTypeId,
JsonSerializerContext& context)
{
namespace JSR = AZ::JsonSerializationResult;
if (azrtti_typeid<AZ::Transform>() != valueTypeId)
{
return context.Report(
JSR::Tasks::WriteValue, JSR::Outcomes::Unsupported,
"Unable to Serialize Transform to json because the valueTypeId isn't a Transform type.");
}
const AZ::Transform* transformInstance = reinterpret_cast<const AZ::Transform*>(inputValue);
AZ_Assert(transformInstance, "Input value for JsonTransformSerializer can't be null.");
const AZ::Transform* defaultTransformInstance = reinterpret_cast<const AZ::Transform*>(defaultValue);
JSR::ResultCode result(JSR::Tasks::WriteValue);
{
AZ::ScopedContextPath subPathName(context, TranslationTag);
const AZ::Vector3 translation = transformInstance->GetTranslation();
const AZ::Vector3 defaultTranslation = defaultTransformInstance ? defaultTransformInstance->GetTranslation() : AZ::Vector3();
JSR::ResultCode storeResult = ContinueStoringToJsonObjectField(
outputValue, TranslationTag, &translation, defaultTransformInstance ? &defaultTranslation : nullptr,
azrtti_typeid<decltype(translation)>(), context);
result.Combine(storeResult);
}
{
AZ::ScopedContextPath subPathName(context, RotationTag);
const AZ::Quaternion rotation = transformInstance->GetRotation();
const AZ::Quaternion defaultRotation = defaultTransformInstance ? defaultTransformInstance->GetRotation() : AZ::Quaternion();
JSR::ResultCode storeResult = ContinueStoringToJsonObjectField(
outputValue, RotationTag, &rotation, defaultTransformInstance ? &defaultRotation : nullptr,
azrtti_typeid<decltype(rotation)>(), context);
result.Combine(storeResult);
}
{
AZ::ScopedContextPath subPathName(context, ScaleTag);
// Scale is transitioning to a single uniform scale value, but since it's still internally represented as a Vector3,
// we need to pick one number to use for load/store operations.
float scale = transformInstance->GetScale().GetMaxElement();
float defaultScale = defaultTransformInstance ? defaultTransformInstance->GetScale().GetMaxElement() : 0.0f;
JSR::ResultCode storeResult = ContinueStoringToJsonObjectField(
outputValue, ScaleTag, &scale, defaultTransformInstance ? &defaultScale : nullptr, azrtti_typeid<decltype(scale)>(),
context);
result.Combine(storeResult);
}
return context.Report(
result,
result.GetProcessing() != JSR::Processing::Halted ? "Successfully stored Transform information."
: "Failed to store Transform information.");
}
} // namespace AZ
@@ -0,0 +1,41 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/Serialization/Json/BaseJsonSerializer.h>
namespace AZ
{
class JsonTransformSerializer : public BaseJsonSerializer
{
public:
AZ_RTTI(JsonTransformSerializer, "{51C321B8-9214-4E85-AA5C-B720428A3B17}", BaseJsonSerializer);
AZ_CLASS_ALLOCATOR_DECL;
JsonSerializationResult::Result Load(
void* outputValue, const Uuid& outputValueTypeId, const rapidjson::Value& inputValue,
JsonDeserializerContext& context) override;
JsonSerializationResult::Result Store(
rapidjson::Value& outputValue, const void* inputValue, const void* defaultValue, const Uuid& valueTypeId,
JsonSerializerContext& context) override;
private:
// Note: These need to be defined as "const char[]" instead of "const char*" so that they can be implicitly converted
// to a rapidjson::GenericStringRef<>. (This also lets rapidjson get the string length at compile time)
static inline constexpr const char TranslationTag[] = "Translation";
static inline constexpr const char RotationTag[] = "Rotation";
static inline constexpr const char ScaleTag[] = "Scale";
};
} // namespace AZ
@@ -19,6 +19,7 @@
#include <AzCore/std/any.h>
#include <AzCore/std/utils.h>
#include <AzCore/std/string/string.h>
#include <AzCore/std/string/fixed_string.h>
namespace AZ
{
@@ -195,7 +196,9 @@ namespace AZ
context.GetSerializeContext()->FindClassData(classElement.m_typeId);
if (!elementClassData)
{
return context.Report(Tasks::RetrieveInfo, Outcomes::Unknown, "Failed to retrieve serialization information.");
return context.Report(Tasks::RetrieveInfo, Outcomes::Unknown,
AZStd::string::format("Failed to retrieve serialization information for type %s.",
classElement.m_typeId.ToString<AZStd::fixed_string<AZ::Uuid::MaxStringBuffer>>().c_str()));
}
if (!elementClassData->m_azRtti)
{
@@ -709,7 +709,7 @@ namespace AZ::SettingsRegistryMergeUtils
}
}
void MergeSettingsToRegistry_UserRegistry(SettingsRegistryInterface& registry, const AZStd::string_view platform,
void MergeSettingsToRegistry_ProjectUserRegistry(SettingsRegistryInterface& registry, const AZStd::string_view platform,
const SettingsRegistryInterface::Specializations& specializations, AZStd::vector<char>* scratchBuffer)
{
// Unlike other paths, the path can't be overwritten by the dev settings because that would create a circular dependency.
@@ -721,6 +721,16 @@ namespace AZ::SettingsRegistryMergeUtils
}
}
void MergeSettingsToRegistry_O3deUserRegistry(SettingsRegistryInterface& registry, const AZStd::string_view platform,
const SettingsRegistryInterface::Specializations& specializations, AZStd::vector<char>* scratchBuffer)
{
if (AZ::IO::FixedMaxPath o3deUserPath = AZ::Utils::GetO3deManifestDirectory(); !o3deUserPath.empty())
{
o3deUserPath /= SettingsRegistryInterface::RegistryFolder;
registry.MergeSettingsFolder(o3deUserPath.Native(), specializations, platform, "", scratchBuffer);
}
}
void MergeSettingsToRegistry_CommandLine(SettingsRegistryInterface& registry, const AZ::CommandLine& commandLine, bool executeCommands)
{
// Iterate over all the command line options in order to parse the --regset and --regremove
@@ -171,7 +171,14 @@ namespace AZ::SettingsRegistryMergeUtils
//! Adds the development settings added by individual users of the project to the Settings Registry.
//! Note that this function is only called in development builds and is compiled out in release builds.
void MergeSettingsToRegistry_UserRegistry(SettingsRegistryInterface& registry, const AZStd::string_view platform,
void MergeSettingsToRegistry_ProjectUserRegistry(SettingsRegistryInterface& registry, const AZStd::string_view platform,
const SettingsRegistryInterface::Specializations& specializations, AZStd::vector<char>* scratchBuffer = nullptr);
//! Adds the user settings from the users home directory of "~/.o3de/Registry"
//! '~' corresponds to %USERPROFILE% on Windows and $HOME on Unix-like platforms(Linux, Mac)
//! Note that this function is only called in development builds and is compiled out in release builds.
//! It is merged before the command line settings are merged so that the command line always takes precedence
void MergeSettingsToRegistry_O3deUserRegistry(SettingsRegistryInterface& registry, const AZStd::string_view platform,
const SettingsRegistryInterface::Specializations& specializations, AZStd::vector<char>* scratchBuffer = nullptr);
//! Adds the settings set through the command line to the Settings Registry. This will also execute any Settings
@@ -42,6 +42,30 @@ namespace AZ::Utils
return result.m_pathStored;
}
AZ::IO::FixedMaxPathString GetExecutableDirectory()
{
AZ::IO::FixedMaxPathString executableDirectory;
if(GetExecutableDirectory(executableDirectory.data(), executableDirectory.capacity())
== ExecutablePathResult::Success)
{
// Updated the size field within the fixed string by using char_traits to calculate the string length
executableDirectory.resize_no_construct(AZStd::char_traits<char>::length(executableDirectory.data()));
}
return executableDirectory;
}
AZ::IO::FixedMaxPathString GetEngineManifestPath()
{
AZ::IO::FixedMaxPath o3deManifestPath = GetO3deManifestDirectory();
if (!o3deManifestPath.empty())
{
o3deManifestPath /= "o3de_manifest.json";
}
return o3deManifestPath.Native();
}
AZ::IO::FixedMaxPathString GetEnginePath()
{
if (auto registry = AZ::SettingsRegistry::Get(); registry != nullptr)
@@ -76,6 +76,9 @@ namespace AZ
//! @returns a result object that indicates if the executable directory was able to be stored within the buffer
ExecutablePathResult GetExecutableDirectory(char* exeStorageBuffer, size_t exeStorageSize);
//! Retrieves the full path of the directroy containing the executable
AZ::IO::FixedMaxPathString GetExecutableDirectory();
//! Retrieves the full path to the engine from settings registry
AZ::IO::FixedMaxPathString GetEnginePath();
@@ -85,6 +88,9 @@ namespace AZ
//! Retrieves the project name from the settings registry
AZ::SettingsRegistryInterface::FixedValueString GetProjectName();
//! Retrieves the full directory to the O3DE manifest directory, i.e. "<userhome>/.o3de"
AZ::IO::FixedMaxPathString GetO3deManifestDirectory();
//! Retrieves the full path where the manifest file lives, i.e. "<userhome>/.o3de/o3de_manifest.json"
AZ::IO::FixedMaxPathString GetEngineManifestPath();
@@ -332,6 +332,8 @@ set(FILES
Math/Transform.cpp
Math/Transform.h
Math/Transform.inl
Math/TransformSerializer.cpp
Math/TransformSerializer.h
Math/Uuid.cpp
Math/Uuid.h
Math/UuidSerializer.h
@@ -38,7 +38,7 @@ namespace AZStd
* therefore an empty class in C++ has size of 1 byte.
* From the C++20 draft chapter 10, note 5
* "[Note: Complete objects of class type have nonzero size. Base class subobjects and "
* "members declared with the no_­unique_­address attribute ([dcl.attr.nouniqueaddr]) are not so constrained. end note]"
* "members declared with the no_unique_address attribute ([dcl.attr.nouniqueaddr]) are not so constrained. -end note]"
* The Index template parameter is used to disambiguate a compressed pair containing multiple elements of the same types
* This is used to allow multiple inheritance from 2 of the same types underlying elements
*/
+1 -1
View File
@@ -96,7 +96,7 @@ namespace AZStd
* \page Setup AZSTD Setup
*
* After you have the AZStd code, you need to make sure you project has add the include path to the folder where AZStd was installed. All AZStd include files are using based on
* AZStd parent folder. For instance all includes are like this \e AZStd/base.h,"AZCore/std/containers/vector,h",etc. We use use the AZStd to avoid name collisions with other
* AZStd parent folder. For instance all includes are like this \e AZStd/base.h,"AzCore/std/containers/vector,h",etc. We use use the AZStd to avoid name collisions with other
* stl implementations and make it obvious where the included file comes from.
* If you decide to use the default allocator (AZStd::allocator) you will need to implement AZStd::Default_Alloc and AZStd::Default_Free functions otherwise you should
* use your own allocator.