Merge pull request #3052 from aws-lumberyard-dev/Atom/guthadam/atomtools_refactor_move_mainwindow_bus
AtomTools: move main window bus reflection to atom tools
This commit is contained in:
@@ -13,9 +13,9 @@ import os
|
||||
import sys
|
||||
import time
|
||||
import azlmbr.atom
|
||||
import azlmbr.atomtools as atomtools
|
||||
import azlmbr.materialeditor as materialeditor
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.atomtools.general as general
|
||||
|
||||
|
||||
def is_close(actual, expected, buffer=sys.float_info.min):
|
||||
@@ -125,11 +125,11 @@ def is_pane_visible(pane_name):
|
||||
"""
|
||||
:return: bool
|
||||
"""
|
||||
return materialeditor.MaterialEditorWindowRequestBus(bus.Broadcast, "IsDockWidgetVisible", pane_name)
|
||||
return atomtools.AtomToolsWindowRequestBus(bus.Broadcast, "IsDockWidgetVisible", pane_name)
|
||||
|
||||
|
||||
def set_pane_visibility(pane_name, value):
|
||||
materialeditor.MaterialEditorWindowRequestBus(bus.Broadcast, "SetDockWidgetVisible", pane_name, value)
|
||||
atomtools.AtomToolsWindowRequestBus(bus.Broadcast, "SetDockWidgetVisible", pane_name, value)
|
||||
|
||||
|
||||
def select_lighting_config(config_name):
|
||||
@@ -175,7 +175,7 @@ def wait_for_condition(function, timeout_in_seconds=1.0):
|
||||
with Timeout(timeout_in_seconds) as t:
|
||||
while True:
|
||||
try:
|
||||
general.idle_wait_frames(1)
|
||||
atomtools.general.idle_wait_frames(1)
|
||||
except Exception:
|
||||
print("WARNING: Couldn't wait for frame")
|
||||
|
||||
@@ -269,6 +269,6 @@ class ScreenshotHelper:
|
||||
|
||||
|
||||
def capture_screenshot(file_path):
|
||||
return ScreenshotHelper(azlmbr.atomtools.general.idle_wait_frames).capture_screenshot_blocking(
|
||||
return ScreenshotHelper(atomtools.general.idle_wait_frames).capture_screenshot_blocking(
|
||||
os.path.join(file_path)
|
||||
)
|
||||
|
||||
@@ -8,20 +8,23 @@
|
||||
|
||||
#include <AtomToolsFrameworkModule.h>
|
||||
#include <AtomToolsFrameworkSystemComponent.h>
|
||||
#include <Window/AtomToolsMainWindowSystemComponent.h>
|
||||
|
||||
namespace AtomToolsFramework
|
||||
{
|
||||
AtomToolsFrameworkModule::AtomToolsFrameworkModule()
|
||||
{
|
||||
m_descriptors.insert(m_descriptors.end(), {
|
||||
AtomToolsFrameworkSystemComponent::CreateDescriptor(),
|
||||
});
|
||||
AtomToolsFrameworkSystemComponent::CreateDescriptor(),
|
||||
AtomToolsMainWindowSystemComponent::CreateDescriptor(),
|
||||
});
|
||||
}
|
||||
|
||||
AZ::ComponentTypeList AtomToolsFrameworkModule::GetRequiredSystemComponents() const
|
||||
{
|
||||
return AZ::ComponentTypeList{
|
||||
azrtti_typeid<AtomToolsFrameworkSystemComponent>(),
|
||||
azrtti_typeid<AtomToolsMainWindowSystemComponent>(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AtomToolsFramework/Window/AtomToolsMainWindowFactoryRequestBus.h>
|
||||
#include <AtomToolsFramework/Window/AtomToolsMainWindowRequestBus.h>
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <Window/AtomToolsMainWindowSystemComponent.h>
|
||||
|
||||
namespace AtomToolsFramework
|
||||
{
|
||||
void AtomToolsMainWindowSystemComponent::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serialize->Class<AtomToolsMainWindowSystemComponent, AZ::Component>()
|
||||
->Version(0);
|
||||
}
|
||||
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->EBus<AtomToolsMainWindowFactoryRequestBus>("AtomToolsMainWindowFactoryRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
|
||||
->Attribute(AZ::Script::Attributes::Category, "Editor")
|
||||
->Attribute(AZ::Script::Attributes::Module, "atomtools")
|
||||
->Event("CreateMainWindow", &AtomToolsMainWindowFactoryRequestBus::Events::CreateMainWindow)
|
||||
->Event("DestroyMainWindow", &AtomToolsMainWindowFactoryRequestBus::Events::DestroyMainWindow)
|
||||
;
|
||||
|
||||
behaviorContext->EBus<AtomToolsMainWindowRequestBus>("AtomToolsMainWindowRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
|
||||
->Attribute(AZ::Script::Attributes::Category, "Editor")
|
||||
->Attribute(AZ::Script::Attributes::Module, "atomtools")
|
||||
->Event("ActivateWindow", &AtomToolsMainWindowRequestBus::Events::ActivateWindow)
|
||||
->Event("SetDockWidgetVisible", &AtomToolsMainWindowRequestBus::Events::SetDockWidgetVisible)
|
||||
->Event("IsDockWidgetVisible", &AtomToolsMainWindowRequestBus::Events::IsDockWidgetVisible)
|
||||
->Event("GetDockWidgetNames", &AtomToolsMainWindowRequestBus::Events::GetDockWidgetNames)
|
||||
->Event("ResizeViewportRenderTarget", &AtomToolsMainWindowRequestBus::Events::ResizeViewportRenderTarget)
|
||||
->Event("LockViewportRenderTargetSize", &AtomToolsMainWindowRequestBus::Events::LockViewportRenderTargetSize)
|
||||
->Event("UnlockViewportRenderTargetSize", &AtomToolsMainWindowRequestBus::Events::UnlockViewportRenderTargetSize)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void AtomToolsMainWindowSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
|
||||
{
|
||||
provided.push_back(AZ_CRC_CE("AtomToolsMainWindowSystemService"));
|
||||
}
|
||||
|
||||
void AtomToolsMainWindowSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
|
||||
{
|
||||
incompatible.push_back(AZ_CRC_CE("AtomToolsMainWindowSystemService"));
|
||||
}
|
||||
|
||||
void AtomToolsMainWindowSystemComponent::Init()
|
||||
{
|
||||
}
|
||||
|
||||
void AtomToolsMainWindowSystemComponent::Activate()
|
||||
{
|
||||
}
|
||||
|
||||
void AtomToolsMainWindowSystemComponent::Deactivate()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace AtomToolsFramework
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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/Component/Component.h>
|
||||
|
||||
namespace AtomToolsFramework
|
||||
{
|
||||
//! AtomToolsMainWindowSystemComponent is used for initialization and registration of other classes.
|
||||
class AtomToolsMainWindowSystemComponent
|
||||
: public AZ::Component
|
||||
{
|
||||
public:
|
||||
AZ_COMPONENT(AtomToolsMainWindowSystemComponent, "{6E42380B-4ECD-47CF-B904-E16AB4E87D0D}");
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
|
||||
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
|
||||
|
||||
private:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// AZ::Component interface implementation
|
||||
void Init() override;
|
||||
void Activate() override;
|
||||
void Deactivate() override;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
}
|
||||
@@ -45,4 +45,6 @@ set(FILES
|
||||
Source/Viewport/RenderViewportWidget.cpp
|
||||
Source/Viewport/ModularViewportCameraController.cpp
|
||||
Source/Window/AtomToolsMainWindow.cpp
|
||||
Source/Window/AtomToolsMainWindowSystemComponent.cpp
|
||||
Source/Window/AtomToolsMainWindowSystemComponent.h
|
||||
)
|
||||
+6
-29
@@ -30,47 +30,24 @@ namespace MaterialEditor
|
||||
serialize->Class<MaterialEditorWindowComponent, AZ::Component>()
|
||||
->Version(0);
|
||||
}
|
||||
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->EBus<AtomToolsFramework::AtomToolsMainWindowFactoryRequestBus>("MaterialEditorWindowAtomRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
|
||||
->Attribute(AZ::Script::Attributes::Category, "Editor")
|
||||
->Attribute(AZ::Script::Attributes::Module, "materialeditor")
|
||||
->Event("CreateMaterialEditorWindow", &AtomToolsFramework::AtomToolsMainWindowFactoryRequestBus::Events::CreateMainWindow)
|
||||
->Event("DestroyMaterialEditorWindow", &AtomToolsFramework::AtomToolsMainWindowFactoryRequestBus::Events::DestroyMainWindow)
|
||||
;
|
||||
|
||||
behaviorContext->EBus<AtomToolsFramework::AtomToolsMainWindowRequestBus>("MaterialEditorWindowRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
|
||||
->Attribute(AZ::Script::Attributes::Category, "Editor")
|
||||
->Attribute(AZ::Script::Attributes::Module, "materialeditor")
|
||||
->Event("ActivateWindow", &AtomToolsFramework::AtomToolsMainWindowRequestBus::Events::ActivateWindow)
|
||||
->Event("SetDockWidgetVisible", &AtomToolsFramework::AtomToolsMainWindowRequestBus::Events::SetDockWidgetVisible)
|
||||
->Event("IsDockWidgetVisible", &AtomToolsFramework::AtomToolsMainWindowRequestBus::Events::IsDockWidgetVisible)
|
||||
->Event("GetDockWidgetNames", &AtomToolsFramework::AtomToolsMainWindowRequestBus::Events::GetDockWidgetNames)
|
||||
->Event("ResizeViewportRenderTarget", &AtomToolsFramework::AtomToolsMainWindowRequestBus::Events::ResizeViewportRenderTarget)
|
||||
->Event("LockViewportRenderTargetSize", &AtomToolsFramework::AtomToolsMainWindowRequestBus::Events::LockViewportRenderTargetSize)
|
||||
->Event("UnlockViewportRenderTargetSize", &AtomToolsFramework::AtomToolsMainWindowRequestBus::Events::UnlockViewportRenderTargetSize)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void MaterialEditorWindowComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
|
||||
{
|
||||
required.push_back(AZ_CRC("AssetBrowserService", 0x1e54fffb));
|
||||
required.push_back(AZ_CRC("PropertyManagerService", 0x63a3d7ad));
|
||||
required.push_back(AZ_CRC("SourceControlService", 0x67f338fd));
|
||||
required.push_back(AZ_CRC_CE("AssetBrowserService"));
|
||||
required.push_back(AZ_CRC_CE("PropertyManagerService"));
|
||||
required.push_back(AZ_CRC_CE("SourceControlService"));
|
||||
required.push_back(AZ_CRC_CE("AtomToolsMainWindowSystemService"));
|
||||
}
|
||||
|
||||
void MaterialEditorWindowComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
|
||||
{
|
||||
provided.push_back(AZ_CRC("MaterialEditorWindowService", 0xb6e7d922));
|
||||
provided.push_back(AZ_CRC_CE("MaterialEditorWindowService"));
|
||||
}
|
||||
|
||||
void MaterialEditorWindowComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
|
||||
{
|
||||
incompatible.push_back(AZ_CRC("MaterialEditorWindowService", 0xb6e7d922));
|
||||
incompatible.push_back(AZ_CRC_CE("MaterialEditorWindowService"));
|
||||
}
|
||||
|
||||
void MaterialEditorWindowComponent::Init()
|
||||
|
||||
@@ -6,6 +6,7 @@ SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
"""
|
||||
|
||||
import azlmbr.bus
|
||||
import azlmbr.atomtools
|
||||
import azlmbr.materialeditor
|
||||
import azlmbr.name
|
||||
import azlmbr.render
|
||||
@@ -122,12 +123,12 @@ def CaptureScreenshot(screenshotOutputPath):
|
||||
|
||||
def ResizeViewport(width, height):
|
||||
# This locks the size of the render target to the desired resolution
|
||||
azlmbr.materialeditor.MaterialEditorWindowRequestBus(azlmbr.bus.Broadcast, 'LockViewportRenderTargetSize', width, height)
|
||||
azlmbr.atomtools.AtomToolsMainWindowRequestBus(azlmbr.bus.Broadcast, 'LockViewportRenderTargetSize', width, height)
|
||||
# This resizes the window to closely match the render target resolution so it doesn't appear stretched while the script is running
|
||||
azlmbr.materialeditor.MaterialEditorWindowRequestBus(azlmbr.bus.Broadcast, 'ResizeViewportRenderTarget', width, height)
|
||||
azlmbr.atomtools.AtomToolsMainWindowRequestBus(azlmbr.bus.Broadcast, 'ResizeViewportRenderTarget', width, height)
|
||||
|
||||
def ReleaseViewportResolutionLock():
|
||||
azlmbr.materialeditor.MaterialEditorWindowRequestBus(azlmbr.bus.Broadcast, 'UnlockViewportRenderTargetSize')
|
||||
azlmbr.atomtools.AtomToolsMainWindowRequestBus(azlmbr.bus.Broadcast, 'UnlockViewportRenderTargetSize')
|
||||
|
||||
def GenerateMaterialScreenshot(materialName,
|
||||
uniqueSuffix="",
|
||||
|
||||
+6
-13
@@ -44,14 +44,6 @@ namespace ShaderManagementConsole
|
||||
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->EBus<AtomToolsFramework::AtomToolsMainWindowFactoryRequestBus>("ShaderManagementConsoleWindowRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation)
|
||||
->Attribute(AZ::Script::Attributes::Category, "Editor")
|
||||
->Attribute(AZ::Script::Attributes::Module, "shadermanagementconsole")
|
||||
->Event("CreateShaderManagementConsoleWindow", &AtomToolsFramework::AtomToolsMainWindowFactoryRequestBus::Events::CreateMainWindow)
|
||||
->Event("DestroyShaderManagementConsoleWindow", &AtomToolsFramework::AtomToolsMainWindowFactoryRequestBus::Events::DestroyMainWindow)
|
||||
;
|
||||
|
||||
behaviorContext->EBus<ShaderManagementConsoleRequestBus>("ShaderManagementConsoleRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation)
|
||||
->Attribute(AZ::Script::Attributes::Category, "Editor")
|
||||
@@ -65,19 +57,20 @@ namespace ShaderManagementConsole
|
||||
|
||||
void ShaderManagementConsoleWindowComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
|
||||
{
|
||||
required.push_back(AZ_CRC("AssetBrowserService", 0x1e54fffb));
|
||||
required.push_back(AZ_CRC("PropertyManagerService", 0x63a3d7ad));
|
||||
required.push_back(AZ_CRC("SourceControlService", 0x67f338fd));
|
||||
required.push_back(AZ_CRC_CE("AssetBrowserService"));
|
||||
required.push_back(AZ_CRC_CE("PropertyManagerService"));
|
||||
required.push_back(AZ_CRC_CE("SourceControlService"));
|
||||
required.push_back(AZ_CRC_CE("AtomToolsMainWindowSystemService"));
|
||||
}
|
||||
|
||||
void ShaderManagementConsoleWindowComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
|
||||
{
|
||||
provided.push_back(AZ_CRC("ShaderManagementConsoleWindowService", 0xb6e7d922));
|
||||
provided.push_back(AZ_CRC_CE("ShaderManagementConsoleWindowService"));
|
||||
}
|
||||
|
||||
void ShaderManagementConsoleWindowComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
|
||||
{
|
||||
incompatible.push_back(AZ_CRC("ShaderManagementConsoleWindowService", 0xb6e7d922));
|
||||
incompatible.push_back(AZ_CRC_CE("ShaderManagementConsoleWindowService"));
|
||||
}
|
||||
|
||||
void ShaderManagementConsoleWindowComponent::Init()
|
||||
|
||||
Reference in New Issue
Block a user