FBX settings can be opened again: g_fbxImporter is set, and if the ex… (#878)

* 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()
This commit is contained in:
AMZN-stankowi
2021-05-24 10:05:12 -07:00
committed by GitHub
parent aeaa3a9c55
commit 58adcf168f
2 changed files with 15 additions and 3 deletions
@@ -114,6 +114,11 @@ namespace AZ
extern "C" AZ_DLL_EXPORT void InitializeDynamicModule(void* env)
{
AZ::Environment::Attach(static_cast<AZ::EnvironmentInstance>(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)
{
@@ -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<AZStd::string>& 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());
}