ATWindowNotificationBus and ATFactoryRequestBus
Signed-off-by: Dayo Lawal <lawalfua@amazon.com>
This commit is contained in:
-31
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
|
||||
namespace MaterialEditor
|
||||
{
|
||||
//! MaterialEditorWindowFactoryRequestBus provides
|
||||
class MaterialEditorWindowFactoryRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
|
||||
/// Creates and shows the MaterialEditorWindow
|
||||
virtual void CreateMaterialEditorWindow() = 0;
|
||||
|
||||
//! Destroys material editor window and releases all cached assets
|
||||
virtual void DestroyMaterialEditorWindow() = 0;
|
||||
};
|
||||
using MaterialEditorWindowFactoryRequestBus = AZ::EBus<MaterialEditorWindowFactoryRequests>;
|
||||
|
||||
} // namespace MaterialEditor
|
||||
@@ -6,8 +6,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AtomToolsFramework/Util/Util.h>
|
||||
|
||||
#include <Atom/RPI.Edit/Common/AssetUtils.h>
|
||||
#include <Atom/RPI.Public/RPISystemInterface.h>
|
||||
|
||||
@@ -17,8 +15,9 @@
|
||||
#include <Atom/Viewport/MaterialViewportModule.h>
|
||||
|
||||
#include <Atom/Window/MaterialEditorWindowModule.h>
|
||||
#include <Atom/Window/MaterialEditorWindowFactoryRequestBus.h>
|
||||
#include <Atom/Window/MaterialEditorWindowRequestBus.h>
|
||||
|
||||
#include <AtomToolsFramework/Util/Util.h>
|
||||
#include <AtomToolsFramework/Window/AtomToolsMainWindowRequestBus.h>
|
||||
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
@@ -84,7 +83,6 @@ namespace MaterialEditor
|
||||
MaterialEditorApplication::~MaterialEditorApplication()
|
||||
{
|
||||
AzToolsFramework::AssetDatabase::AssetDatabaseRequestsBus::Handler::BusDisconnect();
|
||||
MaterialEditorWindowNotificationBus::Handler::BusDisconnect();
|
||||
AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
@@ -96,22 +94,6 @@ namespace MaterialEditor
|
||||
outModules.push_back(aznew MaterialEditorWindowModule);
|
||||
}
|
||||
|
||||
void MaterialEditorApplication::OnMaterialEditorWindowClosing()
|
||||
{
|
||||
ExitMainLoop();
|
||||
}
|
||||
|
||||
void MaterialEditorApplication::Destroy()
|
||||
{
|
||||
// before modules are unloaded, destroy UI to free up any assets it cached
|
||||
MaterialEditor::MaterialEditorWindowFactoryRequestBus::Broadcast(
|
||||
&MaterialEditor::MaterialEditorWindowFactoryRequestBus::Handler::DestroyMaterialEditorWindow);
|
||||
|
||||
MaterialEditorWindowNotificationBus::Handler::BusDisconnect();
|
||||
|
||||
Base::Destroy();
|
||||
}
|
||||
|
||||
AZStd::vector<AZStd::string> MaterialEditorApplication::GetCriticalAssetFilters() const
|
||||
{
|
||||
return AZStd::vector<AZStd::string>({ "passes/", "config/", "MaterialEditor" });
|
||||
@@ -122,8 +104,8 @@ namespace MaterialEditor
|
||||
const AZStd::string activateWindowSwitchName = "activatewindow";
|
||||
if (commandLine.HasSwitch(activateWindowSwitchName))
|
||||
{
|
||||
MaterialEditor::MaterialEditorWindowRequestBus::Broadcast(
|
||||
&MaterialEditor::MaterialEditorWindowRequestBus::Handler::ActivateWindow);
|
||||
AtomToolsFramework::AtomToolsMainWindowRequestBus::Broadcast(
|
||||
&AtomToolsFramework::AtomToolsMainWindowRequestBus::Handler::ActivateWindow);
|
||||
}
|
||||
|
||||
// Process command line options for opening one or more material documents on startup
|
||||
@@ -138,22 +120,4 @@ namespace MaterialEditor
|
||||
|
||||
Base::ProcessCommandLine(commandLine);
|
||||
}
|
||||
|
||||
void MaterialEditorApplication::StartInternal()
|
||||
{
|
||||
Base::StartInternal();
|
||||
|
||||
MaterialEditorWindowNotificationBus::Handler::BusConnect();
|
||||
|
||||
MaterialEditor::MaterialEditorWindowFactoryRequestBus::Broadcast(
|
||||
&MaterialEditor::MaterialEditorWindowFactoryRequestBus::Handler::CreateMaterialEditorWindow);
|
||||
}
|
||||
|
||||
void MaterialEditorApplication::Stop()
|
||||
{
|
||||
MaterialEditor::MaterialEditorWindowFactoryRequestBus::Broadcast(
|
||||
&MaterialEditor::MaterialEditorWindowFactoryRequestBus::Handler::DestroyMaterialEditorWindow);
|
||||
|
||||
Base::Stop();
|
||||
}
|
||||
} // namespace MaterialEditor
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <Atom/Document/MaterialDocumentSystemRequestBus.h>
|
||||
#include <Atom/Window/MaterialEditorWindowNotificationBus.h>
|
||||
#include <AtomToolsFramework/Application/AtomToolsApplication.h>
|
||||
|
||||
#include <QTimer>
|
||||
@@ -20,7 +19,6 @@ namespace MaterialEditor
|
||||
|
||||
class MaterialEditorApplication
|
||||
: public AtomToolsFramework::AtomToolsApplication
|
||||
, private MaterialEditorWindowNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_TYPE_INFO(MaterialEditor::MaterialEditorApplication, "{30F90CA5-1253-49B5-8143-19CEE37E22BB}");
|
||||
@@ -34,21 +32,9 @@ namespace MaterialEditor
|
||||
// AzFramework::Application
|
||||
void CreateStaticModules(AZStd::vector<AZ::Module*>& outModules) override;
|
||||
const char* GetCurrentConfigurationName() const override;
|
||||
void Stop() override;
|
||||
|
||||
private:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// MaterialEditorWindowNotificationBus::Handler overrides...
|
||||
void OnMaterialEditorWindowClosing() override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AzFramework::Application overrides...
|
||||
void Destroy() override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void ProcessCommandLine(const AZ::CommandLine& commandLine) override;
|
||||
void StartInternal() override;
|
||||
AZStd::string GetBuildTargetName() const override;
|
||||
|
||||
//! List of common asset filters for things that need to be compiled to run the material editor
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace MaterialEditor
|
||||
windowSettings->m_mainWindowState.assign(windowState.begin(), windowState.end());
|
||||
|
||||
AtomToolsFramework::AtomToolsMainWindowNotificationBus::Broadcast(
|
||||
&AtomToolsFramework::AtomToolsMainWindowNotifications::OnAtomToolsMainWindowWindowClosing);
|
||||
&AtomToolsFramework::AtomToolsMainWindowNotifications::OnMainWindowClosing);
|
||||
}
|
||||
|
||||
void MaterialEditorWindow::OnDocumentOpened(const AZ::Uuid& documentId)
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
set(FILES
|
||||
Include/Atom/Window/MaterialEditorWindowModule.h
|
||||
Include/Atom/Window/MaterialEditorWindowSettings.h
|
||||
Include/Atom/Window/MaterialEditorWindowFactoryRequestBus.h
|
||||
Source/Window/MaterialEditorBrowserInteractions.h
|
||||
Source/Window/MaterialEditorBrowserInteractions.cpp
|
||||
Source/Window/MaterialEditorWindow.h
|
||||
|
||||
Reference in New Issue
Block a user