Merge branch 'Atom/santorac/RemixableMaterialTypes' into Atom/santorac/RemixableMaterialTypes2

This commit is contained in:
santorac
2021-09-28 22:14:23 -07:00
860 changed files with 25089 additions and 12205 deletions
@@ -1,38 +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
*
*/
#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};
}
}
@@ -9,5 +9,4 @@
set(FILES
MaterialEditor_Traits_Platform.h
MaterialEditor_Traits_Linux.h
MaterialEditor_Linux.cpp
)
@@ -6,5 +6,5 @@
#
#
set(GEM_DEPENDENCIES
set(LY_RUNTIME_DEPENDENCIES
)
@@ -1,38 +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
*
*/
#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};
}
}
@@ -9,5 +9,4 @@
set(FILES
MaterialEditor_Traits_Platform.h
MaterialEditor_Traits_Mac.h
MaterialEditor_Mac.cpp
)
@@ -6,5 +6,5 @@
#
#
set(GEM_DEPENDENCIES
set(LY_RUNTIME_DEPENDENCIES
)
@@ -1,58 +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
*
*/
#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{};
}
}
}
@@ -9,6 +9,5 @@
set(FILES
MaterialEditor_Traits_Platform.h
MaterialEditor_Traits_Windows.h
MaterialEditor_Windows.cpp
MaterialEditor.rc
)
@@ -6,6 +6,6 @@
#
#
set(GEM_DEPENDENCIES
set(LY_RUNTIME_DEPENDENCIES
Gem::QtForPython.Editor
)
@@ -231,12 +231,10 @@ namespace MaterialEditor
MaterialViewportNotificationBus::Handler::BusConnect();
AZ::TickBus::Handler::BusConnect();
AZ::TransformNotificationBus::MultiHandler::BusConnect(m_cameraEntity->GetId());
AzFramework::WindowSystemRequestBus::Handler::BusConnect();
}
MaterialViewportRenderer::~MaterialViewportRenderer()
{
AzFramework::WindowSystemRequestBus::Handler::BusDisconnect();
AZ::TransformNotificationBus::MultiHandler::BusDisconnect();
AZ::TickBus::Handler::BusDisconnect();
AtomToolsFramework::AtomToolsDocumentNotificationBus::Handler::BusDisconnect();
@@ -287,11 +285,6 @@ namespace MaterialEditor
return m_viewportController;
}
AzFramework::NativeWindowHandle MaterialViewportRenderer::GetDefaultWindowHandle()
{
return (m_windowContext) ? m_windowContext->GetWindowHandle() : nullptr;
}
void MaterialViewportRenderer::OnDocumentOpened(const AZ::Uuid& documentId)
{
AZ::Data::Instance<AZ::RPI::Material> materialInstance;
@@ -16,7 +16,6 @@
#include <AtomToolsFramework/Document/AtomToolsDocumentNotificationBus.h>
#include <AzCore/Component/TickBus.h>
#include <AzCore/Component/TransformBus.h>
#include <AzFramework/Windowing/WindowBus.h>
#include <Viewport/InputController/MaterialEditorViewportInputController.h>
namespace AZ
@@ -46,7 +45,6 @@ namespace MaterialEditor
, public AtomToolsFramework::AtomToolsDocumentNotificationBus::Handler
, public MaterialViewportNotificationBus::Handler
, public AZ::TransformNotificationBus::MultiHandler
, public AzFramework::WindowSystemRequestBus::Handler
{
public:
AZ_CLASS_ALLOCATOR(MaterialViewportRenderer, AZ::SystemAllocator, 0);
@@ -81,9 +79,6 @@ namespace MaterialEditor
// AZ::TransformNotificationBus::MultiHandler overrides...
void OnTransformChanged(const AZ::Transform&, const AZ::Transform&) override;
// AzFramework::WindowSystemRequestBus::Handler overrides ...
AzFramework::NativeWindowHandle GetDefaultWindowHandle() override;
using DirectionalLightHandle = AZ::Render::DirectionalLightFeatureProcessorInterface::LightHandle;
AZ::Data::Instance<AZ::RPI::SwapChainPass> m_swapChainPass;
@@ -13,24 +13,16 @@
#include <Atom/RPI.Public/ViewportContextBus.h>
#include <Atom/RPI.Public/WindowContext.h>
#include <Source/Viewport/MaterialViewportRenderer.h>
#include <Source/Viewport/MaterialViewportWidget.h>
#include <Viewport/MaterialViewportRenderer.h>
#include <Viewport/MaterialViewportWidget.h>
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT
#include <QAbstractEventDispatcher>
#include <QWindow>
#include "Source/Viewport/ui_MaterialViewportWidget.h"
#include "Viewport/ui_MaterialViewportWidget.h"
AZ_POP_DISABLE_WARNING
#include <AzCore/PlatformIncl.h>
#include <AzFramework/Viewport/ViewportControllerList.h>
namespace Platform
{
void ProcessInput(void* message);
}
namespace MaterialEditor
{
@@ -40,11 +32,6 @@ namespace MaterialEditor
{
m_ui->setupUi(this);
if (auto dispatcher = QAbstractEventDispatcher::instance())
{
dispatcher->installNativeEventFilter(this);
}
// 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();
@@ -54,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