Bug fix (updating WindowComponent)

Signed-off-by: Dayo Lawal <lawalfua@amazon.com>
This commit is contained in:
Dayo Lawal
2021-08-03 19:47:50 -05:00
parent 259bc3f85e
commit f8c8181b0c
4 changed files with 28 additions and 26 deletions
@@ -6,7 +6,6 @@
*
*/
#include <Atom/Window/MaterialEditorWindowFactoryRequestBus.h>
#include <Atom/Window/MaterialEditorWindowSettings.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
@@ -23,6 +22,9 @@
namespace MaterialEditor
{
using FactoryRequestBus = AtomToolsFramework::AtomToolsMainWindowFactoryRequestBus;
using RequestBus = AtomToolsFramework::AtomToolsMainWindowRequestBus;
void MaterialEditorWindowComponent::Reflect(AZ::ReflectContext* context)
{
MaterialEditorWindowSettings::Reflect(context);
@@ -35,16 +37,14 @@ namespace MaterialEditor
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
using FactoryRequestBus = MaterialEditorWindowFactoryRequestBus;
behaviorContext->EBus<FactoryRequestBus>("MaterialEditorWindowFactoryRequestBus")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Category, "Editor")
->Attribute(AZ::Script::Attributes::Module, "materialeditor")
->Event("CreateMaterialEditorWindow", &FactoryRequestBus::Events::CreateMaterialEditorWindow)
->Event("DestroyMaterialEditorWindow", &FactoryRequestBus::Events::DestroyMaterialEditorWindow)
->Event("CreateMaterialEditorWindow", &FactoryRequestBus::Events::CreateMainWindow)
->Event("DestroyMaterialEditorWindow", &FactoryRequestBus::Events::DestroyMainWindow)
;
using RequestBus = AtomToolsFramework::AtomToolsMainWindowRequestBus;
behaviorContext->EBus<RequestBus>("MaterialEditorWindowRequestBus")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Category, "Editor")
@@ -84,26 +84,26 @@ namespace MaterialEditor
void MaterialEditorWindowComponent::Activate()
{
AzToolsFramework::EditorWindowRequestBus::Handler::BusConnect();
MaterialEditorWindowFactoryRequestBus::Handler::BusConnect();
FactoryRequestBus::Handler::BusConnect();
AzToolsFramework::SourceControlConnectionRequestBus::Broadcast(&AzToolsFramework::SourceControlConnectionRequests::EnableSourceControl, true);
}
void MaterialEditorWindowComponent::Deactivate()
{
MaterialEditorWindowFactoryRequestBus::Handler::BusDisconnect();
FactoryRequestBus::Handler::BusDisconnect();
AzToolsFramework::EditorWindowRequestBus::Handler::BusDisconnect();
m_window.reset();
}
void MaterialEditorWindowComponent::CreateMaterialEditorWindow()
void MaterialEditorWindowComponent::CreateMainWindow()
{
m_materialEditorBrowserInteractions.reset(aznew MaterialEditorBrowserInteractions);
m_window.reset(aznew MaterialEditorWindow);
}
void MaterialEditorWindowComponent::DestroyMaterialEditorWindow()
void MaterialEditorWindowComponent::DestroyMainWindow()
{
m_window.reset();
}
@@ -11,7 +11,7 @@
#include <AzCore/Component/Component.h>
#include <AzToolsFramework/API/EditorWindowRequestBus.h>
#include <Atom/Window/MaterialEditorWindowFactoryRequestBus.h>
#include <AtomToolsFramework/Window/AtomToolsMainWindowFactoryRequestBus.h>
#include <Source/Window/MaterialEditorBrowserInteractions.h>
#include <Source/Window/MaterialEditorWindow.h>
@@ -22,7 +22,7 @@ namespace MaterialEditor
class MaterialEditorWindowComponent
: public AZ::Component
, private AzToolsFramework::EditorWindowRequestBus::Handler
, private MaterialEditorWindowFactoryRequestBus::Handler
, private AtomToolsFramework::AtomToolsMainWindowFactoryRequestBus::Handler
{
public:
AZ_COMPONENT(MaterialEditorWindowComponent, "{03976F19-3C74-49FE-A15F-7D3CADBA616C}");
@@ -35,9 +35,9 @@ namespace MaterialEditor
private:
////////////////////////////////////////////////////////////////////////
// MaterialEditorWindowFactoryRequestBus::Handler overrides...
void CreateMaterialEditorWindow() override;
void DestroyMaterialEditorWindow() override;
// AtomToolsMainWindowFactoryRequestBus::Handler overrides...
void CreateMainWindow() override;
void DestroyMainWindow() override;
////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////