Switch to using settings registry
# Conflicts: # Assets/Engine/Registry/assetimporter.setreg
This commit is contained in:
@@ -46,11 +46,6 @@ namespace AZ
|
||||
// Currently it's still needed to explicitly create an instance of this instead of letting
|
||||
// it be a normal component. This is because ResourceCompilerScene needs to return
|
||||
// the list of available extensions before it can start the application.
|
||||
if (!g_fbxImporter)
|
||||
{
|
||||
g_fbxImporter = aznew AZ::SceneAPI::FbxSceneImporter::FbxImportRequestHandler();
|
||||
g_fbxImporter->Activate();
|
||||
}
|
||||
}
|
||||
|
||||
void Reflect(AZ::SerializeContext* /*context*/)
|
||||
@@ -64,6 +59,7 @@ namespace AZ
|
||||
{
|
||||
// Global importer and behavior
|
||||
g_componentDescriptors.push_back(FbxSceneBuilder::FbxImporter::CreateDescriptor());
|
||||
g_componentDescriptors.push_back(FbxSceneImporter::FbxImportRequestHandler::CreateDescriptor());
|
||||
|
||||
// Node and attribute importers
|
||||
g_componentDescriptors.push_back(AssImpBitangentStreamImporter::CreateDescriptor());
|
||||
|
||||
@@ -30,12 +30,6 @@ namespace AZ
|
||||
{
|
||||
namespace FbxSceneImporter
|
||||
{
|
||||
AssetImporterSettings::AssetImporterSettings()
|
||||
{
|
||||
// Default supported extension in case the settings file isn't found
|
||||
m_supportedFileTypeExtensions.emplace(".fbx");
|
||||
}
|
||||
|
||||
void AssetImporterSettings::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context); serializeContext)
|
||||
@@ -48,27 +42,11 @@ namespace AZ
|
||||
|
||||
void FbxImportRequestHandler::Activate()
|
||||
{
|
||||
// Attempt to load the Slice Builder Settings file
|
||||
AZ::IO::LocalFileIO localFileIO;
|
||||
|
||||
// This will point to @assets@/SettingsFilename, which loads from the cache
|
||||
// We don't really want this but it works for now
|
||||
// Trying to use AzToolsFramework::AssetSystemRequestBus::Events::GetSourceInfoBySourcePath at this point
|
||||
// would fail because components seem to activate before the AP has populated its file list
|
||||
AZ::IO::Path sliceBuilderSettingsIoPath(SettingsFilename);
|
||||
auto result = AzFramework::FileFunc::ReadJsonFile(sliceBuilderSettingsIoPath, &localFileIO);
|
||||
if (result.IsSuccess())
|
||||
auto settingsRegistry = AZ::SettingsRegistry::Get();
|
||||
|
||||
if (settingsRegistry)
|
||||
{
|
||||
AZ::JsonSerializationResult::ResultCode serializationResult =
|
||||
AZ::JsonSerialization::Load(m_settings, result.GetValue());
|
||||
if (serializationResult.GetProcessing() == AZ::JsonSerializationResult::Processing::Halted)
|
||||
{
|
||||
AZ_Warning("", false, "Error in Asset Importer Settings file.\nUsing default settings.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Warning("", false, "Failed to load Asset Importer Settings file.\nUsing default settings.");
|
||||
settingsRegistry->GetObject(m_settings, "/O3DE/SceneAPI/AssetImporter");
|
||||
}
|
||||
|
||||
BusConnect();
|
||||
@@ -125,6 +103,11 @@ namespace AZ
|
||||
return Events::LoadingResult::AssetFailure;
|
||||
}
|
||||
}
|
||||
|
||||
void FbxImportRequestHandler::GetProvidedServices(ComponentDescriptor::DependencyArrayType& provided)
|
||||
{
|
||||
provided.emplace_back(AZ_CRC_CE("AssetImportRequestHandler"));
|
||||
}
|
||||
} // namespace Import
|
||||
} // namespace SceneAPI
|
||||
} // namespace AZ
|
||||
|
||||
@@ -24,9 +24,7 @@ namespace AZ
|
||||
struct AssetImporterSettings
|
||||
{
|
||||
AZ_TYPE_INFO(AssetImporterSettings, "{8BB6C7AD-BF99-44DC-9DA1-E7AD3F03DC10}");
|
||||
|
||||
AssetImporterSettings();
|
||||
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
AZStd::unordered_set<AZStd::string> m_supportedFileTypeExtensions;
|
||||
@@ -49,6 +47,8 @@ namespace AZ
|
||||
Events::LoadingResult LoadAsset(Containers::Scene& scene, const AZStd::string& path, const Uuid& guid,
|
||||
RequestingApplication requester) override;
|
||||
|
||||
static void GetProvidedServices(ComponentDescriptor::DependencyArrayType& provided);
|
||||
|
||||
private:
|
||||
|
||||
AssetImporterSettings m_settings;
|
||||
|
||||
Reference in New Issue
Block a user