deleting platform specific code from ME and SMC

fixed ME viewport

Signed-off-by: Guthrie Adams <guthadam@amazon.com>
This commit is contained in:
Guthrie Adams
2021-09-20 23:13:51 -05:00
parent 847e8058e0
commit 88ee878025
7 changed files with 0 additions and 199 deletions
@@ -6,33 +6,6 @@
*
*/
#include <AzCore/std/string/string.h>
#include <QWidget>
#include <AzFramework/Windowing/WindowBus.h>
namespace Platform
{
void LoadPluginDependencies()
{
AZ_Warning("Material Editor", false, "LoadPluginDependencies() function is not implemented");
}
void ProcessInput(void* message)
{
AZ_Warning("Material Editor", false, "ProcessInput() function is not implemented");
}
AzFramework::NativeWindowHandle GetWindowHandle(WId winId)
{
AZ_Warning("Material Editor", false, "GetWindowHandle() function is not implemented");
AZ_UNUSED(winId);
return nullptr;
}
AzFramework::WindowSize GetClientAreaSize(AzFramework::NativeWindowHandle window)
{
AZ_Warning("Material Editor", false, "GetClientAreaSize() function is not implemented");
AZ_UNUSED(window);
return AzFramework::WindowSize{1,1};
}
}
@@ -6,33 +6,6 @@
*
*/
#include <AzCore/std/string/string.h>
#include <QWidget>
#include <AzFramework/Windowing/WindowBus.h>
namespace Platform
{
void LoadPluginDependencies()
{
AZ_Warning("Material Editor", false, "LoadPluginDependencies() function is not implemented");
}
void ProcessInput(void* message)
{
AZ_Warning("Material Editor", false, "ProcessInput() function is not implemented");
}
AzFramework::NativeWindowHandle GetWindowHandle(WId winId)
{
AZ_Warning("Material Editor", false, "GetWindowHandle() function is not implemented");
AZ_UNUSED(winId);
return nullptr;
}
AzFramework::WindowSize GetClientAreaSize(AzFramework::NativeWindowHandle window)
{
AZ_Warning("Material Editor", false, "GetClientAreaSize() function is not implemented");
AZ_UNUSED(window);
return AzFramework::WindowSize{1,1};
}
}
@@ -6,53 +6,6 @@
*
*/
#include <AzCore/std/string/string.h>
#include <AzFramework/API/ApplicationAPI.h>
#include <QDir>
#include <QWidget>
#include <MaterialEditor_Traits_Platform.h>
namespace Platform
{
void ProcessInput(void* message)
{
MSG* msg = (MSG*)message;
// Ensure that the Windows WM_INPUT messages get passed through to the AzFramework input system,
// but only while in game mode so we don't accumulate raw input events before we start actually
// ticking the input devices, otherwise the queued events will get sent when entering game mode.
if (msg->message == WM_INPUT)
{
UINT rawInputSize;
const UINT rawInputHeaderSize = sizeof(RAWINPUTHEADER);
GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, NULL, &rawInputSize, rawInputHeaderSize);
LPBYTE rawInputBytes = new BYTE[rawInputSize];
GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, rawInputBytes, &rawInputSize, rawInputHeaderSize);
RAWINPUT* rawInput = (RAWINPUT*)rawInputBytes;
AzFramework::RawInputNotificationBusWindows::Broadcast(
&AzFramework::RawInputNotificationBusWindows::Events::OnRawInputEvent, *rawInput);
}
}
AzFramework::NativeWindowHandle GetWindowHandle(WId winId)
{
return reinterpret_cast<HWND>(winId);
}
AzFramework::WindowSize GetClientAreaSize(AzFramework::NativeWindowHandle window)
{
RECT r;
if (GetWindowRect(reinterpret_cast<HWND>(window), &r))
{
return AzFramework::WindowSize{aznumeric_cast<uint32_t>(r.right - r.left), aznumeric_cast<uint32_t>(r.bottom - r.top)};
}
else
{
AZ_Assert(false, "Failed to get dimensions for window");
return AzFramework::WindowSize{};
}
}
}
@@ -17,20 +17,11 @@
#include <Viewport/MaterialViewportWidget.h>
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknow n-warning-option") // disable warnings spawned by QT
#include <QAbstractEventDispatcher>
#include <QWindow>
#include "Viewport/ui_MaterialViewportWidget.h"
AZ_POP_DISABLE_WARNING
#include <AzCore/PlatformIncl.h>
#include <AzFramework/Viewport/ViewportControllerList.h>
#include <AzFramework/Windowing/WindowBus.h>
namespace Platform
{
void ProcessInput(void* message);
}
namespace MaterialEditor
{
@@ -41,14 +32,6 @@ namespace MaterialEditor
{
m_ui->setupUi(this);
if (auto dispatcher = QAbstractEventDispatcher::instance())
{
dispatcher->installNativeEventFilter(this);
}
AzFramework::WindowSystemNotificationBus::Broadcast(
&AzFramework::WindowSystemNotificationBus::Events::OnWindowCreated, GetViewportContext()->GetWindowHandle());
// The viewport context created by AtomToolsFramework::RenderViewportWidget has no name.
// Systems like frame capturing and post FX expect there to be a context with DefaultViewportContextName
auto viewportContextManager = AZ::Interface<AZ::RPI::ViewportContextRequestsInterface>::Get();
@@ -58,13 +41,4 @@ namespace MaterialEditor
m_renderer = AZStd::make_unique<MaterialViewportRenderer>(GetViewportContext()->GetWindowContext());
GetControllerList()->Add(m_renderer->GetController());
}
// This is a temporary fix to get input working in Qt window, otherwise it wont receive input events
// This will later be handled on the QApplication subclass level
bool MaterialViewportWidget::nativeEventFilter(const QByteArray& /*eventType*/, void* message, long* /*result*/)
{
Platform::ProcessInput(message);
return false;
}
} // namespace MaterialEditor
@@ -8,12 +8,10 @@
#pragma once
#if !defined(Q_MOC_RUN)
#include <AzCore/Asset/AssetCommon.h>
#include <AzFramework/Windowing/WindowBus.h>
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT
#include <QWidget>
#include <QAbstractNativeEventFilter>
AZ_POP_DISABLE_WARNING
#endif
@@ -38,14 +36,11 @@ namespace MaterialEditor
class MaterialViewportWidget
: public AtomToolsFramework::RenderViewportWidget
, public QAbstractNativeEventFilter
{
public:
MaterialViewportWidget(QWidget* parent = nullptr);
QScopedPointer<Ui::MaterialViewportWidget> m_ui;
AZStd::unique_ptr<MaterialViewportRenderer> m_renderer;
bool nativeEventFilter(const QByteArray& eventType, void* message, long* result) override;
};
} // namespace MaterialEditor
@@ -6,28 +6,6 @@
*
*/
#include <AzCore/std/string/string.h>
#include <QWidget>
#include <AzFramework/Windowing/WindowBus.h>
namespace Platform
{
void ProcessInput(void* message)
{
AZ_Warning("Shader Management Console", false, "ProcessInput() function is not implemented");
}
AzFramework::NativeWindowHandle GetWindowHandle(WId winId)
{
AZ_Warning("Shader Management Console", false, "GetWindowHandle() function is not implemented");
AZ_UNUSED(winId);
return nullptr;
}
AzFramework::WindowSize GetClientAreaSize(AzFramework::NativeWindowHandle window)
{
AZ_Warning("Shader Management Console", false, "GetClientAreaSize() function is not implemented");
AZ_UNUSED(window);
return AzFramework::WindowSize{1,1};
}
}
@@ -6,51 +6,6 @@
*
*/
#include <AzCore/std/string/string.h>
#include <QWidget>
#include <ShaderManagementConsole_Traits_Platform.h>
namespace Platform
{
void ProcessInput(void* message)
{
MSG* msg = (MSG*)message;
// Ensure that the Windows WM_INPUT messages get passed through to the AzFramework input system,
// but only while in game mode so we don't accumulate raw input events before we start actually
// ticking the input devices, otherwise the queued events will get sent when entering game mode.
if (msg->message == WM_INPUT)
{
UINT rawInputSize;
const UINT rawInputHeaderSize = sizeof(RAWINPUTHEADER);
GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, NULL, &rawInputSize, rawInputHeaderSize);
LPBYTE rawInputBytes = new BYTE[rawInputSize];
GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, rawInputBytes, &rawInputSize, rawInputHeaderSize);
RAWINPUT* rawInput = (RAWINPUT*)rawInputBytes;
AzFramework::RawInputNotificationBusWindows::Broadcast(
&AzFramework::RawInputNotificationBusWindows::Events::OnRawInputEvent, *rawInput);
}
}
AzFramework::NativeWindowHandle GetWindowHandle(WId winId)
{
return reinterpret_cast<HWND>(winId);
}
AzFramework::WindowSize GetClientAreaSize(AzFramework::NativeWindowHandle window)
{
RECT r;
if (GetWindowRect(reinterpret_cast<HWND>(window), &r))
{
return AzFramework::WindowSize{aznumeric_cast<uint32_t>(r.right - r.left), aznumeric_cast<uint32_t>(r.bottom - r.top)};
}
else
{
AZ_Assert(false, "Failed to get dimensions for window");
return AzFramework::WindowSize{};
}
}
}