diff --git a/Code/Framework/AzCore/AzCore/AzCoreModule.cpp b/Code/Framework/AzCore/AzCore/AzCoreModule.cpp index 3c93ae5561..3d074455cc 100644 --- a/Code/Framework/AzCore/AzCore/AzCoreModule.cpp +++ b/Code/Framework/AzCore/AzCore/AzCoreModule.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -43,7 +42,6 @@ namespace AZ AssetManagerComponent::CreateDescriptor(), UserSettingsComponent::CreateDescriptor(), Debug::FrameProfilerComponent::CreateDescriptor(), - NativeUI::NativeUISystemComponent::CreateDescriptor(), SliceComponent::CreateDescriptor(), SliceSystemComponent::CreateDescriptor(), SliceMetadataInfoComponent::CreateDescriptor(), diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp index c55f565615..d0f277a6b8 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp @@ -28,6 +28,8 @@ #include #include +#include + #include #include #include @@ -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::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 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; diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h index 3ebcf39d95..8617aa5f2e 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h @@ -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 diff --git a/Code/Framework/AzCore/AzCore/NativeUI/NativeUIRequests.h b/Code/Framework/AzCore/AzCore/NativeUI/NativeUIRequests.h index 5055540874..f45295d221 100644 --- a/Code/Framework/AzCore/AzCore/NativeUI/NativeUIRequests.h +++ b/Code/Framework/AzCore/AzCore/NativeUI/NativeUIRequests.h @@ -15,45 +15,49 @@ #include #include -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& /*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& /*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; - } -} + 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; +} // namespace AZ::NativeUI diff --git a/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.cpp b/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.cpp index cf0c2872f1..bed066018a 100644 --- a/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.cpp +++ b/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.cpp @@ -15,50 +15,19 @@ #include -namespace AZ +namespace AZ::NativeUI { - using namespace AZ::NativeUI; - - void NativeUISystemComponent::Reflect(AZ::ReflectContext* context) + NativeUISystem::NativeUISystem() { - if (AZ::SerializeContext* serialize = azrtti_cast(context)) - { - serialize->Class() - ->Version(0) - ; - - if (AZ::EditContext* ec = serialize->GetEditContext()) - { - ec->Class("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 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 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 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 diff --git a/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.h b/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.h index 2d5cc36ffc..771b9a2af9 100644 --- a/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.h +++ b/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.h @@ -15,40 +15,24 @@ #include #include -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& 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& 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 diff --git a/Code/Framework/AzCore/AzCore/Script/ScriptSystemComponent.cpp b/Code/Framework/AzCore/AzCore/Script/ScriptSystemComponent.cpp index f12da5c60e..015554538f 100644 --- a/Code/Framework/AzCore/AzCore/Script/ScriptSystemComponent.cpp +++ b/Code/Framework/AzCore/AzCore/Script/ScriptSystemComponent.cpp @@ -699,6 +699,10 @@ Data::AssetHandler::LoadResult ScriptSystemComponent::LoadAssetData( script->m_scriptBuffer.resize(scriptDataLength); stream->Read(scriptDataLength, script->m_scriptBuffer.data()); + // Clear cached references in the event of a successful load. This function has to be queued on + // AssetBus where NotifyAssetReloaded is also queued, to ensure its execution before NotifyAssetReloaded + Data::AssetBus::QueueFunction(&ScriptSystemComponent::ClearAssetReferences, this, asset.GetId()); + return Data::AssetHandler::LoadResult::LoadComplete; } diff --git a/Code/Framework/AzCore/AzCore/Settings/SettingsRegistry.h b/Code/Framework/AzCore/AzCore/Settings/SettingsRegistry.h index 58cfa0d049..768841cc09 100644 --- a/Code/Framework/AzCore/AzCore/Settings/SettingsRegistry.h +++ b/Code/Framework/AzCore/AzCore/Settings/SettingsRegistry.h @@ -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 diff --git a/Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.cpp b/Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.cpp index 34f1bdef89..56dfbdcb71 100644 --- a/Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.cpp +++ b/Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.cpp @@ -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 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(path.size()), path.data(), aznumeric_cast(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; } } @@ -874,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 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) { diff --git a/Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.h b/Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.h index 10b3c2f18b..4e00c0e6ec 100644 --- a/Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.h +++ b/Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.h @@ -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 { diff --git a/Code/Framework/AzCore/Platform/Android/AzCore/NativeUI/NativeUISystemComponent_Android.cpp b/Code/Framework/AzCore/Platform/Android/AzCore/NativeUI/NativeUISystemComponent_Android.cpp index b9f7e87b4b..b43044f0b3 100644 --- a/Code/Framework/AzCore/Platform/Android/AzCore/NativeUI/NativeUISystemComponent_Android.cpp +++ b/Code/Framework/AzCore/Platform/Android/AzCore/NativeUI/NativeUISystemComponent_Android.cpp @@ -22,7 +22,7 @@ namespace AZ { namespace NativeUI { - AZStd::string NativeUISystemComponent::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector& options) const + AZStd::string NativeUISystem::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector& 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"); diff --git a/Code/Framework/AzCore/Platform/Common/Unimplemented/AzCore/NativeUI/NativeUISystemComponent_Unimplemented.cpp b/Code/Framework/AzCore/Platform/Common/Unimplemented/AzCore/NativeUI/NativeUISystemComponent_Unimplemented.cpp index 6a24415ec5..ceba9d2701 100644 --- a/Code/Framework/AzCore/Platform/Common/Unimplemented/AzCore/NativeUI/NativeUISystemComponent_Unimplemented.cpp +++ b/Code/Framework/AzCore/Platform/Common/Unimplemented/AzCore/NativeUI/NativeUISystemComponent_Unimplemented.cpp @@ -12,16 +12,11 @@ #include -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& options) const { - AZStd::string NativeUISystemComponent::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector& options) const - { - AZ_UNUSED(title); - AZ_UNUSED(message); - AZ_UNUSED(options); - return ""; - } + return {}; } } diff --git a/Code/Framework/AzCore/Platform/Mac/AzCore/NativeUI/NativeUISystemComponent_Mac.mm b/Code/Framework/AzCore/Platform/Mac/AzCore/NativeUI/NativeUISystemComponent_Mac.mm index 4af67a1d54..801adaf4ea 100644 --- a/Code/Framework/AzCore/Platform/Mac/AzCore/NativeUI/NativeUISystemComponent_Mac.mm +++ b/Code/Framework/AzCore/Platform/Mac/AzCore/NativeUI/NativeUISystemComponent_Mac.mm @@ -26,7 +26,7 @@ namespace AZ { namespace NativeUI { - AZStd::string NativeUISystemComponent::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector& options) const + AZStd::string NativeUISystem::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector& options) const { __block NSModalResponse response = -1; diff --git a/Code/Framework/AzCore/Platform/Windows/AzCore/NativeUI/NativeUISystemComponent_Windows.cpp b/Code/Framework/AzCore/Platform/Windows/AzCore/NativeUI/NativeUISystemComponent_Windows.cpp index a5dd65512f..f88cea5313 100644 --- a/Code/Framework/AzCore/Platform/Windows/AzCore/NativeUI/NativeUISystemComponent_Windows.cpp +++ b/Code/Framework/AzCore/Platform/Windows/AzCore/NativeUI/NativeUISystemComponent_Windows.cpp @@ -245,7 +245,7 @@ namespace AZ { namespace NativeUI { - AZStd::string NativeUISystemComponent::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector& options) const + AZStd::string NativeUISystem::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector& options) const { if (options.size() >= MAX_ITEMS) { diff --git a/Code/Framework/AzCore/Platform/iOS/AzCore/NativeUI/NativeUISystemComponent_iOS.mm b/Code/Framework/AzCore/Platform/iOS/AzCore/NativeUI/NativeUISystemComponent_iOS.mm index 835a7fb5e7..62f07f7483 100644 --- a/Code/Framework/AzCore/Platform/iOS/AzCore/NativeUI/NativeUISystemComponent_iOS.mm +++ b/Code/Framework/AzCore/Platform/iOS/AzCore/NativeUI/NativeUISystemComponent_iOS.mm @@ -18,7 +18,7 @@ namespace AZ { namespace NativeUI { - AZStd::string NativeUISystemComponent::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector& options) const + AZStd::string NativeUISystem::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector& options) const { __block AZStd::string userSelection = ""; diff --git a/Code/Framework/AzFramework/AzFramework/Application/Application.cpp b/Code/Framework/AzFramework/AzFramework/Application/Application.cpp index 4b75a3d1cf..ba313812ce 100644 --- a/Code/Framework/AzFramework/AzFramework/Application/Application.cpp +++ b/Code/Framework/AzFramework/AzFramework/Application/Application.cpp @@ -175,7 +175,7 @@ namespace AzFramework } // Initializes the IArchive for reading archive(.pak) files - if (auto archive = AZ::Interface::Get(); !archive) + if (auto archive = AZ::Interface::Get(); archive == nullptr) { m_archive = AZStd::make_unique(); AZ::Interface::Register(m_archive.get()); @@ -189,6 +189,12 @@ namespace AzFramework SetFileIOAliases(); } + if (auto nativeUI = AZ::Interface::Get(); nativeUI == nullptr) + { + m_nativeUI = AZStd::make_unique(); + AZ::Interface::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::Get() == m_nativeUI.get()) + { + AZ::Interface::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(), azrtti_typeid(), azrtti_typeid(), - azrtti_typeid(), azrtti_typeid(), azrtti_typeid(), @@ -372,7 +382,6 @@ namespace AzFramework azrtti_typeid(), azrtti_typeid(), azrtti_typeid(), - azrtti_typeid(), azrtti_typeid(), azrtti_typeid(), diff --git a/Code/Framework/AzFramework/AzFramework/Application/Application.h b/Code/Framework/AzFramework/AzFramework/Application/Application.h index fdc0ddcfb7..4d7e45a423 100644 --- a/Code/Framework/AzFramework/AzFramework/Application/Application.h +++ b/Code/Framework/AzFramework/AzFramework/Application/Application.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -187,6 +188,7 @@ namespace AzFramework AZStd::unique_ptr m_archiveFileIO; ///> The Default file IO instance is a ArchiveFileIO. AZStd::unique_ptr m_archive; ///> The AZ::IO::Instance AZStd::unique_ptr m_pimpl; + AZStd::unique_ptr m_nativeUI; bool m_ownsConsole = false; bool m_exitMainLoopRequested = false; diff --git a/Code/Framework/AzFramework/AzFramework/Asset/AssetSystemComponentHelper.cpp b/Code/Framework/AzFramework/AzFramework/Asset/AssetSystemComponentHelper.cpp index 618fd92ac1..727d5051fa 100644 --- a/Code/Framework/AzFramework/AzFramework/Asset/AssetSystemComponentHelper.cpp +++ b/Code/Framework/AzFramework/AzFramework/Asset/AssetSystemComponentHelper.cpp @@ -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; } diff --git a/Code/Framework/AzFramework/AzFramework/ProjectManager/ProjectManager.cpp b/Code/Framework/AzFramework/AzFramework/ProjectManager/ProjectManager.cpp index 7e968ffcd8..ea8fd75cfd 100644 --- a/Code/Framework/AzFramework/AzFramework/ProjectManager/ProjectManager.cpp +++ b/Code/Framework/AzFramework/AzFramework/ProjectManager/ProjectManager.cpp @@ -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)) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp index 50315e9d7a..ed7fb1515f 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp @@ -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(); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/EditorVertexSelection.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/EditorVertexSelection.cpp index 9a191f93de..089037bbf3 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/EditorVertexSelection.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/EditorVertexSelection.cpp @@ -769,12 +769,12 @@ namespace AzToolsFramework template void EditorVertexSelectionBase::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 diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorBoxSelect.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorBoxSelect.cpp index d9cf4af944..2e467caa4c 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorBoxSelect.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorBoxSelect.cpp @@ -13,6 +13,7 @@ #include "EditorBoxSelect.h" #include +#include #include @@ -72,7 +73,7 @@ namespace AzToolsFramework m_previousModifiers = mouseInteraction.m_mouseInteraction.m_keyboardModifiers; } - void EditorBoxSelect::Display2d(AzFramework::DebugDisplayRequests& debugDisplay) + void EditorBoxSelect::Display2d(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) { AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); @@ -82,12 +83,15 @@ namespace AzToolsFramework debugDisplay.SetLineWidth(s_boxSelectLineWidth); debugDisplay.SetColor(s_boxSelectColor); - debugDisplay.DrawWireBox( - AZ::Vector3( - static_cast(m_boxSelectRegion->x()), static_cast(m_boxSelectRegion->y()), 0.0f), - AZ::Vector3( - static_cast(m_boxSelectRegion->x()) + static_cast(m_boxSelectRegion->width()), - static_cast(m_boxSelectRegion->y()) + static_cast(m_boxSelectRegion->height()), 0.0f)); + AZ::Vector2 viewportSize = AzToolsFramework::GetCameraState(viewportInfo.m_viewportId).m_viewportSize; + + debugDisplay.DrawWireQuad2d( + AZ::Vector2( + aznumeric_cast(m_boxSelectRegion->x()), aznumeric_cast(m_boxSelectRegion->y())) / viewportSize, + AZ::Vector2( + aznumeric_cast(m_boxSelectRegion->x()) + aznumeric_cast(m_boxSelectRegion->width()), + aznumeric_cast(m_boxSelectRegion->y()) + aznumeric_cast(m_boxSelectRegion->height())) / viewportSize, + 0.f); debugDisplay.DepthTestOn(); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorBoxSelect.h b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorBoxSelect.h index d9fca58168..7f50b16325 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorBoxSelect.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorBoxSelect.h @@ -42,7 +42,7 @@ namespace AzToolsFramework const ViewportInteraction::MouseInteractionEvent& mouseInteraction); /// Responsible for drawing the 2d box representing the selection in screen space. - void Display2d(AzFramework::DebugDisplayRequests& debugDisplay); + void Display2d(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay); /// Custom drawing behavior to happen during a box select. void DisplayScene( diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp index a558e5895d..ec22a2f7c8 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp @@ -3494,7 +3494,7 @@ namespace AzToolsFramework DrawAxisGizmo(viewportInfo, debugDisplay); - m_boxSelect.Display2d(debugDisplay); + m_boxSelect.Display2d(viewportInfo, debugDisplay); } void EditorTransformComponentSelection::RefreshSelectedEntityIds() diff --git a/Code/Sandbox/Editor/Controls/ReflectedPropertyControl/PropertyGenericCtrl.cpp b/Code/Sandbox/Editor/Controls/ReflectedPropertyControl/PropertyGenericCtrl.cpp index ce76137466..3d17e77bb0 100644 --- a/Code/Sandbox/Editor/Controls/ReflectedPropertyControl/PropertyGenericCtrl.cpp +++ b/Code/Sandbox/Editor/Controls/ReflectedPropertyControl/PropertyGenericCtrl.cpp @@ -90,9 +90,6 @@ void ShaderPropertyEditor::onEditClicked() } void MaterialPropertyEditor::onEditClicked() { - QString name = GetValue(); - IDataBaseItem *pItem = GetIEditor()->GetMaterialManager()->FindItemByName(name); - GetIEditor()->OpenMaterialLibrary(pItem); } void MaterialPropertyEditor::onButton2Clicked() diff --git a/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.cpp b/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.cpp index aed53d6e8b..b0e00de020 100644 --- a/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.cpp +++ b/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.cpp @@ -605,8 +605,6 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe editMenu.AddSeparator(); // Lock Selection - editMenu.AddAction(ID_EDIT_FREEZE); - // NEWMENUS: NEEDS IMPLEMENTATION //// Unlock Selection //auto unlockSelectionMenu = editMenu.Get()->addAction(tr("Unlock Selection")); @@ -614,11 +612,6 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe //// Unlock Last Locked //auto unlockLastLockedMenu = editMenu.Get()->addAction(tr("Unlock Last Locked")); - // Unlock All - editMenu.AddAction(ID_EDIT_UNFREEZEALL); - - editMenu.AddSeparator(); - // Editor Settings auto editorSettingsMenu = editMenu.AddMenu(tr("Editor Settings")); diff --git a/Code/Sandbox/Editor/CryEdit.cpp b/Code/Sandbox/Editor/CryEdit.cpp index 3f28717072..dcc978433c 100644 --- a/Code/Sandbox/Editor/CryEdit.cpp +++ b/Code/Sandbox/Editor/CryEdit.cpp @@ -389,14 +389,9 @@ void CCryEditApp::RegisterActionHandlers() ON_COMMAND(ID_EDIT_DELETE, OnEditDelete) ON_COMMAND(ID_MOVE_OBJECT, OnMoveObject) ON_COMMAND(ID_RENAME_OBJ, OnRenameObj) - ON_COMMAND(ID_SET_HEIGHT, OnSetHeight) ON_COMMAND(ID_EDITMODE_MOVE, OnEditmodeMove) ON_COMMAND(ID_EDITMODE_ROTATE, OnEditmodeRotate) ON_COMMAND(ID_EDITMODE_SCALE, OnEditmodeScale) - ON_COMMAND(ID_OBJECTMODIFY_SETAREA, OnObjectSetArea) - ON_COMMAND(ID_OBJECTMODIFY_SETHEIGHT, OnObjectSetHeight) - ON_COMMAND(ID_OBJECTMODIFY_FREEZE, OnObjectmodifyFreeze) - ON_COMMAND(ID_OBJECTMODIFY_UNFREEZE, OnObjectmodifyUnfreeze) ON_COMMAND(ID_UNDO, OnUndo) ON_COMMAND(ID_TOOLBAR_WIDGET_REDO, OnUndo) // Can't use the same ID, because for the menu we can't have a QWidgetAction, while for the toolbar we want one ON_COMMAND(ID_IMPORT_ASSET, OnOpenAssetImporter) @@ -424,8 +419,6 @@ void CCryEditApp::RegisterActionHandlers() ON_COMMAND(ID_EDIT_HIDE, OnEditHide) ON_COMMAND(ID_EDIT_SHOW_LAST_HIDDEN, OnEditShowLastHidden) ON_COMMAND(ID_EDIT_UNHIDEALL, OnEditUnhideall) - ON_COMMAND(ID_EDIT_FREEZE, OnEditFreeze) - ON_COMMAND(ID_EDIT_UNFREEZEALL, OnEditUnfreezeall) ON_COMMAND(ID_SNAP_TO_GRID, OnSnap) @@ -477,7 +470,6 @@ void CCryEditApp::RegisterActionHandlers() ON_COMMAND(ID_ROTATESELECTION_YAXIS, OnRotateselectionYaxis) ON_COMMAND(ID_ROTATESELECTION_ZAXIS, OnRotateselectionZaxis) ON_COMMAND(ID_ROTATESELECTION_ROTATEANGLE, OnRotateselectionRotateangle) - ON_COMMAND(ID_MODIFY_OBJECT_HEIGHT, OnObjectSetHeight) ON_COMMAND(ID_EDIT_RENAMEOBJECT, OnEditRenameobject) ON_COMMAND(ID_CHANGEMOVESPEED_INCREASE, OnChangemovespeedIncrease) ON_COMMAND(ID_CHANGEMOVESPEED_DECREASE, OnChangemovespeedDecrease) @@ -500,7 +492,6 @@ void CCryEditApp::RegisterActionHandlers() ON_COMMAND(ID_OPEN_ASSET_BROWSER, OnOpenAssetBrowserView) ON_COMMAND(ID_OPEN_AUDIO_CONTROLS_BROWSER, OnOpenAudioControlsEditor) - ON_COMMAND(ID_OPEN_MATERIAL_EDITOR, OnOpenMaterialEditor) ON_COMMAND(ID_GOTO_VIEWPORTSEARCH, OnGotoViewportSearch) ON_COMMAND(ID_DISPLAY_SHOWHELPERS, OnShowHelpers) ON_COMMAND(ID_OPEN_TRACKVIEW, OnOpenTrackView) @@ -2734,10 +2725,6 @@ void CCryEditApp::OnRenameObj() { } -void CCryEditApp::OnSetHeight() -{ -} - ////////////////////////////////////////////////////////////////////////// void CCryEditApp::OnEditmodeMove() { @@ -2807,167 +2794,6 @@ void CCryEditApp::OnUpdateEditmodeScale(QAction* action) action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Scale); } -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnObjectSetArea() -{ - CSelectionGroup* pSelection = GetIEditor()->GetSelection(); - if (!pSelection->IsEmpty()) - { - bool ok = false; - int fractionalDigitCount = 2; - float area = aznumeric_caster(QInputDialog::getDouble(AzToolsFramework::GetActiveWindow(), QObject::tr("Insert Value"), QStringLiteral(""), 0, std::numeric_limits::lowest(), std::numeric_limits::max(), fractionalDigitCount, &ok)); - if (!ok) - { - return; - } - - GetIEditor()->BeginUndo(); - for (int i = 0; i < pSelection->GetCount(); i++) - { - CBaseObject* obj = pSelection->GetObject(i); - obj->SetArea(area); - } - GetIEditor()->AcceptUndo("Set Area"); - GetIEditor()->SetModifiedFlag(); - GetIEditor()->SetModifiedModule(eModifiedBrushes); - } - else - { - QMessageBox::critical(AzToolsFramework::GetActiveWindow(), QString(), QObject::tr("No objects selected")); - } -} - -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnObjectSetHeight() -{ - AzFramework::EntityContextId editorContextId; - AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult( - editorContextId, &AzToolsFramework::EditorEntityContextRequests::GetEditorEntityContextId); - - CSelectionGroup* sel = GetIEditor()->GetObjectManager()->GetSelection(); - - if (!sel->IsEmpty()) - { - // Retrieve the Z origin from where height is messured from - auto getZOrigin = [&](const Vec3& pos, [[maybe_unused]] AZ::EntityId entityId) - { - float z = GetIEditor()->GetTerrainElevation(pos.x, pos.y); - if (z != pos.z) - { - float zdown = FLT_MAX; - float zup = FLT_MAX; - AzFramework::RenderGeometry::RayRequest ray; - ray.m_startWorldPosition = LYVec3ToAZVec3(pos); - ray.m_onlyVisible = true; - if (entityId.IsValid()) // Don't check height against self - { - ray.m_entityFilter.m_ignoreEntities.insert(entityId); - } - // Down - ray.m_endWorldPosition = LYVec3ToAZVec3(pos - Vec3(0, 0, 4000)); - { - AzFramework::RenderGeometry::RayResult result; - AzFramework::RenderGeometry::IntersectorBus::EventResult(result, editorContextId, - &AzFramework::RenderGeometry::IntersectorInterface::RayIntersect, ray); - if (result) - { - zdown = result.m_worldPosition.GetZ(); - } - } - // Up - ray.m_endWorldPosition = LYVec3ToAZVec3(pos + Vec3(0, 0, 4000)); - { - AzFramework::RenderGeometry::RayResult result; - AzFramework::RenderGeometry::IntersectorBus::EventResult(result, editorContextId, - &AzFramework::RenderGeometry::IntersectorInterface::RayIntersect, ray); - if (result) - { - zup = result.m_worldPosition.GetZ(); - } - } - if (zdown != FLT_MAX && zup != FLT_MAX) - { - if (fabs(zup - z) < fabs(zdown - z)) - { - z = zup; - } - else - { - z = zdown; - } - } - else if (zup != FLT_MAX) - { - z = zup; - } - else if (zdown != FLT_MAX) - { - z = zdown; - } - } - return z; - }; - - - float height = 0; - if (sel->GetCount() == 1) - { - CBaseObject* obj = sel->GetObject(0); - Vec3 pos = obj->GetWorldPos(); - AZ::EntityId entityId; - if (obj->GetType() == OBJTYPE_AZENTITY) - { - entityId = static_cast(obj)->GetAssociatedEntityId(); - } - height = pos.z - getZOrigin(pos, entityId); - } - - bool ok = false; - int fractionalDigitCount = 2; - height = aznumeric_caster(QInputDialog::getDouble(AzToolsFramework::GetActiveWindow(), QObject::tr("Enter Height"), QStringLiteral(""), height, -10000, 10000, fractionalDigitCount, &ok)); - if (!ok) - { - return; - } - - CUndo undo("Set Height"); - for (int i = 0; i < sel->GetCount(); i++) - { - CBaseObject* obj = sel->GetObject(i); - Matrix34 wtm = obj->GetWorldTM(); - Vec3 pos = wtm.GetTranslation(); - AZ::EntityId entityId; - if (obj->GetType() == OBJTYPE_AZENTITY) - { - entityId = static_cast(obj)->GetAssociatedEntityId(); - } - float z = getZOrigin(pos, entityId); - pos.z = z + height; - wtm.SetTranslation(pos); - obj->SetWorldTM(wtm, eObjectUpdateFlags_UserInput); - } - - GetIEditor()->SetModifiedFlag(); - GetIEditor()->SetModifiedModule(eModifiedBrushes); - } - else - { - QMessageBox::critical(AzToolsFramework::GetActiveWindow(), QString(), QObject::tr("No objects selected")); - } -} - -void CCryEditApp::OnObjectmodifyFreeze() -{ - // Freeze selection. - OnEditFreeze(); -} - -void CCryEditApp::OnObjectmodifyUnfreeze() -{ - // Unfreeze all. - OnEditUnfreezeall(); -} - void CCryEditApp::OnViewSwitchToGame() { if (IsInPreviewMode()) @@ -3883,54 +3709,6 @@ void CCryEditApp::OnEditUnhideall() } } -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnEditFreeze() -{ - if (!GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - // Freeze selection. - CSelectionGroup* sel = GetIEditor()->GetSelection(); - if (!sel->IsEmpty()) - { - AzToolsFramework::ScopedUndoBatch undo("Lock Selected Entities"); - - // We need to iterate over the list of selected objects in reverse order - // because when the objects are locked, they are removed from the - // selection so you would end up with the last selected object not - // being locked - int numSelected = sel->GetCount(); - for (int i = numSelected - 1; i >= 0; --i) - { - // Duplicated object names can exist in the case of prefab objects so passing a name as a script parameter and processing it couldn't be exact. - sel->GetObject(i)->SetFrozen(true); - } - } - } -} - -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnUpdateEditFreeze(QAction* action) -{ - OnUpdateEditHide(action); -} - -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnEditUnfreezeall() -{ - if (!GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - if (QMessageBox::question( - AzToolsFramework::GetActiveWindow(), QObject::tr("Unlock All"), - QObject::tr("Are you sure you want to unlock all the objects?"), - QMessageBox::Yes | QMessageBox::Cancel) == QMessageBox::Yes) - { - // Unfreeze all. - AzToolsFramework::ScopedUndoBatch undo("Unlock all Entities"); - GetIEditor()->GetObjectManager()->UnfreezeAll(); - } - } -} - ////////////////////////////////////////////////////////////////////////// void CCryEditApp::OnSnap() { @@ -4618,12 +4396,6 @@ void CCryEditApp::OnMaterialGetmaterial() GetIEditor()->GetMaterialManager()->Command_SelectFromObject(); } -////////////////////////////////////////////////////////////////////////// -void CCryEditApp::OnOpenMaterialEditor() -{ - QtViewPaneManager::instance()->OpenPane(LyViewPane::MaterialEditor); -} - ////////////////////////////////////////////////////////////////////////// void CCryEditApp::OnOpenAssetBrowserView() { @@ -5045,12 +4817,28 @@ extern "C" #pragma comment(lib, "Shell32.lib") #endif +struct CryAllocatorsRAII +{ + CryAllocatorsRAII() + { + AZ_Assert(!AZ::AllocatorInstance::IsReady(), "Expected allocator to not be initialized, hunt down the static that is initializing it"); + AZ_Assert(!AZ::AllocatorInstance::IsReady(), "Expected allocator to not be initialized, hunt down the static that is initializing it"); + + AZ::AllocatorInstance::Create(); + AZ::AllocatorInstance::Create(); + } + + ~CryAllocatorsRAII() + { + AZ::AllocatorInstance::Destroy(); + AZ::AllocatorInstance::Destroy(); + } +}; + + extern "C" int AZ_DLL_EXPORT CryEditMain(int argc, char* argv[]) { - AZ_Assert(!AZ::AllocatorInstance::IsReady(), "Expected allocator to not be initialized, hunt down the static that is initializing it"); - AZ::AllocatorInstance::Create(); - AZ_Assert(!AZ::AllocatorInstance::IsReady(), "Expected allocator to not be initialized, hunt down the static that is initializing it"); - AZ::AllocatorInstance::Create(); + CryAllocatorsRAII cryAllocatorsRAII; // ensure the EditorEventsBus context gets created inside EditorLib [[maybe_unused]] const auto& editorEventsContext = AzToolsFramework::EditorEvents::Bus::GetOrCreateContext(); @@ -5058,7 +4846,7 @@ extern "C" int AZ_DLL_EXPORT CryEditMain(int argc, char* argv[]) // connect relevant buses to global settings gSettings.Connect(); - CCryEditApp* theApp = new CCryEditApp(); + auto theApp = AZStd::make_unique(); // this does some magic to set the current directory... { QCoreApplication app(argc, argv); @@ -5145,8 +4933,6 @@ extern "C" int AZ_DLL_EXPORT CryEditMain(int argc, char* argv[]) } - delete theApp; - gSettings.Disconnect(); return ret; diff --git a/Code/Sandbox/Editor/CryEdit.h b/Code/Sandbox/Editor/CryEdit.h index 7b96ab3827..2cbb34dd9f 100644 --- a/Code/Sandbox/Editor/CryEdit.h +++ b/Code/Sandbox/Editor/CryEdit.h @@ -220,17 +220,12 @@ public: void DeleteSelectedEntities(bool includeDescendants); void OnMoveObject(); void OnRenameObj(); - void OnSetHeight(); void OnEditmodeMove(); void OnEditmodeRotate(); void OnEditmodeScale(); - void OnObjectSetArea(); - void OnObjectSetHeight(); void OnUpdateEditmodeMove(QAction* action); void OnUpdateEditmodeRotate(QAction* action); void OnUpdateEditmodeScale(QAction* action); - void OnObjectmodifyFreeze(); - void OnObjectmodifyUnfreeze(); void OnUndo(); void OnOpenAssetImporter(); void OnUpdateSelected(QAction* action); @@ -388,9 +383,6 @@ private: void OnUpdateEditHide(QAction* action); void OnEditShowLastHidden(); void OnEditUnhideall(); - void OnEditFreeze(); - void OnUpdateEditFreeze(QAction* action); - void OnEditUnfreezeall(); void OnSnap(); void OnWireframe(); void OnUpdateWireframe(QAction* action); @@ -459,7 +451,6 @@ private: void OnUpdateSwitchToSelectedCamera(QAction* action); void OnSwitchcameraNext(); void OnOpenProceduralMaterialEditor(); - void OnOpenMaterialEditor(); void OnOpenAssetBrowserView(); void OnOpenTrackView(); void OnOpenAudioControlsEditor(); diff --git a/Code/Sandbox/Editor/ErrorReportDialog.cpp b/Code/Sandbox/Editor/ErrorReportDialog.cpp index 8c29da91ce..83839f3e08 100644 --- a/Code/Sandbox/Editor/ErrorReportDialog.cpp +++ b/Code/Sandbox/Editor/ErrorReportDialog.cpp @@ -519,11 +519,6 @@ void CErrorReportDialog::OnReportItemDblClick(const QModelIndex& index) } bDone = true; } - if (pError && pError->pItem != NULL) - { - GetIEditor()->OpenMaterialLibrary(pError->pItem); - bDone = true; - } if (!bDone && pError && GetIEditor()->GetActiveView()) { @@ -581,11 +576,6 @@ void CErrorReportDialog::OnReportHyperlink(const QModelIndex& index) GetIEditor()->SelectObject(pError->pObject); bDone = true; } - if (pError && pError->pItem != NULL) - { - GetIEditor()->OpenMaterialLibrary(pError->pItem); - bDone = true; - } if (!bDone && pError && GetIEditor()->GetActiveView()) { diff --git a/Code/Sandbox/Editor/IEditor.h b/Code/Sandbox/Editor/IEditor.h index 90fb8823e7..4a26e7475f 100644 --- a/Code/Sandbox/Editor/IEditor.h +++ b/Code/Sandbox/Editor/IEditor.h @@ -632,9 +632,6 @@ struct IEditor virtual RefCoordSys GetReferenceCoordSys() = 0; virtual XmlNodeRef FindTemplate(const QString& templateName) = 0; virtual void AddTemplate(const QString& templateName, XmlNodeRef& tmpl) = 0; - //! Open material library and select specified item. - //! If parameter is NULL current selection in material library does not change. - virtual void OpenMaterialLibrary(IDataBaseItem* pItem = NULL) = 0; virtual const QtViewPane* OpenView(QString sViewClassName, bool reuseOpen = true) = 0; virtual QWidget* FindView(QString viewClassName) = 0; diff --git a/Code/Sandbox/Editor/IEditorImpl.cpp b/Code/Sandbox/Editor/IEditorImpl.cpp index 561953d729..04d7b88fb6 100644 --- a/Code/Sandbox/Editor/IEditorImpl.cpp +++ b/Code/Sandbox/Editor/IEditorImpl.cpp @@ -1013,29 +1013,6 @@ IDataBaseManager* CEditorImpl::GetDBItemManager(EDataBaseItemType itemType) return 0; } -void CEditorImpl::OpenMaterialLibrary(IDataBaseItem* item) -{ - EDataBaseItemType type = item ? item->GetType() : EDB_TYPE_MATERIAL; - AZ_Assert(type == EDB_TYPE_MATERIAL, "Call to OpenMaterialLibrary with non-material data base item"); - - if (type == EDB_TYPE_MATERIAL) - { - QtViewPaneManager::instance()->OpenPane(LyViewPane::MaterialEditor); - - // This is a workaround for a timing issue where the material editor - // gets in a bad state while it is being polished for the first time - // while loading a material at the same time, so delay the setting - // of the material until the next event queue check - QTimer::singleShot(0, [this, item] { - IDataBaseManager* pManager = GetDBItemManager(EDB_TYPE_MATERIAL); - if (pManager) - { - pManager->SetSelectedItem(item); - } - }); - } -} - bool CEditorImpl::SelectColor(QColor& color, QWidget* parent) { const AZ::Color c = AzQtComponents::fromQColor(color); diff --git a/Code/Sandbox/Editor/IEditorImpl.h b/Code/Sandbox/Editor/IEditorImpl.h index a99fa234b9..cde1012b94 100644 --- a/Code/Sandbox/Editor/IEditorImpl.h +++ b/Code/Sandbox/Editor/IEditorImpl.h @@ -237,7 +237,6 @@ public: RefCoordSys GetReferenceCoordSys(); XmlNodeRef FindTemplate(const QString& templateName); void AddTemplate(const QString& templateName, XmlNodeRef& tmpl); - void OpenMaterialLibrary(IDataBaseItem* pItem = NULL); const QtViewPane* OpenView(QString sViewClassName, bool reuseOpened = true) override; diff --git a/Code/Sandbox/Editor/Lib/Tests/IEditorMock.h b/Code/Sandbox/Editor/Lib/Tests/IEditorMock.h index b28a80967a..b51a3d7a4a 100644 --- a/Code/Sandbox/Editor/Lib/Tests/IEditorMock.h +++ b/Code/Sandbox/Editor/Lib/Tests/IEditorMock.h @@ -135,7 +135,6 @@ public: MOCK_METHOD0(GetReferenceCoordSys, RefCoordSys()); MOCK_METHOD1(FindTemplate, XmlNodeRef(const QString& )); MOCK_METHOD2(AddTemplate, void(const QString& , XmlNodeRef& )); - MOCK_METHOD1(OpenMaterialLibrary, void (IDataBaseItem*)); MOCK_METHOD2(OpenView, const QtViewPane* (QString , bool )); MOCK_METHOD1(FindView, QWidget* (QString )); MOCK_METHOD1(CloseView, bool(const char* )); diff --git a/Code/Sandbox/Editor/LyViewPaneNames.h b/Code/Sandbox/Editor/LyViewPaneNames.h index c0c2dbdb45..3ea793b9c7 100644 --- a/Code/Sandbox/Editor/LyViewPaneNames.h +++ b/Code/Sandbox/Editor/LyViewPaneNames.h @@ -43,7 +43,6 @@ namespace LyViewPane static const char* const TerrainEditor = "Terrain Editor"; static const char* const TerrainTool = "Terrain Tool"; static const char* const TerrainTextureLayers = "Terrain Texture Layers"; - static const char* const MaterialEditor = "Material Editor"; static const char* const ParticleEditor = "Particle Editor"; static const char* const LensFlareEditor = "Lens Flare Editor"; static const char* const TimeOfDayEditor = "Time Of Day"; diff --git a/Code/Sandbox/Editor/MainWindow.cpp b/Code/Sandbox/Editor/MainWindow.cpp index 2915ca9c2e..a18cec12f0 100644 --- a/Code/Sandbox/Editor/MainWindow.cpp +++ b/Code/Sandbox/Editor/MainWindow.cpp @@ -435,13 +435,6 @@ MainWindow::MainWindow(QWidget* parent) setAcceptDrops(true); -#ifdef Q_OS_WIN - if (auto aed = QAbstractEventDispatcher::instance()) - { - aed->installNativeEventFilter(this); - } -#endif - // special handling for escape key (outside ActionManager) auto* escapeAction = new QAction(this); escapeAction->setShortcut(QKeySequence(Qt::Key_Escape)); @@ -508,13 +501,6 @@ void MainWindow::SetActiveView(CLayoutViewPane* v) MainWindow::~MainWindow() { -#ifdef Q_OS_WIN - if (auto aed = QAbstractEventDispatcher::instance()) - { - aed->removeNativeEventFilter(this); - } -#endif - AzToolsFramework::SourceControlNotificationBus::Handler::BusDisconnect(); delete m_toolbarManager; @@ -938,22 +924,6 @@ void MainWindow::InitActions() am->AddAction(ID_MODIFY_UNLINK, tr("Un-Parent")); } - if (!GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - // implemented by EditorTransformComponentSelection when the new Viewport Interaction Model is enabled - am->AddAction(ID_EDIT_FREEZE, tr("Lock selection")) - .SetShortcut(tr("L")) - .SetToolTip(tr("Lock selection (L)")) - .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditFreeze) - .SetIcon(Style::icon("Locked")) - .SetApplyHoverEffect(); - am->AddAction(ID_EDIT_UNFREEZEALL, tr("Unlock all")) - .SetShortcut(tr("Ctrl+L")) - .SetToolTip(tr("Unlock All (Ctrl+L)")) - .SetIcon(Style::icon("Unlocked")) - .SetApplyHoverEffect(); - } - am->AddAction(ID_EDIT_HOLD, tr("&Hold")) .SetShortcut(tr("Ctrl+Alt+H")) .SetToolTip(tr("&Hold (Ctrl+Alt+H)")) @@ -987,7 +957,6 @@ void MainWindow::InitActions() } // Modify actions - am->AddAction(ID_MODIFY_OBJECT_HEIGHT, tr("Set Object(s) Height...")); am->AddAction(ID_EDIT_RENAMEOBJECT, tr("Rename Object(s)...")) .SetStatusTip(tr("Rename Object")); @@ -1202,10 +1171,6 @@ void MainWindow::InitActions() if (!GetIEditor()->IsNewViewportInteractionModelEnabled()) { - am->AddAction(ID_GENERATORS_LIGHTING, tr("&Sun Trajectory Tool")) - .SetIcon(Style::icon("Lighting")) - .SetApplyHoverEffect() - .SetStatusTip(tr("Bring up the terrain lighting dialog")); am->AddAction(ID_TERRAIN_TIMEOFDAY, tr("Time Of Day")) .SetStatusTip(tr("Open Time of Day Editor")); } @@ -1300,14 +1265,6 @@ void MainWindow::InitActions() .SetToolTip(tr("Open Asset Browser")) .SetApplyHoverEffect(); - if (!AZ::Interface::Get()) - { - am->AddAction(ID_OPEN_MATERIAL_EDITOR, tr(LyViewPane::MaterialEditor)) - .SetToolTip(tr("Open Material Editor")) - .SetIcon(Style::icon("Material")) - .SetApplyHoverEffect(); - } - AZ::EBusReduceResult> emfxEnabled(false); using AnimationRequestBus = AzToolsFramework::EditorAnimationSystemRequestsBus; using AnimationSystemType = AzToolsFramework::EditorAnimationSystemRequests::AnimationSystem; @@ -1360,14 +1317,6 @@ void MainWindow::InitActions() .SetApplyHoverEffect() .Connect(&QAction::triggered, this, &MainWindow::OnGotoSelected); - if (!GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - am->AddAction(ID_OBJECTMODIFY_SETHEIGHT, tr("Set object(s) height")) - .SetIcon(QIcon(":/MainWindow/toolbars/object_toolbar-03.svg")) - .SetApplyHoverEffect() - .RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelected); - } - // Misc Toolbar Actions am->AddAction(ID_OPEN_SUBSTANCE_EDITOR, tr("Open Substance Editor")) .SetApplyHoverEffect(); @@ -2215,35 +2164,6 @@ void MainWindow::RegisterOpenWndCommands() } } -void MainWindow::MatEditSend(int param) -{ - if (param == eMSM_Init || GetIEditor()->IsInMatEditMode()) - { - // In MatEditMode this message is handled by CMatEditMainDlg, which doesn't have - // any view panes and opens MaterialDialog directly. - return; - } - - if (QtViewPaneManager::instance()->OpenPane(LyViewPane::MaterialEditor)) - { - GetIEditor()->GetMaterialManager()->SyncMaterialEditor(); - } -} - -#ifdef Q_OS_WIN -bool MainWindow::nativeEventFilter([[maybe_unused]] const QByteArray &eventType, void *message, long *) -{ - MSG* msg = static_cast(message); - if (msg->message == WM_MATEDITSEND) // For supporting 3ds Max Exporter, Windows Only - { - MatEditSend(msg->wParam); - return true; - } - - return false; -} -#endif - bool MainWindow::event(QEvent* event) { #ifdef Q_OS_MAC diff --git a/Code/Sandbox/Editor/MainWindow.h b/Code/Sandbox/Editor/MainWindow.h index cafa719589..adf271b383 100644 --- a/Code/Sandbox/Editor/MainWindow.h +++ b/Code/Sandbox/Editor/MainWindow.h @@ -24,13 +24,11 @@ #include #include #include -#include #include "Include/SandboxAPI.h" #include #include #include -#include #include "IEditor.h" #endif @@ -93,9 +91,6 @@ class SANDBOX_API MainWindow : public QMainWindow , public IEditorNotifyListener , private AzToolsFramework::SourceControlNotificationBus::Handler -#ifdef Q_OS_WIN - , public QAbstractNativeEventFilter -#endif { AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING @@ -160,13 +155,9 @@ public: void UpdateToolsMenu(); int ViewPaneVersion() const; - void MatEditSend(int param); LevelEditorMenuHandler* GetLevelEditorMenuHandler() { return m_levelEditorMenuHandler; } -#ifdef Q_OS_WIN - bool nativeEventFilter(const QByteArray& eventType, void* message, long* result) override; -#endif bool event(QEvent* event) override; void OnGotoSliceRoot(); diff --git a/Code/Sandbox/Editor/Material/MaterialManager.cpp b/Code/Sandbox/Editor/Material/MaterialManager.cpp index 3c21a74d97..51460ff34a 100644 --- a/Code/Sandbox/Editor/Material/MaterialManager.cpp +++ b/Code/Sandbox/Editor/Material/MaterialManager.cpp @@ -1668,25 +1668,13 @@ void CMaterialManager::InitMatSender() } ////////////////////////////////////////////////////////////////////////// -void CMaterialManager::GotoMaterial(CMaterial* pMaterial) +void CMaterialManager::GotoMaterial([[maybe_unused]] CMaterial* pMaterial) { - if (pMaterial) - { - GetIEditor()->OpenMaterialLibrary(pMaterial); - } } ////////////////////////////////////////////////////////////////////////// -void CMaterialManager::GotoMaterial(_smart_ptr pMtl) +void CMaterialManager::GotoMaterial([[maybe_unused]] _smart_ptr pMtl) { - if (pMtl) - { - CMaterial* pEdMaterial = FromIMaterial(pMtl); - if (pEdMaterial) - { - GetIEditor()->OpenMaterialLibrary(pEdMaterial); - } - } } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Sandbox/Editor/Resource.h b/Code/Sandbox/Editor/Resource.h index 15d04bd5c0..ce2c3a9ca4 100644 --- a/Code/Sandbox/Editor/Resource.h +++ b/Code/Sandbox/Editor/Resource.h @@ -75,13 +75,10 @@ #define IDC_PLATFORM_SALEM 2759 #define IDC_GROUPBOX_GLOBALTAGS 2916 #define IDC_GROUPBOX_FRAGMENTTAGS 2917 -#define ID_PARTICLE_EDITOR 2922 #define ID_RESOURCES_GENERATECGFTHUMBNAILS 32894 #define ID_RESOURCES_REDUCEWORKINGSET 32896 #define ID_EDIT_HIDE 32898 #define ID_EDIT_UNHIDEALL 32899 -#define ID_EDIT_FREEZE 32900 -#define ID_EDIT_UNFREEZEALL 32901 #define ID_RELOAD_TERRAIN 32902 #define ID_VIEW_GRIDSETTINGS 32904 #define ID_VIEW_CONFIGURELAYOUT 32906 @@ -125,7 +122,6 @@ #define ID_EDIT_SELECTNONE 33377 #define ID_WIREFRAME 33410 #define ID_FILE_GENERATETERRAINTEXTURE 33445 -#define ID_GENERATORS_LIGHTING 33446 #define ID_GENERATORS_STATICOBJECTS 33447 #define ID_GENERATORS_TEXTURE 33448 #define ID_FILE_IMPORT 33457 @@ -136,17 +132,12 @@ #define ID_EDIT_DELETE 33480 #define ID_MOVE_OBJECT 33481 #define ID_RENAME_OBJ 33483 -#define ID_SET_HEIGHT 33484 #define ID_FETCH 33496 #define ID_EDITMODE_ROTATE 33506 #define ID_EDITMODE_SCALE 33507 #define ID_EDITMODE_MOVE 33508 #define ID_SELECTION_DELETE 33512 #define ID_EDIT_ESCAPE 33513 -#define ID_OBJECTMODIFY_SETAREA 33514 -#define ID_OBJECTMODIFY_SETHEIGHT 33515 -#define ID_OBJECTMODIFY_FREEZE 33517 -#define ID_OBJECTMODIFY_UNFREEZE 33518 #define ID_UNDO 33524 #define ID_EDIT_CLONE 33525 #define ID_GOTO_SELECTED 33535 @@ -230,7 +221,6 @@ #define ID_VIEW_OPENVIEWPANE 33709 #define ID_VIEW_OPENPANE_FIRST 33712 #define ID_VIEW_OPENPANE_LAST 33811 -#define ID_OPEN_MATERIAL_EDITOR 33822 #define ID_OPEN_EMOTIONFX_EDITOR 39742 #define ID_BRUSH_CSGSUBSTRUCT 33837 #define ID_MATERIAL_PICKTOOL 33842 @@ -320,7 +310,6 @@ #define ID_SNAP_TO_ANGLE_RANGE_END 34330 #define ID_MODIFY_LINK 34355 #define ID_MODIFY_UNLINK 34356 -#define ID_MODIFY_OBJECT_HEIGHT 34357 #define ID_MODIFY_GOTO_SELECTION 34358 #define ID_VIEW_LAYOUT_FIRST 34363 #define ID_VIEW_LAYOUT_LAST 34377 diff --git a/Code/Sandbox/Editor/ToolbarManager.cpp b/Code/Sandbox/Editor/ToolbarManager.cpp index c1758405ca..0e757dad7c 100644 --- a/Code/Sandbox/Editor/ToolbarManager.cpp +++ b/Code/Sandbox/Editor/ToolbarManager.cpp @@ -609,14 +609,6 @@ AmazonToolbar ToolbarManager::GetObjectToolbar() const AmazonToolbar t = AmazonToolbar("Object", QObject::tr("Object Toolbar")); t.SetMainToolbar(true); t.AddAction(ID_GOTO_SELECTED, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_OBJECTMODIFY_SETHEIGHT, ORIGINAL_TOOLBAR_VERSION); - - if (!GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_EDIT_FREEZE, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_EDIT_UNFREEZEALL, ORIGINAL_TOOLBAR_VERSION); - } return t; } @@ -636,19 +628,9 @@ AmazonToolbar ToolbarManager::GetPlayConsoleToolbar() const AmazonToolbar ToolbarManager::GetEditorsToolbar() const { AmazonToolbar t = AmazonToolbar("Editors", QObject::tr("Editors Toolbar")); - if( !AZ::Interface::Get() && !GetIEditor()->IsNewViewportInteractionModelEnabled()) - { - t.AddAction(ID_OPEN_MATERIAL_EDITOR, ORIGINAL_TOOLBAR_VERSION); - } t.AddAction(ID_OPEN_AUDIO_CONTROLS_BROWSER, ORIGINAL_TOOLBAR_VERSION); - if (!AZ::Interface::Get()) - { - t.AddAction(ID_PARTICLE_EDITOR, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_GENERATORS_LIGHTING, ORIGINAL_TOOLBAR_VERSION); - } - return t; } diff --git a/Code/Sandbox/Editor/main.cpp b/Code/Sandbox/Editor/main.cpp index 013dc4ff69..17c177e9d3 100644 --- a/Code/Sandbox/Editor/main.cpp +++ b/Code/Sandbox/Editor/main.cpp @@ -30,17 +30,14 @@ int main(int argc, char* argv[]) [[maybe_unused]] const bool loaded = handle->Load(true); AZ_Assert(loaded, "EditorLib could not be loaded"); + int ret = 1; if (auto fn = handle->GetFunction(CryEditMainName); fn != nullptr) { - const int ret = AZStd::invoke(fn, argc, argv); - - AZ::AllocatorInstance::Destroy(); - AZ::Environment::Detach(); - - return ret; + ret = AZStd::invoke(fn, argc, argv); } + handle = {}; AZ::AllocatorInstance::Destroy(); AZ::Environment::Detach(); - return 1; + return ret; } diff --git a/Code/Tools/RC/ResourceCompiler/main.cpp b/Code/Tools/RC/ResourceCompiler/main.cpp index 02dbd406d8..67a585aaa4 100644 --- a/Code/Tools/RC/ResourceCompiler/main.cpp +++ b/Code/Tools/RC/ResourceCompiler/main.cpp @@ -579,6 +579,8 @@ int rcmain(int argc, char** argv, [[maybe_unused]] char** envp) // on the command line AZ::CommandLine commandLine; commandLine.Parse(argc, argv); + AZ::SettingsRegistryMergeUtils::ParseCommandLine(commandLine); + AZ::SettingsRegistryImpl settingsRegistry; AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_Bootstrap(settingsRegistry); AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_O3deUserRegistry(settingsRegistry, AZ_TRAIT_OS_PLATFORM_CODENAME, {}); diff --git a/Gems/Atom/Feature/Common/Code/Source/DiffuseProbeGrid/DiffuseProbeGrid.cpp b/Gems/Atom/Feature/Common/Code/Source/DiffuseProbeGrid/DiffuseProbeGrid.cpp index 8a349083ea..5be1303434 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DiffuseProbeGrid/DiffuseProbeGrid.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DiffuseProbeGrid/DiffuseProbeGrid.cpp @@ -263,7 +263,7 @@ namespace AZ RHI::ImageInitRequest request; request.m_image = m_classificationImage[m_currentImageIndex].get(); request.m_descriptor = RHI::ImageDescriptor::Create2D(RHI::ImageBindFlags::ShaderReadWrite, width, height, DiffuseProbeGridRenderData::ClassificationImageFormat); - RHI::ResultCode result = m_renderData->m_imagePool->InitImage(request); + [[maybe_unused]] RHI::ResultCode result = m_renderData->m_imagePool->InitImage(request); AZ_Assert(result == RHI::ResultCode::Success, "Failed to initialize m_probeClassificationImage image"); } diff --git a/Gems/Atom/Feature/Common/Code/Source/DiffuseProbeGrid/DiffuseProbeGridRayTracingPass.cpp b/Gems/Atom/Feature/Common/Code/Source/DiffuseProbeGrid/DiffuseProbeGridRayTracingPass.cpp index 6a0e618830..143ae1a08c 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DiffuseProbeGrid/DiffuseProbeGridRayTracingPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DiffuseProbeGrid/DiffuseProbeGridRayTracingPass.cpp @@ -294,7 +294,7 @@ namespace AZ // probe classification { - RHI::ResultCode result = frameGraph.GetAttachmentDatabase().ImportImage(diffuseProbeGrid->GetClassificationImageAttachmentId(), diffuseProbeGrid->GetClassificationImage()); + [[maybe_unused]] RHI::ResultCode result = frameGraph.GetAttachmentDatabase().ImportImage(diffuseProbeGrid->GetClassificationImageAttachmentId(), diffuseProbeGrid->GetClassificationImage()); AZ_Assert(result == RHI::ResultCode::Success, "Failed to import probeClassificationImage"); RHI::ImageScopeAttachmentDescriptor desc; diff --git a/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp b/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp index f1c41576ef..90499be8b8 100644 --- a/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp @@ -31,6 +31,11 @@ #include #include +#include + +#if defined(OPEN_IMAGE_IO_ENABLED) +#include +#endif namespace AZ { @@ -38,6 +43,41 @@ namespace AZ { AZ_ENUM_DEFINE_REFLECT_UTILITIES(FrameCaptureResult); +#if defined(OPEN_IMAGE_IO_ENABLED) + AZ_CVAR(unsigned int, + r_pngCompressionLevel, + 3, // A compression level of 3 seems like the best default in terms of file size and saving speeds + nullptr, + ConsoleFunctorFlags::Null, + "Sets the compression level for saving png screenshots. Valid values are from 0 to 8" + ); + + FrameCaptureOutputResult PngFrameCaptureOutput( + const AZStd::string& outputFilePath, const AZ::RPI::AttachmentReadback::ReadbackResult& readbackResult) + { + using namespace OIIO; + AZStd::unique_ptr out = ImageOutput::create(outputFilePath.c_str()); + if (out) + { + ImageSpec spec( + readbackResult.m_imageDescriptor.m_size.m_width, + readbackResult.m_imageDescriptor.m_size.m_height, + AZ::RHI::GetFormatComponentCount(readbackResult.m_imageDescriptor.m_format) + ); + spec.attribute("png:compressionLevel", r_pngCompressionLevel); + + if (out->open(outputFilePath.c_str(), spec)) + { + out->write_image(TypeDesc::UINT8, readbackResult.m_dataBuffer->data()); + out->close(); + return FrameCaptureOutputResult{FrameCaptureResult::Success, AZStd::nullopt}; + } + } + + return FrameCaptureOutputResult{FrameCaptureResult::InternalError, "Unable to save frame capture output to " + outputFilePath}; + } +#endif + FrameCaptureOutputResult DdsFrameCaptureOutput( const AZStd::string& outputFilePath, const AZ::RPI::AttachmentReadback::ReadbackResult& readbackResult) { @@ -377,7 +417,6 @@ namespace AZ if (readbackResult.m_attachmentType == AZ::RHI::AttachmentType::Buffer) { // write buffer data to the data file - AZ::IO::FileIOStream fileStream(m_outputFilePath.c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeCreatePath); if (fileStream.IsOpen()) { @@ -418,6 +457,18 @@ namespace AZ m_result = ddsFrameCapture.m_result; m_latestCaptureInfo = ddsFrameCapture.m_errorMessage.value_or(""); } +#if defined(OPEN_IMAGE_IO_ENABLED) + else if (extension == "png") + { + AZStd::string folderPath; + AzFramework::StringFunc::Path::GetFolderPath(m_outputFilePath.c_str(), folderPath); + AZ::IO::SystemFile::CreateDir(folderPath.c_str()); + + const auto frameCaptureResult = PngFrameCaptureOutput(m_outputFilePath, readbackResult); + m_result = frameCaptureResult.m_result; + m_latestCaptureInfo = frameCaptureResult.m_errorMessage.value_or(""); + } +#endif else { m_latestCaptureInfo = AZStd::string::format("Only supports saving image to ppm or dds files"); diff --git a/Gems/Atom/Feature/Common/Code/Source/Platform/Windows/platform_windows.cmake b/Gems/Atom/Feature/Common/Code/Source/Platform/Windows/platform_windows.cmake index f5b9ea77a2..b12b5de9ce 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Platform/Windows/platform_windows.cmake +++ b/Gems/Atom/Feature/Common/Code/Source/Platform/Windows/platform_windows.cmake @@ -9,3 +9,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +set(LY_BUILD_DEPENDENCIES + PRIVATE + 3rdParty::OpenImageIO + 3rdParty::ilmbase +) + +# [GFX-TODO] Add macro defintion in OpenImageIO 3rd party find cmake file +set(LY_COMPILE_DEFINITIONS + PRIVATE + OPEN_IMAGE_IO_ENABLED +) diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/RenderViewportWidget.cpp b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/RenderViewportWidget.cpp index f282aaebee..483b4bc55b 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/RenderViewportWidget.cpp +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/RenderViewportWidget.cpp @@ -416,9 +416,7 @@ namespace AtomToolsFramework } AzFramework::ScreenPoint position = AzFramework::WorldToScreen( worldPosition, - currentView->GetViewToWorldMatrix(), - currentView->GetViewToClipMatrix(), - AZ::Vector2{aznumeric_cast(width()), aznumeric_cast(height())} + GetCameraState() ); return {position.m_x, position.m_y}; } diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DiskLightDelegate.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DiskLightDelegate.cpp index 54babd3bc1..7805a92cd1 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DiskLightDelegate.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DiskLightDelegate.cpp @@ -103,12 +103,15 @@ namespace AZ::Render void DiskLightDelegate::SetEnableShutters(bool enabled) { Base::SetEnableShutters(enabled); - GetFeatureProcessor()->SetConstrainToConeLight(GetLightHandle(), true); + if (GetLightHandle().IsValid()) + { + GetFeatureProcessor()->SetConstrainToConeLight(GetLightHandle(), true); + } } void DiskLightDelegate::SetShutterAngles(float innerAngleDegrees, float outerAngleDegrees) { - if (GetShuttersEnabled()) + if (GetShuttersEnabled() && GetLightHandle().IsValid()) { GetFeatureProcessor()->SetConeAngles(GetLightHandle(), DegToRad(innerAngleDegrees), DegToRad(outerAngleDegrees)); } @@ -117,12 +120,16 @@ namespace AZ::Render void DiskLightDelegate::SetEnableShadow(bool enabled) { Base::SetEnableShadow(enabled); - GetFeatureProcessor()->SetShadowsEnabled(GetLightHandle(), enabled); + + if (GetLightHandle().IsValid()) + { + GetFeatureProcessor()->SetShadowsEnabled(GetLightHandle(), enabled); + } } void DiskLightDelegate::SetShadowmapMaxSize(ShadowmapSize size) { - if (GetShadowsEnabled()) + if (GetShadowsEnabled() && GetLightHandle().IsValid()) { GetFeatureProcessor()->SetShadowmapMaxResolution(GetLightHandle(), size); } @@ -130,7 +137,7 @@ namespace AZ::Render void DiskLightDelegate::SetShadowFilterMethod(ShadowFilterMethod method) { - if (GetShadowsEnabled()) + if (GetShadowsEnabled() && GetLightHandle().IsValid()) { GetFeatureProcessor()->SetShadowFilterMethod(GetLightHandle(), method); } @@ -138,7 +145,7 @@ namespace AZ::Render void DiskLightDelegate::SetSofteningBoundaryWidthAngle(float widthInDegrees) { - if (GetShadowsEnabled()) + if (GetShadowsEnabled() && GetLightHandle().IsValid()) { GetFeatureProcessor()->SetSofteningBoundaryWidthAngle(GetLightHandle(), DegToRad(widthInDegrees)); } @@ -146,7 +153,7 @@ namespace AZ::Render void DiskLightDelegate::SetPredictionSampleCount(uint32_t count) { - if (GetShadowsEnabled()) + if (GetShadowsEnabled() && GetLightHandle().IsValid()) { GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), count); } @@ -154,7 +161,7 @@ namespace AZ::Render void DiskLightDelegate::SetFilteringSampleCount(uint32_t count) { - if (GetShadowsEnabled()) + if (GetShadowsEnabled() && GetLightHandle().IsValid()) { GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), count); } @@ -162,7 +169,7 @@ namespace AZ::Render void DiskLightDelegate::SetPcfMethod(PcfMethod method) { - if (GetShadowsEnabled()) + if (GetShadowsEnabled() && GetLightHandle().IsValid()) { GetFeatureProcessor()->SetPcfMethod(GetLightHandle(), method); } diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SimplePointLightDelegate.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SimplePointLightDelegate.cpp index a2a24c3055..073b74d4bc 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SimplePointLightDelegate.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SimplePointLightDelegate.cpp @@ -23,7 +23,10 @@ namespace AZ : LightDelegateBase(entityId, isVisible) { InitBase(entityId); - GetFeatureProcessor()->SetPosition(GetLightHandle(), GetTransform().GetTranslation()); + if (GetLightHandle().IsValid()) + { + GetFeatureProcessor()->SetPosition(GetLightHandle(), GetTransform().GetTranslation()); + } } float SimplePointLightDelegate::CalculateAttenuationRadius(float lightThreshold) const { @@ -39,7 +42,10 @@ namespace AZ void SimplePointLightDelegate::HandleShapeChanged() { - GetFeatureProcessor()->SetPosition(GetLightHandle(), GetTransform().GetTranslation()); + if (GetLightHandle().IsValid()) + { + GetFeatureProcessor()->SetPosition(GetLightHandle(), GetTransform().GetTranslation()); + } } void SimplePointLightDelegate::DrawDebugDisplay(const Transform& transform, const Color& color, AzFramework::DebugDisplayRequests& debugDisplay, bool isSelected) const diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SimpleSpotLightDelegate.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SimpleSpotLightDelegate.cpp index 705a71571a..5ce8f6d563 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SimpleSpotLightDelegate.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SimpleSpotLightDelegate.cpp @@ -24,8 +24,11 @@ namespace AZ::Render void SimpleSpotLightDelegate::HandleShapeChanged() { - GetFeatureProcessor()->SetPosition(GetLightHandle(), GetTransform().GetTranslation()); - GetFeatureProcessor()->SetDirection(GetLightHandle(), GetTransform().GetBasisZ()); + if (GetLightHandle().IsValid()) + { + GetFeatureProcessor()->SetPosition(GetLightHandle(), GetTransform().GetTranslation()); + GetFeatureProcessor()->SetDirection(GetLightHandle(), GetTransform().GetBasisZ()); + } } float SimpleSpotLightDelegate::CalculateAttenuationRadius(float lightThreshold) const @@ -42,7 +45,10 @@ namespace AZ::Render void SimpleSpotLightDelegate::SetShutterAngles(float innerAngleDegrees, float outerAngleDegrees) { - GetFeatureProcessor()->SetConeAngles(GetLightHandle(), DegToRad(innerAngleDegrees), DegToRad(outerAngleDegrees)); + if (GetLightHandle().IsValid()) + { + GetFeatureProcessor()->SetConeAngles(GetLightHandle(), DegToRad(innerAngleDegrees), DegToRad(outerAngleDegrees)); + } } void SimpleSpotLightDelegate::DrawDebugDisplay(const Transform& transform, const Color& /*color*/, AzFramework::DebugDisplayRequests& debugDisplay, bool isSelected) const diff --git a/Gems/Blast/Code/CMakeLists.txt b/Gems/Blast/Code/CMakeLists.txt index aabb6646aa..6c90357364 100644 --- a/Gems/Blast/Code/CMakeLists.txt +++ b/Gems/Blast/Code/CMakeLists.txt @@ -43,6 +43,7 @@ ly_add_target( ly_add_target( NAME Blast ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE} NAMESPACE Gem + OUTPUT_NAME Blast.Gem FILES_CMAKE blast_shared_files.cmake INCLUDE_DIRECTORIES @@ -89,8 +90,8 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS) ly_add_target( NAME Blast.Editor GEM_MODULE - NAMESPACE Gem + OUTPUT_NAME Blast.Editor.Gem AUTOMOC FILES_CMAKE blast_editor_shared_files.cmake @@ -119,6 +120,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) ly_add_target( NAME Blast.Tests MODULE NAMESPACE Gem + OUTPUT_NAME Blast.Tests.Gem FILES_CMAKE blast_tests_files.cmake INCLUDE_DIRECTORIES @@ -142,6 +144,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) ly_add_target( NAME Blast.Editor.Tests MODULE NAMESPACE Gem + OUTPUT_NAME Blast.Editor.Tests.Gem FILES_CMAKE blast_editor_tests_files.cmake INCLUDE_DIRECTORIES diff --git a/Gems/NvCloth/Code/CMakeLists.txt b/Gems/NvCloth/Code/CMakeLists.txt index 983e7ff8f8..d83190a05c 100644 --- a/Gems/NvCloth/Code/CMakeLists.txt +++ b/Gems/NvCloth/Code/CMakeLists.txt @@ -43,6 +43,7 @@ ly_add_target( ly_add_target( NAME NvCloth ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE} NAMESPACE Gem + OUTPUT_NAME NvCloth.Gem FILES_CMAKE nvcloth_shared_files.cmake INCLUDE_DIRECTORIES @@ -83,8 +84,8 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS) ly_add_target( NAME NvCloth.Editor GEM_MODULE - NAMESPACE Gem + OUTPUT_NAME NvCloth.Editor.Gem FILES_CMAKE nvcloth_editor_shared_files.cmake INCLUDE_DIRECTORIES @@ -109,6 +110,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) ly_add_target( NAME NvCloth.Tests ${PAL_TRAIT_TEST_TARGET_TYPE} NAMESPACE Gem + OUTPUT_NAME NvCloth.Tests.Gem FILES_CMAKE nvcloth_tests_files.cmake INCLUDE_DIRECTORIES @@ -134,6 +136,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) ly_add_target( NAME NvCloth.Editor.Tests ${PAL_TRAIT_TEST_TARGET_TYPE} NAMESPACE Gem + OUTPUT_NAME NvCloth.Editor.Tests.Gem FILES_CMAKE nvcloth_editor_tests_files.cmake INCLUDE_DIRECTORIES diff --git a/Gems/PhysX/Code/CMakeLists.txt b/Gems/PhysX/Code/CMakeLists.txt index e6f8fc7188..e1b13d92c4 100644 --- a/Gems/PhysX/Code/CMakeLists.txt +++ b/Gems/PhysX/Code/CMakeLists.txt @@ -52,6 +52,7 @@ ly_add_target( ly_add_target( NAME PhysX ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE} NAMESPACE Gem + OUTPUT_NAME PhysX.Gem FILES_CMAKE ${physx_shared_files} COMPILE_DEFINITIONS @@ -118,8 +119,8 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS) ly_add_target( NAME PhysX.Editor GEM_MODULE - NAMESPACE Gem + OUTPUT_NAME PhysX.Editor.Gem AUTOMOC FILES_CMAKE physx_editor_shared_files.cmake @@ -147,6 +148,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) ly_add_target( NAME PhysX.Tests ${PAL_TRAIT_TEST_TARGET_TYPE} NAMESPACE Gem + OUTPUT_NAME PhysX.Tests.Gem FILES_CMAKE physx_tests_files.cmake INCLUDE_DIRECTORIES @@ -175,6 +177,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) ly_add_target( NAME PhysX.Editor.Tests ${PAL_TRAIT_TEST_TARGET_TYPE} NAMESPACE Gem + OUTPUT_NAME PhysX.Editor.Tests.Gem FILES_CMAKE physx_editor_tests_files.cmake INCLUDE_DIRECTORIES diff --git a/Gems/PhysXDebug/Code/CMakeLists.txt b/Gems/PhysXDebug/Code/CMakeLists.txt index a3730e5bcf..f198f6f26e 100644 --- a/Gems/PhysXDebug/Code/CMakeLists.txt +++ b/Gems/PhysXDebug/Code/CMakeLists.txt @@ -25,6 +25,7 @@ endif() ly_add_target( NAME PhysXDebug ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE} NAMESPACE Gem + OUTPUT_NAME PhysXDebug.Gem FILES_CMAKE ${physx_files} INCLUDE_DIRECTORIES @@ -47,8 +48,8 @@ ly_add_target( if(PAL_TRAIT_BUILD_HOST_TOOLS) ly_add_target( NAME PhysXDebug.Editor GEM_MODULE - NAMESPACE Gem + OUTPUT_NAME PhysXDebug.Editor.Gem FILES_CMAKE ${physx_editor_files} COMPILE_DEFINITIONS diff --git a/Registry/Platform/Windows/streamer.test.setreg b/Registry/Platform/Windows/streamer.test.setreg index a87dc599c8..13e4fa2d57 100644 --- a/Registry/Platform/Windows/streamer.test.setreg +++ b/Registry/Platform/Windows/streamer.test.setreg @@ -21,7 +21,7 @@ "MaxFileHandles": 1024, "MaxMetaDataCache": 1024, "Overcommit": 8, - "EnableFileSharing": false, + "EnableFileSharing": true, "EnableUnbufferedReads": true, "MinimalReporting": true }, diff --git a/scripts/build/Jenkins/Jenkinsfile b/scripts/build/Jenkins/Jenkinsfile index bb9bd4ff48..98f31eddea 100644 --- a/scripts/build/Jenkins/Jenkinsfile +++ b/scripts/build/Jenkins/Jenkinsfile @@ -504,9 +504,8 @@ try { envVars['IS_UNIX'] = 1 } withEnv(GetEnvStringList(envVars)) { + def build_job_name = build_job.key try { - def build_job_name = build_job.key - CreateSetupStage(pipelineConfig, repositoryName, projectName, pipelineName, branchName, platform.key, build_job.key, envVars).call() if(build_job.value.steps) { //this is a pipe with many steps so create all the build stages @@ -517,12 +516,6 @@ try { } else { CreateBuildStage(pipelineConfig, platform.key, build_job.key, envVars).call() } - - if (env.MARS_REPO && platform.value.build_types[build_job_name].PARAMETERS.containsKey('TEST_METRICS') && platform.value.build_types[build_job_name].PARAMETERS.TEST_METRICS == 'True') { - def output_directory = platform.value.build_types[build_job_name].PARAMETERS.OUTPUT_DIRECTORY - def configuration = platform.value.build_types[build_job_name].PARAMETERS.CONFIGURATION - CreateTestMetricsStage(pipelineConfig, branchName, envVars, build_job_name, output_directory, configuration).call() - } } catch(Exception e) { // https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Result.java @@ -537,6 +530,11 @@ try { } } finally { + if (env.MARS_REPO && platform.value.build_types[build_job_name].PARAMETERS.containsKey('TEST_METRICS') && platform.value.build_types[build_job_name].PARAMETERS.TEST_METRICS == 'True') { + def output_directory = platform.value.build_types[build_job_name].PARAMETERS.OUTPUT_DIRECTORY + def configuration = platform.value.build_types[build_job_name].PARAMETERS.CONFIGURATION + CreateTestMetricsStage(pipelineConfig, branchName, envVars, build_job_name, output_directory, configuration).call() + } CreateTeardownStage(envVars).call() } }