Initial commit

This commit is contained in:
alexpete
2021-03-05 11:26:34 -08:00
commit a10351f38d
27091 changed files with 5521199 additions and 0 deletions
@@ -0,0 +1,40 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/EBus/EBus.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AtomCore/Instance/InstanceId.h>
namespace MaterialEditor
{
//! MaterialDocumentFactoryRequestBus provides a factory interface for creating and destroying material documents (in memory)
class MaterialDocumentFactoryRequests
: public AZ::EBusTraits
{
public:
// Only a single handler is allowed
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
//! Create a material document object
//! @return Uuid of new material document, or null Uuid if failed
virtual AZ::Uuid CreateDocument() = 0;
//! Destroy a material document object with the specified id
//! @return true if Uuid was found and removed, otherwise false
virtual bool DestroyDocument(const AZ::Uuid& documentId) = 0;
};
using MaterialDocumentFactoryRequestBus = AZ::EBus<MaterialDocumentFactoryRequests>;
} // namespace MaterialEditor
@@ -0,0 +1,33 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/Module/Module.h>
namespace MaterialEditor
{
//! Entry point for Material Editor Document library. This module is responsible for registering dependencies and logic needed
//! for the Material Document API
class MaterialDocumentModule
: public AZ::Module
{
public:
AZ_RTTI(MaterialDocumentModule, "{81D7A170-9284-4DE9-8D92-B6B94E8A2BDF}", AZ::Module);
AZ_CLASS_ALLOCATOR(MaterialDocumentModule, AZ::SystemAllocator, 0);
MaterialDocumentModule();
//! Add required SystemComponents to the SystemEntity.
AZ::ComponentTypeList GetRequiredSystemComponents() const override;
};
}
@@ -0,0 +1,83 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h>
#include <Atom/RPI.Public/Material/Material.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/std/any.h>
#include <AtomToolsFramework/DynamicProperty/DynamicProperty.h>
namespace MaterialEditor
{
class MaterialDocumentNotifications
: public AZ::EBusTraits
{
public:
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
//! Signal that a material document was created
//! @param documentId unique id of material document for which the notification is sent
virtual void OnDocumentCreated([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a material document was destroyed
//! @param documentId unique id of material document for which the notification is sent
virtual void OnDocumentDestroyed([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a material document was opened
//! @param documentId unique id of material document for which the notification is sent
virtual void OnDocumentOpened([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a material document was closed
//! @param documentId unique id of material document for which the notification is sent
virtual void OnDocumentClosed([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a material document was saved
//! @param documentId unique id of material document for which the notification is sent
virtual void OnDocumentSaved([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a material document was selected
//! @param documentId unique id of material document for which the notification is sent
virtual void OnDocumentSelected([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a material document was modified
//! @param documentId unique id of material document for which the notification is sent
virtual void OnDocumentModified([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a material document dependency was modified
//! @param documentId unique id of material document for which the notification is sent
virtual void OnDocumentDependencyModified([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a material document was modified externally
//! @param documentId unique id of material document for which the notification is sent
virtual void OnDocumentExternallyModified([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a material document undo state was updated
//! @param documentId unique id of material document for which the notification is sent
virtual void OnDocumentUndoStateChanged([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a material property changed
//! @param documentId unique id of material document for which the notification is sent
//! @param property object containing the property value and configuration that was modified
virtual void OnDocumentPropertyValueModified([[maybe_unused]] const AZ::Uuid& documentId, [[maybe_unused]] const AtomToolsFramework::DynamicProperty& property) {}
//! Signal that the property configuration has been changed.
//! @param documentId unique id of material document for which the notification is sent
//! @param property object containing the property value and configuration that was modified
virtual void OnDocumentPropertyConfigModified([[maybe_unused]] const AZ::Uuid& documentId, [[maybe_unused]] const AtomToolsFramework::DynamicProperty& property) {}
};
using MaterialDocumentNotificationBus = AZ::EBus<MaterialDocumentNotifications>;
} // namespace MaterialEditor
@@ -0,0 +1,124 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <Atom/RPI.Reflect/Material/MaterialAsset.h>
#include <Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h>
#include <Atom/RPI.Public/Material/Material.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/std/any.h>
#include <AtomToolsFramework/DynamicProperty/DynamicProperty.h>
namespace AZ
{
namespace RPI
{
class MaterialSourceData;
class MaterialTypeSourceData;
} // namespace RPI
} // namespace AZ
namespace MaterialEditor
{
//! UVs are processed in a property group but will be handled differently.
static constexpr const char UvGroupName[] = "UvNames";
class MaterialDocumentRequests
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
typedef AZ::Uuid BusIdType;
//! Get absolute path of material source file
virtual AZStd::string_view GetAbsolutePath() const = 0;
//! Get relative path of material source file
virtual AZStd::string_view GetRelativePath() const = 0;
//! Get material asset created by MaterialDocument
virtual AZ::Data::Asset<AZ::RPI::MaterialAsset> GetAsset() const = 0;
//! Get material instance created from asset loaded by MaterialDocument
virtual AZ::Data::Instance<AZ::RPI::Material> GetInstance() const = 0;
//! Get the internal material source data
virtual const AZ::RPI::MaterialSourceData* GetMaterialSourceData() const = 0;
//! Get the internal material type source data
virtual const AZ::RPI::MaterialTypeSourceData* GetMaterialTypeSourceData() const = 0;
//! Return property value
//! If the document is not open or the id can't be found, an invalid value is returned instead.
virtual const AZStd::any& GetPropertyValue(const AZ::Name& propertyFullName) const = 0;
//! Returns a property object
//! If the document is not open or the id can't be found, an invalid property is returned.
virtual const AtomToolsFramework::DynamicProperty& GetProperty(const AZ::Name& propertyFullName) const = 0;
//! Modify material property value
virtual void SetPropertyValue(const AZ::Name& propertyFullName, const AZStd::any& value) = 0;
//! Load source material and related data
//! @param loadPath Absolute path of material to load
virtual bool Open(AZStd::string_view loadPath) = 0;
//! Reload document preserving edits
virtual bool Rebuild() = 0;
//! Save material to source file
virtual bool Save() = 0;
//! Save material to a new source file
//! @param savePath Absolute path where material is saved
virtual bool SaveAsCopy(AZStd::string_view savePath) = 0;
//! Save material to a new source file as a child of the open material
//! @param savePath Absolute path where material is saved
virtual bool SaveAsChild(AZStd::string_view savePath) = 0;
//! Close material document and reset its data
virtual bool Close() = 0;
//! Material is loaded
virtual bool IsOpen() const = 0;
//! Material has changes pending
virtual bool IsModified() const = 0;
//! Can the document be saved
virtual bool IsSavable() const = 0;
//! Returns true if there are reversible modifications to the material document
virtual bool CanUndo() const = 0;
//! Returns true if there are changes that were reversed and can be re-applied to the material document
virtual bool CanRedo() const = 0;
//! Restores the previous state of the material document
virtual bool Undo() = 0;
//! Restores the next state of the material document
virtual bool Redo() = 0;
//! Signal that property editing is about to begin, like beginning to drag a slider control
virtual bool BeginEdit() = 0;
//! Signal that property editing has completed, like after releasing the mouse button after continuously dragging a slider control
virtual bool EndEdit() = 0;
};
using MaterialDocumentRequestBus = AZ::EBus<MaterialDocumentRequests>;
} // namespace MaterialEditor
@@ -0,0 +1,82 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/EBus/EBus.h>
namespace MaterialEditor
{
static const char* MaterialExtension = "material";
static const char* MaterialTypeExtension = "materialtype";
//! MaterialDocumentSystemRequestBus provides high level file requests for menus, scripts, etc.
class MaterialDocumentSystemRequests
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
//! Create a material document object
//! @return Uuid of new material document, or null Uuid if failed
virtual AZ::Uuid CreateDocument() = 0;
//! Destroy a material document object with the specified id
//! @return true if Uuid was found and removed, otherwise false
virtual bool DestroyDocument(const AZ::Uuid& documentId) = 0;
//! Open a material document for editing
//! @param sourcePath material document to open.
//! @return unique id of new material document if successful, otherwise null Uuid
virtual AZ::Uuid OpenDocument(AZStd::string_view sourcePath) = 0;
//! Create a new document by specifying a source and prompting the user for destination path.
//! If the source file is a material type then this results in creating a new material based on that type.
//! If the source file is a material this results in creating a child material with the source file as its parent.
//! @param sourcePath material document to open.
//! @param targetPath location where document is saved.
//! @return unique id of new material document if successful, otherwise null Uuid
virtual AZ::Uuid CreateDocumentFromFile(AZStd::string_view sourcePath, AZStd::string_view targetPath) = 0;
//! Close the specified material document
//! @param documentId unique id of material document to close
virtual bool CloseDocument(const AZ::Uuid& documentId) = 0;
//! Close all material documents
virtual bool CloseAllDocuments() = 0;
//! Close all material documents except for documentId
//! @param documentId unique id of material document to not close
virtual bool CloseAllDocumentsExcept(const AZ::Uuid& documentId) = 0;
//! Save the specified material document
//! @param documentId unique id of material document to save
virtual bool SaveDocument(const AZ::Uuid& documentId) = 0;
//! Save the specified material document to a different file
//! @param documentId unique id of material document to save
//! @param targetPath location where document is saved.
virtual bool SaveDocumentAsCopy(const AZ::Uuid& documentId, AZStd::string_view targetPath) = 0;
//! Save the specified material document to a different file, referencing the original material as its parent
//! @param documentId unique id of material document to save
//! @param targetPath location where document is saved.
virtual bool SaveDocumentAsChild(const AZ::Uuid& documentId, AZStd::string_view targetPath) = 0;
//! Save all material documents
virtual bool SaveAllDocuments() = 0;
};
using MaterialDocumentSystemRequestBus = AZ::EBus<MaterialDocumentSystemRequests>;
} // namespace MaterialEditor
@@ -0,0 +1,49 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/EBus/EBus.h>
#include <AzCore/std/any.h>
#include <AzCore/Outcome/Outcome.h>
namespace MaterialEditor
{
class MaterialEditorSettingsRequests
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
virtual AZ::Outcome<AZStd::any> GetProperty(AZStd::string_view name) const = 0;
virtual AZ::Outcome<AZStd::string> GetStringProperty(AZStd::string_view name) const = 0;
virtual AZ::Outcome<bool> GetBoolProperty(AZStd::string_view name) const = 0;
virtual void SetProperty(AZStd::string_view name, const AZStd::any& value) = 0;
virtual void SetStringProperty(AZStd::string_view name, AZStd::string_view stringValue) = 0;
virtual void SetBoolProperty(AZStd::string_view name, bool boolValue) = 0;
};
using MaterialEditorSettingsRequestBus = AZ::EBus<MaterialEditorSettingsRequests>;
class MaterialEditorSettingsNotifications
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
virtual void OnPropertyChanged(AZStd::string_view name, const AZStd::any& value) = 0;
};
using MaterialEditorSettingsNotificationBus = AZ::EBus<MaterialEditorSettingsNotifications>;
} // namespace MaterialEditor
@@ -0,0 +1,59 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#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;
//! 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;
};
using MaterialEditorViewportInputControllerRequestBus = AZ::EBus<MaterialEditorViewportInputControllerRequests>;
} // namespace MaterialEditor
@@ -0,0 +1,32 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#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,66 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/EBus/EBus.h>
#include <AzCore/std/smart_ptr/shared_ptr.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) {}
};
using MaterialViewportNotificationBus = AZ::EBus<MaterialViewportNotifications>;
} // namespace MaterialEditor
@@ -0,0 +1,114 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#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>
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 SaveLightingPresetSelection(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 name 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;
//! 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 SaveModelPresetSelection(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;
//! 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;
};
using MaterialViewportRequestBus = AZ::EBus<MaterialViewportRequests>;
} // namespace MaterialEditor
@@ -0,0 +1,29 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#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
@@ -0,0 +1,38 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/EBus/EBus.h>
#include <Atom/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
@@ -0,0 +1,35 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/EBus/EBus.h>
namespace MaterialEditor
{
//! MaterialEditorWindowFactoryRequestBus provides
class MaterialEditorWindowFactoryRequests
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
/// Creates and shows the MaterialEditorWindow
virtual void CreateMaterialEditorWindow() = 0;
//! Destroys material editor window and releases all cached assets
virtual void DestroyMaterialEditorWindow() = 0;
};
using MaterialEditorWindowFactoryRequestBus = AZ::EBus<MaterialEditorWindowFactoryRequests>;
} // namespace MaterialEditor
@@ -0,0 +1,32 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/Module/Module.h>
namespace MaterialEditor
{
//! Entry point for Material Editor Window library.
class MaterialEditorWindowModule
: public AZ::Module
{
public:
AZ_RTTI(MaterialEditorWindowModule, "{57D6239C-AE03-4ED8-9125-35C5B1625503}", AZ::Module);
AZ_CLASS_ALLOCATOR(MaterialEditorWindowModule, AZ::SystemAllocator, 0);
MaterialEditorWindowModule();
//! Add required SystemComponents to the SystemEntity.
AZ::ComponentTypeList GetRequiredSystemComponents() const override;
};
}
@@ -0,0 +1,30 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/EBus/EBus.h>
namespace MaterialEditor
{
class MaterialEditorWindowNotifications
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
virtual void OnMaterialEditorWindowClosing() {};
};
using MaterialEditorWindowNotificationBus = AZ::EBus<MaterialEditorWindowNotifications>;
} // namespace MaterialEditor
@@ -0,0 +1,65 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/EBus/EBus.h>
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/string/string.h>
class QWidget;
namespace MaterialEditor
{
//! MaterialEditorWindowRequestBus provides
class MaterialEditorWindowRequests
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
//! Add dockable widget in main window
//! @param name title of the dockable window
//! @param widget docked window content
//! @param area location of docked window corresponding to Qt::DockWidgetArea
//! @param orientation orientation of docked window corresponding to Qt::Orientation
virtual bool AddDockWidget(const AZStd::string& name, QWidget* widget, uint32_t area, uint32_t orientation) = 0;
//! Destroy dockable widget in main window
//! @param name title of the dockable window
virtual void RemoveDockWidget(const AZStd::string& name) = 0;
//! Show or hide dockable widget in main window
//! @param name title of the dockable window
virtual void SetDockWidgetVisible(const AZStd::string& name, bool visible) = 0;
//! Determine visibility of dockable widget in main window
//! @param name title of the dockable window
virtual bool IsDockWidgetVisible(const AZStd::string& name) const = 0;
//! Get a list of registered docked widget names
virtual AZStd::vector<AZStd::string> GetDockWidgetNames() const = 0;
//! Resizes the Material Editor window to achieve a requested size for the viewport render target.
//! (This indicates the size of the render target, not the desktop-scaled QT widget size).
virtual void ResizeViewportRenderTarget(uint32_t width, uint32_t height) = 0;
//! Forces the viewport's render target to use the given resolution, ignoring the size of the viewport widget.
virtual void LockViewportRenderTargetSize(uint32_t width, uint32_t height) = 0;
//! Releases the viewport's render target resolution lock, allowing it to match the viewport widget again.
virtual void UnlockViewportRenderTargetSize() = 0;
};
using MaterialEditorWindowRequestBus = AZ::EBus<MaterialEditorWindowRequests>;
} // namespace MaterialEditor