From 58adcf168fcab0da94b25004482a6edabb2b0fad Mon Sep 17 00:00:00 2001 From: AMZN-stankowi Date: Mon, 24 May 2021 10:05:12 -0700 Subject: [PATCH] =?UTF-8?q?FBX=20settings=20can=20be=20opened=20again:=20g?= =?UTF-8?q?=5FfbxImporter=20is=20set,=20and=20if=20the=20ex=E2=80=A6=20(#8?= =?UTF-8?q?78)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * FBX settings can be opened again: g_fbxImporter is set, and if the extension list is empty, it is reloaded. * auto -> auto*, .size() == 0 -> .empty() --- Code/Tools/SceneAPI/FbxSceneBuilder/DllMain.cpp | 5 +++++ .../FbxSceneBuilder/FbxImportRequestHandler.cpp | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/DllMain.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/DllMain.cpp index d2818f3653..6fd664eee4 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/DllMain.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/DllMain.cpp @@ -114,6 +114,11 @@ namespace AZ extern "C" AZ_DLL_EXPORT void InitializeDynamicModule(void* env) { AZ::Environment::Attach(static_cast(env)); + if (!AZ::SceneAPI::FbxSceneBuilder::g_fbxImporter) + { + AZ::SceneAPI::FbxSceneBuilder::g_fbxImporter = aznew AZ::SceneAPI::FbxSceneImporter::FbxImportRequestHandler(); + AZ::SceneAPI::FbxSceneBuilder::g_fbxImporter->Activate(); + } } extern "C" AZ_DLL_EXPORT void Reflect(AZ::SerializeContext* context) { diff --git a/Code/Tools/SceneAPI/FbxSceneBuilder/FbxImportRequestHandler.cpp b/Code/Tools/SceneAPI/FbxSceneBuilder/FbxImportRequestHandler.cpp index a43f1e16b8..ebdb57e452 100644 --- a/Code/Tools/SceneAPI/FbxSceneBuilder/FbxImportRequestHandler.cpp +++ b/Code/Tools/SceneAPI/FbxSceneBuilder/FbxImportRequestHandler.cpp @@ -39,9 +39,7 @@ namespace AZ void FbxImportRequestHandler::Activate() { - auto settingsRegistry = AZ::SettingsRegistry::Get(); - - if (settingsRegistry) + if (auto* settingsRegistry = AZ::SettingsRegistry::Get()) { settingsRegistry->GetObject(m_settings, "/O3DE/SceneAPI/AssetImporter"); } @@ -70,6 +68,15 @@ namespace AZ void FbxImportRequestHandler::GetSupportedFileExtensions(AZStd::unordered_set& extensions) { + // It's unlikely an empty file extension list is intentional, + // so if it's empty, try reloading it from the registry. + if (m_settings.m_supportedFileTypeExtensions.empty()) + { + if (auto* settingsRegistry = AZ::SettingsRegistry::Get()) + { + settingsRegistry->GetObject(m_settings, "/O3DE/SceneAPI/AssetImporter"); + } + } extensions.insert(m_settings.m_supportedFileTypeExtensions.begin(), m_settings.m_supportedFileTypeExtensions.end()); }