Atom Tools: move asset processor connection to fix thumbnails
Thumbnails for the AtomLyIntegration common feature gem were no longer being rendered. The setup code was modified to initialize the thumbnail system after receiving a new event that critical assets finished compiling. This event was being sent and handled correctly in the main editor. This process was failing in other tools because the event was sent before systems were registered to listen for it. To resolve the problem, atom tools application now explicitly connects to the asset processor and processes critical assets after the base application StartCommon function is called. This ensures that the connection is established and the event gets sent after all of the system components have been activated. Signed-off-by: Guthrie Adams <guthadam@amazon.com>
This commit is contained in:
+1
-7
@@ -16,7 +16,6 @@
|
||||
#include <AzCore/UserSettings/UserSettingsProvider.h>
|
||||
|
||||
#include <AzFramework/Application/Application.h>
|
||||
#include <AzFramework/Asset/AssetSystemBus.h>
|
||||
|
||||
#include <AzQtComponents/Application/AzQtApplication.h>
|
||||
#include <AzQtComponents/Components/StyleManager.h>
|
||||
@@ -34,7 +33,6 @@ namespace AtomToolsFramework
|
||||
: public AzFramework::Application
|
||||
, public AzQtComponents::AzQtApplication
|
||||
, protected AzToolsFramework::AssetDatabase::AssetDatabaseRequestsBus::Handler
|
||||
, protected AzFramework::AssetSystemStatusBus::Handler
|
||||
, protected AzToolsFramework::EditorPythonConsoleNotificationBus::Handler
|
||||
, protected AZ::UserSettingsOwnerRequestBus::Handler
|
||||
, protected AtomToolsMainWindowNotificationBus::Handler
|
||||
@@ -77,11 +75,6 @@ namespace AtomToolsFramework
|
||||
void Destroy() override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AzFramework::AssetSystemStatusBus::Handler overrides...
|
||||
void AssetSystemAvailable() override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AZ::ComponentApplication overrides...
|
||||
void QueryApplicationType(AZ::ApplicationTypeQuery& appType) const override;
|
||||
@@ -107,6 +100,7 @@ namespace AtomToolsFramework
|
||||
|
||||
virtual void LoadSettings();
|
||||
virtual void UnloadSettings();
|
||||
virtual void ConnectToAssetProcessor();
|
||||
virtual void CompileCriticalAssets();
|
||||
virtual void ProcessCommandLine(const AZ::CommandLine& commandLine);
|
||||
|
||||
|
||||
@@ -171,7 +171,6 @@ namespace AtomToolsFramework
|
||||
|
||||
void AtomToolsApplication::StartCommon(AZ::Entity* systemEntity)
|
||||
{
|
||||
AzFramework::AssetSystemStatusBus::Handler::BusConnect();
|
||||
AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusConnect();
|
||||
|
||||
Base::StartCommon(systemEntity);
|
||||
@@ -179,6 +178,8 @@ namespace AtomToolsFramework
|
||||
const bool clearLogFile = GetSettingOrDefault("/O3DE/AtomToolsFramework/Application/ClearLogOnStart", false);
|
||||
m_traceLogger.OpenLogFile(GetBuildTargetName() + ".log", clearLogFile);
|
||||
|
||||
ConnectToAssetProcessor();
|
||||
|
||||
AzToolsFramework::AssetDatabase::AssetDatabaseRequestsBus::Handler::BusConnect();
|
||||
AzToolsFramework::AssetBrowser::AssetDatabaseLocationNotificationBus::Broadcast(
|
||||
&AzToolsFramework::AssetBrowser::AssetDatabaseLocationNotifications::OnDatabaseInitialized);
|
||||
@@ -236,7 +237,7 @@ namespace AtomToolsFramework
|
||||
return AZStd::vector<AZStd::string>({});
|
||||
}
|
||||
|
||||
void AtomToolsApplication::AssetSystemAvailable()
|
||||
void AtomToolsApplication::ConnectToAssetProcessor()
|
||||
{
|
||||
bool connectedToAssetProcessor = false;
|
||||
|
||||
@@ -245,18 +246,19 @@ namespace AtomToolsFramework
|
||||
// and able to negotiate a connection when running a debug build
|
||||
// and to negotiate a connection
|
||||
|
||||
auto targetName = GetBuildTargetName();
|
||||
const auto targetName = GetBuildTargetName();
|
||||
|
||||
AzFramework::AssetSystem::ConnectionSettings connectionSettings;
|
||||
AzFramework::AssetSystem::ReadConnectionSettingsFromSettingsRegistry(connectionSettings);
|
||||
connectionSettings.m_connectionDirection =
|
||||
AzFramework::AssetSystem::ConnectionSettings::ConnectionDirection::ConnectToAssetProcessor;
|
||||
connectionSettings.m_connectionIdentifier = GetBuildTargetName();
|
||||
connectionSettings.m_connectionIdentifier = targetName;
|
||||
connectionSettings.m_loggingCallback = [targetName]([[maybe_unused]] AZStd::string_view logData)
|
||||
{
|
||||
AZ_UNUSED(targetName); // Prevent unused warning in release builds
|
||||
AZ_TracePrintf(targetName.c_str(), "%.*s", aznumeric_cast<int>(logData.size()), logData.data());
|
||||
};
|
||||
|
||||
AzFramework::AssetSystemRequestBus::BroadcastResult(
|
||||
connectedToAssetProcessor, &AzFramework::AssetSystemRequestBus::Events::EstablishAssetProcessorConnection, connectionSettings);
|
||||
|
||||
@@ -264,8 +266,6 @@ namespace AtomToolsFramework
|
||||
{
|
||||
CompileCriticalAssets();
|
||||
}
|
||||
|
||||
AzFramework::AssetSystemStatusBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
void AtomToolsApplication::CompileCriticalAssets()
|
||||
@@ -302,6 +302,7 @@ namespace AtomToolsFramework
|
||||
}
|
||||
|
||||
AZ::ComponentApplicationLifecycle::SignalEvent(*m_settingsRegistry, "CriticalAssetsCompiled", R"({})");
|
||||
|
||||
// Reload the assetcatalog.xml at this point again
|
||||
// Start Monitoring Asset changes over the network and load the AssetCatalog
|
||||
auto LoadCatalog = [settingsRegistry = m_settingsRegistry.get()](AZ::Data::AssetCatalogRequests* assetCatalogRequests)
|
||||
|
||||
Reference in New Issue
Block a user