Merge branch 'main' into Prefab/Instantiate/Loop
@@ -19,7 +19,6 @@
|
||||
#include <AzCore/Jobs/JobManagerComponent.h>
|
||||
#include <AzCore/Serialization/Json/JsonSystemComponent.h>
|
||||
#include <AzCore/Memory/MemoryComponent.h>
|
||||
#include <AzCore/NativeUI/NativeUISystemComponent.h>
|
||||
#include <AzCore/Script/ScriptSystemComponent.h>
|
||||
#include <AzCore/Slice/SliceComponent.h>
|
||||
#include <AzCore/Slice/SliceSystemComponent.h>
|
||||
@@ -43,7 +42,6 @@ namespace AZ
|
||||
AssetManagerComponent::CreateDescriptor(),
|
||||
UserSettingsComponent::CreateDescriptor(),
|
||||
Debug::FrameProfilerComponent::CreateDescriptor(),
|
||||
NativeUI::NativeUISystemComponent::CreateDescriptor(),
|
||||
SliceComponent::CreateDescriptor(),
|
||||
SliceSystemComponent::CreateDescriptor(),
|
||||
SliceMetadataInfoComponent::CreateDescriptor(),
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <AzCore/Memory/AllocatorManager.h>
|
||||
#include <AzCore/Memory/MallocSchema.h>
|
||||
|
||||
#include <AzCore/NativeUI/NativeUIRequests.h>
|
||||
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Serialization/ObjectStream.h>
|
||||
#include <AzCore/Serialization/Utils.h>
|
||||
@@ -424,7 +426,7 @@ namespace AZ
|
||||
|
||||
// Now that the Allocators are initialized, the Command Line parameters can be parsed
|
||||
m_commandLine.Parse(m_argC, m_argV);
|
||||
ParseCommandLine(m_commandLine);
|
||||
SettingsRegistryMergeUtils::ParseCommandLine(m_commandLine);
|
||||
|
||||
// Create the settings registry and register it with the AZ interface system
|
||||
// This is done after the AppRoot has been calculated so that the Bootstrap.cfg
|
||||
@@ -527,10 +529,42 @@ namespace AZ
|
||||
DestroyAllocator();
|
||||
}
|
||||
|
||||
|
||||
void ReportBadEngineRoot()
|
||||
{
|
||||
AZStd::string errorMessage = {"Unable to determine a valid path to the engine.\n"
|
||||
"Check parameters such as --project-path and --engine-path and make sure they are valid.\n"};
|
||||
if (auto registry = AZ::SettingsRegistry::Get(); registry != nullptr)
|
||||
{
|
||||
AZ::SettingsRegistryInterface::FixedValueString filePathErrorStr;
|
||||
if (registry->Get(filePathErrorStr, AZ::SettingsRegistryMergeUtils::FilePathKey_ErrorText); !filePathErrorStr.empty())
|
||||
{
|
||||
errorMessage += "Additional Info:\n";
|
||||
errorMessage += filePathErrorStr.c_str();
|
||||
}
|
||||
}
|
||||
|
||||
if (auto nativeUI = AZ::Interface<AZ::NativeUI::NativeUIRequests>::Get(); nativeUI != nullptr)
|
||||
{
|
||||
nativeUI->DisplayOkDialog("O3DE Fatal Error", errorMessage.c_str(), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Error("ComponentApplication", false, "O3DE Fatal Error: %s\n", errorMessage.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Entity* ComponentApplication::Create(const Descriptor& descriptor, const StartupParameters& startupParameters)
|
||||
{
|
||||
AZ_Assert(!m_isStarted, "Component application already started!");
|
||||
|
||||
if (m_engineRoot.empty())
|
||||
{
|
||||
ReportBadEngineRoot();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_startupParameters = startupParameters;
|
||||
|
||||
m_descriptor = descriptor;
|
||||
@@ -871,46 +905,6 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void ComponentApplication::ParseCommandLine(const AZ::CommandLine& commandLine)
|
||||
{
|
||||
struct OptionKeyToRegsetKey
|
||||
{
|
||||
AZStd::string_view m_optionKey;
|
||||
AZStd::string m_regsetKey;
|
||||
};
|
||||
|
||||
// Provide overrides for the engine root, the project root and the project cache root
|
||||
AZStd::array commandOptions = {
|
||||
OptionKeyToRegsetKey{ "engine-path", AZStd::string::format("%s/engine_path", AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) },
|
||||
OptionKeyToRegsetKey{ "project-path", AZStd::string::format("%s/project_path", AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) },
|
||||
OptionKeyToRegsetKey{ "project-cache-path", AZStd::string::format("%s/project_cache_path", AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) }
|
||||
};
|
||||
|
||||
AZStd::fixed_vector<AZStd::string, commandOptions.size()> overrideArgs;
|
||||
|
||||
for (auto&& [optionKey, regsetKey] : commandOptions)
|
||||
{
|
||||
if (size_t optionCount = commandLine.GetNumSwitchValues(optionKey); optionCount > 0)
|
||||
{
|
||||
// Use the last supplied command option value to override previous values
|
||||
auto overrideArg = AZStd::string::format(R"(--regset="%s=%s")", regsetKey.c_str(),
|
||||
commandLine.GetSwitchValue(optionKey, optionCount - 1).c_str());
|
||||
overrideArgs.emplace_back(AZStd::move(overrideArg));
|
||||
}
|
||||
}
|
||||
|
||||
if (!overrideArgs.empty())
|
||||
{
|
||||
// Dump the input command line, add the additional option overrides
|
||||
// and Parse the new command line into the Component Application command line
|
||||
AZ::CommandLine::ParamContainer commandLineArgs;
|
||||
commandLine.Dump(commandLineArgs);
|
||||
commandLineArgs.insert(commandLineArgs.end(), AZStd::make_move_iterator(overrideArgs.begin()),
|
||||
AZStd::make_move_iterator(overrideArgs.end()));
|
||||
m_commandLine.Parse(commandLineArgs);
|
||||
}
|
||||
}
|
||||
|
||||
void ComponentApplication::MergeSettingsToRegistry(SettingsRegistryInterface& registry)
|
||||
{
|
||||
SettingsRegistryInterface::Specializations specializations;
|
||||
|
||||
@@ -328,9 +328,6 @@ namespace AZ
|
||||
/// Create the drillers
|
||||
void CreateDrillers();
|
||||
|
||||
/// Parse ComponentApplication specific command line arguments
|
||||
void ParseCommandLine(const AZ::CommandLine& commandLine);
|
||||
|
||||
virtual void MergeSettingsToRegistry(SettingsRegistryInterface& registry);
|
||||
|
||||
//! Sets the specializations that will be used when loading the Settings Registry. Extend this in derived
|
||||
|
||||
@@ -15,45 +15,49 @@
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
namespace AZ
|
||||
namespace AZ::NativeUI
|
||||
{
|
||||
namespace NativeUI
|
||||
enum AssertAction
|
||||
{
|
||||
enum AssertAction
|
||||
{
|
||||
IGNORE_ASSERT = 0,
|
||||
IGNORE_ALL_ASSERTS,
|
||||
BREAK,
|
||||
NONE,
|
||||
};
|
||||
IGNORE_ASSERT = 0,
|
||||
IGNORE_ALL_ASSERTS,
|
||||
BREAK,
|
||||
NONE,
|
||||
};
|
||||
|
||||
class NativeUIRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
using MutexType = AZStd::recursive_mutex;
|
||||
class NativeUIRequests
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(NativeUIRequests, "{48361EE6-C1E7-4965-A13A-7425B2691817}");
|
||||
virtual ~NativeUIRequests() = default;
|
||||
|
||||
// Waits for user to select an option before execution continues
|
||||
// Returns the option string selected by the user
|
||||
virtual AZStd::string DisplayBlockingDialog(const AZStd::string& /*title*/, const AZStd::string& /*message*/, const AZStd::vector<AZStd::string>& /*options*/) const { return ""; };
|
||||
// Waits for user to select an option before execution continues
|
||||
// Returns the option string selected by the user
|
||||
virtual AZStd::string DisplayBlockingDialog(const AZStd::string& /*title*/, const AZStd::string& /*message*/, const AZStd::vector<AZStd::string>& /*options*/) const { return ""; };
|
||||
|
||||
// Waits for user to select an option ('Ok' or optionally 'Cancel') before execution continues
|
||||
// Returns the option string selected by the user
|
||||
virtual AZStd::string DisplayOkDialog(const AZStd::string& /*title*/, const AZStd::string& /*message*/, bool /*showCancel*/) const { return ""; };
|
||||
// Waits for user to select an option ('Ok' or optionally 'Cancel') before execution continues
|
||||
// Returns the option string selected by the user
|
||||
virtual AZStd::string DisplayOkDialog(const AZStd::string& /*title*/, const AZStd::string& /*message*/, bool /*showCancel*/) const { return ""; };
|
||||
|
||||
// Waits for user to select an option ('Yes', 'No' or optionally 'Cancel') before execution continues
|
||||
// Returns the option string selected by the user
|
||||
virtual AZStd::string DisplayYesNoDialog(const AZStd::string& /*title*/, const AZStd::string& /*message*/, bool /*showCancel*/) const { return ""; };
|
||||
// Waits for user to select an option ('Yes', 'No' or optionally 'Cancel') before execution continues
|
||||
// Returns the option string selected by the user
|
||||
virtual AZStd::string DisplayYesNoDialog(const AZStd::string& /*title*/, const AZStd::string& /*message*/, bool /*showCancel*/) const { return ""; };
|
||||
|
||||
// Displays an assert dialog box
|
||||
// Returns the action selected by the user
|
||||
virtual AssertAction DisplayAssertDialog(const AZStd::string& /*message*/) const { return AssertAction::NONE; };
|
||||
};
|
||||
// Displays an assert dialog box
|
||||
// Returns the action selected by the user
|
||||
virtual AssertAction DisplayAssertDialog(const AZStd::string& /*message*/) const { return AssertAction::NONE; };
|
||||
};
|
||||
|
||||
using NativeUIRequestBus = AZ::EBus<NativeUIRequests>;
|
||||
}
|
||||
}
|
||||
class NativeUIEBusTraits
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
using MutexType = AZStd::recursive_mutex;
|
||||
};
|
||||
|
||||
using NativeUIRequestBus = AZ::EBus<NativeUIRequests, NativeUIEBusTraits>;
|
||||
} // namespace AZ::NativeUI
|
||||
|
||||
@@ -15,50 +15,19 @@
|
||||
|
||||
#include <AzCore/NativeUI/NativeUISystemComponent.h>
|
||||
|
||||
namespace AZ
|
||||
namespace AZ::NativeUI
|
||||
{
|
||||
using namespace AZ::NativeUI;
|
||||
|
||||
void NativeUISystemComponent::Reflect(AZ::ReflectContext* context)
|
||||
NativeUISystem::NativeUISystem()
|
||||
{
|
||||
if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serialize->Class<NativeUISystemComponent, AZ::Component>()
|
||||
->Version(0)
|
||||
;
|
||||
|
||||
if (AZ::EditContext* ec = serialize->GetEditContext())
|
||||
{
|
||||
ec->Class<NativeUISystemComponent>("NativeUI", "Adds basic support for native (platform specific) UI dialog boxes")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b))
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
;
|
||||
}
|
||||
}
|
||||
NativeUIRequestBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
void NativeUISystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
|
||||
NativeUISystem::~NativeUISystem()
|
||||
{
|
||||
provided.push_back(AZ_CRC("NativeUIService", 0x8ec25f87));
|
||||
NativeUIRequestBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
void NativeUISystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
|
||||
{
|
||||
incompatible.push_back(AZ_CRC("NativeUIService", 0x8ec25f87));
|
||||
}
|
||||
|
||||
void NativeUISystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
|
||||
{
|
||||
(void)required;
|
||||
}
|
||||
|
||||
void NativeUISystemComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
|
||||
{
|
||||
(void)dependent;
|
||||
}
|
||||
|
||||
AssertAction NativeUISystemComponent::DisplayAssertDialog(const AZStd::string& message) const
|
||||
AssertAction NativeUISystem::DisplayAssertDialog(const AZStd::string& message) const
|
||||
{
|
||||
static const char* buttonNames[3] = { "Ignore", "Ignore All", "Break" };
|
||||
AZStd::vector<AZStd::string> options;
|
||||
@@ -80,7 +49,7 @@ namespace AZ
|
||||
return AssertAction::NONE;
|
||||
}
|
||||
|
||||
AZStd::string NativeUISystemComponent::DisplayOkDialog(const AZStd::string& title, const AZStd::string& message, bool showCancel) const
|
||||
AZStd::string NativeUISystem::DisplayOkDialog(const AZStd::string& title, const AZStd::string& message, bool showCancel) const
|
||||
{
|
||||
AZStd::vector<AZStd::string> options;
|
||||
|
||||
@@ -93,7 +62,7 @@ namespace AZ
|
||||
return DisplayBlockingDialog(title, message, options);
|
||||
}
|
||||
|
||||
AZStd::string NativeUISystemComponent::DisplayYesNoDialog(const AZStd::string& title, const AZStd::string& message, bool showCancel) const
|
||||
AZStd::string NativeUISystem::DisplayYesNoDialog(const AZStd::string& title, const AZStd::string& message, bool showCancel) const
|
||||
{
|
||||
AZStd::vector<AZStd::string> options;
|
||||
|
||||
@@ -106,18 +75,4 @@ namespace AZ
|
||||
|
||||
return DisplayBlockingDialog(title, message, options);
|
||||
}
|
||||
|
||||
void NativeUISystemComponent::Init()
|
||||
{
|
||||
}
|
||||
|
||||
void NativeUISystemComponent::Activate()
|
||||
{
|
||||
NativeUIRequestBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
void NativeUISystemComponent::Deactivate()
|
||||
{
|
||||
NativeUIRequestBus::Handler::BusDisconnect();
|
||||
}
|
||||
}
|
||||
} // namespace AZ::NativeUI
|
||||
|
||||
@@ -15,40 +15,24 @@
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzCore/NativeUI/NativeUIRequests.h>
|
||||
|
||||
namespace AZ
|
||||
namespace AZ::NativeUI
|
||||
{
|
||||
namespace NativeUI
|
||||
class NativeUISystem
|
||||
: public NativeUIRequestBus::Handler
|
||||
{
|
||||
class NativeUISystemComponent
|
||||
: public AZ::Component
|
||||
, public NativeUIRequestBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_COMPONENT(NativeUISystemComponent, "{E996C058-4AFE-4C8C-816F-98D864D8576D}");
|
||||
public:
|
||||
AZ_RTTI(NativeUISystem, "{FF534B2C-11BE-4DEA-A5B7-A4FA96FE1EDE}", NativeUIRequests);
|
||||
AZ_CLASS_ALLOCATOR(NativeUISystem, AZ::OSAllocator, 0);
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
NativeUISystem();
|
||||
~NativeUISystem() override;
|
||||
|
||||
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
|
||||
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
|
||||
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
|
||||
static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// NativeUIRequestBus interface implementation
|
||||
AZStd::string DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector<AZStd::string>& options) const override;
|
||||
AZStd::string DisplayOkDialog(const AZStd::string& title, const AZStd::string& message, bool showCancel) const override;
|
||||
AZStd::string DisplayYesNoDialog(const AZStd::string& title, const AZStd::string& message, bool showCancel) const override;
|
||||
AssertAction DisplayAssertDialog(const AZStd::string& message) const override;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
protected:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// AZ::Component interface implementation
|
||||
void Init() override;
|
||||
void Activate() override;
|
||||
void Deactivate() override;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// NativeUIRequestBus interface implementation
|
||||
AZStd::string DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector<AZStd::string>& options) const override;
|
||||
AZStd::string DisplayOkDialog(const AZStd::string& title, const AZStd::string& message, bool showCancel) const override;
|
||||
AZStd::string DisplayYesNoDialog(const AZStd::string& title, const AZStd::string& message, bool showCancel) const override;
|
||||
AssertAction DisplayAssertDialog(const AZStd::string& message) const override;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
} // namespace AZ::NativeUI
|
||||
|
||||
@@ -853,7 +853,7 @@ const char* ScriptSystemComponent::GetGroup() const
|
||||
|
||||
const char* AZ::ScriptSystemComponent::GetBrowserIcon() const
|
||||
{
|
||||
return "Editor/Icons/Components/LuaScript.svg";
|
||||
return "Icons/Components/LuaScript.svg";
|
||||
}
|
||||
|
||||
AZ::Uuid AZ::ScriptSystemComponent::GetComponentTypeId() const
|
||||
|
||||
@@ -118,6 +118,7 @@ namespace AZ
|
||||
const static AZ::Crc32 StringLineEditingCompleteNotify = AZ_CRC("StringLineEditingCompleteNotify", 0x139e5fa9);
|
||||
|
||||
const static AZ::Crc32 NameLabelOverride = AZ_CRC("NameLabelOverride", 0x9ff79cab);
|
||||
const static AZ::Crc32 AssetPickerTitle = AZ_CRC_CE("AssetPickerTitle");
|
||||
const static AZ::Crc32 ChildNameLabelOverride = AZ_CRC("ChildNameLabelOverride", 0x73dd2909);
|
||||
//! Container attribute that is used to override labels for its elements given the index of the element
|
||||
const static AZ::Crc32 IndexedChildNameLabelOverride = AZ_CRC("IndexedChildNameLabelOverride", 0x5f313ac2);
|
||||
|
||||
@@ -10,91 +10,75 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ByteStreamSerializer.h"
|
||||
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/Serialization/Json/ByteStreamSerializer.h>
|
||||
#include <AzCore/Serialization/Json/JsonSerialization.h>
|
||||
#include <AzCore/StringFunc/StringFunc.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace ByteSerializerInternal
|
||||
{
|
||||
static JsonSerializationResult::Result Load(void* outputValue, const rapidjson::Value& inputValue, JsonDeserializerContext& context)
|
||||
{
|
||||
using JsonSerializationResult::Outcomes;
|
||||
using JsonSerializationResult::Tasks;
|
||||
|
||||
AZ_Assert(outputValue, "Expected a valid pointer to load from json value.");
|
||||
|
||||
switch (inputValue.GetType())
|
||||
{
|
||||
case rapidjson::kStringType: {
|
||||
JsonByteStream buffer;
|
||||
if (AZ::StringFunc::Base64::Decode(buffer, inputValue.GetString(), inputValue.GetStringLength()))
|
||||
{
|
||||
JsonByteStream* valAsByteStream = static_cast<JsonByteStream*>(outputValue);
|
||||
*valAsByteStream = AZStd::move(buffer);
|
||||
return context.Report(Tasks::ReadField, Outcomes::Success, "Successfully read ByteStream.");
|
||||
}
|
||||
return context.Report(Tasks::ReadField, Outcomes::Invalid, "Decode of Base64 encoded ByteStream failed.");
|
||||
}
|
||||
case rapidjson::kArrayType:
|
||||
case rapidjson::kObjectType:
|
||||
case rapidjson::kNullType:
|
||||
case rapidjson::kFalseType:
|
||||
case rapidjson::kTrueType:
|
||||
case rapidjson::kNumberType:
|
||||
return context.Report(
|
||||
Tasks::ReadField, Outcomes::Unsupported,
|
||||
"Unsupported type. ByteStream values cannot be read from arrays, objects, nulls, booleans or numbers.");
|
||||
default:
|
||||
return context.Report(Tasks::ReadField, Outcomes::Unknown, "Unknown json type encountered for ByteStream value.");
|
||||
}
|
||||
}
|
||||
|
||||
static JsonSerializationResult::Result StoreWithDefault(
|
||||
rapidjson::Value& outputValue, const void* inputValue, const void* defaultValue, JsonSerializerContext& context)
|
||||
{
|
||||
using JsonSerializationResult::Outcomes;
|
||||
using JsonSerializationResult::Tasks;
|
||||
|
||||
const JsonByteStream& valAsByteStream = *static_cast<const JsonByteStream*>(inputValue);
|
||||
if (context.ShouldKeepDefaults() || !defaultValue || (valAsByteStream != *static_cast<const JsonByteStream*>(defaultValue)))
|
||||
{
|
||||
const auto base64ByteStream = AZ::StringFunc::Base64::Encode(valAsByteStream.data(), valAsByteStream.size());
|
||||
outputValue.SetString(base64ByteStream.c_str(), base64ByteStream.size(), context.GetJsonAllocator());
|
||||
return context.Report(Tasks::WriteValue, Outcomes::Success, "ByteStream successfully stored.");
|
||||
}
|
||||
|
||||
return context.Report(Tasks::WriteValue, Outcomes::DefaultsUsed, "Default ByteStream used.");
|
||||
}
|
||||
} // namespace ByteSerializerInternal
|
||||
|
||||
AZ_CLASS_ALLOCATOR_IMPL(JsonByteStreamSerializer, SystemAllocator, 0);
|
||||
|
||||
JsonSerializationResult::Result JsonByteStreamSerializer::Load(
|
||||
void* outputValue, [[maybe_unused]] const Uuid& outputValueTypeId, const rapidjson::Value& inputValue,
|
||||
JsonDeserializerContext& context)
|
||||
{
|
||||
using JsonSerializationResult::Outcomes;
|
||||
using JsonSerializationResult::Tasks;
|
||||
|
||||
AZ_Assert(
|
||||
azrtti_typeid<JsonByteStream>() == outputValueTypeId,
|
||||
"Unable to deserialize AZStd::vector<AZ::u8>> to json because the provided type is %s",
|
||||
outputValueTypeId.ToString<AZStd::string>().c_str());
|
||||
AZ_Assert(outputValue, "Expected a valid pointer to load from json value.");
|
||||
|
||||
return ByteSerializerInternal::Load(outputValue, inputValue, context);
|
||||
switch (inputValue.GetType())
|
||||
{
|
||||
case rapidjson::kStringType: {
|
||||
JsonByteStream buffer;
|
||||
if (AZ::StringFunc::Base64::Decode(buffer, inputValue.GetString(), inputValue.GetStringLength()))
|
||||
{
|
||||
JsonByteStream* valAsByteStream = static_cast<JsonByteStream*>(outputValue);
|
||||
*valAsByteStream = AZStd::move(buffer);
|
||||
return context.Report(Tasks::ReadField, Outcomes::Success, "Successfully read ByteStream.");
|
||||
}
|
||||
return context.Report(Tasks::ReadField, Outcomes::Invalid, "Decode of Base64 encoded ByteStream failed.");
|
||||
}
|
||||
case rapidjson::kArrayType:
|
||||
case rapidjson::kObjectType:
|
||||
case rapidjson::kNullType:
|
||||
case rapidjson::kFalseType:
|
||||
case rapidjson::kTrueType:
|
||||
case rapidjson::kNumberType:
|
||||
return context.Report(
|
||||
Tasks::ReadField, Outcomes::Unsupported,
|
||||
"Unsupported type. ByteStream values cannot be read from arrays, objects, nulls, booleans or numbers.");
|
||||
default:
|
||||
return context.Report(Tasks::ReadField, Outcomes::Unknown, "Unknown json type encountered for ByteStream value.");
|
||||
}
|
||||
}
|
||||
|
||||
JsonSerializationResult::Result JsonByteStreamSerializer::Store(
|
||||
rapidjson::Value& outputValue, const void* inputValue, const void* defaultValue, [[maybe_unused]] const Uuid& valueTypeId,
|
||||
JsonSerializerContext& context)
|
||||
{
|
||||
using JsonSerializationResult::Outcomes;
|
||||
using JsonSerializationResult::Tasks;
|
||||
|
||||
AZ_Assert(
|
||||
azrtti_typeid<JsonByteStream>() == valueTypeId,
|
||||
"Unable to serialize AZStd::vector<AZ::u8> to json because the provided type is %s",
|
||||
valueTypeId.ToString<AZStd::string>().c_str());
|
||||
|
||||
return ByteSerializerInternal::StoreWithDefault(outputValue, inputValue, defaultValue, context);
|
||||
const JsonByteStream& valAsByteStream = *static_cast<const JsonByteStream*>(inputValue);
|
||||
if (context.ShouldKeepDefaults() || !defaultValue || (valAsByteStream != *static_cast<const JsonByteStream*>(defaultValue)))
|
||||
{
|
||||
const auto base64ByteStream = AZ::StringFunc::Base64::Encode(valAsByteStream.data(), valAsByteStream.size());
|
||||
outputValue.SetString(base64ByteStream.c_str(), base64ByteStream.size(), context.GetJsonAllocator());
|
||||
return context.Report(Tasks::WriteValue, Outcomes::Success, "ByteStream successfully stored.");
|
||||
}
|
||||
|
||||
return context.Report(Tasks::WriteValue, Outcomes::DefaultsUsed, "Default ByteStream used.");
|
||||
}
|
||||
} // namespace AZ
|
||||
|
||||
@@ -104,13 +104,12 @@ namespace AZ
|
||||
auto serializer = context.GetRegistrationContext()->GetSerializerForType(classData.m_typeId);
|
||||
if (serializer)
|
||||
{
|
||||
if (storeTypeId == StoreTypeId::Yes)
|
||||
ResultCode result = serializer->Store(node, object, defaultObject, classData.m_typeId, context);
|
||||
if (storeTypeId == StoreTypeId::Yes && result.GetProcessing() != Processing::Halted)
|
||||
{
|
||||
return context.Report(Tasks::WriteValue, Outcomes::Catastrophic,
|
||||
"Unable to store type information in a JSON Serializer primitive.");
|
||||
result.Combine(InsertTypeId(node, classData, context));
|
||||
}
|
||||
|
||||
return serializer->Store(node, object, defaultObject, classData.m_typeId, context);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (classData.m_azRtti && (classData.m_azRtti->GetTypeTraits() & AZ::TypeTraits::is_enum) == AZ::TypeTraits::is_enum)
|
||||
@@ -128,13 +127,12 @@ namespace AZ
|
||||
serializer = context.GetRegistrationContext()->GetSerializerForType(classData.m_azRtti->GetGenericTypeId());
|
||||
if (serializer)
|
||||
{
|
||||
if (storeTypeId == StoreTypeId::Yes)
|
||||
ResultCode result = serializer->Store(node, object, defaultObject, classData.m_typeId, context);
|
||||
if (storeTypeId == StoreTypeId::Yes && result.GetProcessing() != Processing::Halted)
|
||||
{
|
||||
return context.Report(Tasks::WriteValue, Outcomes::Catastrophic,
|
||||
"Unable to store type information in a JSON Serializer primitive.");
|
||||
result.Combine(InsertTypeId(node, classData, context));
|
||||
}
|
||||
|
||||
return serializer->Store(node, object, defaultObject, classData.m_typeId, context);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,6 +147,7 @@ namespace AZ
|
||||
ResultCode result(Tasks::WriteValue);
|
||||
if (storeTypeId == StoreTypeId::Yes)
|
||||
{
|
||||
// Not using InsertTypeId here to avoid needing to create the temporary value and swap it in that call.
|
||||
node.AddMember(rapidjson::StringRef(JsonSerialization::TypeIdFieldIdentifier),
|
||||
StoreTypeName(classData, context), context.GetJsonAllocator());
|
||||
result = ResultCode(Tasks::WriteValue, Outcomes::Success);
|
||||
@@ -569,6 +568,31 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
JsonSerializationResult::ResultCode JsonSerializer::InsertTypeId(
|
||||
rapidjson::Value& output, const SerializeContext::ClassData& classData, JsonSerializerContext& context)
|
||||
{
|
||||
using namespace JsonSerializationResult;
|
||||
|
||||
if (output.IsObject())
|
||||
{
|
||||
rapidjson::Value insertedObject(rapidjson::kObjectType);
|
||||
insertedObject.AddMember(
|
||||
rapidjson::StringRef(JsonSerialization::TypeIdFieldIdentifier), StoreTypeName(classData, context),
|
||||
context.GetJsonAllocator());
|
||||
|
||||
for (auto& element : output.GetObject())
|
||||
{
|
||||
insertedObject.AddMember(AZStd::move(element.name), AZStd::move(element.value), context.GetJsonAllocator());
|
||||
}
|
||||
output = AZStd::move(insertedObject);
|
||||
return ResultCode(Tasks::WriteValue, Outcomes::Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
return context.Report(Tasks::WriteValue, Outcomes::Catastrophic, "Only able to store type information in a JSON Object.");
|
||||
}
|
||||
}
|
||||
|
||||
rapidjson::Value JsonSerializer::GetExplicitDefault()
|
||||
{
|
||||
return rapidjson::Value(rapidjson::kObjectType);
|
||||
|
||||
@@ -80,6 +80,9 @@ namespace AZ
|
||||
static JsonSerializationResult::ResultCode StoreTypeName(rapidjson::Value& output,
|
||||
const Uuid& typeId, JsonSerializerContext& context);
|
||||
|
||||
static JsonSerializationResult::ResultCode InsertTypeId(
|
||||
rapidjson::Value& output, const SerializeContext::ClassData& classData, JsonSerializerContext& context);
|
||||
|
||||
static rapidjson::Value GetExplicitDefault();
|
||||
};
|
||||
} // namespace AZ
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace AZ
|
||||
|
||||
//! Remove the value at the provided path
|
||||
//! @param path The path to a value that should be removed
|
||||
//! @return Whether or not the value was stored at the provided path. An invalid path will return false;
|
||||
//! @return Whether or not the path was found and removed. An invalid path will return false;
|
||||
virtual bool Remove(AZStd::string_view path) = 0;
|
||||
|
||||
//! Structure which contains configuration settings for how to parse a single command line argument
|
||||
|
||||
@@ -32,17 +32,12 @@
|
||||
namespace AZ::Internal
|
||||
{
|
||||
AZ::SettingsRegistryInterface::FixedValueString GetEngineMonikerForProject(
|
||||
SettingsRegistryInterface& settingsRegistry, const AZ::IO::FixedMaxPath& projectPath)
|
||||
SettingsRegistryInterface& settingsRegistry, const AZ::IO::FixedMaxPath& projectJsonPath)
|
||||
{
|
||||
// projectPath needs to be an absolute path here.
|
||||
using namespace AZ::SettingsRegistryMergeUtils;
|
||||
bool projectJsonMerged = false;
|
||||
auto projectJsonPath = projectPath / "project.json";
|
||||
if (AZ::IO::SystemFile::Exists(projectJsonPath.c_str()))
|
||||
{
|
||||
projectJsonMerged = settingsRegistry.MergeSettingsFile(
|
||||
projectJsonPath.Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch, ProjectSettingsRootKey);
|
||||
}
|
||||
bool projectJsonMerged = settingsRegistry.MergeSettingsFile(
|
||||
projectJsonPath.Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch, ProjectSettingsRootKey);
|
||||
|
||||
AZ::SettingsRegistryInterface::FixedValueString engineMoniker;
|
||||
if (projectJsonMerged)
|
||||
@@ -105,12 +100,12 @@ namespace AZ::Internal
|
||||
|
||||
const auto engineMonikerKey = AZ::SettingsRegistryInterface::FixedValueString::format("%s/engine_name", EngineSettingsRootKey);
|
||||
|
||||
AZStd::set<AZ::IO::FixedMaxPath> projectPathsNotFound;
|
||||
|
||||
for (EngineInfo& engineInfo : pathVisitor.m_enginePaths)
|
||||
{
|
||||
AZ::IO::FixedMaxPath engineSettingsPath{engineInfo.m_path};
|
||||
engineSettingsPath /= "engine.json";
|
||||
|
||||
if (AZ::IO::SystemFile::Exists(engineSettingsPath.c_str()))
|
||||
if (auto engineSettingsPath = AZ::IO::FixedMaxPath{engineInfo.m_path} / "engine.json";
|
||||
AZ::IO::SystemFile::Exists(engineSettingsPath.c_str()))
|
||||
{
|
||||
if (settingsRegistry.MergeSettingsFile(
|
||||
engineSettingsPath.Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch, EngineSettingsRootKey))
|
||||
@@ -119,12 +114,61 @@ namespace AZ::Internal
|
||||
}
|
||||
}
|
||||
|
||||
auto engineMoniker = Internal::GetEngineMonikerForProject(settingsRegistry, engineInfo.m_path / projectPath);
|
||||
if (!engineMoniker.empty() && engineMoniker == engineInfo.m_moniker)
|
||||
if (auto projectJsonPath = (engineInfo.m_path / projectPath / "project.json").LexicallyNormal();
|
||||
AZ::IO::SystemFile::Exists(projectJsonPath.c_str()))
|
||||
{
|
||||
engineRoot = engineInfo.m_path;
|
||||
break;
|
||||
if (auto engineMoniker = Internal::GetEngineMonikerForProject(settingsRegistry, projectJsonPath);
|
||||
!engineMoniker.empty() && engineMoniker == engineInfo.m_moniker)
|
||||
{
|
||||
engineRoot = engineInfo.m_path;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
projectPathsNotFound.insert(projectJsonPath);
|
||||
}
|
||||
|
||||
// Continue looking for candidates, remove the previous engine and project settings that were merged above.
|
||||
settingsRegistry.Remove(ProjectSettingsRootKey);
|
||||
settingsRegistry.Remove(EngineSettingsRootKey);
|
||||
}
|
||||
|
||||
if (engineRoot.empty())
|
||||
{
|
||||
AZStd::string errorStr;
|
||||
if (!projectPathsNotFound.empty())
|
||||
{
|
||||
// This case is usually encountered when a project path is given as a relative path,
|
||||
// which is assumed to be relative to an engine root.
|
||||
// When no project.json files are found this way, dump this error message about
|
||||
// which project paths were checked.
|
||||
AZStd::string projectPathsTested;
|
||||
for (const auto& path : projectPathsNotFound)
|
||||
{
|
||||
projectPathsTested.append(AZStd::string::format(" %s\n", path.c_str()));
|
||||
}
|
||||
errorStr = AZStd::string::format("No valid project was found at these locations:\n%s"
|
||||
"Please supply a valid --project-path to the application.",
|
||||
projectPathsTested.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
// The other case is that a project.json was found, but after checking all the registered engines
|
||||
// none of them matched the engine moniker.
|
||||
AZStd::string enginePathsChecked;
|
||||
for (const auto& engineInfo : pathVisitor.m_enginePaths)
|
||||
{
|
||||
enginePathsChecked.append(AZStd::string::format(" %s (%s)\n", engineInfo.m_path.c_str(), engineInfo.m_moniker.c_str()));
|
||||
}
|
||||
errorStr = AZStd::string::format(
|
||||
"No engine was found in o3de_manifest.json with a name that matches the one set in the project.json.\n"
|
||||
"Engines that were checked:\n%s"
|
||||
"Please check that your engine and project have both been registered with scripts/o3de.py.", enginePathsChecked.c_str()
|
||||
);
|
||||
}
|
||||
|
||||
settingsRegistry.Set(FilePathKey_ErrorText, errorStr.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +202,7 @@ namespace AZ::Internal
|
||||
return {};
|
||||
}
|
||||
|
||||
void InjectSettingToCommandLineFront(AZ::SettingsRegistryInterface& settingsRegistry,
|
||||
void InjectSettingToCommandLineBack(AZ::SettingsRegistryInterface& settingsRegistry,
|
||||
AZStd::string_view path, AZStd::string_view value)
|
||||
{
|
||||
AZ::CommandLine commandLine;
|
||||
@@ -168,7 +212,7 @@ namespace AZ::Internal
|
||||
|
||||
auto projectPathOverride = AZStd::string::format(R"(--regset="%.*s=%.*s")",
|
||||
aznumeric_cast<int>(path.size()), path.data(), aznumeric_cast<int>(value.size()), value.data());
|
||||
paramContainer.emplace(paramContainer.begin(), AZStd::move(projectPathOverride));
|
||||
paramContainer.emplace(paramContainer.end(), AZStd::move(projectPathOverride));
|
||||
commandLine.Parse(paramContainer);
|
||||
AZ::SettingsRegistryMergeUtils::StoreCommandLineToRegistry(settingsRegistry, commandLine);
|
||||
}
|
||||
@@ -197,8 +241,8 @@ namespace AZ::SettingsRegistryMergeUtils
|
||||
if (!engineRoot.empty())
|
||||
{
|
||||
settingsRegistry.Set(engineRootKey, engineRoot.Native());
|
||||
// Inject the engine root into the front of the command line settings
|
||||
Internal::InjectSettingToCommandLineFront(settingsRegistry, engineRootKey, engineRoot.Native());
|
||||
// Inject the engine root at the end of the command line settings
|
||||
Internal::InjectSettingToCommandLineBack(settingsRegistry, engineRootKey, engineRoot.Native());
|
||||
return engineRoot;
|
||||
}
|
||||
}
|
||||
@@ -244,8 +288,8 @@ namespace AZ::SettingsRegistryMergeUtils
|
||||
if (!projectRoot.empty())
|
||||
{
|
||||
settingsRegistry.Set(projectRootKey, projectRoot.c_str());
|
||||
// Inject the project root into the front of the command line settings
|
||||
Internal::InjectSettingToCommandLineFront(settingsRegistry, projectRootKey, projectRoot.Native());
|
||||
// Inject the project root at the end of the command line settings
|
||||
Internal::InjectSettingToCommandLineBack(settingsRegistry, projectRootKey, projectRoot.Native());
|
||||
return projectRoot;
|
||||
}
|
||||
}
|
||||
@@ -654,7 +698,6 @@ namespace AZ::SettingsRegistryMergeUtils
|
||||
if (registry.Get(engineRootPath, FilePathKey_EngineRootFolder))
|
||||
{
|
||||
AZ::IO::FixedMaxPath mergePath{ AZStd::move(engineRootPath) };
|
||||
mergePath /= "Engine";
|
||||
mergePath /= SettingsRegistryInterface::RegistryFolder;
|
||||
registry.MergeSettingsFolder(mergePath.Native(), specializations, platform, "", scratchBuffer);
|
||||
}
|
||||
@@ -875,6 +918,49 @@ namespace AZ::SettingsRegistryMergeUtils
|
||||
return true;
|
||||
}
|
||||
|
||||
void ParseCommandLine(AZ::CommandLine& commandLine)
|
||||
{
|
||||
struct OptionKeyToRegsetKey
|
||||
{
|
||||
AZStd::string_view m_optionKey;
|
||||
AZStd::string m_regsetKey;
|
||||
};
|
||||
|
||||
// Provide overrides for the engine root, the project root and the project cache root
|
||||
AZStd::array commandOptions = {
|
||||
OptionKeyToRegsetKey{
|
||||
"engine-path", AZStd::string::format("%s/engine_path", AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey)},
|
||||
OptionKeyToRegsetKey{
|
||||
"project-path", AZStd::string::format("%s/project_path", AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey)},
|
||||
OptionKeyToRegsetKey{
|
||||
"project-cache-path",
|
||||
AZStd::string::format("%s/project_cache_path", AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey)}};
|
||||
|
||||
AZStd::fixed_vector<AZStd::string, commandOptions.size()> overrideArgs;
|
||||
|
||||
for (auto&& [optionKey, regsetKey] : commandOptions)
|
||||
{
|
||||
if (size_t optionCount = commandLine.GetNumSwitchValues(optionKey); optionCount > 0)
|
||||
{
|
||||
// Use the last supplied command option value to override previous values
|
||||
auto overrideArg = AZStd::string::format(
|
||||
R"(--regset="%s=%s")", regsetKey.c_str(), commandLine.GetSwitchValue(optionKey, optionCount - 1).c_str());
|
||||
overrideArgs.emplace_back(AZStd::move(overrideArg));
|
||||
}
|
||||
}
|
||||
|
||||
if (!overrideArgs.empty())
|
||||
{
|
||||
// Dump the input command line, add the additional option overrides
|
||||
// and Parse the new command line args (write back) into the input command line.
|
||||
AZ::CommandLine::ParamContainer commandLineArgs;
|
||||
commandLine.Dump(commandLineArgs);
|
||||
commandLineArgs.insert(
|
||||
commandLineArgs.end(), AZStd::make_move_iterator(overrideArgs.begin()), AZStd::make_move_iterator(overrideArgs.end()));
|
||||
commandLine.Parse(commandLineArgs);
|
||||
}
|
||||
}
|
||||
|
||||
bool DumpSettingsRegistryToStream(SettingsRegistryInterface& registry, AZStd::string_view key,
|
||||
AZ::IO::GenericStream& stream, const DumperSettings& dumperSettings)
|
||||
{
|
||||
|
||||
@@ -55,6 +55,9 @@ namespace AZ::SettingsRegistryMergeUtils
|
||||
//! Development write storage path may be considered temporary or cache storage on some platforms
|
||||
inline static constexpr char FilePathKey_DevWriteStorage[] = "/Amazon/AzCore/Runtime/FilePaths/DevWriteStorage";
|
||||
|
||||
//! Stores error text regarding engine boot sequence when engine and project roots cannot be determined
|
||||
inline static constexpr char FilePathKey_ErrorText[] = "/Amazon/AzCore/Runtime/FilePaths/ErrorText";
|
||||
|
||||
//! Root key for where command line are stored at within the settings registry
|
||||
inline static constexpr char CommandLineRootKey[] = "/Amazon/AzCore/Runtime/CommandLine";
|
||||
//! Key set to trigger a notification that the CommandLine has been stored within the settings registry
|
||||
@@ -219,6 +222,9 @@ namespace AZ::SettingsRegistryMergeUtils
|
||||
//! into the AZ::CommandLine instance
|
||||
bool GetCommandLineFromRegistry(SettingsRegistryInterface& registry, AZ::CommandLine& commandLine);
|
||||
|
||||
//! Parse a CommandLine and transform certain options into formal "regset" options
|
||||
void ParseCommandLine(AZ::CommandLine& commandLine);
|
||||
|
||||
//! Structure for configuring how values should be dumped from the Settings Registry
|
||||
struct DumperSettings
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace AZ
|
||||
{
|
||||
namespace NativeUI
|
||||
{
|
||||
AZStd::string NativeUISystemComponent::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector<AZStd::string>& options) const
|
||||
AZStd::string NativeUISystem::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector<AZStd::string>& options) const
|
||||
{
|
||||
AZ::Android::JNI::Object object("com/amazon/lumberyard/NativeUI/LumberyardNativeUI");
|
||||
object.RegisterStaticMethod("DisplayDialog", "(Landroid/app/Activity;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V");
|
||||
|
||||
@@ -12,16 +12,11 @@
|
||||
|
||||
#include <AzCore/NativeUI/NativeUISystemComponent.h>
|
||||
|
||||
namespace AZ
|
||||
namespace AZ::NativeUI
|
||||
{
|
||||
namespace NativeUI
|
||||
AZStd::string NativeUISystem::DisplayBlockingDialog([[maybe_unused]] const AZStd::string& title, [[maybe_unused]] const AZStd::string& message,
|
||||
[[maybe_unused]] const AZStd::vector<AZStd::string>& options) const
|
||||
{
|
||||
AZStd::string NativeUISystemComponent::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector<AZStd::string>& options) const
|
||||
{
|
||||
AZ_UNUSED(title);
|
||||
AZ_UNUSED(message);
|
||||
AZ_UNUSED(options);
|
||||
return "";
|
||||
}
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace AZ
|
||||
{
|
||||
namespace NativeUI
|
||||
{
|
||||
AZStd::string NativeUISystemComponent::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector<AZStd::string>& options) const
|
||||
AZStd::string NativeUISystem::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector<AZStd::string>& options) const
|
||||
{
|
||||
__block NSModalResponse response = -1;
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ namespace AZ
|
||||
{
|
||||
namespace NativeUI
|
||||
{
|
||||
AZStd::string NativeUISystemComponent::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector<AZStd::string>& options) const
|
||||
AZStd::string NativeUISystem::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector<AZStd::string>& options) const
|
||||
{
|
||||
if (options.size() >= MAX_ITEMS)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace AZ
|
||||
{
|
||||
namespace NativeUI
|
||||
{
|
||||
AZStd::string NativeUISystemComponent::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector<AZStd::string>& options) const
|
||||
AZStd::string NativeUISystem::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector<AZStd::string>& options) const
|
||||
{
|
||||
__block AZStd::string userSelection = "";
|
||||
|
||||
|
||||
@@ -449,6 +449,46 @@ namespace JsonSerializationTests
|
||||
|
||||
}
|
||||
|
||||
TEST_F(JsonSerializationTests, Load_PrimitiveForInheritedClass_LoadsCorrectClass)
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
using namespace ::testing;
|
||||
|
||||
AZStd::string json = AZStd::string::format(R"(
|
||||
{
|
||||
"%s": "SimpleInheritence",
|
||||
"base_var": -88.0,
|
||||
"var1": 88,
|
||||
"var2": 42
|
||||
})",
|
||||
AZ::JsonSerialization::TypeIdFieldIdentifier);
|
||||
m_jsonDocument->Parse(json.c_str());
|
||||
|
||||
SimpleInheritence::Reflect(m_serializeContext, true);
|
||||
m_serializeContext->RegisterGenericType<AZStd::unique_ptr<BaseClass>>();
|
||||
m_jsonRegistrationContext->Serializer<JsonSerializerMock>()->HandlesType<SimpleInheritence>();
|
||||
JsonSerializerMock* mock =
|
||||
reinterpret_cast<JsonSerializerMock*>(m_jsonRegistrationContext->GetSerializerForType(azrtti_typeid<SimpleInheritence>()));
|
||||
EXPECT_CALL(*mock, Load(_, _, _, _))
|
||||
.Times(Exactly(1))
|
||||
.WillRepeatedly(Return(Result(m_deserializationSettings->m_reporting, "Test", Tasks::ReadField, Outcomes::Success, "")));
|
||||
|
||||
AZStd::unique_ptr<BaseClass> instance;
|
||||
ResultCode result = AZ::JsonSerialization::Load(instance, *m_jsonDocument, *m_deserializationSettings);
|
||||
EXPECT_NE(Processing::Halted, result.GetProcessing());
|
||||
|
||||
EXPECT_EQ(azrtti_typeid<SimpleInheritence>(), azrtti_typeid(*instance));
|
||||
|
||||
m_serializeContext->EnableRemoveReflection();
|
||||
SimpleInheritence::Reflect(m_serializeContext, true);
|
||||
m_serializeContext->DisableRemoveReflection();
|
||||
|
||||
m_jsonRegistrationContext->EnableRemoveReflection();
|
||||
m_serializeContext->RegisterGenericType<AZStd::unique_ptr<BaseClass>>();
|
||||
m_jsonRegistrationContext->Serializer<JsonSerializerMock>()->HandlesType<SimpleInheritence>();
|
||||
m_jsonRegistrationContext->DisableRemoveReflection();
|
||||
}
|
||||
|
||||
TEST_F(JsonSerializationTests, Store_TemplatedClassWithRegisteredHandler_StoreOnHandlerCalled)
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
@@ -474,6 +514,52 @@ namespace JsonSerializationTests
|
||||
m_jsonRegistrationContext->DisableRemoveReflection();
|
||||
}
|
||||
|
||||
TEST_F(JsonSerializationTests, Store_PrimitiveForInheritedClass_StoreSucceedsAndTypeIdIsAdded)
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
using namespace ::testing;
|
||||
|
||||
SimpleInheritence::Reflect(m_serializeContext, true);
|
||||
m_serializeContext->RegisterGenericType<AZStd::unique_ptr<BaseClass>>();
|
||||
m_jsonRegistrationContext->Serializer<JsonSerializerMock>()->HandlesType<SimpleInheritence>();
|
||||
JsonSerializerMock* mock =
|
||||
reinterpret_cast<JsonSerializerMock*>(m_jsonRegistrationContext->GetSerializerForType(azrtti_typeid<SimpleInheritence>()));
|
||||
EXPECT_CALL(*mock, Store(_, _, _, _, _))
|
||||
.Times(Exactly(1))
|
||||
.WillRepeatedly(Invoke([](rapidjson::Value& output, const void*, const void*, const AZ::Uuid&, AZ::JsonSerializerContext& context)
|
||||
{
|
||||
// Insert some values to allow verification later on.
|
||||
output.SetObject();
|
||||
output.AddMember("base_var", -88.0, context.GetJsonAllocator());
|
||||
output.AddMember("var1", 88, context.GetJsonAllocator());
|
||||
output.AddMember("var2", 42, context.GetJsonAllocator());
|
||||
return context.Report(Tasks::WriteValue, Outcomes::Success, "");
|
||||
}));
|
||||
|
||||
AZStd::unique_ptr<BaseClass> instance{ aznew SimpleInheritence() };
|
||||
ResultCode result = AZ::JsonSerialization::Store(*m_jsonDocument, m_jsonDocument->GetAllocator(), instance, *m_serializationSettings);
|
||||
EXPECT_NE(Processing::Halted, result.GetProcessing());
|
||||
|
||||
AZStd::string compare = AZStd::string::format(R"(
|
||||
{
|
||||
"%s": "SimpleInheritence",
|
||||
"base_var": -88.0,
|
||||
"var1": 88,
|
||||
"var2": 42
|
||||
})",
|
||||
AZ::JsonSerialization::TypeIdFieldIdentifier);
|
||||
Expect_DocStrEq(compare.c_str());
|
||||
|
||||
m_serializeContext->EnableRemoveReflection();
|
||||
m_serializeContext->RegisterGenericType<AZStd::unique_ptr<BaseClass>>();
|
||||
SimpleInheritence::Reflect(m_serializeContext, true);
|
||||
m_serializeContext->DisableRemoveReflection();
|
||||
|
||||
m_jsonRegistrationContext->EnableRemoveReflection();
|
||||
m_jsonRegistrationContext->Serializer<JsonSerializerMock>()->HandlesType<SimpleInheritence>();
|
||||
m_jsonRegistrationContext->DisableRemoveReflection();
|
||||
}
|
||||
|
||||
TEST_F(JsonSerializationTests, Store_StoreWithNullPtr_ReturnsCatastrophic)
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace AzFramework
|
||||
}
|
||||
|
||||
// Initializes the IArchive for reading archive(.pak) files
|
||||
if (auto archive = AZ::Interface<AZ::IO::IArchive>::Get(); !archive)
|
||||
if (auto archive = AZ::Interface<AZ::IO::IArchive>::Get(); archive == nullptr)
|
||||
{
|
||||
m_archive = AZStd::make_unique<AZ::IO::Archive>();
|
||||
AZ::Interface<AZ::IO::IArchive>::Register(m_archive.get());
|
||||
@@ -189,6 +189,12 @@ namespace AzFramework
|
||||
SetFileIOAliases();
|
||||
}
|
||||
|
||||
if (auto nativeUI = AZ::Interface<AZ::NativeUI::NativeUIRequests>::Get(); nativeUI == nullptr)
|
||||
{
|
||||
m_nativeUI = AZStd::make_unique<AZ::NativeUI::NativeUISystem>();
|
||||
AZ::Interface<AZ::NativeUI::NativeUIRequests>::Register(m_nativeUI.get());
|
||||
}
|
||||
|
||||
ApplicationRequests::Bus::Handler::BusConnect();
|
||||
AZ::UserSettingsFileLocatorBus::Handler::BusConnect();
|
||||
NetSystemRequestBus::Handler::BusConnect();
|
||||
@@ -205,12 +211,17 @@ namespace AzFramework
|
||||
AZ::UserSettingsFileLocatorBus::Handler::BusDisconnect();
|
||||
ApplicationRequests::Bus::Handler::BusDisconnect();
|
||||
|
||||
if (AZ::Interface<AZ::NativeUI::NativeUIRequests>::Get() == m_nativeUI.get())
|
||||
{
|
||||
AZ::Interface<AZ::NativeUI::NativeUIRequests>::Unregister(m_nativeUI.get());
|
||||
}
|
||||
m_nativeUI.reset();
|
||||
|
||||
// Unset the Archive file IO if it is set as the direct instance
|
||||
if (AZ::IO::FileIOBase::GetInstance() == m_archiveFileIO.get())
|
||||
{
|
||||
AZ::IO::FileIOBase::SetInstance(nullptr);
|
||||
}
|
||||
|
||||
m_archiveFileIO.reset();
|
||||
|
||||
// Destroy the IArchive instance
|
||||
@@ -303,7 +314,6 @@ namespace AzFramework
|
||||
azrtti_typeid<AZ::AssetManagerComponent>(),
|
||||
azrtti_typeid<AZ::UserSettingsComponent>(),
|
||||
azrtti_typeid<AZ::Debug::FrameProfilerComponent>(),
|
||||
azrtti_typeid<AZ::NativeUI::NativeUISystemComponent>(),
|
||||
azrtti_typeid<AZ::SliceComponent>(),
|
||||
azrtti_typeid<AZ::SliceSystemComponent>(),
|
||||
|
||||
@@ -372,7 +382,6 @@ namespace AzFramework
|
||||
azrtti_typeid<AZ::UserSettingsComponent>(),
|
||||
azrtti_typeid<AZ::ScriptSystemComponent>(),
|
||||
azrtti_typeid<AZ::JobManagerComponent>(),
|
||||
azrtti_typeid<AZ::NativeUI::NativeUISystemComponent>(),
|
||||
azrtti_typeid<AZ::SliceSystemComponent>(),
|
||||
|
||||
azrtti_typeid<AzFramework::AssetCatalogComponent>(),
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <AzCore/Component/ComponentApplication.h>
|
||||
#include <AzCore/UserSettings/UserSettings.h>
|
||||
#include <AzCore/Math/Uuid.h>
|
||||
#include <AzCore/NativeUI/NativeUIRequests.h>
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
#include <AzCore/std/smart_ptr/unique_ptr.h>
|
||||
#include <AzCore/std/string/fixed_string.h>
|
||||
@@ -187,6 +188,7 @@ namespace AzFramework
|
||||
AZStd::unique_ptr<AZ::IO::FileIOBase> m_archiveFileIO; ///> The Default file IO instance is a ArchiveFileIO.
|
||||
AZStd::unique_ptr<AZ::IO::Archive> m_archive; ///> The AZ::IO::Instance
|
||||
AZStd::unique_ptr<Implementation> m_pimpl;
|
||||
AZStd::unique_ptr<AZ::NativeUI::NativeUIRequests> m_nativeUI;
|
||||
bool m_ownsConsole = false;
|
||||
|
||||
bool m_exitMainLoopRequested = false;
|
||||
|
||||
@@ -809,7 +809,7 @@ namespace AzFramework
|
||||
#if defined(AZ_ENABLE_TRACING)
|
||||
if (message.m_assetType == AZ::Data::s_invalidAssetType)
|
||||
{
|
||||
AZ_TracePrintf("AssetCatalog", "Registering asset \"%s\" via AssetSystem message, but type is not set.", relativePath.c_str());
|
||||
AZ_TracePrintf("AssetCatalog", "Registering asset \"%s\" via AssetSystem message, but type is not set.\n", relativePath.c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace AzFramework
|
||||
{
|
||||
// Read the wait for connection boolean from the Settings Registry
|
||||
AZ::s64 waitForConnect64{};
|
||||
if (!AZ::SettingsRegistryMergeUtils::PlatformGet(*settingsRegistry, waitForConnect64, AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey, AzFramework::AssetSystem::WaitForConnect))
|
||||
if (AZ::SettingsRegistryMergeUtils::PlatformGet(*settingsRegistry, waitForConnect64, AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey, AzFramework::AssetSystem::WaitForConnect))
|
||||
{
|
||||
outputConnectionSettings.m_waitForConnect = waitForConnect64 != 0;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
#include <AzCore/Debug/Trace.h>
|
||||
#include <AzFramework/Scene/Scene.h>
|
||||
#include <AzFramework/Scene/SceneSystemBus.h>
|
||||
#include <AzFramework/Scene/SceneSystemInterface.h>
|
||||
#include <AzFramework/Entity/GameEntityContextComponent.h>
|
||||
|
||||
namespace AzFramework
|
||||
@@ -50,36 +50,34 @@ namespace AzFramework
|
||||
|
||||
void AzFrameworkConfigurationSystemComponent::Activate()
|
||||
{
|
||||
// Create the defaults scene and associate the GameEntityContext with it.
|
||||
AZ::Outcome<Scene*, AZStd::string> createSceneOutcome = AZ::Failure<AZStd::string>("SceneSystemRequests bus not responding.");
|
||||
SceneSystemRequestBus::BroadcastResult(createSceneOutcome, &AzFramework::SceneSystemRequests::CreateScene, "default");
|
||||
AZ::Outcome<AZStd::shared_ptr<Scene>, AZStd::string> createSceneOutcome =
|
||||
SceneSystemInterface::Get()->CreateScene(Scene::MainSceneName);
|
||||
if (createSceneOutcome)
|
||||
{
|
||||
Scene* scene = createSceneOutcome.GetValue();
|
||||
bool success = false;
|
||||
EntityContextId gameEntityContextId = EntityContextId::CreateNull();
|
||||
GameEntityContextRequestBus::BroadcastResult(gameEntityContextId, &GameEntityContextRequests::GetGameEntityContextId);
|
||||
|
||||
if (!gameEntityContextId.IsNull())
|
||||
AZStd::shared_ptr<Scene> scene = createSceneOutcome.TakeValue();
|
||||
EntityContext* gameEntityContext = nullptr;
|
||||
GameEntityContextRequestBus::BroadcastResult(gameEntityContext, &GameEntityContextRequests::GetGameEntityContextInstance);
|
||||
if (gameEntityContext != nullptr)
|
||||
{
|
||||
SceneSystemRequestBus::BroadcastResult(success, &AzFramework::SceneSystemRequests::SetSceneForEntityContextId, gameEntityContextId, scene);
|
||||
[[maybe_unused]] bool result = scene->SetSubsystem<EntityContext::SceneStorageType&>(gameEntityContext);
|
||||
AZ_Assert(result, "Unable to register main entity context with the main scene.");
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Assert(false, "Unable to retrieve the game entity context instance.");
|
||||
}
|
||||
AZ_Assert(success, "The application was unable to setup a scene for the game entity context, this should always work");
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Assert(false, "%s", createSceneOutcome.GetError().data());
|
||||
AZ_Assert(false, "Unable to create main scene due to: %s", createSceneOutcome.GetError().c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void AzFrameworkConfigurationSystemComponent::Deactivate()
|
||||
{
|
||||
bool success = false;
|
||||
SceneSystemRequestBus::BroadcastResult(
|
||||
success, &AzFramework::SceneSystemRequestBus::Events::RemoveScene, "default");
|
||||
|
||||
AZ_Assert(success, "\"default\" scene was not removed");
|
||||
[[maybe_unused]] bool success = SceneSystemInterface::Get()->RemoveScene(Scene::MainSceneName);
|
||||
AZ_Assert(success, "Unable to remove the main scene.");
|
||||
}
|
||||
|
||||
void AzFrameworkConfigurationSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
#include <AzCore/Debug/Profiler.h>
|
||||
#include <AzCore/std/containers/stack.h>
|
||||
#include <AzFramework/Scene/Scene.h>
|
||||
#include <AzFramework/Scene/SceneSystemInterface.h>
|
||||
|
||||
#include "EntityContext.h"
|
||||
|
||||
@@ -37,6 +39,30 @@ namespace AzFramework
|
||||
}
|
||||
}
|
||||
|
||||
AZStd::shared_ptr<Scene> EntityContext::FindContainingScene(const EntityContextId& contextId)
|
||||
{
|
||||
auto sceneSystem = SceneSystemInterface::Get();
|
||||
AZ_Assert(sceneSystem, "Attempting to retrieve the scene containing a entity context before the scene system is available.");
|
||||
|
||||
AZStd::shared_ptr<Scene> result;
|
||||
sceneSystem->IterateActiveScenes([&result, &contextId](const AZStd::shared_ptr<Scene>& scene)
|
||||
{
|
||||
EntityContext** entityContext = scene->FindSubsystemInScene<EntityContext::SceneStorageType>();
|
||||
if (entityContext && (*entityContext)->GetContextId() == contextId)
|
||||
{
|
||||
result = scene;
|
||||
// Result found, returning.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No match, continuing to search for containing scene.
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// EntityContext ctor
|
||||
//=========================================================================
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <AzCore/Component/EntityBus.h>
|
||||
#include <AzCore/Serialization/ObjectStream.h>
|
||||
#include <AzCore/Serialization/IdUtils.h>
|
||||
#include <AzCore/std/smart_ptr/shared_ptr.h>
|
||||
#include <AzFramework/Entity/EntityContextBus.h>
|
||||
#include <AzFramework/Entity/SliceEntityOwnershipService.h>
|
||||
|
||||
@@ -27,7 +28,7 @@ namespace AZ
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
class EntityContext;
|
||||
class Scene;
|
||||
|
||||
/**
|
||||
* Provides services for a group of entities under the umbrella of a given context.
|
||||
@@ -47,9 +48,11 @@ namespace AzFramework
|
||||
, public EntityOwnershipServiceNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
|
||||
AZ_TYPE_INFO(EntityContext, "{4F98A6B9-C7B5-450E-8A8A-30EEFC411EF5}");
|
||||
|
||||
/// The type used to store entity in AzFramework::Scene.
|
||||
using SceneStorageType = EntityContext*;
|
||||
|
||||
EntityContext(AZ::SerializeContext* serializeContext = nullptr);
|
||||
EntityContext(const EntityContextId& contextId, AZ::SerializeContext* serializeContext = nullptr);
|
||||
EntityContext(const EntityContextId& contextId, AZStd::unique_ptr<EntityOwnershipService> entityOwnershipService,
|
||||
@@ -75,6 +78,7 @@ namespace AzFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
static AZStd::shared_ptr<Scene> FindContainingScene(const EntityContextId& contextId);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -66,6 +66,8 @@ namespace AzFramework
|
||||
*/
|
||||
virtual EntityContextId GetGameEntityContextId() = 0;
|
||||
|
||||
virtual EntityContext* GetGameEntityContextInstance() = 0;
|
||||
|
||||
/**
|
||||
* Creates an entity in the game context.
|
||||
* @param name A name for the new entity.
|
||||
|
||||
@@ -51,6 +51,7 @@ namespace AzFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// GameEntityContextRequestBus
|
||||
AZ::Uuid GetGameEntityContextId() override { return GetContextId(); }
|
||||
EntityContext* GetGameEntityContextInstance() override { return this; }
|
||||
void ResetGameContext() override;
|
||||
AZ::Entity* CreateGameEntity(const char* name) override;
|
||||
BehaviorEntity CreateGameEntityForBehaviorContext(const char* name) override;
|
||||
|
||||
@@ -12,11 +12,13 @@
|
||||
|
||||
#include <AzCore/Serialization/Utils.h>
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/string/wildcard.h>
|
||||
#include <AzCore/std/string/regex.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzCore/XML/rapidxml.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <AzFramework/Asset/FileTagAsset.h>
|
||||
@@ -31,7 +33,7 @@ namespace AzFramework
|
||||
const char* ExcludeFileName = "exclude";
|
||||
const char* IncludeFileName = "include";
|
||||
const char* FileTags[] = { "ignore", "error", "productdependency", "editoronly", "shader" };
|
||||
const char EngineName[] = "Engine";
|
||||
constexpr AZ::IO::PathView EngineAssetSourceRelPath = "Assets/Engine";
|
||||
|
||||
void LowerCaseFileTags(AZStd::vector<AZStd::string>& fileTags)
|
||||
{
|
||||
@@ -107,7 +109,7 @@ namespace AzFramework
|
||||
}
|
||||
|
||||
AZ::Outcome<AZStd::string, AZStd::string> FileTagManager::AddTagsInternal(AZStd::string filePath, FileTagType fileTagType, AZStd::vector<AZStd::string> fileTags, AzFramework::FileTag::FilePatternType filePatternType)
|
||||
{
|
||||
{
|
||||
if (!NormalizeFileAndLowerCaseTags(filePath, filePatternType, fileTags))
|
||||
{
|
||||
return AZ::Failure(AZStd::string::format("Unable to normalize file (%s). Unable to remove the file.\n", filePath.c_str()));
|
||||
@@ -243,11 +245,10 @@ namespace AzFramework
|
||||
|
||||
AZStd::string FileTagQueryManager::GetDefaultFileTagFilePath(FileTagType fileTagType)
|
||||
{
|
||||
AZStd::string destinationFilePath;
|
||||
const char* engineRoot = nullptr;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
|
||||
AzFramework::StringFunc::Path::ConstructFull(engineRoot, EngineName, fileTagType == FileTagType::Exclude ? ExcludeFileName : IncludeFileName, AzFramework::FileTag::FileTagAsset::Extension(), destinationFilePath, true);
|
||||
return destinationFilePath;
|
||||
auto destinationFilePath = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / EngineAssetSourceRelPath;
|
||||
destinationFilePath /= fileTagType == FileTagType::Exclude ? ExcludeFileName : IncludeFileName;
|
||||
destinationFilePath.ReplaceExtension(AzFramework::FileTag::FileTagAsset::Extension());
|
||||
return destinationFilePath.String();
|
||||
}
|
||||
|
||||
bool FileTagQueryManager::Load(const AZStd::string& filePath)
|
||||
|
||||
@@ -44,8 +44,8 @@ namespace AzFramework
|
||||
"Network Binding", "The Network Binding component marks an entity as able to be replicated across the network")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Category, "Networking")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/NetBinding.svg")
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/NetBinding.png")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/NetBinding.svg")
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/NetBinding.png")
|
||||
->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://docs.aws.amazon.com/lumberyard/latest/userguide/component-network-binding.html")
|
||||
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c));
|
||||
}
|
||||
|
||||
@@ -41,9 +41,10 @@ namespace AzFramework::ProjectManager
|
||||
// at the end of the function
|
||||
AZ::CommandLine commandLine;
|
||||
commandLine.Parse(argc, argv);
|
||||
AZ::SettingsRegistryImpl settingsRegistry;
|
||||
// Store the Command line to the Setting Registry
|
||||
AZ::SettingsRegistryMergeUtils::ParseCommandLine(commandLine);
|
||||
|
||||
// Store the Command line to the Setting Registry
|
||||
AZ::SettingsRegistryImpl settingsRegistry;
|
||||
AZ::SettingsRegistryMergeUtils::StoreCommandLineToRegistry(settingsRegistry, commandLine);
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_Bootstrap(settingsRegistry);
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_O3deUserRegistry(settingsRegistry, AZ_TRAIT_OS_PLATFORM_CODENAME, {});
|
||||
@@ -68,7 +69,14 @@ namespace AzFramework::ProjectManager
|
||||
// If we were able to locate a path to a project, we're done
|
||||
if (!projectRootPath.empty())
|
||||
{
|
||||
return ProjectPathCheckResult::ProjectPathFound;
|
||||
AZ::IO::FixedMaxPath projectJsonPath = engineRootPath / projectRootPath / "project.json";
|
||||
if (AZ::IO::SystemFile::Exists(projectJsonPath.c_str()))
|
||||
{
|
||||
return ProjectPathCheckResult::ProjectPathFound;
|
||||
}
|
||||
AZ_TracePrintf(
|
||||
"ProjectManager", "Did not find a project file at location '%s', launching the Project Manager...",
|
||||
projectJsonPath.c_str());
|
||||
}
|
||||
|
||||
if (LaunchProjectManager(engineRootPath))
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/sort.h>
|
||||
|
||||
#include <AzFramework/Entity/EntityContext.h>
|
||||
#include <AzFramework/Render/Intersector.h>
|
||||
#include <AzFramework/Scene/Scene.h>
|
||||
#include <AzFramework/Scene/SceneSystemBus.h>
|
||||
#include <AzFramework/Visibility/BoundsBus.h>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -30,11 +30,11 @@ namespace AzFramework
|
||||
{
|
||||
IntersectorBus::Handler::BusConnect(m_contextId);
|
||||
IntersectionNotificationBus::Handler::BusConnect(m_contextId);
|
||||
Scene* scene = nullptr;
|
||||
SceneSystemRequestBus::BroadcastResult(scene, &AzFramework::SceneSystemRequestBus::Events::GetSceneFromEntityContextId, m_contextId);
|
||||
|
||||
AZStd::shared_ptr<Scene> scene = EntityContext::FindContainingScene(m_contextId);
|
||||
if (scene)
|
||||
{
|
||||
scene->SetSubsystem<IntersectorInterface>(this);
|
||||
scene->SetSubsystem(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,11 +42,12 @@ namespace AzFramework
|
||||
{
|
||||
IntersectorBus::Handler::BusDisconnect();
|
||||
IntersectionNotificationBus::Handler::BusDisconnect();
|
||||
Scene* scene = nullptr;
|
||||
SceneSystemRequestBus::BroadcastResult(scene, &AzFramework::SceneSystemRequestBus::Events::GetSceneFromEntityContextId, m_contextId);
|
||||
|
||||
AZStd::shared_ptr<Scene> scene = EntityContext::FindContainingScene(m_contextId);
|
||||
if (scene)
|
||||
{
|
||||
scene->UnsetSubsystem<IntersectorInterface>();
|
||||
[[maybe_unused]] bool result = scene->UnsetSubsystem(this);
|
||||
AZ_Assert(result, "Failed to unregister Intersector with scene");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ namespace AzFramework
|
||||
, protected IntersectionNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_TYPE_INFO(AzFramework::RenderGeometry::Intersector, "{4CCA7971-CD83-4856-ADEA-89CEB41FB197}");
|
||||
|
||||
Intersector(AzFramework::EntityContextId contextId);
|
||||
~Intersector();
|
||||
|
||||
|
||||
@@ -14,13 +14,102 @@
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
Scene::Scene(AZStd::string_view name)
|
||||
: m_name(name)
|
||||
Scene::Scene(AZStd::string name)
|
||||
: m_name(AZStd::move(name))
|
||||
{
|
||||
}
|
||||
|
||||
const AZStd::string& Scene::GetName()
|
||||
Scene::Scene(AZStd::string name, AZStd::shared_ptr<Scene> parent)
|
||||
: m_name(AZStd::move(name))
|
||||
, m_parent(AZStd::move(parent))
|
||||
{
|
||||
}
|
||||
|
||||
Scene::~Scene()
|
||||
{
|
||||
m_removalEvent.Signal(*this, RemovalEventType::Destroyed);
|
||||
}
|
||||
|
||||
const AZStd::string& Scene::GetName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
const AZStd::shared_ptr<Scene>& Scene::GetParent()
|
||||
{
|
||||
return m_parent;
|
||||
}
|
||||
|
||||
AZStd::shared_ptr<const Scene> Scene::GetParent() const
|
||||
{
|
||||
return m_parent;
|
||||
}
|
||||
|
||||
bool Scene::IsAlive() const
|
||||
{
|
||||
return m_isAlive;
|
||||
}
|
||||
|
||||
void Scene::ConnectToEvents(RemovalEvent::Handler& handler)
|
||||
{
|
||||
handler.Connect(m_removalEvent);
|
||||
}
|
||||
|
||||
void Scene::ConnectToEvents(SubsystemEvent::Handler& handler)
|
||||
{
|
||||
handler.Connect(m_subsystemEvent);
|
||||
}
|
||||
|
||||
AZStd::any* Scene::FindSubsystem(const AZ::TypeId& typeId)
|
||||
{
|
||||
AZStd::any* result = FindSubsystemInScene(typeId);
|
||||
return (!result && m_parent) ? m_parent->FindSubsystem(typeId) : result;
|
||||
}
|
||||
|
||||
const AZStd::any* Scene::FindSubsystem(const AZ::TypeId& typeId) const
|
||||
{
|
||||
return const_cast<Scene*>(this)->FindSubsystem(typeId);
|
||||
}
|
||||
|
||||
AZStd::any* Scene::FindSubsystemInScene(const AZ::TypeId& typeId)
|
||||
{
|
||||
// Spot check that the internal arrays remain consistent.
|
||||
AZ_Assert(
|
||||
m_systemKeys.size() == m_systemObjects.size(), "Key and object list in AzFramework::Scene '%s' have gone out of sync.",
|
||||
m_name.c_str());
|
||||
|
||||
const size_t m_systemKeysCount = m_systemKeys.size();
|
||||
for (size_t i = 0; i < m_systemKeysCount; ++i)
|
||||
{
|
||||
if (m_systemKeys[i] != typeId)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return &m_systemObjects[i];
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const AZStd::any* Scene::FindSubsystemInScene(const AZ::TypeId& typeId) const
|
||||
{
|
||||
return const_cast<Scene*>(this)->FindSubsystemInScene(typeId);
|
||||
}
|
||||
|
||||
void Scene::MarkForDestruction()
|
||||
{
|
||||
m_isAlive = false;
|
||||
m_removalEvent.Signal(*this, RemovalEventType::Zombified);
|
||||
}
|
||||
|
||||
void Scene::RemoveSubsystem(size_t index, const AZ::TypeId& subsystemType)
|
||||
{
|
||||
m_systemKeys[index] = m_systemKeys.back();
|
||||
m_systemObjects[index] = AZStd::move(m_systemObjects.back());
|
||||
m_systemKeys.pop_back();
|
||||
m_systemObjects.pop_back();
|
||||
m_subsystemEvent.Signal(*this, SubsystemEventType::Removed, subsystemType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,14 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/EBus/Event.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/std/any.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/smart_ptr/shared_ptr.h>
|
||||
#include <AzCore/std/string/string_view.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
@@ -24,71 +28,100 @@ namespace AzFramework
|
||||
AZ_TYPE_INFO(Scene, "{DB449BB3-7A95-434D-BC61-47ACBB1F3436}");
|
||||
AZ_CLASS_ALLOCATOR(Scene, AZ::SystemAllocator, 0);
|
||||
|
||||
explicit Scene(AZStd::string_view name);
|
||||
friend class ISceneSystem;
|
||||
|
||||
const AZStd::string& GetName();
|
||||
constexpr static AZStd::string_view MainSceneName = "Main";
|
||||
constexpr static AZStd::string_view EditorMainSceneName = "Editor";
|
||||
|
||||
enum class RemovalEventType
|
||||
{
|
||||
Zombified, // The scene has be marked for destruction and is no longer visible in the scene system.
|
||||
Destroyed, // The scene has been destroyed.
|
||||
};
|
||||
using RemovalEvent = AZ::Event<Scene&, RemovalEventType>;
|
||||
enum class SubsystemEventType
|
||||
{
|
||||
Added,
|
||||
Removed
|
||||
};
|
||||
using SubsystemEvent = AZ::Event<Scene&, SubsystemEventType, const AZ::TypeId&>;
|
||||
|
||||
explicit Scene(AZStd::string name);
|
||||
Scene(AZStd::string name, AZStd::shared_ptr<Scene> parent);
|
||||
~Scene();
|
||||
|
||||
[[nodiscard]] const AZStd::string& GetName() const;
|
||||
|
||||
[[nodiscard]] const AZStd::shared_ptr<Scene>& GetParent();
|
||||
[[nodiscard]] AZStd::shared_ptr<const Scene> GetParent() const;
|
||||
|
||||
[[nodiscard]] bool IsAlive() const;
|
||||
|
||||
void ConnectToEvents(RemovalEvent::Handler& handler);
|
||||
void ConnectToEvents(SubsystemEvent::Handler& handler);
|
||||
|
||||
// Set the instance of a subsystem associated with this scene.
|
||||
template <typename T>
|
||||
bool SetSubsystem(T* system);
|
||||
bool SetSubsystem(T&& system);
|
||||
|
||||
// Unset the instance of a subsystem associated with this scene.
|
||||
template <typename T>
|
||||
bool UnsetSubsystem();
|
||||
|
||||
// Get the instance of a subsystem associated with this scene.
|
||||
// Unset the instance of the exact system associated with this scene.
|
||||
// Use this to make sure the expected instance is removed or to make sure type deduction is done in the same way as during setting.
|
||||
template<typename T>
|
||||
bool UnsetSubsystem(const T& system);
|
||||
|
||||
// Get the instance of a subsystem associated with this scene. This call will also look in parent scenes if not found on the target
|
||||
// scene. Returns a pointer to the subsystem if found, otherwise returns a nullptr.
|
||||
[[nodiscard]] AZStd::any* FindSubsystem(const AZ::TypeId& typeId);
|
||||
// Get the instance of a subsystem associated with this scene. This call will also look in parent scenes if not found on the target
|
||||
// scene. Returns a pointer to the subsystem if found, otherwise returns a nullptr.
|
||||
[[nodiscard]] const AZStd::any* FindSubsystem(const AZ::TypeId& typeId) const;
|
||||
// Get the instance of a subsystem associated with this scene. This call will also look in parent scenes if not found on the target
|
||||
// scene. Returns a pointer to the subsystem if found, otherwise returns a nullptr.
|
||||
template <typename T>
|
||||
T* GetSubsystem();
|
||||
[[nodiscard]] T* FindSubsystem();
|
||||
// Get the instance of a subsystem associated with this scene. This call will also look in parent scenes if not found on the target
|
||||
// scene. Returns a pointer to the subsystem if found, otherwise returns a nullptr.
|
||||
template<typename T>
|
||||
[[nodiscard]] const T* FindSubsystem() const;
|
||||
|
||||
// Get the instance of a subsystem associated with this scene. This call will only look in the selected scene. Returns a pointer to
|
||||
// the subsystem if found, otherwise returns a nullptr.
|
||||
[[nodiscard]] AZStd::any* FindSubsystemInScene(const AZ::TypeId& typeId);
|
||||
// Get the instance of a subsystem associated with this scene. This call will only look in the selected scene. Returns a pointer to
|
||||
// the subsystem if found, otherwise returns a nullptr.
|
||||
[[nodiscard]] const AZStd::any* FindSubsystemInScene(const AZ::TypeId& typeId) const;
|
||||
// Get the instance of a subsystem associated with this scene. This call will only look in the selected scene. Returns a pointer to
|
||||
// the subsystem if found, otherwise returns a nullptr.
|
||||
template<typename T>
|
||||
[[nodiscard]] T* FindSubsystemInScene();
|
||||
// Get the instance of a subsystem associated with this scene. This call will only look in the selected scene. Returns a pointer to
|
||||
// the subsystem if found, otherwise returns a nullptr.
|
||||
template<typename T>
|
||||
[[nodiscard]] const T* FindSubsystemInScene() const;
|
||||
|
||||
private:
|
||||
void MarkForDestruction();
|
||||
void RemoveSubsystem(size_t index, const AZ::TypeId& subsystemType);
|
||||
|
||||
AZStd::string m_name;
|
||||
RemovalEvent m_removalEvent;
|
||||
SubsystemEvent m_subsystemEvent;
|
||||
|
||||
// Storing keys separate from data to optimize for fast key search.
|
||||
AZStd::vector<AZ::TypeId> m_systemKeys;
|
||||
AZStd::vector<void*> m_systemPointers;
|
||||
AZStd::vector<AZStd::any> m_systemObjects;
|
||||
|
||||
// Name that identifies the scene.
|
||||
AZStd::string m_name;
|
||||
// Parent to this scene. Any subsystems are inherited from the parent but can be overwritten locally.
|
||||
AZStd::shared_ptr<Scene> m_parent;
|
||||
// If false, the scene has been removed from scene system and can no longer be found. As soon as all handles to the scene are
|
||||
// released it will be destroyed.
|
||||
bool m_isAlive{ true };
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
bool Scene::SetSubsystem(T* system)
|
||||
{
|
||||
if (GetSubsystem<T>() != nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_systemKeys.push_back(T::RTTI_Type());
|
||||
m_systemPointers.push_back(system);
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool Scene::UnsetSubsystem()
|
||||
{
|
||||
for (size_t i = 0; i < m_systemKeys.size(); ++i)
|
||||
{
|
||||
if (m_systemKeys.at(i) == T::RTTI_Type())
|
||||
{
|
||||
m_systemKeys.at(i) = m_systemKeys.back();
|
||||
m_systemKeys.pop_back();
|
||||
m_systemPointers.at(i) = m_systemPointers.back();
|
||||
m_systemPointers.pop_back();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T* Scene::GetSubsystem()
|
||||
{
|
||||
for (size_t i = 0; i < m_systemKeys.size(); ++i)
|
||||
{
|
||||
if (m_systemKeys.at(i) == T::RTTI_Type())
|
||||
{
|
||||
return reinterpret_cast<T*>(m_systemPointers.at(i));
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // AzFramework
|
||||
|
||||
#include <AzFramework/Scene/Scene.inl>
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
template<typename T>
|
||||
bool Scene::SetSubsystem(T&& system)
|
||||
{
|
||||
const AZ::TypeId& targetType = azrtti_typeid<T>();
|
||||
for (const AZ::TypeId& key : m_systemKeys)
|
||||
{
|
||||
if (key == targetType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
m_systemKeys.push_back(targetType);
|
||||
m_systemObjects.emplace_back(AZStd::forward<T>(system));
|
||||
m_subsystemEvent.Signal(*this, SubsystemEventType::Added, targetType);
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool Scene::UnsetSubsystem()
|
||||
{
|
||||
const AZ::TypeId& targetType = azrtti_typeid<T>();
|
||||
const size_t m_systemKeysCount = m_systemKeys.size();
|
||||
for (size_t i = 0; i < m_systemKeysCount; ++i)
|
||||
{
|
||||
if (m_systemKeys[i] != targetType)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveSubsystem(i, targetType);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool Scene::UnsetSubsystem(const T& system)
|
||||
{
|
||||
const AZ::TypeId& targetType = azrtti_typeid<T>();
|
||||
const size_t systemKeysCount = m_systemKeys.size();
|
||||
for (size_t i = 0; i < systemKeysCount; ++i)
|
||||
{
|
||||
if (m_systemKeys[i] != targetType)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
[[maybe_unused]] T* instance = AZStd::any_cast<T>(&m_systemObjects[i]);
|
||||
AZ_Assert(
|
||||
instance && *instance == system,
|
||||
"Subsystem being released matched type, but wasn't pointing to the same system that was stored.");
|
||||
RemoveSubsystem(i, targetType);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* Scene::FindSubsystem()
|
||||
{
|
||||
const AZ::TypeId& targetType = azrtti_typeid<T>();
|
||||
AZStd::any* subSystem = FindSubsystem(targetType);
|
||||
return subSystem ? AZStd::any_cast<T>(subSystem) : nullptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T* Scene::FindSubsystem() const
|
||||
{
|
||||
const AZ::TypeId& targetType = azrtti_typeid<T>();
|
||||
const AZStd::any* subSystem = FindSubsystem(targetType);
|
||||
return subSystem ? AZStd::any_cast<const T>(subSystem) : nullptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* Scene::FindSubsystemInScene()
|
||||
{
|
||||
const AZ::TypeId& targetType = azrtti_typeid<T>();
|
||||
AZStd::any* subSystem = FindSubsystemInScene(targetType);
|
||||
return subSystem ? AZStd::any_cast<T>(subSystem) : nullptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T* Scene::FindSubsystemInScene() const
|
||||
{
|
||||
const AZ::TypeId& targetType = azrtti_typeid<T>();
|
||||
const AZStd::any* subSystem = FindSubsystemInScene(targetType);
|
||||
return subSystem ? AZStd::any_cast<const T>(subSystem) : nullptr;
|
||||
}
|
||||
} // namespace AzFramework
|
||||
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* 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/EBus/EBus.h>
|
||||
#include <AzFramework/Entity/EntityContext.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
// Forward declarations
|
||||
class Scene;
|
||||
|
||||
//! Interface used to create, get, or destroy scenes.
|
||||
class SceneSystemRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~SceneSystemRequests() = default;
|
||||
|
||||
//! Single handler policy since there should only be one instance of this system component.
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
|
||||
//! Creates a scene with a given name.
|
||||
//! - If there is already a scene with the provided name this will return AZ::Failure().
|
||||
//! - If isDefault is set to true and there is already a default scene, the default scene will be switched to this one.
|
||||
virtual AZ::Outcome<Scene*, AZStd::string> CreateScene(AZStd::string_view name) = 0;
|
||||
|
||||
//! Gets a scene with a given name
|
||||
//! - If a scene does not exist with the given name, nullptr is returned.
|
||||
virtual Scene* GetScene(AZStd::string_view name) = 0;
|
||||
|
||||
//! Gets all the scenes that currently exist.
|
||||
virtual AZStd::vector<Scene*> GetAllScenes() = 0;
|
||||
|
||||
//! Remove a scene with a given name and return if the operation was successful.
|
||||
//! - If the removed scene is the default scene, there will no longer be a default scene.
|
||||
virtual bool RemoveScene(AZStd::string_view name) = 0;
|
||||
|
||||
//! Add a mapping from the provided EntityContextId to a Scene
|
||||
//! - If a scene is already associated with this EntityContextId, nothing is changed and false is returned.
|
||||
virtual bool SetSceneForEntityContextId(EntityContextId entityContextId, Scene* scene) = 0;
|
||||
|
||||
//! Remove a mapping from the provided EntityContextId to a Scene
|
||||
//! - If no scene is found from the provided EntityContextId, false is returned.
|
||||
virtual bool RemoveSceneForEntityContextId(EntityContextId entityContextId, Scene* scene) = 0;
|
||||
|
||||
//! Get the scene associated with an EntityContextId
|
||||
//! - If no scene is found for the provided EntityContextId, nullptr is returned.
|
||||
virtual Scene* GetSceneFromEntityContextId(EntityContextId entityContextId) = 0;
|
||||
};
|
||||
|
||||
using SceneSystemRequestBus = AZ::EBus<SceneSystemRequests>;
|
||||
|
||||
//! Interface used for notifications from the scene system
|
||||
class SceneSystemNotifications
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~SceneSystemNotifications() = default;
|
||||
|
||||
//! There can be multiple listeners to changes in the scene system.
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
|
||||
//! Called when a scene has been created.
|
||||
virtual void SceneCreated(Scene& /*scene*/) {};
|
||||
|
||||
//! Called just before a scene is removed.
|
||||
virtual void SceneAboutToBeRemoved(Scene& /*scene*/) {};
|
||||
|
||||
};
|
||||
|
||||
using SceneSystemNotificationBus = AZ::EBus<SceneSystemNotifications>;
|
||||
|
||||
//! Interface used for notifications about individual scenes
|
||||
class SceneNotifications
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~SceneNotifications() = default;
|
||||
|
||||
//! There can be multiple listeners to changes in the scene system.
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
|
||||
//! Bus is listened to using the pointer of the scene
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
|
||||
|
||||
//! Specifies that events are addressed by the pointer to the scene
|
||||
using BusIdType = Scene*;
|
||||
|
||||
//! Called just before a scene is removed.
|
||||
virtual void SceneAboutToBeRemoved() {};
|
||||
|
||||
//! Called when an entity context is mapped to this scene.
|
||||
virtual void EntityContextMapped(EntityContextId /*entityContextId*/) {};
|
||||
|
||||
//! Called when an entity context is unmapped from this scene.
|
||||
virtual void EntityContextUnmapped(EntityContextId /*entityContextId*/) {};
|
||||
};
|
||||
|
||||
using SceneNotificationBus = AZ::EBus<SceneNotifications>;
|
||||
|
||||
} // AzFramework
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzFramework/Scene/Scene.h>
|
||||
#include <AzCore/std/smart_ptr/make_shared.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
@@ -41,14 +41,10 @@ namespace AzFramework
|
||||
|
||||
void SceneSystemComponent::Activate()
|
||||
{
|
||||
// Connect busses
|
||||
SceneSystemRequestBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
void SceneSystemComponent::Deactivate()
|
||||
{
|
||||
// Disconnect Busses
|
||||
SceneSystemRequestBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
void SceneSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
|
||||
@@ -61,140 +57,105 @@ namespace AzFramework
|
||||
incompatible.push_back(AZ_CRC("SceneSystemComponentService", 0xd8975435));
|
||||
}
|
||||
|
||||
AZ::Outcome<Scene*, AZStd::string> SceneSystemComponent::CreateScene(AZStd::string_view name)
|
||||
AZ::Outcome<AZStd::shared_ptr<Scene>, AZStd::string> SceneSystemComponent::CreateScene(AZStd::string_view name)
|
||||
{
|
||||
Scene* existingScene = GetScene(name);
|
||||
return CreateSceneWithParent(name, nullptr);
|
||||
}
|
||||
|
||||
AZ::Outcome<AZStd::shared_ptr<Scene>, AZStd::string> SceneSystemComponent::CreateSceneWithParent(
|
||||
AZStd::string_view name, AZStd::shared_ptr<Scene> parent)
|
||||
{
|
||||
const AZStd::shared_ptr<Scene>& existingScene = GetScene(name);
|
||||
if (existingScene)
|
||||
{
|
||||
return AZ::Failure<AZStd::string>("A scene already exists with this name.");
|
||||
}
|
||||
|
||||
auto newScene = AZStd::make_unique<Scene>(name);
|
||||
Scene* scenePointer = newScene.get();
|
||||
m_scenes.push_back(AZStd::move(newScene));
|
||||
SceneSystemNotificationBus::Broadcast(&SceneSystemNotificationBus::Events::SceneCreated, *scenePointer);
|
||||
return AZ::Success(scenePointer);
|
||||
auto newScene = AZStd::make_shared<Scene>(name, AZStd::move(parent));
|
||||
m_activeScenes.push_back(newScene);
|
||||
{
|
||||
AZStd::lock_guard lock(m_eventMutex);
|
||||
m_events.Signal(EventType::SceneCreated, newScene);
|
||||
}
|
||||
return AZ::Success(AZStd::move(newScene));
|
||||
}
|
||||
|
||||
Scene* SceneSystemComponent::GetScene(AZStd::string_view name)
|
||||
AZStd::shared_ptr<Scene> SceneSystemComponent::GetScene(AZStd::string_view name)
|
||||
{
|
||||
auto sceneIterator = AZStd::find_if(m_scenes.begin(), m_scenes.end(),
|
||||
auto sceneIterator = AZStd::find_if(m_activeScenes.begin(), m_activeScenes.end(),
|
||||
[name](auto& scene) -> bool
|
||||
{
|
||||
return scene->GetName() == name;
|
||||
}
|
||||
);
|
||||
|
||||
return sceneIterator == m_scenes.end() ? nullptr : sceneIterator->get();
|
||||
return sceneIterator == m_activeScenes.end() ? nullptr : *sceneIterator;
|
||||
}
|
||||
|
||||
AZStd::vector<Scene*> SceneSystemComponent::GetAllScenes()
|
||||
void SceneSystemComponent::IterateActiveScenes(const ActiveIterationCallback& callback)
|
||||
{
|
||||
AZStd::vector<Scene*> scenes;
|
||||
scenes.resize_no_construct(m_scenes.size());
|
||||
|
||||
for (size_t i = 0; i < m_scenes.size(); ++i)
|
||||
bool keepGoing = true;
|
||||
auto end = m_activeScenes.end();
|
||||
for (auto it = m_activeScenes.begin(); it != end && keepGoing; ++it)
|
||||
{
|
||||
scenes.at(i) = m_scenes.at(i).get();
|
||||
keepGoing = callback(*it);
|
||||
}
|
||||
}
|
||||
|
||||
void SceneSystemComponent::IterateZombieScenes(const ZombieIterationCallback& callback)
|
||||
{
|
||||
bool keepGoing = true;
|
||||
auto end = m_zombieScenes.end();
|
||||
for (auto it = m_zombieScenes.begin(); it != end && keepGoing;)
|
||||
{
|
||||
if (!it->expired())
|
||||
{
|
||||
keepGoing = callback(*(it->lock()));
|
||||
++it;
|
||||
}
|
||||
else
|
||||
{
|
||||
*it = m_zombieScenes.back();
|
||||
m_zombieScenes.pop_back();
|
||||
end = m_zombieScenes.end();
|
||||
}
|
||||
}
|
||||
return scenes;
|
||||
}
|
||||
|
||||
bool SceneSystemComponent::RemoveScene(AZStd::string_view name)
|
||||
{
|
||||
for (size_t i = 0; i < m_scenes.size(); ++i)
|
||||
for (AZStd::shared_ptr<Scene>& scene : m_activeScenes)
|
||||
{
|
||||
auto& scenePtr = m_scenes.at(i);
|
||||
if (scenePtr->GetName() == name)
|
||||
if (scene->GetName() == name)
|
||||
{
|
||||
// Remove any entityContext mappings.
|
||||
Scene* scene = scenePtr.get();
|
||||
for (auto entityContextScenePairIt = m_entityContextToScenes.begin(); entityContextScenePairIt != m_entityContextToScenes.end();)
|
||||
MarkSceneForDestruction(*scene);
|
||||
{
|
||||
AZStd::pair<EntityContextId, Scene*>& pair = *entityContextScenePairIt;
|
||||
if (pair.second == scene)
|
||||
{
|
||||
// swap and pop back.
|
||||
*entityContextScenePairIt = m_entityContextToScenes.back();
|
||||
m_entityContextToScenes.pop_back();
|
||||
}
|
||||
else
|
||||
{
|
||||
++entityContextScenePairIt;
|
||||
}
|
||||
AZStd::lock_guard lock(m_eventMutex);
|
||||
m_events.Signal(EventType::ScenePendingRemoval, scene);
|
||||
}
|
||||
|
||||
SceneSystemNotificationBus::Broadcast(&SceneSystemNotificationBus::Events::SceneAboutToBeRemoved, *scene);
|
||||
SceneNotificationBus::Event(scene, &SceneNotificationBus::Events::SceneAboutToBeRemoved);
|
||||
|
||||
m_scenes.erase(&scenePtr);
|
||||
// Zombies are weak pointers that are kept around for situations where there's a delay in deleting the scene. This can happen
|
||||
// if there are outstanding calls like in-progress async calls or resources locked by hardware. A weak_ptr of the original
|
||||
// scene is kept so the zombie scene can still be found through iteration as it may require additional calls such as Tick calls.
|
||||
m_zombieScenes.push_back(scene);
|
||||
scene = AZStd::move(m_activeScenes.back());
|
||||
m_activeScenes.pop_back();
|
||||
// The scene may not be held onto anymore, so check here to see if the previously added zombie can be released.
|
||||
if (m_zombieScenes.back().expired())
|
||||
{
|
||||
m_zombieScenes.pop_back();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
AZ_Warning("SceneSystemComponent", false, "Attempting to remove scene name \"%.*s\", but that scene was not found.", static_cast<int>(name.size()), name.data());
|
||||
AZ_Warning("SceneSystemComponent", false, R"(Attempting to remove scene name "%.*s", but that scene was not found.)", AZ_STRING_ARG(name));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SceneSystemComponent::SetSceneForEntityContextId(EntityContextId entityContextId, Scene* scene)
|
||||
void SceneSystemComponent::ConnectToEvents(SceneEvent::Handler& handler)
|
||||
{
|
||||
Scene* existingSceneForEntityContext = GetSceneFromEntityContextId(entityContextId);
|
||||
if (existingSceneForEntityContext)
|
||||
{
|
||||
// This entity context is already mapped and must be unmapped explictely before it can be changed.
|
||||
char entityContextIdString[EntityContextId::MaxStringBuffer];
|
||||
entityContextId.ToString(entityContextIdString, sizeof(entityContextIdString));
|
||||
AZ_Warning("SceneSystemComponent", false, "Failed to set a scene for entity context %s, scene is already set for that entity context.", entityContextIdString);
|
||||
|
||||
return false;
|
||||
}
|
||||
m_entityContextToScenes.emplace_back(entityContextId, scene);
|
||||
SceneNotificationBus::Event(scene, &SceneNotificationBus::Events::EntityContextMapped, entityContextId);
|
||||
return true;
|
||||
AZStd::lock_guard lock(m_eventMutex);
|
||||
handler.Connect(m_events);
|
||||
}
|
||||
|
||||
bool SceneSystemComponent::RemoveSceneForEntityContextId(EntityContextId entityContextId, Scene* scene)
|
||||
{
|
||||
if (!scene || entityContextId.IsNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto entityContextScenePairIt = m_entityContextToScenes.begin(); entityContextScenePairIt != m_entityContextToScenes.end();)
|
||||
{
|
||||
AZStd::pair<EntityContextId, Scene*>& pair = *entityContextScenePairIt;
|
||||
if (!(pair.first == entityContextId && pair.second == scene))
|
||||
{
|
||||
++entityContextScenePairIt;
|
||||
}
|
||||
else
|
||||
{
|
||||
// swap and pop back.
|
||||
*entityContextScenePairIt = m_entityContextToScenes.back();
|
||||
m_entityContextToScenes.pop_back();
|
||||
|
||||
SceneNotificationBus::Event(scene, &SceneNotificationBus::Events::EntityContextUnmapped, entityContextId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
char entityContextIdString[EntityContextId::MaxStringBuffer];
|
||||
entityContextId.ToString(entityContextIdString, sizeof(entityContextIdString));
|
||||
AZ_Warning("SceneSystemComponent", false, "Failed to remove scene \"%.*s\" for entity context %s, entity context is not currently mapped to that scene.", static_cast<int>(scene->GetName().size()), scene->GetName().data(), entityContextIdString);
|
||||
return false;
|
||||
}
|
||||
|
||||
Scene* SceneSystemComponent::GetSceneFromEntityContextId(EntityContextId entityContextId)
|
||||
{
|
||||
for (AZStd::pair<EntityContextId, Scene*>& pair : m_entityContextToScenes)
|
||||
{
|
||||
if (pair.first == entityContextId)
|
||||
{
|
||||
return pair.second;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // AzFramework
|
||||
} // namespace AzFramework
|
||||
|
||||
@@ -13,18 +13,18 @@
|
||||
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzCore/std/containers/map.h>
|
||||
#include <AzFramework/Scene/SceneSystemBus.h>
|
||||
#include <AzCore/std/parallel/mutex.h>
|
||||
#include <AzFramework/Scene/SceneSystemInterface.h>
|
||||
#include <AzFramework/Entity/EntityContext.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
class SceneSystemComponent
|
||||
: public AZ::Component
|
||||
, public SceneSystemRequestBus::Handler
|
||||
, public SceneSystemInterface::Registrar
|
||||
{
|
||||
public:
|
||||
|
||||
AZ_COMPONENT(SceneSystemComponent, "{7AC53AF0-BE1A-437C-BE3E-4D6A998DA945}", AZ::Component);
|
||||
AZ_COMPONENT(SceneSystemComponent, "{7AC53AF0-BE1A-437C-BE3E-4D6A998DA945}", AZ::Component, ISceneSystem);
|
||||
|
||||
SceneSystemComponent();
|
||||
~SceneSystemComponent() override;
|
||||
@@ -41,24 +41,26 @@ namespace AzFramework
|
||||
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// SceneSystemRequestsBus::Handler
|
||||
// SceneSystemInterface overrides
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
AZ::Outcome<Scene*, AZStd::string> CreateScene(AZStd::string_view name) override;
|
||||
Scene* GetScene(AZStd::string_view name) override;
|
||||
AZStd::vector<Scene*> GetAllScenes() override;
|
||||
AZ::Outcome<AZStd::shared_ptr<Scene>, AZStd::string> CreateScene(AZStd::string_view name) override;
|
||||
AZ::Outcome<AZStd::shared_ptr<Scene>, AZStd::string> CreateSceneWithParent(
|
||||
AZStd::string_view name, AZStd::shared_ptr<Scene> parent) override;
|
||||
[[nodiscard]] AZStd::shared_ptr<Scene> GetScene(AZStd::string_view name) override;
|
||||
void IterateActiveScenes(const ActiveIterationCallback& callback) override;
|
||||
void IterateZombieScenes(const ZombieIterationCallback& callback) override;
|
||||
bool RemoveScene(AZStd::string_view name) override;
|
||||
bool SetSceneForEntityContextId(EntityContextId entityContextId, Scene* scene) override;
|
||||
bool RemoveSceneForEntityContextId(EntityContextId entityContextId, Scene* scene) override;
|
||||
Scene* GetSceneFromEntityContextId(EntityContextId entityContextId) override;
|
||||
void ConnectToEvents(SceneEvent::Handler& handler) override;
|
||||
|
||||
private:
|
||||
AZ_DISABLE_COPY_MOVE(SceneSystemComponent);
|
||||
|
||||
AZ_DISABLE_COPY(SceneSystemComponent);
|
||||
|
||||
// Container of scene in order of creation
|
||||
AZStd::vector<AZStd::unique_ptr<Scene>> m_scenes;
|
||||
|
||||
// Map of entity context Ids to scenes. Using a vector because lookups will be common, but the size will be small.
|
||||
AZStd::vector<AZStd::pair<EntityContextId, Scene*>> m_entityContextToScenes;
|
||||
AZStd::vector<AZStd::shared_ptr<Scene>> m_activeScenes;
|
||||
AZStd::vector<AZStd::weak_ptr<Scene>> m_zombieScenes;
|
||||
// Using a mutex around the events as other threads may respond to a new/deleted scene by making
|
||||
// local updates and unregistering themselves. Since Scene is single threaded, no updates (other
|
||||
// then unregistering an event) should be done from other threads though.
|
||||
AZStd::recursive_mutex m_eventMutex;
|
||||
SceneEvent m_events;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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/EBus/EBus.h>
|
||||
#include <AzCore/EBus/Event.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzCore/std/smart_ptr/shared_ptr.h>
|
||||
#include <AzCore/std/functional.h>
|
||||
#include <AzFramework/Entity/EntityContext.h>
|
||||
#include <AzFramework/Scene/Scene.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
//! Interface used to create, get, or destroy scenes.
|
||||
//! This interface is single thread and is intended to be called from a single thread, commonly the main thread. The exception
|
||||
//! is connecting events, which is thread safe.
|
||||
class ISceneSystem
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(AzFramework::ISceneSystem, "{DAE482A8-88AE-4BD3-8A5B-52D19A96E15F}");
|
||||
AZ_DISABLE_COPY_MOVE(ISceneSystem);
|
||||
|
||||
enum class EventType
|
||||
{
|
||||
SceneCreated,
|
||||
ScenePendingRemoval
|
||||
};
|
||||
using SceneEvent = AZ::Event<EventType, const AZStd::shared_ptr<Scene>&>;
|
||||
|
||||
ISceneSystem() = default;
|
||||
virtual ~ISceneSystem() = default;
|
||||
|
||||
using ActiveIterationCallback = AZStd::function<bool(const AZStd::shared_ptr<Scene>& scene)>;
|
||||
using ZombieIterationCallback = AZStd::function<bool(Scene& scene)>;
|
||||
|
||||
//! Creates a scene with a given name.
|
||||
//! - If there is already a scene with the provided name this will return AZ::Failure().
|
||||
virtual AZ::Outcome<AZStd::shared_ptr<Scene>, AZStd::string> CreateScene(AZStd::string_view name) = 0;
|
||||
|
||||
//! Creates a scene with a given name and a parent.
|
||||
//! - If there is already a scene with the provided name this will return AZ::Failure().
|
||||
virtual AZ::Outcome<AZStd::shared_ptr<Scene>, AZStd::string> CreateSceneWithParent(
|
||||
AZStd::string_view name, AZStd::shared_ptr<Scene> parent) = 0;
|
||||
|
||||
//! Gets a scene with a given name
|
||||
//! - If a scene does not exist with the given name, nullptr is returned.
|
||||
[[nodiscard]] virtual AZStd::shared_ptr<Scene> GetScene(AZStd::string_view name) = 0;
|
||||
|
||||
//! Iterates over all scenes that are in active use. Iteration stops if the callback returns false or all scenes have been listed.
|
||||
virtual void IterateActiveScenes(const ActiveIterationCallback& callback) = 0;
|
||||
//! Iterates over all zombie scenes. Zombie scenes are scenes that have been removed but still have references held on to. This can
|
||||
//! happen because scenes hold on to subsystems that can't immediately be deleted. These subsystems may still require being called
|
||||
//! such as a periodic tick. Iteration stops if the callback returns false or all scenes have been listed.
|
||||
virtual void IterateZombieScenes(const ZombieIterationCallback& callback) = 0;
|
||||
|
||||
//! Remove a scene with a given name and return if the operation was successful.
|
||||
virtual bool RemoveScene(AZStd::string_view name) = 0;
|
||||
|
||||
//! Connects the provided handler to the events that are called after scenes are created or before they get removed.
|
||||
virtual void ConnectToEvents(SceneEvent::Handler& handler) = 0;
|
||||
|
||||
protected:
|
||||
// Strictly a forwarding function to call private functions on the scene.
|
||||
void MarkSceneForDestruction(Scene& scene) { scene.MarkForDestruction(); }
|
||||
};
|
||||
|
||||
using SceneSystemInterface = AZ::Interface<ISceneSystem>;
|
||||
|
||||
// EBus wrapper for ScriptCanvas
|
||||
class ISceneSystemRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
};
|
||||
using ILoggerRequestBus = AZ::EBus<ISceneSystem, ISceneSystemRequests>;
|
||||
} // AzFramework
|
||||
@@ -81,7 +81,7 @@ namespace AzFramework
|
||||
|
||||
const char* SpawnableAssetHandler::GetBrowserIcon() const
|
||||
{
|
||||
return "Editor/Icons/Components/Viewport/EntityInSlice.png";
|
||||
return "Icons/Components/Viewport/EntityInSlice.png";
|
||||
}
|
||||
|
||||
void SpawnableAssetHandler::GetAssetTypeExtensions(AZStd::vector<AZStd::string>& extensions)
|
||||
|
||||
@@ -194,10 +194,11 @@ set(FILES
|
||||
Logging/MissingAssetLogger.h
|
||||
Logging/MissingAssetNotificationBus.h
|
||||
Scene/Scene.h
|
||||
Scene/Scene.inl
|
||||
Scene/Scene.cpp
|
||||
Scene/SceneSystemBus.h
|
||||
Scene/SceneSystemComponent.h
|
||||
Scene/SceneSystemComponent.cpp
|
||||
Scene/SceneSystemInterface.h
|
||||
Script/ScriptComponent.h
|
||||
Script/ScriptComponent.cpp
|
||||
Script/ScriptDebugAgentBus.h
|
||||
|
||||
@@ -250,9 +250,9 @@ namespace AzQtComponents
|
||||
// STYLESHEETIMAGES:something.txt
|
||||
// UI:blah/blah.png
|
||||
// EDITOR:blah/something.txt
|
||||
QDir::addSearchPath("STYLESHEETIMAGES", appPath.filePath("Editor/Styles/StyleSheetImages"));
|
||||
QDir::addSearchPath("UI", appPath.filePath("Editor/UI"));
|
||||
QDir::addSearchPath("EDITOR", appPath.filePath("Editor"));
|
||||
QDir::addSearchPath("STYLESHEETIMAGES", appPath.filePath("Assets/Editor/Styles/StyleSheetImages"));
|
||||
QDir::addSearchPath("UI", appPath.filePath("Assets/Editor/UI"));
|
||||
QDir::addSearchPath("EDITOR", appPath.filePath("Assets/Editor"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,5 +24,5 @@ QProgressBar
|
||||
|
||||
QProgressBar::chunk
|
||||
{
|
||||
background: #54AFD0;
|
||||
background: #1E70EB;
|
||||
}
|
||||
|
||||
@@ -13,14 +13,14 @@ Width=24;
|
||||
ArrowWidth=10;
|
||||
|
||||
[PrimaryColorSet]
|
||||
Disabled\Start=#7092A7
|
||||
Disabled\End=#7092A7
|
||||
Sunken\Start=#0073BB
|
||||
Sunken\End=#0073BB
|
||||
Hovered\Start=#44BAFF
|
||||
Hovered\End=#4AB2F8
|
||||
Disabled\Start=#2A4875
|
||||
Disabled\End=#2A4875
|
||||
Sunken\Start=#1E70EB
|
||||
Sunken\End=#1E70EB
|
||||
Hovered\Start=#4ABAFF
|
||||
Hovered\End=#94D2FF
|
||||
Normal\Start=#0095F2
|
||||
Normal\End=#0073BB
|
||||
Normal\End=#1E70EB
|
||||
|
||||
[SecondaryColorSet]
|
||||
Disabled\Start=#666666
|
||||
@@ -42,10 +42,10 @@ Color=#3D000000
|
||||
|
||||
[FocusedBorder]
|
||||
Thickness=1
|
||||
Color=#00A1C9
|
||||
Color=#4B8CEF
|
||||
|
||||
[IconButton]
|
||||
ActiveColor=#00A1C9
|
||||
ActiveColor=#1E70EB
|
||||
DisabledColor=#999999
|
||||
SelectedColor=#FFFFFF
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ HandleBorder\Color=#FFFFFF
|
||||
HandleBorder\Radius=1.5
|
||||
|
||||
[Slider]
|
||||
Handle\Color=#0185D7
|
||||
Handle\Color=#1E70EB
|
||||
Handle\ColorDisabled=#999999
|
||||
Handle\Size=12
|
||||
Handle\SizeMinusMargin=8
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace AzQtComponents
|
||||
Text::Config Text::defaultConfig()
|
||||
{
|
||||
Config config;
|
||||
config.hyperlinkColor = QStringLiteral("#44B2F8");
|
||||
config.hyperlinkColor = QStringLiteral("#94D2FF");
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
[Hyperlink]
|
||||
Color=#44B2F8
|
||||
Color=#94D2FF
|
||||
@@ -4,7 +4,7 @@
|
||||
<title>Selection Controls / Checkbox / Off</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Selection-Controls-/-Checkbox-/-Off" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="checkbox-(off)" stroke="#00A1C9">
|
||||
<g id="checkbox-(off)" stroke="#4B8CEF">
|
||||
<path d="M14.2222222,0.5 L1.77777778,0.5 C1.07614237,0.5 0.5,1.07614237 0.5,1.77777778 L0.5,14.2222222 C0.5,14.9238576 1.07614237,15.5 1.77777778,15.5 L14.2222222,15.5 C14.9238576,15.5 15.5,14.9238576 15.5,14.2222222 L15.5,1.77777778 C15.5,1.07614237 14.9238576,0.5 14.2222222,0.5 Z" id="Shape"></path>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 850 B After Width: | Height: | Size: 850 B |
@@ -5,7 +5,7 @@
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Selection-Controls-/-Checkbox-/-On---Disabled" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="checkbox-(on)">
|
||||
<path d="M1.77777778,0 C0.8,0 0,0.8 0,1.77777778 L0,14.2222222 C0,15.2 0.8,16 1.77777778,16 L14.2222222,16 C15.2,16 16,15.2 16,14.2222222 L16,1.77777778 C16,0.8 15.2,0 14.2222222,0 L1.77777778,0 Z" id="Shape" fill="#7092A7"></path>
|
||||
<path d="M1.77777778,0 C0.8,0 0,0.8 0,1.77777778 L0,14.2222222 C0,15.2 0.8,16 1.77777778,16 L14.2222222,16 C15.2,16 16,15.2 16,14.2222222 L16,1.77777778 C16,0.8 15.2,0 14.2222222,0 L1.77777778,0 Z" id="Shape" fill="#2A4875"></path>
|
||||
<polygon id="Path" fill="#BBBBBB" points="1 8.19230769 2.4 6.84615385 6 10.3076923 13.6 3 15 4.34615385 6 13"></polygon>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 914 B After Width: | Height: | Size: 914 B |
@@ -5,7 +5,7 @@
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Selection-Controls-/-Checkbox-/-On-focus" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="checkbox-(on)">
|
||||
<path d="M14.2222222,0.5 L1.77777778,0.5 C1.07614237,0.5 0.5,1.07614237 0.5,1.77777778 L0.5,14.2222222 C0.5,14.9238576 1.07614237,15.5 1.77777778,15.5 L14.2222222,15.5 C14.9238576,15.5 15.5,14.9238576 15.5,14.2222222 L15.5,1.77777778 C15.5,1.07614237 14.9238576,0.5 14.2222222,0.5 Z" id="Shape" stroke="#00A1C9" fill="#0073BB"></path>
|
||||
<path d="M14.2222222,0.5 L1.77777778,0.5 C1.07614237,0.5 0.5,1.07614237 0.5,1.77777778 L0.5,14.2222222 C0.5,14.9238576 1.07614237,15.5 1.77777778,15.5 L14.2222222,15.5 C14.9238576,15.5 15.5,14.9238576 15.5,14.2222222 L15.5,1.77777778 C15.5,1.07614237 14.9238576,0.5 14.2222222,0.5 Z" id="Shape" stroke="#4B8CEF" fill="#1E70EB"></path>
|
||||
<polygon id="Path" fill="#FFFFFF" points="1 8.19230769 2.4 6.84615385 6 10.3076923 13.6 3 15 4.34615385 6 13"></polygon>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 1007 B After Width: | Height: | Size: 1007 B |
@@ -5,7 +5,7 @@
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Selection-Controls-/-Checkbox-/-On" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="checkbox-(on)">
|
||||
<path d="M1.77777778,0 C0.8,0 0,0.8 0,1.77777778 L0,14.2222222 C0,15.2 0.8,16 1.77777778,16 L14.2222222,16 C15.2,16 16,15.2 16,14.2222222 L16,1.77777778 C16,0.8 15.2,0 14.2222222,0 L1.77777778,0 Z" id="Shape" fill="#0073BB"></path>
|
||||
<path d="M1.77777778,0 C0.8,0 0,0.8 0,1.77777778 L0,14.2222222 C0,15.2 0.8,16 1.77777778,16 L14.2222222,16 C15.2,16 16,15.2 16,14.2222222 L16,1.77777778 C16,0.8 15.2,0 14.2222222,0 L1.77777778,0 Z" id="Shape" fill="#1E70EB"></path>
|
||||
<polygon id="Path" fill="#FFFFFF" points="1 8.19230769 2.4 6.84615385 6 10.3076923 13.6 3 15 4.34615385 6 13"></polygon>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 892 B After Width: | Height: | Size: 892 B |
@@ -5,7 +5,7 @@
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Selection-Controls-/-Checkbox-/-Partial-Selected" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Group">
|
||||
<rect id="Rectangle-10" fill="#7092A7" x="0" y="0" width="16" height="16" rx="2"></rect>
|
||||
<rect id="Rectangle-10" fill="#2A4875" x="0" y="0" width="16" height="16" rx="2"></rect>
|
||||
<rect id="Rectangle-9" fill="#BBBBBB" x="3" y="7" width="10" height="2"></rect>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 728 B After Width: | Height: | Size: 728 B |
@@ -5,7 +5,7 @@
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Selection-Controls-/-Checkbox-/-Partial-Selected" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Group">
|
||||
<path d="M14.2222222,0.5 L1.77777778,0.5 C1.07614237,0.5 0.5,1.07614237 0.5,1.77777778 L0.5,14.2222222 C0.5,14.9238576 1.07614237,15.5 1.77777778,15.5 L14.2222222,15.5 C14.9238576,15.5 15.5,14.9238576 15.5,14.2222222 L15.5,1.77777778 C15.5,1.07614237 14.9238576,0.5 14.2222222,0.5 Z" id="Shape" stroke="#00A1C9" fill="#0073BB"></path>
|
||||
<path d="M14.2222222,0.5 L1.77777778,0.5 C1.07614237,0.5 0.5,1.07614237 0.5,1.77777778 L0.5,14.2222222 C0.5,14.9238576 1.07614237,15.5 1.77777778,15.5 L14.2222222,15.5 C14.9238576,15.5 15.5,14.9238576 15.5,14.2222222 L15.5,1.77777778 C15.5,1.07614237 14.9238576,0.5 14.2222222,0.5 Z" id="Shape" stroke="#4B8CEF" fill="#1E70EB"></path>
|
||||
<rect id="Rectangle-9" fill="#FFFFFF" x="3" y="7" width="10" height="2"></rect>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 974 B After Width: | Height: | Size: 974 B |
@@ -5,7 +5,7 @@
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Selection-Controls-/-Checkbox-/-Partial-Selected" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Group">
|
||||
<rect id="Rectangle-10" fill="#0073BB" x="0" y="0" width="16" height="16" rx="2"></rect>
|
||||
<rect id="Rectangle-10" fill="#1E70EB" x="0" y="0" width="16" height="16" rx="2"></rect>
|
||||
<rect id="Rectangle-9" fill="#FFFFFF" x="3" y="7" width="10" height="2"></rect>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 728 B After Width: | Height: | Size: 728 B |
@@ -4,7 +4,7 @@
|
||||
<title>Selection Controls / Radio Button / On - Disabled</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Selection-Controls-/-Radio-Button-/-On---Disabled" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<circle id="Oval" fill="#7092A7" cx="8" cy="8" r="8"></circle>
|
||||
<circle id="Oval" fill="#2A4875" cx="8" cy="8" r="8"></circle>
|
||||
<circle id="Oval" fill="#BBBBBB" cx="8" cy="8" r="4"></circle>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 643 B After Width: | Height: | Size: 643 B |
@@ -4,7 +4,7 @@
|
||||
<title>Selection Controls / Radio Button / On-focus</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Selection-Controls-/-Radio-Button-/-On-focus" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<circle id="Oval" stroke="#00A1C9" fill="#0073BB" cx="9" cy="9" r="8.5"></circle>
|
||||
<circle id="Oval" stroke="#4B8CEF" fill="#1E70EB" cx="9" cy="9" r="8.5"></circle>
|
||||
<circle id="Oval" fill="#FFFFFF" cx="9" cy="9" r="4"></circle>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 647 B After Width: | Height: | Size: 647 B |
@@ -5,7 +5,7 @@
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Selection-Controls-/-Radio-Button-/-On" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="radio-button-(on)">
|
||||
<circle id="Oval" fill="#0073BB" cx="8" cy="8" r="8"></circle>
|
||||
<circle id="Oval" fill="#1E70EB" cx="8" cy="8" r="8"></circle>
|
||||
<circle id="Oval" fill="#FFFFFF" cx="8" cy="8" r="4"></circle>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 677 B After Width: | Height: | Size: 677 B |
@@ -4,7 +4,7 @@
|
||||
<title>Selection Controls / Radio Button / Off-focus</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Selection-Controls-/-Radio-Button-/-Off-focus" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="radio-button-(off)" transform="translate(1.000000, 1.000000)" stroke="#00A1C9">
|
||||
<g id="radio-button-(off)" transform="translate(1.000000, 1.000000)" stroke="#4B8CEF">
|
||||
<circle id="Oval" cx="8" cy="8" r="8.5"></circle>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 658 B After Width: | Height: | Size: 658 B |
@@ -5,7 +5,7 @@
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Selection-Controls-/-Switch-/-On---Disabled" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="switch-(on)">
|
||||
<path d="M25.4117647,16 L6.58823529,16 C2.91764706,16 0,12.4571429 0,8 C0,3.54285714 2.91764706,0 6.58823529,0 L25.4117647,0 C29.0823529,0 32,3.54285714 32,8 C32,12.4571429 29.0823529,16 25.4117647,16 Z" id="track" fill="#7092A7"></path>
|
||||
<path d="M25.4117647,16 L6.58823529,16 C2.91764706,16 0,12.4571429 0,8 C0,3.54285714 2.91764706,0 6.58823529,0 L25.4117647,0 C29.0823529,0 32,3.54285714 32,8 C32,12.4571429 29.0823529,16 25.4117647,16 Z" id="track" fill="#2A4875"></path>
|
||||
<circle id="knob" fill="#BBBBBB" cx="24" cy="8" r="6"></circle>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 857 B After Width: | Height: | Size: 857 B |
@@ -5,7 +5,7 @@
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Selection-Controls-/-Switch-/-On-focus" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="switch-(on)" transform="translate(1.000000, 1.000000)">
|
||||
<path d="M25.4117647,16.5 L6.58823529,16.5 C2.61773665,16.5 -0.5,12.7141769 -0.5,8 C-0.5,3.28582307 2.61773665,-0.5 6.58823529,-0.5 L25.4117647,-0.5 C29.3822634,-0.5 32.5,3.28582307 32.5,8 C32.5,12.7141769 29.3822634,16.5 25.4117647,16.5 Z" id="track" stroke="#00A1C9" fill="#0073BB"></path>
|
||||
<path d="M25.4117647,16.5 L6.58823529,16.5 C2.61773665,16.5 -0.5,12.7141769 -0.5,8 C-0.5,3.28582307 2.61773665,-0.5 6.58823529,-0.5 L25.4117647,-0.5 C29.3822634,-0.5 32.5,3.28582307 32.5,8 C32.5,12.7141769 29.3822634,16.5 25.4117647,16.5 Z" id="track" stroke="#4B8CEF" fill="#1E70EB"></path>
|
||||
<circle id="knob" fill="#FFFFFF" cx="24" cy="8" r="6"></circle>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 938 B After Width: | Height: | Size: 938 B |
@@ -5,7 +5,7 @@
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Selection-Controls-/-Switch-/-On" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="switch-(on)">
|
||||
<path d="M25.4117647,16 L6.58823529,16 C2.91764706,16 0,12.4571429 0,8 C0,3.54285714 2.91764706,0 6.58823529,0 L25.4117647,0 C29.0823529,0 32,3.54285714 32,8 C32,12.4571429 29.0823529,16 25.4117647,16 Z" id="track" fill="#0073BB"></path>
|
||||
<path d="M25.4117647,16 L6.58823529,16 C2.91764706,16 0,12.4571429 0,8 C0,3.54285714 2.91764706,0 6.58823529,0 L25.4117647,0 C29.0823529,0 32,3.54285714 32,8 C32,12.4571429 29.0823529,16 25.4117647,16 Z" id="track" fill="#1E70EB"></path>
|
||||
<circle id="knob" fill="#FFFFFF" cx="24" cy="8" r="6"></circle>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 835 B After Width: | Height: | Size: 835 B |
@@ -5,7 +5,7 @@
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Selection-Controls-/-Switch-/-Off-focus" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="switch-(off)" transform="translate(1.000000, 1.000000)">
|
||||
<path d="M25.0231909,16.5 L7.01632718,16.5 C2.97419648,16.5 -0.5,12.6299076 -0.5,8 C-0.5,3.37009242 2.97419648,-0.5 7.01632718,-0.5 L25.0231909,-0.5 C29.0586432,-0.5 32.5,3.36297526 32.5,8 C32.5,12.6370247 29.0586432,16.5 25.0231909,16.5 Z" id="track" stroke="#00A1C9"></path>
|
||||
<path d="M25.0231909,16.5 L7.01632718,16.5 C2.97419648,16.5 -0.5,12.6299076 -0.5,8 C-0.5,3.37009242 2.97419648,-0.5 7.01632718,-0.5 L25.0231909,-0.5 C29.0586432,-0.5 32.5,3.36297526 32.5,8 C32.5,12.6370247 29.0586432,16.5 25.0231909,16.5 Z" id="track" stroke="#4B8CEF"></path>
|
||||
<circle id="knob" fill="#FFFFFF" cx="8" cy="8" r="6"></circle>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 925 B After Width: | Height: | Size: 925 B |
@@ -1,6 +1,6 @@
|
||||
<svg version="1.1" class="loader" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="40px" height="40px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
|
||||
<path fill="#54AFD0" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
|
||||
<path fill="#1E70EB" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
|
||||
<animateTransform attributeType="xml"
|
||||
attributeName="transform"
|
||||
type="rotate"
|
||||
|
||||
|
Before Width: | Height: | Size: 878 B After Width: | Height: | Size: 878 B |
@@ -388,8 +388,8 @@
|
||||
<file>img/line.png</file>
|
||||
</qresource>
|
||||
<qresource>
|
||||
<file alias="Editor/Style/EditorStylesheetVariables_Dark.json">../../../../Sandbox/Editor/Style/EditorStylesheetVariables_Dark.json</file>
|
||||
<file alias="Editor/Style/NewEditorStylesheet.qss">../../../../Sandbox/Editor/Style/NewEditorStylesheet.qss</file>
|
||||
<file alias="Assets/Editor/Style/EditorStylesheetVariables_Dark.json">../../../../Sandbox/Editor/Style/EditorStylesheetVariables_Dark.json</file>
|
||||
<file alias="Assets/Editor/Style/NewEditorStylesheet.qss">../../../../Sandbox/Editor/Style/NewEditorStylesheet.qss</file>
|
||||
</qresource>
|
||||
<qresource prefix="/Cards">
|
||||
<file>img/UI20/Cards/point_hand.png</file>
|
||||
|
||||
@@ -284,6 +284,10 @@ namespace AzToolsFramework
|
||||
void ToolsApplication::Start(const Descriptor& descriptor, const StartupParameters& startupParameters/* = StartupParameters()*/)
|
||||
{
|
||||
Application::Start(descriptor, startupParameters);
|
||||
if (!m_isStarted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_editorEntityManager.Start();
|
||||
|
||||
|
||||
@@ -216,14 +216,9 @@ namespace AzToolsFramework::AssetUtils
|
||||
constexpr const char* AssetProcessorGamePlatformConfigFileName = "AssetProcessorGamePlatformConfig.ini";
|
||||
constexpr const char* AssetProcessorGamePlatformConfigSetreg = "AssetProcessorGamePlatformConfig.setreg";
|
||||
AZStd::vector<AZ::IO::Path> configFiles;
|
||||
AZ::IO::Path configRoot(engineRoot);
|
||||
|
||||
AZ::IO::Path rootConfigFile = configRoot / AssetProcessorPlatformConfigFileName;
|
||||
configFiles.push_back(rootConfigFile);
|
||||
|
||||
// Add a file entry for the Engine Root AssetProcessor setreg file
|
||||
rootConfigFile = configRoot / AssetProcessorPlatformConfigSetreg;
|
||||
configFiles.push_back(rootConfigFile);
|
||||
// Add the AssetProcessorPlatformConfig setreg file at the engine root
|
||||
configFiles.push_back(AZ::IO::Path(engineRoot) / AssetProcessorPlatformConfigSetreg);
|
||||
|
||||
if (addPlatformConfigs)
|
||||
{
|
||||
|
||||
@@ -200,67 +200,67 @@ namespace AzToolsFramework
|
||||
{
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".abc"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/ABC_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/ABC_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".bnk"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/Audio_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/Audio_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".cgf"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/LegacyMesh_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/LegacyMesh_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".font"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/Font_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/Font_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".fontfamily"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/Font_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/Font_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".i_caf"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/LegacyAnimation_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/LegacyAnimation_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".inputbindings"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/InputBindings_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/InputBindings_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".lua"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/Lua_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/Lua_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".mtl"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/Material_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/Material_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), AzToolsFramework::SliceUtilities::GetSliceFileExtension().c_str()))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/Slice_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/Slice_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".skin"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/LegacySkin_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/LegacySkin_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".ttf"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/Font_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/Font_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".xml"))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/XML_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/XML_16.svg");
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ namespace AzToolsFramework
|
||||
const char* sourceFormatExtension = sourceFormats[sourceImageFormatIndex];
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), sourceFormatExtension))
|
||||
{
|
||||
return SourceFileDetails("Editor/Icons/AssetBrowser/Image_16.svg");
|
||||
return SourceFileDetails("Icons/AssetBrowser/Image_16.svg");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,17 +52,16 @@ namespace AzToolsFramework
|
||||
return AssetEntryType::Root;
|
||||
}
|
||||
|
||||
void RootAssetBrowserEntry::Update(const char* devPath)
|
||||
void RootAssetBrowserEntry::Update(const char* enginePath)
|
||||
{
|
||||
RemoveChildren();
|
||||
EntryCache::GetInstance()->Clear();
|
||||
m_scanFolderOutputPrefixMap.clear();
|
||||
|
||||
m_devPath = devPath;
|
||||
m_enginePath = enginePath;
|
||||
|
||||
// there is no "Gems" scan folder registered in db, create one manually
|
||||
auto gemFolder = aznew FolderAssetBrowserEntry();
|
||||
gemFolder->m_name = m_devPath + AZ_CORRECT_DATABASE_SEPARATOR + GEMS_FOLDER_NAME;
|
||||
gemFolder->m_name = m_enginePath + AZ_CORRECT_DATABASE_SEPARATOR + GEMS_FOLDER_NAME;
|
||||
gemFolder->m_displayName = GEMS_FOLDER_NAME;
|
||||
gemFolder->m_isGemsFolder = true;
|
||||
AddChild(gemFolder);
|
||||
@@ -90,11 +89,6 @@ namespace AzToolsFramework
|
||||
scanFolder->m_displayName = QString::fromUtf8(scanFolderDatabaseEntry.m_displayName.c_str());
|
||||
EntryCache::GetInstance()->m_scanFolderIdMap[scanFolderDatabaseEntry.m_scanFolderID] = scanFolder;
|
||||
}
|
||||
|
||||
if (!scanFolderDatabaseEntry.m_outputPrefix.empty())
|
||||
{
|
||||
m_scanFolderOutputPrefixMap[scanFolderDatabaseEntry.m_scanFolderID] = scanFolderDatabaseEntry.m_outputPrefix;
|
||||
}
|
||||
}
|
||||
|
||||
void RootAssetBrowserEntry::AddFile(const AssetDatabase::FileDatabaseEntry& fileDatabaseEntry)
|
||||
@@ -132,7 +126,7 @@ namespace AzToolsFramework
|
||||
return;
|
||||
}
|
||||
|
||||
const char* filePath = GetScanFolderOutputAdjustedPath(fileDatabaseEntry, scanFolder);
|
||||
const char* filePath = fileDatabaseEntry.m_fileName.c_str();
|
||||
|
||||
AssetBrowserEntry* file;
|
||||
// file can be either folder or actual file
|
||||
@@ -441,33 +435,5 @@ namespace AzToolsFramework
|
||||
{
|
||||
return MAKE_TKEY(ThumbnailKey);
|
||||
}
|
||||
|
||||
const char* RootAssetBrowserEntry::GetScanFolderOutputAdjustedPath(const AssetDatabase::FileDatabaseEntry& fileDatabaseEntry, const AssetBrowserEntry* scanFolder)
|
||||
{
|
||||
Q_UNUSED(scanFolder);
|
||||
|
||||
const char* filePath = fileDatabaseEntry.m_fileName.c_str();
|
||||
|
||||
// adjust for output prefixes on scan folders (i.e. "editor")
|
||||
auto itScanFolderOutputPrefix = m_scanFolderOutputPrefixMap.find(fileDatabaseEntry.m_scanFolderPK);
|
||||
if (itScanFolderOutputPrefix != m_scanFolderOutputPrefixMap.end())
|
||||
{
|
||||
const AZStd::string& outputPrefix = itScanFolderOutputPrefix->second;
|
||||
|
||||
// Check if the input path starts with the output prefix.
|
||||
// If it doesn't, something probably went seriously wrong,
|
||||
// or someone is calling this function with an absolute path.
|
||||
bool pathStartsWithPrefix = ((strncmp(filePath, outputPrefix.c_str(), outputPrefix.length()) == 0) && (fileDatabaseEntry.m_fileName.length() > (outputPrefix.length() + 1)));
|
||||
AZ_Warning("Asset Browser", pathStartsWithPrefix, "Entry %s reported as under a ScanFolder (%s) with an 'output=%s', but the new entry does not begin with the output prefix! RootAssetBrowserEntry::GetScanFolderOutputAdjustedPath expects relative paths, not absolute; treating the input path as if it does not contain the ScanFolder output prefix.", filePath, scanFolder->m_name.c_str(), outputPrefix.c_str());
|
||||
|
||||
if (pathStartsWithPrefix)
|
||||
{
|
||||
// move the beginning ahead by the output prefix plus the separator
|
||||
filePath += (outputPrefix.length() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
return filePath;
|
||||
}
|
||||
} // namespace AssetBrowser
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
@@ -60,8 +60,8 @@ namespace AzToolsFramework
|
||||
|
||||
AssetEntryType GetEntryType() const override;
|
||||
|
||||
//! Update root node to new dev location
|
||||
void Update(const char* devPath);
|
||||
//! Update root node to new engine location
|
||||
void Update(const char* enginePath);
|
||||
|
||||
void AddScanFolder(const AssetDatabase::ScanFolderDatabaseEntry& scanFolderDatabaseEntry);
|
||||
void AddFile(const AssetDatabase::FileDatabaseEntry& fileDatabaseEntry);
|
||||
@@ -82,15 +82,12 @@ namespace AzToolsFramework
|
||||
private:
|
||||
AZ_DISABLE_COPY_MOVE(RootAssetBrowserEntry);
|
||||
|
||||
AZStd::string m_devPath;
|
||||
AZStd::unordered_map<AZ::s64, AZStd::string> m_scanFolderOutputPrefixMap;
|
||||
AZStd::string 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);
|
||||
//! Get the path for the fileDatabaseEntry, offset by the output prefix for the scan folder ancestor, if it's been specified and if it's appropriate
|
||||
const char* GetScanFolderOutputAdjustedPath(const AssetDatabase::FileDatabaseEntry& fileDatabaseEntry, const AssetBrowserEntry* scanFolder);
|
||||
|
||||
bool m_isInitialUpdate = false;
|
||||
};
|
||||
|
||||
@@ -50,11 +50,11 @@ namespace AzToolsFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// FolderThumbnail
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static constexpr const char* FolderIconPath = "Editor/Icons/AssetBrowser/Folder_16.svg";
|
||||
static constexpr const char* GemIconPath = "Editor/Icons/AssetBrowser/GemFolder_16.svg";
|
||||
static constexpr const char* FolderIconPath = "Icons/AssetBrowser/Folder_16.svg";
|
||||
static constexpr const char* GemIconPath = "Icons/AssetBrowser/GemFolder_16.svg";
|
||||
|
||||
FolderThumbnail::FolderThumbnail(SharedThumbnailKey key, int thumbnailSize)
|
||||
: Thumbnail(key, thumbnailSize)
|
||||
FolderThumbnail::FolderThumbnail(SharedThumbnailKey key)
|
||||
: Thumbnail(key)
|
||||
{}
|
||||
|
||||
void FolderThumbnail::LoadThread()
|
||||
@@ -69,7 +69,8 @@ namespace AzToolsFramework
|
||||
AZStd::string absoluteIconPath;
|
||||
AZ::StringFunc::Path::Join(engineRoot, folderIcon, absoluteIconPath);
|
||||
|
||||
m_icon = QIcon(absoluteIconPath.c_str());
|
||||
m_pixmap.load(absoluteIconPath.c_str());
|
||||
m_state = m_pixmap.isNull() ? State::Failed : State::Ready;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FolderThumbnail(SharedThumbnailKey key, int thumbnailSize);
|
||||
FolderThumbnail(SharedThumbnailKey key);
|
||||
void LoadThread() override;
|
||||
};
|
||||
|
||||
|
||||
@@ -55,10 +55,10 @@ namespace AzToolsFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ProductThumbnail
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static const char* DEFAULT_PRODUCT_ICON_PATH = "Editor/Icons/AssetBrowser/DefaultProduct_16.svg";
|
||||
static const char* DEFAULT_PRODUCT_ICON_PATH = "Icons/AssetBrowser/DefaultProduct_16.svg";
|
||||
|
||||
ProductThumbnail::ProductThumbnail(Thumbnailer::SharedThumbnailKey key, int thumbnailSize)
|
||||
: Thumbnail(key, thumbnailSize)
|
||||
ProductThumbnail::ProductThumbnail(Thumbnailer::SharedThumbnailKey key)
|
||||
: Thumbnail(key)
|
||||
{}
|
||||
|
||||
void ProductThumbnail::LoadThread()
|
||||
@@ -96,12 +96,8 @@ namespace AzToolsFramework
|
||||
iconPath = QString::fromUtf8(DEFAULT_PRODUCT_ICON_PATH);
|
||||
}
|
||||
|
||||
m_icon = QIcon(iconPath);
|
||||
|
||||
if (m_icon.isNull())
|
||||
{
|
||||
m_state = State::Failed;
|
||||
}
|
||||
m_pixmap.load(iconPath);
|
||||
m_state = m_pixmap.isNull() ? State::Failed : State::Ready;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProductThumbnail(Thumbnailer::SharedThumbnailKey key, int thumbnailSize);
|
||||
ProductThumbnail(Thumbnailer::SharedThumbnailKey key);
|
||||
|
||||
protected:
|
||||
void LoadThread() override;
|
||||
|
||||
@@ -55,11 +55,11 @@ namespace AzToolsFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// SourceThumbnail
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static constexpr const char* DefaultFileIconPath = "Editor/Icons/AssetBrowser/Default_16.svg";
|
||||
static constexpr const char* DefaultFileIconPath = "Icons/AssetBrowser/Default_16.svg";
|
||||
QMutex SourceThumbnail::m_mutex;
|
||||
|
||||
SourceThumbnail::SourceThumbnail(SharedThumbnailKey key, int thumbnailSize)
|
||||
: Thumbnail(key, thumbnailSize)
|
||||
SourceThumbnail::SourceThumbnail(SharedThumbnailKey key)
|
||||
: Thumbnail(key)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -124,7 +124,8 @@ namespace AzToolsFramework
|
||||
iconPathToUse = iconPath.c_str();
|
||||
}
|
||||
|
||||
m_icon = QIcon(iconPathToUse);
|
||||
m_pixmap.load(iconPathToUse);
|
||||
m_state = m_pixmap.isNull() ? State::Failed : State::Ready;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SourceThumbnail(SharedThumbnailKey key, int thumbnailSize);
|
||||
SourceThumbnail(SharedThumbnailKey key);
|
||||
|
||||
protected:
|
||||
void LoadThread() override;
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace AzToolsFramework
|
||||
else
|
||||
{
|
||||
// Scaling and centering pixmap within bounds to preserve aspect ratio
|
||||
const QPixmap pixmap = thumbnail->GetPixmap(size).scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
const QPixmap pixmap = thumbnail->GetPixmap().scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
const QSize sizeDelta = size - pixmap.size();
|
||||
const QPoint pointDelta = QPoint(sizeDelta.width() / 2, sizeDelta.height() / 2);
|
||||
painter->drawPixmap(point + pointDelta, pixmap);
|
||||
|
||||
@@ -943,10 +943,8 @@ namespace AzToolsFramework
|
||||
const char* scanFolder,
|
||||
const char* displayName,
|
||||
const char* portableKey,
|
||||
const char* outputPrefix,
|
||||
int isRoot)
|
||||
: m_scanFolderID(scanFolderID)
|
||||
, m_outputPrefix(outputPrefix)
|
||||
, m_isRoot(isRoot)
|
||||
{
|
||||
if (scanFolder)
|
||||
@@ -967,10 +965,8 @@ namespace AzToolsFramework
|
||||
const char* scanFolder,
|
||||
const char* displayName,
|
||||
const char* portableKey,
|
||||
const char* outputPrefix,
|
||||
int isRoot)
|
||||
: m_outputPrefix(outputPrefix)
|
||||
, m_isRoot(isRoot)
|
||||
: m_isRoot(isRoot)
|
||||
{
|
||||
if (scanFolder)
|
||||
{
|
||||
@@ -993,7 +989,6 @@ namespace AzToolsFramework
|
||||
, m_scanFolder(other.m_scanFolder)
|
||||
, m_displayName(other.m_displayName)
|
||||
, m_portableKey(other.m_portableKey)
|
||||
, m_outputPrefix(other.m_outputPrefix)
|
||||
, m_isRoot(other.m_isRoot)
|
||||
{
|
||||
}
|
||||
@@ -1011,7 +1006,6 @@ namespace AzToolsFramework
|
||||
m_scanFolderID = other.m_scanFolderID;
|
||||
m_displayName = AZStd::move(other.m_displayName);
|
||||
m_portableKey = AZStd::move(other.m_portableKey);
|
||||
m_outputPrefix = AZStd::move(other.m_outputPrefix);
|
||||
m_isRoot = other.m_isRoot;
|
||||
}
|
||||
return *this;
|
||||
@@ -1023,7 +1017,6 @@ namespace AzToolsFramework
|
||||
m_scanFolderID = other.m_scanFolderID;
|
||||
m_displayName = other.m_displayName;
|
||||
m_portableKey = other.m_portableKey;
|
||||
m_outputPrefix = other.m_outputPrefix;
|
||||
m_isRoot = other.m_isRoot;
|
||||
return *this;
|
||||
}
|
||||
@@ -1050,7 +1043,6 @@ namespace AzToolsFramework
|
||||
MakeColumn("ScanFolder", m_scanFolder),
|
||||
MakeColumn("DisplayName", m_displayName),
|
||||
MakeColumn("PortableKey", m_portableKey),
|
||||
MakeColumn("OutputPrefix", m_outputPrefix),
|
||||
MakeColumn("IsRoot", m_isRoot)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ namespace AzToolsFramework
|
||||
AddedLastScanTimeField = 28,
|
||||
AddedScanTimeSecondsSinceEpochField = 29,
|
||||
ChangedSortFunctionFromQSortToStdStableSort = 30,
|
||||
RemoveOutputPrefixFromScanFolders,
|
||||
//Add all new versions before this
|
||||
DatabaseVersionCount,
|
||||
LatestVersion = DatabaseVersionCount - 1
|
||||
@@ -99,12 +100,10 @@ namespace AzToolsFramework
|
||||
const char* scanFolder,
|
||||
const char* displayName,
|
||||
const char* portableKey,
|
||||
const char* outputPrefix,
|
||||
int isRoot = 0);
|
||||
ScanFolderDatabaseEntry(const char* scanFolder,
|
||||
const char* displayName,
|
||||
const char* portableKey,
|
||||
const char* outputPrefix,
|
||||
int isRoot = 0);
|
||||
ScanFolderDatabaseEntry(const ScanFolderDatabaseEntry& other);
|
||||
ScanFolderDatabaseEntry(ScanFolderDatabaseEntry&& other);
|
||||
@@ -120,7 +119,6 @@ namespace AzToolsFramework
|
||||
AZStd::string m_scanFolder; // the actual local computer path to that scan folder.
|
||||
AZStd::string m_displayName; // a display name, blank means it should not show up in UIs
|
||||
AZStd::string m_portableKey; // a key that uniquely identifies a scan folder so that we can recognize the same one in other databases/computer
|
||||
AZStd::string m_outputPrefix;
|
||||
int m_isRoot = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -49,6 +49,8 @@ namespace AzToolsFramework
|
||||
/// Retrieve the Id of the editor entity context.
|
||||
virtual AzFramework::EntityContextId GetEditorEntityContextId() = 0;
|
||||
|
||||
virtual AzFramework::EntityContext* GetEditorEntityContextInstance() = 0;
|
||||
|
||||
/// Creates an entity in the editor context.
|
||||
/// \return the EntityId for the created Entity
|
||||
virtual AZ::EntityId CreateNewEditorEntity(const char* name) = 0;
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace AzToolsFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EditorEntityContextRequestBus
|
||||
AzFramework::EntityContextId GetEditorEntityContextId() override { return GetContextId(); }
|
||||
AzFramework::EntityContext* GetEditorEntityContextInstance() override { return this; }
|
||||
void ResetEditorContext() override;
|
||||
|
||||
AZ::EntityId CreateNewEditorEntity(const char* name) override;
|
||||
|
||||
@@ -769,12 +769,12 @@ namespace AzToolsFramework
|
||||
|
||||
template<typename Vertex>
|
||||
void EditorVertexSelectionBase<Vertex>::DisplayViewport2d(
|
||||
const AzFramework::ViewportInfo& /*viewportInfo*/,
|
||||
const AzFramework::ViewportInfo& viewportInfo,
|
||||
AzFramework::DebugDisplayRequests& debugDisplay)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
|
||||
m_editorBoxSelect.Display2d(debugDisplay);
|
||||
m_editorBoxSelect.Display2d(viewportInfo, debugDisplay);
|
||||
}
|
||||
|
||||
template<typename Vertex>
|
||||
|
||||
@@ -36,8 +36,7 @@ namespace AzToolsFramework
|
||||
using namespace Thumbnailer;
|
||||
using namespace AssetBrowser;
|
||||
const char* contextName = "MaterialBrowser";
|
||||
int thumbnailSize = qApp->style()->pixelMetric(QStyle::PM_SmallIconSize);
|
||||
ThumbnailerRequestsBus::Broadcast(&ThumbnailerRequests::RegisterContext, contextName, thumbnailSize);
|
||||
ThumbnailerRequestsBus::Broadcast(&ThumbnailerRequests::RegisterContext, contextName);
|
||||
ThumbnailerRequestsBus::Broadcast(&ThumbnailerRequests::RegisterThumbnailProvider, MAKE_TCACHE(FolderThumbnailCache), contextName);
|
||||
ThumbnailerRequestsBus::Broadcast(&ThumbnailerRequests::RegisterThumbnailProvider, MAKE_TCACHE(SourceThumbnailCache), contextName);
|
||||
ThumbnailerRequestsBus::Broadcast(&ThumbnailerRequests::RegisterThumbnailProvider, MAKE_TCACHE(MaterialThumbnailCache), contextName);
|
||||
|
||||
@@ -24,8 +24,8 @@ namespace AzToolsFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// MaterialThumbnail
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
MaterialThumbnail::MaterialThumbnail(Thumbnailer::SharedThumbnailKey key, int thumbnailSize)
|
||||
: Thumbnail(key, thumbnailSize)
|
||||
MaterialThumbnail::MaterialThumbnail(Thumbnailer::SharedThumbnailKey key)
|
||||
: Thumbnail(key)
|
||||
{
|
||||
auto productKey = azrtti_cast<const AzToolsFramework::AssetBrowser::ProductThumbnailKey*>(m_key.data());
|
||||
AZ_Assert(productKey, "Incorrect key type, excpected ProductThumbnailKey");
|
||||
@@ -34,7 +34,8 @@ namespace AzToolsFramework
|
||||
MaterialBrowserRequestBus::BroadcastResult(multiMat, &MaterialBrowserRequests::IsMultiMaterial, productKey->GetAssetId());
|
||||
|
||||
QString iconPath = multiMat ? MultiMaterialIconPath : SimpleMaterialIconPath;
|
||||
m_pixmap = QPixmap(iconPath).scaled(m_thumbnailSize, m_thumbnailSize, Qt::KeepAspectRatio);
|
||||
m_pixmap.load(iconPath);
|
||||
m_state = m_pixmap.isNull() ? State::Failed : State::Ready;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MaterialThumbnail(Thumbnailer::SharedThumbnailKey key, int thumbnailSize);
|
||||
MaterialThumbnail(Thumbnailer::SharedThumbnailKey key);
|
||||
};
|
||||
|
||||
namespace
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicInterface.h>
|
||||
#include <AzToolsFramework/UI/EditorEntityUi/EditorEntityUiInterface.h>
|
||||
#include <AzToolsFramework/UI/Outliner/EntityOutlinerWidgetInterface.h>
|
||||
#include <AzToolsFramework/UI/Prefab/PrefabIntegrationBus.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
#include <AzToolsFramework/Prefab/Instance/TemplateInstanceMapperInterface.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabDomUtils.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicInterface.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicNotificationBus.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabSystemComponentInterface.h>
|
||||
#include <AzToolsFramework/Prefab/Template/Template.h>
|
||||
#include <AzToolsFramework/UI/Outliner/EntityOutlinerWidgetInterface.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
@@ -90,17 +90,13 @@ namespace AzToolsFramework
|
||||
|
||||
if (instanceCountToUpdateInBatch > 0)
|
||||
{
|
||||
// Notify Propagation has begun
|
||||
PrefabPublicNotificationBus::Broadcast(&PrefabPublicNotifications::OnPrefabInstancePropagationBegin);
|
||||
|
||||
EntityIdList selectedEntityIds;
|
||||
ToolsApplicationRequestBus::BroadcastResult(selectedEntityIds, &ToolsApplicationRequests::GetSelectedEntities);
|
||||
ToolsApplicationRequestBus::Broadcast(&ToolsApplicationRequests::SetSelectedEntities, EntityIdList());
|
||||
|
||||
// Disable the Outliner to avoid showing the propagation steps
|
||||
EntityOutlinerWidgetInterface* entityOutlinerWidgetInterface = AZ::Interface<EntityOutlinerWidgetInterface>::Get();
|
||||
if (entityOutlinerWidgetInterface)
|
||||
{
|
||||
entityOutlinerWidgetInterface->SetUpdatesEnabled(false);
|
||||
}
|
||||
|
||||
for (int i = 0; i < instanceCountToUpdateInBatch; ++i)
|
||||
{
|
||||
Instance* instanceToUpdate = m_instancesUpdateQueue.front();
|
||||
@@ -168,18 +164,8 @@ namespace AzToolsFramework
|
||||
}
|
||||
ToolsApplicationRequestBus::Broadcast(&ToolsApplicationRequests::SetSelectedEntities, selectedEntityIds);
|
||||
|
||||
// Enable the Outliner
|
||||
if (entityOutlinerWidgetInterface)
|
||||
{
|
||||
entityOutlinerWidgetInterface->SetUpdatesEnabled(true);
|
||||
|
||||
auto prefabPublicInterface = AZ::Interface<PrefabPublicInterface>::Get();
|
||||
if (prefabPublicInterface)
|
||||
{
|
||||
AZ::EntityId rootEntityId = prefabPublicInterface->GetLevelInstanceContainerEntityId();
|
||||
entityOutlinerWidgetInterface->ExpandEntityChildren(rootEntityId);
|
||||
}
|
||||
}
|
||||
// Notify Propagation has ended
|
||||
PrefabPublicNotificationBus::Broadcast(&PrefabPublicNotifications::OnPrefabInstancePropagationEnd);
|
||||
}
|
||||
|
||||
m_updatingTemplateInstancesInQueue = false;
|
||||
|
||||
@@ -108,11 +108,9 @@ namespace AzToolsFramework
|
||||
m_targetTemplateId = id;
|
||||
}
|
||||
|
||||
void Link::SetTemplatePatches(const PrefabDomValue& patches)
|
||||
void Link::SetLinkDom(const PrefabDomValue& linkDom)
|
||||
{
|
||||
PrefabDom newPatches;
|
||||
newPatches.CopyFrom(patches, newPatches.GetAllocator());
|
||||
m_linkDom.Swap(newPatches);
|
||||
m_linkDom.CopyFrom(linkDom, m_linkDom.GetAllocator());
|
||||
}
|
||||
|
||||
void Link::SetInstanceName(const char* instanceName)
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace AzToolsFramework
|
||||
|
||||
void SetSourceTemplateId(TemplateId id);
|
||||
void SetTargetTemplateId(TemplateId id);
|
||||
void SetTemplatePatches(const PrefabDomValue& patches);
|
||||
void SetLinkDom(const PrefabDomValue& linkDom);
|
||||
void SetInstanceName(const char* instanceName);
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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/EBus/EBus.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Prefab
|
||||
{
|
||||
class PrefabPublicNotifications
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
virtual ~PrefabPublicNotifications() = default;
|
||||
|
||||
virtual void OnPrefabInstancePropagationBegin() {}
|
||||
virtual void OnPrefabInstancePropagationEnd() {}
|
||||
};
|
||||
|
||||
using PrefabPublicNotificationBus = AZ::EBus<PrefabPublicNotifications>;
|
||||
|
||||
} // namespace Prefab
|
||||
} // namespace AzToolsFramework
|
||||
@@ -784,22 +784,21 @@ namespace AzToolsFramework
|
||||
link.SetInstanceName(instanceName.data());
|
||||
|
||||
PrefabDomValue& instance = instanceIterator->value;
|
||||
AZ_Assert(instance.IsObject(), "Nested instance DOM provided is not a valid JSON object.");
|
||||
PrefabDomValueReference sourceTemplateName = PrefabDomUtils::FindPrefabDomValue(instance, PrefabDomUtils::SourceName);
|
||||
AZ_Assert(sourceTemplateName, "Couldn't find source template name in the DOM of the nested instance while creating a link.");
|
||||
AZ_Assert(
|
||||
sourceTemplateName->get() == sourceTemplate.GetFilePath().c_str(),
|
||||
"The name of the source template in the nested instance DOM does not match the name of the source template already loaded");
|
||||
|
||||
PrefabDomValueReference patchesReference = PrefabDomUtils::FindPrefabDomValue(instance, PrefabDomUtils::PatchesName);
|
||||
if (!patchesReference.has_value())
|
||||
if (patchesReference.has_value())
|
||||
{
|
||||
PrefabDom& newLinkDom = link.GetLinkDom();
|
||||
|
||||
newLinkDom.SetObject();
|
||||
|
||||
newLinkDom.AddMember(rapidjson::StringRef(PrefabDomUtils::SourceName),
|
||||
rapidjson::StringRef(sourceTemplate.GetFilePath().c_str()), newLinkDom.GetAllocator());
|
||||
}
|
||||
else
|
||||
{
|
||||
link.SetTemplatePatches(patchesReference->get());
|
||||
AZ_Assert(patchesReference->get().IsArray(), "Patches in the nested instance DOM are not represented as an array.");
|
||||
}
|
||||
|
||||
link.SetLinkDom(instance);
|
||||
|
||||
if (!link.UpdateTarget())
|
||||
{
|
||||
AZ_Error("Prefab", false,
|
||||
|
||||
@@ -18,13 +18,15 @@ namespace AzToolsFramework
|
||||
{
|
||||
namespace Thumbnailer
|
||||
{
|
||||
static constexpr const int LoadingThumbnailSize = 128;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// LoadingThumbnail
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static const char* LoadingIconPath = "Editor/Icons/AssetBrowser/in_progress.gif";
|
||||
static const char* LoadingIconPath = "Icons/AssetBrowser/in_progress.gif";
|
||||
|
||||
LoadingThumbnail::LoadingThumbnail(int thumbnailSize)
|
||||
: Thumbnail(MAKE_TKEY(ThumbnailKey), thumbnailSize)
|
||||
LoadingThumbnail::LoadingThumbnail()
|
||||
: Thumbnail(MAKE_TKEY(ThumbnailKey))
|
||||
, m_angle(0)
|
||||
{
|
||||
const char* engineRoot = nullptr;
|
||||
@@ -34,7 +36,7 @@ namespace AzToolsFramework
|
||||
AZ::StringFunc::Path::Join(engineRoot, LoadingIconPath, iconPath);
|
||||
m_loadingMovie.setFileName(iconPath.c_str());
|
||||
m_loadingMovie.setCacheMode(QMovie::CacheMode::CacheAll);
|
||||
m_loadingMovie.setScaledSize(QSize(m_thumbnailSize, m_thumbnailSize));
|
||||
m_loadingMovie.setScaledSize(QSize(LoadingThumbnailSize, LoadingThumbnailSize));
|
||||
m_loadingMovie.start();
|
||||
m_pixmap = m_loadingMovie.currentPixmap();
|
||||
m_state = State::Ready;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LoadingThumbnail(int thumbnailSize);
|
||||
LoadingThumbnail();
|
||||
~LoadingThumbnail() override;
|
||||
|
||||
void UpdateTime(float /*deltaTime*/) override;
|
||||
|
||||
@@ -16,13 +16,13 @@ namespace AzToolsFramework
|
||||
{
|
||||
namespace Thumbnailer
|
||||
{
|
||||
static const char* MISSING_ICON_PATH = "Editor/Icons/AssetBrowser/Default_16.svg";
|
||||
static const char* MISSING_ICON_PATH = "Icons/AssetBrowser/Default_16.svg";
|
||||
|
||||
MissingThumbnail::MissingThumbnail(int thumbnailSize)
|
||||
: Thumbnail(MAKE_TKEY(ThumbnailKey), thumbnailSize)
|
||||
MissingThumbnail::MissingThumbnail()
|
||||
: Thumbnail(MAKE_TKEY(ThumbnailKey))
|
||||
{
|
||||
m_icon = QIcon(MISSING_ICON_PATH);
|
||||
m_state = State::Ready;
|
||||
m_pixmap.load(MISSING_ICON_PATH);
|
||||
m_state = m_pixmap.isNull() ? State::Failed : State::Ready;
|
||||
}
|
||||
|
||||
} // namespace Thumbnailer
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MissingThumbnail(int thumbnailSize);
|
||||
MissingThumbnail();
|
||||
};
|
||||
} // namespace Thumbnailer
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
@@ -64,13 +64,13 @@ namespace AzToolsFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// SourceControlThumbnail
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static const char* WRITABLE_ICON_PATH = "Editor/Icons/AssetBrowser/Writable_16.svg";
|
||||
static const char* NONWRITABLE_ICON_PATH = "Editor/Icons/AssetBrowser/NonWritable_16.svg";
|
||||
static const char* WRITABLE_ICON_PATH = "Icons/AssetBrowser/Writable_16.svg";
|
||||
static const char* NONWRITABLE_ICON_PATH = "Icons/AssetBrowser/NonWritable_16.svg";
|
||||
|
||||
bool SourceControlThumbnail::m_readyForUpdate = true;
|
||||
|
||||
SourceControlThumbnail::SourceControlThumbnail(SharedThumbnailKey key, int thumbnailSize)
|
||||
: Thumbnail(key, thumbnailSize)
|
||||
SourceControlThumbnail::SourceControlThumbnail(SharedThumbnailKey key)
|
||||
: Thumbnail(key)
|
||||
{
|
||||
const char* engineRoot = nullptr;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
|
||||
@@ -122,16 +122,16 @@ namespace AzToolsFramework
|
||||
{
|
||||
if (fileInfo.HasFlag(AzToolsFramework::SCF_Writeable))
|
||||
{
|
||||
m_icon = QIcon(m_writableIconPath.c_str());
|
||||
m_pixmap.load(m_writableIconPath.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_icon = QIcon(m_nonWritableIconPath.c_str());
|
||||
m_pixmap.load(m_nonWritableIconPath.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_icon = QIcon();
|
||||
m_pixmap = QPixmap();
|
||||
}
|
||||
m_readyForUpdate = true;
|
||||
emit Updated();
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SourceControlThumbnail(SharedThumbnailKey key, int thumbnailSize);
|
||||
SourceControlThumbnail(SharedThumbnailKey key);
|
||||
~SourceControlThumbnail() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -24,8 +24,6 @@ namespace AzToolsFramework
|
||||
{
|
||||
namespace Thumbnailer
|
||||
{
|
||||
static const int DefaultIconSize = 16;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ThumbnailKey
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -54,10 +52,9 @@ namespace AzToolsFramework
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Thumbnail
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
Thumbnail::Thumbnail(SharedThumbnailKey key, int thumbnailSize)
|
||||
Thumbnail::Thumbnail(SharedThumbnailKey key)
|
||||
: QObject()
|
||||
, m_state(State::Unloaded)
|
||||
, m_thumbnailSize(thumbnailSize)
|
||||
, m_key(key)
|
||||
{
|
||||
connect(&m_watcher, &QFutureWatcher<void>::finished, this, [this]()
|
||||
@@ -91,19 +88,9 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
QPixmap Thumbnail::GetPixmap() const
|
||||
const QPixmap& Thumbnail::GetPixmap() const
|
||||
{
|
||||
return GetPixmap(QSize(DefaultIconSize, DefaultIconSize));
|
||||
}
|
||||
|
||||
QPixmap Thumbnail::GetPixmap(const QSize& size) const
|
||||
{
|
||||
if (m_icon.isNull())
|
||||
{
|
||||
return m_pixmap;
|
||||
}
|
||||
|
||||
return m_icon.pixmap(size);
|
||||
return m_pixmap;
|
||||
}
|
||||
|
||||
SharedThumbnailKey Thumbnail::GetKey() const
|
||||
|
||||
@@ -19,7 +19,6 @@ AZ_PUSH_DISABLE_WARNING(4127 4251 4800, "-Wunknown-warning-option") // 4127: con
|
||||
// 4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
|
||||
#include <QObject>
|
||||
#include <QPixmap>
|
||||
#include <QIcon>
|
||||
#include <QFutureWatcher>
|
||||
AZ_POP_DISABLE_WARNING
|
||||
#endif
|
||||
@@ -86,12 +85,11 @@ namespace AzToolsFramework
|
||||
Failed
|
||||
};
|
||||
|
||||
Thumbnail(SharedThumbnailKey key, int thumbnailSize);
|
||||
Thumbnail(SharedThumbnailKey key);
|
||||
~Thumbnail() override;
|
||||
bool operator == (const Thumbnail& other) const;
|
||||
void Load();
|
||||
virtual QPixmap GetPixmap() const;
|
||||
virtual QPixmap GetPixmap(const QSize& size) const;
|
||||
const QPixmap& GetPixmap() const;
|
||||
virtual void UpdateTime(float /*deltaTime*/) {}
|
||||
SharedThumbnailKey GetKey() const;
|
||||
State GetState() const;
|
||||
@@ -105,10 +103,8 @@ namespace AzToolsFramework
|
||||
protected:
|
||||
QFutureWatcher<void> m_watcher;
|
||||
State m_state;
|
||||
int m_thumbnailSize;
|
||||
SharedThumbnailKey m_key;
|
||||
QPixmap m_pixmap;
|
||||
QIcon m_icon;
|
||||
|
||||
virtual void LoadThread() {}
|
||||
};
|
||||
@@ -122,7 +118,6 @@ namespace AzToolsFramework
|
||||
ThumbnailProvider() = default;
|
||||
virtual ~ThumbnailProvider() = default;
|
||||
virtual bool GetThumbnail(SharedThumbnailKey key, SharedThumbnail& thumbnail) = 0;
|
||||
virtual void SetThumbnailSize(int thumbnailSize) = 0;
|
||||
//! Priority identifies ThumbnailProvider order in ThumbnailContext
|
||||
//! Higher priority means this ThumbnailProvider will take precedence in generating a thumbnail when
|
||||
//! a supplied ThumbnailKey is supported by multiple providers.
|
||||
@@ -185,10 +180,7 @@ namespace AzToolsFramework
|
||||
|
||||
bool GetThumbnail(SharedThumbnailKey key, SharedThumbnail& thumbnail) override;
|
||||
|
||||
void SetThumbnailSize(int thumbnailSize) override;
|
||||
|
||||
protected:
|
||||
int m_thumbnailSize;
|
||||
AZStd::unordered_map<SharedThumbnailKey, SharedThumbnail, Hasher, EqualKey> m_cache;
|
||||
|
||||
//! Check if thumbnail key is handled by this provider, overload in derived class
|
||||
|
||||