Atom Tools: Removing unnecessary modules, components, and dead code from ME

• Working toward creating a standalone application template
Removing application level modules and system components that make it difficult to navigate the project and add a lot of boilerplate code
• Temporarily keeping viewport module and components because shutting down the application deactivates module entities before system entities without respecting component service dependency order. This caused several RPI assets and names to leak because they were not being destroyed in the correct order.
• Fixing include paths not referenced source folders
• Mostly cleanup and reorganization, no behavioral changes

Signed-off-by: Guthrie Adams <guthadam@amazon.com>
This commit is contained in:
Guthrie Adams
2022-01-20 00:10:07 -06:00
parent bcc155049d
commit c98d14ad92
80 changed files with 327 additions and 736 deletions
@@ -6,10 +6,9 @@
*
*/
#include <AzCore/Math/Vector3.h>
#include <AzCore/Component/TransformBus.h>
#include <Source/Viewport/InputController/Behavior.h>
#include <AzCore/Math/Vector3.h>
#include <Viewport/InputController/Behavior.h>
#include <Viewport/InputController/MaterialEditorViewportInputController.h>
namespace MaterialEditor
@@ -6,11 +6,11 @@
*
*/
#include <AzCore/Component/TransformBus.h>
#include <AzCore/Math/MathUtils.h>
#include <AzCore/Math/Vector3.h>
#include <AzCore/Component/TransformBus.h>
#include <Viewport/InputController/DollyCameraBehavior.h>
#include <Viewport/InputController/MaterialEditorViewportInputController.h>
#include <Source/Viewport/InputController/DollyCameraBehavior.h>
namespace MaterialEditor
{
@@ -7,7 +7,7 @@
*/
#pragma once
#include <Source/Viewport/InputController/Behavior.h>
#include <Viewport/InputController/Behavior.h>
namespace MaterialEditor
{
@@ -6,7 +6,7 @@
*
*/
#include <Source/Viewport/InputController/IdleBehavior.h>
#include <Viewport/InputController/IdleBehavior.h>
namespace MaterialEditor
{
@@ -7,7 +7,7 @@
*/
#pragma once
#include <Source/Viewport/InputController/Behavior.h>
#include <Viewport/InputController/Behavior.h>
namespace MaterialEditor
{
@@ -9,30 +9,30 @@
#include <QApplication>
#include <QWidget>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Component/TransformBus.h>
#include <AzCore/Math/Matrix4x4.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzFramework/Components/CameraBus.h>
#include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
#include <AzFramework/Input/Devices/Mouse/InputDeviceMouse.h>
#include <AzFramework/Components/CameraBus.h>
#include <AzFramework/Viewport/ScreenGeometry.h>
#include <AzToolsFramework/Viewport/ViewportMessages.h>
#include <AtomLyIntegration/CommonFeatures/Mesh/MeshComponentBus.h>
#include <Atom/Feature/SkyBox/SkyBoxFeatureProcessorInterface.h>
#include <Atom/RPI.Public/RPISystemInterface.h>
#include <Atom/RPI.Public/Scene.h>
#include <Atom/RPI.Reflect/Model/ModelAsset.h>
#include <Atom/Feature/SkyBox/SkyBoxFeatureProcessorInterface.h>
#include <AtomLyIntegration/CommonFeatures/Mesh/MeshComponentBus.h>
#include <Source/Viewport/InputController/MaterialEditorViewportInputController.h>
#include <Source/Viewport/InputController/IdleBehavior.h>
#include <Source/Viewport/InputController/PanCameraBehavior.h>
#include <Source/Viewport/InputController/OrbitCameraBehavior.h>
#include <Source/Viewport/InputController/MoveCameraBehavior.h>
#include <Source/Viewport/InputController/DollyCameraBehavior.h>
#include <Source/Viewport/InputController/RotateModelBehavior.h>
#include <Source/Viewport/InputController/RotateEnvironmentBehavior.h>
#include <Viewport/InputController/DollyCameraBehavior.h>
#include <Viewport/InputController/IdleBehavior.h>
#include <Viewport/InputController/MaterialEditorViewportInputController.h>
#include <Viewport/InputController/MoveCameraBehavior.h>
#include <Viewport/InputController/OrbitCameraBehavior.h>
#include <Viewport/InputController/PanCameraBehavior.h>
#include <Viewport/InputController/RotateEnvironmentBehavior.h>
#include <Viewport/InputController/RotateModelBehavior.h>
namespace MaterialEditor
{
@@ -9,8 +9,8 @@
#include <AzFramework/Input/Events/InputChannelEventListener.h>
#include <AzFramework/Viewport/SingleViewportController.h>
#include <Atom/Viewport/InputController/MaterialEditorViewportInputControllerBus.h>
#include <Source/Viewport/InputController/Behavior.h>
#include <Viewport/InputController/Behavior.h>
#include <Viewport/InputController/MaterialEditorViewportInputControllerBus.h>
namespace MaterialEditor
{
@@ -0,0 +1,61 @@
/*
* 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>
#include <AzCore/Math/Vector3.h>
namespace MaterialEditor
{
class MaterialEditorViewportInputControllerRequests
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
//! Get entityId of viewport camera
virtual const AZ::EntityId& GetCameraEntityId() const = 0;
//! Get entityId of camera target
virtual const AZ::EntityId& GetTargetEntityId() const = 0;
//! Get entityId of scene's IBL entity
virtual const AZ::EntityId& GetIblEntityId() const = 0;
//! Get actual position where the camera is facing
virtual const AZ::Vector3& GetTargetPosition() const = 0;
//! Set camera target position
//! @param targetPosition world space position to point camera at
virtual void SetTargetPosition(const AZ::Vector3& targetPosition) = 0;
//! Get distance between camera and its target
virtual float GetDistanceToTarget() const = 0;
//! Get minimum and maximum camera distance to the model based on mesh size
//! @param distanceMin closest camera can be to the target
//! @param distanceMax furthest camera can be from the target
virtual void GetExtents(float& distanceMin, float& distanceMax) const = 0;
//! Get bounding sphere radius of the active model
virtual float GetRadius() const = 0;
//! Reset camera to default position and rotation
virtual void Reset() = 0;
//! Modify camera's field of view
//! @param value field of view in degrees
virtual void SetFieldOfView(float value) = 0;
//! Check if camera is looking directly at a model
virtual bool IsCameraCentered() const = 0;
};
using MaterialEditorViewportInputControllerRequestBus = AZ::EBus<MaterialEditorViewportInputControllerRequests>;
} // namespace MaterialEditor
@@ -6,10 +6,10 @@
*
*/
#include <AzCore/Math/Vector3.h>
#include <AzCore/Component/TransformBus.h>
#include <Atom/Viewport/InputController/MaterialEditorViewportInputControllerBus.h>
#include <Source/Viewport/InputController/MoveCameraBehavior.h>
#include <AzCore/Math/Vector3.h>
#include <Viewport/InputController/MaterialEditorViewportInputControllerBus.h>
#include <Viewport/InputController/MoveCameraBehavior.h>
namespace MaterialEditor
{
@@ -7,7 +7,7 @@
*/
#pragma once
#include <Source/Viewport/InputController/Behavior.h>
#include <Viewport/InputController/Behavior.h>
namespace MaterialEditor
{
@@ -7,8 +7,8 @@
*/
#include <AzCore/Component/TransformBus.h>
#include <Source/Viewport/InputController/OrbitCameraBehavior.h>
#include <Viewport/InputController/MaterialEditorViewportInputController.h>
#include <Viewport/InputController/OrbitCameraBehavior.h>
namespace MaterialEditor
{
@@ -7,7 +7,7 @@
*/
#pragma once
#include <Source/Viewport/InputController/Behavior.h>
#include <Viewport/InputController/Behavior.h>
namespace MaterialEditor
{
@@ -6,11 +6,11 @@
*
*/
#include <AzCore/Math/Vector3.h>
#include <AzCore/Math/Quaternion.h>
#include <AzCore/Component/TransformBus.h>
#include <Atom/Viewport/InputController/MaterialEditorViewportInputControllerBus.h>
#include <Source/Viewport/InputController/PanCameraBehavior.h>
#include <AzCore/Math/Quaternion.h>
#include <AzCore/Math/Vector3.h>
#include <Viewport/InputController/MaterialEditorViewportInputControllerBus.h>
#include <Viewport/InputController/PanCameraBehavior.h>
namespace MaterialEditor
{
@@ -7,7 +7,7 @@
*/
#pragma once
#include <Source/Viewport/InputController/Behavior.h>
#include <Viewport/InputController/Behavior.h>
namespace MaterialEditor
{
@@ -13,7 +13,7 @@
#include <Atom/RPI.Public/Scene.h>
#include <Viewport/InputController/MaterialEditorViewportInputController.h>
#include <Source/Viewport/InputController/RotateEnvironmentBehavior.h>
#include <Viewport/InputController/RotateEnvironmentBehavior.h>
namespace MaterialEditor
{
@@ -7,7 +7,7 @@
*/
#pragma once
#include <Source/Viewport/InputController/Behavior.h>
#include <Viewport/InputController/Behavior.h>
namespace AZ
{
@@ -8,7 +8,7 @@
#include <AzCore/Component/TransformBus.h>
#include <Viewport/InputController/MaterialEditorViewportInputController.h>
#include <Source/Viewport/InputController/RotateModelBehavior.h>
#include <Viewport/InputController/RotateModelBehavior.h>
namespace MaterialEditor
{
@@ -7,7 +7,7 @@
*/
#pragma once
#include <Source/Viewport/InputController/Behavior.h>
#include <Viewport/InputController/Behavior.h>
namespace MaterialEditor
{
@@ -9,19 +9,19 @@
#include <Atom/RPI.Edit/Common/AssetUtils.h>
#include <Atom/RPI.Edit/Common/JsonUtils.h>
#include <Atom/RPI.Reflect/Asset/AssetUtils.h>
#include <Atom/Viewport/MaterialViewportNotificationBus.h>
#include <Atom/Viewport/MaterialViewportSettings.h>
#include <AzCore/Component/TickBus.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/Json/JsonUtils.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/StringFunc/StringFunc.h>
#include <AzFramework/Asset/AssetSystemBus.h>
#include <AzFramework/IO/LocalFileIO.h>
#include <AzCore/StringFunc/StringFunc.h>
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
#include <AzToolsFramework/AssetBrowser/AssetBrowserEntry.h>
#include <Viewport/MaterialViewportComponent.h>
#include <Viewport/MaterialViewportNotificationBus.h>
#include <Viewport/MaterialViewportSettings.h>
namespace MaterialEditor
{
@@ -42,7 +42,7 @@ namespace MaterialEditor
{
editContext->Class<MaterialViewportComponent>("MaterialViewport", "Manages configurations for lighting and models displayed in the viewport")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b))
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC_CE("System"))
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
;
}
@@ -103,18 +103,19 @@ namespace MaterialEditor
void MaterialViewportComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
{
required.push_back(AZ_CRC("PerformanceMonitorService", 0x6a44241a));
required.push_back(AZ_CRC("AtomImageBuilderService", 0x76ded592));
required.push_back(AZ_CRC_CE("RPISystem"));
required.push_back(AZ_CRC_CE("AssetDatabaseService"));
required.push_back(AZ_CRC_CE("PerformanceMonitorService"));
}
void MaterialViewportComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC("MaterialViewportService", 0xed9b44d7));
provided.push_back(AZ_CRC_CE("MaterialViewportService"));
}
void MaterialViewportComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
incompatible.push_back(AZ_CRC("MaterialViewportService", 0xed9b44d7));
incompatible.push_back(AZ_CRC_CE("MaterialViewportService"));
}
void MaterialViewportComponent::Init()
@@ -12,11 +12,11 @@
#include <Atom/Feature/Utils/LightingPreset.h>
#include <Atom/Feature/Utils/ModelPreset.h>
#include <Atom/RPI.Reflect/System/AnyAsset.h>
#include <Atom/Viewport/MaterialViewportRequestBus.h>
#include <Atom/Viewport/MaterialViewportSettings.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/Component/Component.h>
#include <AzFramework/Asset/AssetCatalogBus.h>
#include <Viewport/MaterialViewportRequestBus.h>
#include <Viewport/MaterialViewportSettings.h>
namespace MaterialEditor
{
@@ -6,8 +6,8 @@
*
*/
#include <Atom/Viewport/MaterialViewportModule.h>
#include <Viewport/MaterialViewportComponent.h>
#include <Viewport/MaterialViewportModule.h>
#include <Viewport/PerformanceMonitorComponent.h>
namespace MaterialEditor
@@ -0,0 +1,28 @@
/*
* 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/Module/Module.h>
namespace MaterialEditor
{
//! Entry point for Material Editor Viewport library. This module is responsible for registering and reflecting dependencies
class MaterialViewportModule
: public AZ::Module
{
public:
AZ_RTTI(MaterialViewportModule, "{D4A53226-D31A-4FBD-A599-F17F740EC2BA}", AZ::Module);
AZ_CLASS_ALLOCATOR(MaterialViewportModule, AZ::SystemAllocator, 0);
MaterialViewportModule();
//! Add required SystemComponents to the SystemEntity.
AZ::ComponentTypeList GetRequiredSystemComponents() const override;
};
}
@@ -0,0 +1,71 @@
/*
* 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 <ACES/Aces.h>
#include <AzCore/EBus/EBus.h>
#include <Atom/Feature/Utils/LightingPreset.h>
#include <Atom/Feature/Utils/ModelPreset.h>
namespace MaterialEditor
{
class MaterialViewportNotifications
: public AZ::EBusTraits
{
public:
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
//! Signal that all configs are about to be reloaded
virtual void OnBeginReloadContent() {}
//! Signal that all configs were reloaded
virtual void OnEndReloadContent() {}
//! Signal that a preset was added
//! @param preset being added
virtual void OnLightingPresetAdded([[maybe_unused]] AZ::Render::LightingPresetPtr preset) {}
//! Signal that a preset was selected
//! @param preset being selected
virtual void OnLightingPresetSelected([[maybe_unused]] AZ::Render::LightingPresetPtr preset) {}
//! Signal that a preset was changed
//! @param preset being changed
virtual void OnLightingPresetChanged([[maybe_unused]] AZ::Render::LightingPresetPtr preset) {}
//! Signal that a preset was added
//! @param preset being added
virtual void OnModelPresetAdded([[maybe_unused]] AZ::Render::ModelPresetPtr preset) {}
//! Signal that a preset was selected
//! @param preset being selected
virtual void OnModelPresetSelected([[maybe_unused]] AZ::Render::ModelPresetPtr preset) {}
//! Signal that a preset was changed
//! @param preset being changed
virtual void OnModelPresetChanged([[maybe_unused]] AZ::Render::ModelPresetPtr preset) {}
//! Notify when enabled state for shadow catcher changes
virtual void OnShadowCatcherEnabledChanged([[maybe_unused]] bool enable) {}
//! Notify when enabled state for grid changes
virtual void OnGridEnabledChanged([[maybe_unused]] bool enable) {}
//! Notify when enabled state for alternate skybox changes
virtual void OnAlternateSkyboxEnabledChanged([[maybe_unused]] bool enable) {}
//! Notify when field of view changes
virtual void OnFieldOfViewChanged([[maybe_unused]] float fieldOfView) {}
//! Notify when tone mapping changes
virtual void OnDisplayMapperOperationTypeChanged([[maybe_unused]] AZ::Render::DisplayMapperOperationType operationType) {}
};
using MaterialViewportNotificationBus = AZ::EBus<MaterialViewportNotifications>;
} // namespace MaterialEditor
@@ -8,51 +8,51 @@
#undef RC_INVOKED
#include <AzCore/Component/Entity.h>
#include <AzCore/Component/Component.h>
#include <AzCore/Component/Entity.h>
#include <AzFramework/Components/TransformComponent.h>
#include <AzFramework/Components/NonUniformScaleComponent.h>
#include <AzFramework/Components/TransformComponent.h>
#include <AzFramework/Entity/GameEntityContextBus.h>
#include <AtomCore/Instance/InstanceDatabase.h>
#include <Atom/RPI.Public/WindowContext.h>
#include <Atom/RPI.Public/Image/StreamingImage.h>
#include <Atom/RPI.Public/Material/Material.h>
#include <Atom/RPI.Public/Pass/Specific/SwapChainPass.h>
#include <Atom/RPI.Public/RPISystemInterface.h>
#include <Atom/RPI.Public/RenderPipeline.h>
#include <Atom/RPI.Public/Scene.h>
#include <Atom/RPI.Public/Material/Material.h>
#include <Atom/RPI.Public/Image/StreamingImage.h>
#include <Atom/RPI.Public/WindowContext.h>
#include <Atom/RPI.Reflect/Asset/AssetUtils.h>
#include <Atom/Component/DebugCamera/CameraComponent.h>
#include <Atom/Feature/PostProcessing/PostProcessingConstants.h>
#include <Atom/Feature/PostProcess/PostProcessFeatureProcessorInterface.h>
#include <Atom/Feature/ImageBasedLights/ImageBasedLightFeatureProcessorInterface.h>
#include <Atom/Feature/ACES/AcesDisplayMapperFeatureProcessor.h>
#include <Atom/Component/DebugCamera/NoClipControllerComponent.h>
#include <Atom/Feature/ACES/AcesDisplayMapperFeatureProcessor.h>
#include <Atom/Feature/ImageBasedLights/ImageBasedLightFeatureProcessorInterface.h>
#include <Atom/Feature/PostProcess/PostProcessFeatureProcessorInterface.h>
#include <Atom/Feature/PostProcessing/PostProcessingConstants.h>
#include <Atom/Document/MaterialDocumentRequestBus.h>
#include <Atom/Feature/Utils/LightingPreset.h>
#include <Atom/Feature/Utils/ModelPreset.h>
#include <Atom/Viewport/MaterialViewportRequestBus.h>
#include <Atom/Viewport/PerformanceMonitorRequestBus.h>
#include <Atom/Viewport/MaterialViewportSettings.h>
#include <AtomLyIntegration/CommonFeatures/Grid/GridComponentConstants.h>
#include <AtomLyIntegration/CommonFeatures/Grid/GridComponentConfig.h>
#include <AtomLyIntegration/CommonFeatures/Grid/GridComponentConstants.h>
#include <AtomLyIntegration/CommonFeatures/ImageBasedLights/ImageBasedLightComponentBus.h>
#include <AtomLyIntegration/CommonFeatures/ImageBasedLights/ImageBasedLightComponentConstants.h>
#include <AtomLyIntegration/CommonFeatures/Material/MaterialComponentConstants.h>
#include <AtomLyIntegration/CommonFeatures/Material/MaterialComponentBus.h>
#include <AtomLyIntegration/CommonFeatures/Mesh/MeshComponentConstants.h>
#include <AtomLyIntegration/CommonFeatures/Material/MaterialComponentConstants.h>
#include <AtomLyIntegration/CommonFeatures/Mesh/MeshComponentBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxLayerComponentConstants.h>
#include <AtomLyIntegration/CommonFeatures/Mesh/MeshComponentConstants.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/ExposureControl/ExposureControlBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/ExposureControl/ExposureControlComponentConstants.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxLayerComponentConstants.h>
#include <Source/Viewport/MaterialViewportRenderer.h>
#include <Document/MaterialDocumentRequestBus.h>
#include <Viewport/MaterialViewportRenderer.h>
#include <Viewport/MaterialViewportRequestBus.h>
#include <Viewport/MaterialViewportSettings.h>
#include <Viewport/PerformanceMonitorRequestBus.h>
namespace MaterialEditor
{
@@ -11,12 +11,12 @@
#include <Atom/Feature/CoreLights/DirectionalLightFeatureProcessorInterface.h>
#include <Atom/Feature/SkyBox/SkyBoxFeatureProcessorInterface.h>
#include <Atom/RPI.Public/Base.h>
#include <Atom/Viewport/MaterialViewportNotificationBus.h>
#include <AtomCore/Instance/Instance.h>
#include <AtomToolsFramework/Document/AtomToolsDocumentNotificationBus.h>
#include <AzCore/Component/TickBus.h>
#include <AzCore/Component/TransformBus.h>
#include <Viewport/InputController/MaterialEditorViewportInputController.h>
#include <Viewport/MaterialViewportNotificationBus.h>
namespace AZ
{
@@ -0,0 +1,138 @@
/*
* 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 <ACES/Aces.h>
#include <AzCore/EBus/EBus.h>
#include <AzCore/std/containers/set.h>
#include <AzCore/std/string/string.h>
#include <Atom/Feature/Utils/LightingPreset.h>
#include <Atom/Feature/Utils/ModelPreset.h>
#include <QImage>
namespace MaterialEditor
{
using MaterialViewportPresetNameSet = AZStd::set<AZStd::string>;
class MaterialViewportRequests
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
//! Reload all presets
virtual void ReloadContent() = 0;
//! Add lighting preset
//! @param preset lighting preset to add for selection
//! @returns pointer to new, managed preset
virtual AZ::Render::LightingPresetPtr AddLightingPreset(const AZ::Render::LightingPreset& preset) = 0;
//! Get lighting presets
//! @returns all presets
virtual AZ::Render::LightingPresetPtrVector GetLightingPresets() const = 0;
//! Save lighting preset
//! @returns true if preset was saved, otherwise false
virtual bool SaveLightingPreset(AZ::Render::LightingPresetPtr preset, const AZStd::string& path) const = 0;
//! Get lighting preset by name
//! @param name preset name to search for
//! @returns the requested preset if found, otherwise nullptr
virtual AZ::Render::LightingPresetPtr GetLightingPresetByName(const AZStd::string& name) const = 0;
//! Get selected lighting preset
//! @returns selected preset if found, otherwise nullptr
virtual AZ::Render::LightingPresetPtr GetLightingPresetSelection() const = 0;
//! Select lighting preset
//! @param preset to select
virtual void SelectLightingPreset(AZ::Render::LightingPresetPtr preset) = 0;
//! Select lighting preset by name
//! @param name preset name to select
virtual void SelectLightingPresetByName(const AZStd::string& name) = 0;
//! Get set of lighting preset names
virtual MaterialViewportPresetNameSet GetLightingPresetNames() const = 0;
//! Get model preset last save path
//! @param preset to lookup last save path
virtual AZStd::string GetLightingPresetLastSavePath(AZ::Render::LightingPresetPtr preset) const = 0;
//! Add model preset
//! @param preset model preset to add for selection
//! @returns pointer to new, managed preset
virtual AZ::Render::ModelPresetPtr AddModelPreset(const AZ::Render::ModelPreset& preset) = 0;
//! Get model presets
//! @returns all presets
virtual AZ::Render::ModelPresetPtrVector GetModelPresets() const = 0;
//! Save Model preset
//! @returns true if preset was saved, otherwise false
virtual bool SaveModelPreset(AZ::Render::ModelPresetPtr preset, const AZStd::string& path) const = 0;
//! Get model preset by name
//! @param name preset name to search for
//! @returns the requested preset if found, otherwise nullptr
virtual AZ::Render::ModelPresetPtr GetModelPresetByName(const AZStd::string& name) const = 0;
//! Get selected model preset
//! @returns selected preset if found, otherwise nullptr
virtual AZ::Render::ModelPresetPtr GetModelPresetSelection() const = 0;
//! Select lighting preset
//! @param name preset to select
virtual void SelectModelPreset(AZ::Render::ModelPresetPtr preset) = 0;
//! Select model preset by name
//! @param name preset name to select
virtual void SelectModelPresetByName(const AZStd::string& name) = 0;
//! Get set of model preset names
virtual MaterialViewportPresetNameSet GetModelPresetNames() const = 0;
//! Get model preset last save path
//! @param preset to lookup last save path
virtual AZStd::string GetModelPresetLastSavePath(AZ::Render::ModelPresetPtr preset) const = 0;
//! Set enabled state for shadow catcher
virtual void SetShadowCatcherEnabled(bool enable) = 0;
//! Get enabled state for shadow catcher
virtual bool GetShadowCatcherEnabled() const = 0;
//! Set enabled state for grid
virtual void SetGridEnabled(bool enable) = 0;
//! Get enabled state for grid
virtual bool GetGridEnabled() const = 0;
//! Set enabled state for alternate skybox
virtual void SetAlternateSkyboxEnabled(bool enable) = 0;
//! Get enabled state for alternate skybox
virtual bool GetAlternateSkyboxEnabled() const = 0;
//! Set field of view
virtual void SetFieldOfView(float fieldOfView) = 0;
//! Get field of view
virtual float GetFieldOfView() const = 0;
//! Set tone mapping type
virtual void SetDisplayMapperOperationType(AZ::Render::DisplayMapperOperationType operationType) = 0;
//! Get tone mapping type
virtual AZ::Render::DisplayMapperOperationType GetDisplayMapperOperationType() const = 0;
};
using MaterialViewportRequestBus = AZ::EBus<MaterialViewportRequests>;
} // namespace MaterialEditor
@@ -6,9 +6,9 @@
*
*/
#include <Atom/Viewport/MaterialViewportSettings.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <Viewport/MaterialViewportSettings.h>
namespace MaterialEditor
{
@@ -0,0 +1,37 @@
/*
* 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
#if !defined(Q_MOC_RUN)
#include <ACES/Aces.h>
#include <AzCore/Memory/Memory.h>
#include <AzCore/RTTI/RTTI.h>
#include <AzCore/RTTI/ReflectContext.h>
#include <AzCore/UserSettings/UserSettings.h>
#endif
namespace MaterialEditor
{
struct MaterialViewportSettings
: public AZ::UserSettings
{
AZ_RTTI(MaterialViewportSettings, "{16150503-A314-4765-82A3-172670C9EA90}", AZ::UserSettings);
AZ_CLASS_ALLOCATOR(MaterialViewportSettings, AZ::SystemAllocator, 0);
static void Reflect(AZ::ReflectContext* context);
bool m_enableGrid = true;
bool m_enableShadowCatcher = true;
bool m_enableAlternateSkybox = false;
float m_fieldOfView = 90.0f;
AZ::Render::DisplayMapperOperationType m_displayMapperOperationType = AZ::Render::DisplayMapperOperationType::Aces;
AZStd::string m_selectedModelPresetName = "Shader Ball";
AZStd::string m_selectedLightingPresetName = "Neutral Urban";
};
} // namespace MaterialEditor
@@ -0,0 +1,25 @@
/*
* 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/Memory/Memory.h>
#include <AzCore/RTTI/RTTI.h>
#include <AzCore/RTTI/ReflectContext.h>
#include <AzCore/Serialization/SerializeContext.h>
namespace MaterialEditor
{
//! Data structure containing performance metrics for Material Editor
struct PerformanceMetrics final
{
AZ_CLASS_ALLOCATOR(PerformanceMetrics, AZ::SystemAllocator, 0);
double m_cpuFrameTimeMs = 0;
double m_gpuFrameTimeMs = 0;
};
} // namespace MaterialEditor
@@ -31,7 +31,7 @@ namespace MaterialEditor
void PerformanceMonitorComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC("PerformanceMonitorService", 0x6a44241a));
provided.push_back(AZ_CRC_CE("PerformanceMonitorService"));
}
void PerformanceMonitorComponent::Init()
@@ -8,11 +8,10 @@
#pragma once
#include <Atom/RPI.Public/Pass/Pass.h>
#include <AzCore/Component/Component.h>
#include <AzCore/Statistics/RunningStatistic.h>
#include <Atom/RPI.Public/Pass/Pass.h>
#include <Atom/Viewport/PerformanceMonitorRequestBus.h>
#include <Viewport/PerformanceMonitorRequestBus.h>
namespace MaterialEditor
{
@@ -0,0 +1,33 @@
/*
* 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>
#include <Viewport/PerformanceMetrics.h>
namespace MaterialEditor
{
//! Provides communication with Performance Monitor
class PerformanceMonitorRequests
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
//! Enable or disable CPU and GPU monitoring
//! @param enabled whether performance monitoring should be enabled
virtual void SetProfilerEnabled(bool enabled) = 0;
//! Gather performance metrics for the current frame
virtual void GatherMetrics() = 0;
//! Get current metrics
virtual const PerformanceMetrics& GetMetrics() = 0;
};
using PerformanceMonitorRequestBus = AZ::EBus<PerformanceMonitorRequests>;
} // namespace MaterialEditor