Merge pull request #504 from aws-lumberyard-dev/Atom/guthadam/ATOM-15439

ATOM-15439 Implement basic local socket and server for IPC in material editor and other tools
This commit is contained in:
Guthrie Adams
2021-05-03 15:32:28 -05:00
committed by GitHub
18 changed files with 404 additions and 135 deletions
@@ -93,7 +93,6 @@ namespace AZ
void EditorMaterialSystemComponent::Activate()
{
AzFramework::TargetManagerClient::Bus::Handler::BusConnect();
EditorMaterialSystemComponentRequestBus::Handler::BusConnect();
AzFramework::ApplicationLifecycleEvents::Bus::Handler::BusConnect();
AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler::BusConnect();
@@ -105,7 +104,6 @@ namespace AZ
void EditorMaterialSystemComponent::Deactivate()
{
AzFramework::TargetManagerClient::Bus::Handler::BusDisconnect();
EditorMaterialSystemComponentRequestBus::Handler::BusDisconnect();
AzFramework::ApplicationLifecycleEvents::Bus::Handler::BusDisconnect();
AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler::BusDisconnect();
@@ -123,36 +121,11 @@ namespace AZ
void EditorMaterialSystemComponent::OpenInMaterialEditor(const AZStd::string& sourcePath)
{
if (m_materialEditorTarget.IsValid())
{
AzFramework::TmMsg openDocumentMsg(AZ_CRC("OpenInMaterialEditor", 0x9f92aac8));
openDocumentMsg.AddCustomBlob(sourcePath.c_str(), sourcePath.size() + 1);
AzFramework::TargetManager::Bus::Broadcast(&AzFramework::TargetManager::SendTmMessage, m_materialEditorTarget, openDocumentMsg);
}
else
{
AZ_TracePrintf("MaterialComponent", "Launching Material Editor");
AZ_TracePrintf("MaterialComponent", "Launching Material Editor");
QStringList arguments;
arguments.append(sourcePath.c_str());
AtomToolsFramework::LaunchTool("MaterialEditor", ".exe", arguments);
}
}
void EditorMaterialSystemComponent::TargetJoinedNetwork(AzFramework::TargetInfo info)
{
if (AZ::StringFunc::Equal(info.GetDisplayName(), "MaterialEditor"))
{
m_materialEditorTarget = info;
}
}
void EditorMaterialSystemComponent::TargetLeftNetwork(AzFramework::TargetInfo info)
{
if (AZ::StringFunc::Equal(info.GetDisplayName(), "MaterialEditor"))
{
m_materialEditorTarget = {};
}
QStringList arguments;
arguments.append(sourcePath.c_str());
AtomToolsFramework::LaunchTool("MaterialEditor", ".exe", arguments);
}
void EditorMaterialSystemComponent::OnApplicationAboutToStop()
@@ -14,7 +14,6 @@
#include <AzCore/Component/Component.h>
#include <AzFramework/Application/Application.h>
#include <AzFramework/TargetManagement/TargetManagementAPI.h>
#include <AzToolsFramework/Thumbnails/Thumbnail.h>
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
@@ -32,7 +31,6 @@ namespace AZ
class EditorMaterialSystemComponent
: public AZ::Component
, private EditorMaterialSystemComponentRequestBus::Handler
, private AzFramework::TargetManagerClient::Bus::Handler
, private AzFramework::ApplicationLifecycleEvents::Bus::Handler
, public AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler
, public AzToolsFramework::EditorMenuNotificationBus::Handler
@@ -57,10 +55,6 @@ namespace AZ
//! EditorMaterialSystemComponentRequestBus::Handler overrides...
void OpenInMaterialEditor(const AZStd::string& sourcePath) override;
//! AzFramework::TargetManagerClient::Bus::Handler overrides...
void TargetJoinedNetwork(AzFramework::TargetInfo info) override;
void TargetLeftNetwork(AzFramework::TargetInfo info) override;
// AzFramework::ApplicationLifecycleEvents overrides...
void OnApplicationAboutToStop() override;
@@ -74,9 +68,6 @@ namespace AZ
void SetupThumbnails();
void TeardownThumbnails();
// Material Editor target for interprocess communication with MaterialEditor
AzFramework::TargetInfo m_materialEditorTarget;
QAction* m_openMaterialEditorAction = nullptr;
AZStd::unique_ptr<MaterialBrowserInteractions> m_materialBrowserInteractions;