GetCriticalAssetFilters()

Signed-off-by: Dayo Lawal <lawalfua@amazon.com>
This commit is contained in:
Dayo Lawal
2021-07-27 02:06:33 -05:00
parent 4baea40a75
commit 4b97a416a3
6 changed files with 62 additions and 83 deletions
@@ -51,7 +51,7 @@ AZ_POP_DISABLE_WARNING
namespace MaterialEditor
{
//! This function returns the build system target name of "MaterialEditor
AZStd::string MaterialEditorApplication::GetBuildTargetName()
AZStd::string MaterialEditorApplication::GetBuildTargetName() const
{
#if !defined (LY_CMAKE_TARGET)
#error "LY_CMAKE_TARGET must be defined in order to add this source file to a CMake executable target"
@@ -117,36 +117,11 @@ namespace MaterialEditor
Base::Destroy();
}
void MaterialEditorApplication::AssetSystemAvailable()
AZStd::vector<AZStd::string> MaterialEditorApplication::GetCriticalAssetFilters() const
{
bool connectedToAssetProcessor = false;
// When the AssetProcessor is already launched it should take less than a second to perform a connection
// but when the AssetProcessor needs to be launch it could take up to 15 seconds to have the AssetProcessor initialize
// and able to negotiate a connection when running a debug build
// and to negotiate a connection
AzFramework::AssetSystem::ConnectionSettings connectionSettings;
AzFramework::AssetSystem::ReadConnectionSettingsFromSettingsRegistry(connectionSettings);
connectionSettings.m_connectionDirection = AzFramework::AssetSystem::ConnectionSettings::ConnectionDirection::ConnectToAssetProcessor;
connectionSettings.m_connectionIdentifier = GetBuildTargetName();
connectionSettings.m_loggingCallback = []([[maybe_unused]] AZStd::string_view logData)
{
AZ_TracePrintf("Material Editor", "%.*s", aznumeric_cast<int>(logData.size()), logData.data());
};
AzFramework::AssetSystemRequestBus::BroadcastResult(connectedToAssetProcessor,
&AzFramework::AssetSystemRequestBus::Events::EstablishAssetProcessorConnection, connectionSettings);
if (connectedToAssetProcessor)
{
// List of common asset filters for things that need to be compiled to run the material editor
// Some of these things will not be necessary once we have proper support for queued asset loading and reloading
const AZStd::vector<AZStd::string> assetFiltersArray = { "passes/", "config/", "MaterialEditor/" };
CompileCriticalAssets(assetFiltersArray);
}
AzFramework::AssetSystemStatusBus::Handler::BusDisconnect();
// List of common asset filters for things that need to be compiled to run the material editor
// Some of these things will not be necessary once we have proper support for queued asset loading and reloading
return AZStd::vector<AZStd::string>({ "passes/", "config/", "MaterialEditor" });
}
void MaterialEditorApplication::ProcessCommandLine(const AZ::CommandLine& commandLine)
@@ -164,7 +139,7 @@ namespace MaterialEditor
{
const AZStd::string openDocumentPath = commandLine.GetMiscValue(openDocumentIndex);
AZ_Printf("MaterialEditor", "Opening document: %s", openDocumentPath.c_str());
AZ_Printf(GetBuildTargetName().c_str(), "Opening document: %s", openDocumentPath.c_str());
MaterialDocumentSystemRequestBus::Broadcast(&MaterialDocumentSystemRequestBus::Events::OpenDocument, openDocumentPath);
}