Files
o3de/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Document/ShaderManagementConsoleDocument.h
T
Guthrie Adams 3977edb21e Atom Tools: Removing unnecessary modules, components, and dead code from SMC
Looking toward creating a bare bones template for a standalone application, simplifying and removing any boilerplate wherever possible. SMC followed patterns established by material editor, subdividing everything into multiple modules, which required manually adding static modules, implementing system components with little to no functionality, and a bunch of unnecessary files for such a simple application. This change deletes unnecessary boilerplate code, moving everything into a single module, making the application class responsible for reflecting classes and buses.

Signed-off-by: Guthrie Adams <guthadam@amazon.com>
2022-01-20 16:05:08 -06:00

69 lines
2.9 KiB
C++

/*
* 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 <Atom/RPI.Edit/Shader/ShaderVariantListSourceData.h>
#include <Atom/RPI.Reflect/Shader/ShaderAsset.h>
#include <AtomToolsFramework/Document/AtomToolsDocument.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/RTTI/RTTI.h>
#include <Document/ShaderManagementConsoleDocumentRequestBus.h>
namespace ShaderManagementConsole
{
/**
* ShaderManagementConsoleDocument provides an API for modifying and saving document properties.
*/
class ShaderManagementConsoleDocument
: public AtomToolsFramework::AtomToolsDocument
, public ShaderManagementConsoleDocumentRequestBus::Handler
{
public:
AZ_RTTI(ShaderManagementConsoleDocument, "{DBA269AE-892B-415C-8FA1-166B94B0E045}");
AZ_CLASS_ALLOCATOR(ShaderManagementConsoleDocument, AZ::SystemAllocator, 0);
AZ_DISABLE_COPY(ShaderManagementConsoleDocument);
ShaderManagementConsoleDocument();
virtual ~ShaderManagementConsoleDocument();
////////////////////////////////////////////////////////////////////////
// AtomToolsFramework::AtomToolsDocument
////////////////////////////////////////////////////////////////////////
bool Open(AZStd::string_view loadPath) override;
bool Close() override;
bool IsOpen() const override;
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// ShaderManagementConsoleDocumentRequestBus::Handler implementation
size_t GetShaderOptionCount() const override;
const AZ::RPI::ShaderOptionDescriptor& GetShaderOptionDescriptor(size_t index) const override;
size_t GetShaderVariantCount() const override;
const AZ::RPI::ShaderVariantListSourceData::VariantInfo& GetShaderVariantInfo(size_t index) const override;
////////////////////////////////////////////////////////////////////////
private:
// Function to be bound for undo and redo
using UndoRedoFunction = AZStd::function<void()>;
// A pair of functions, where first is the undo operation and second is the redo operation
using UndoRedoFunctionPair = AZStd::pair<UndoRedoFunction, UndoRedoFunction>;
// Container for all of the active undo and redo functions and state
using UndoRedoHistory = AZStd::vector<UndoRedoFunctionPair>;
void Clear();
// Source data for shader variant list
AZ::RPI::ShaderVariantListSourceData m_shaderVariantListSourceData;
// Shader asset for the corresponding shader variant list
AZ::Data::Asset<AZ::RPI::ShaderAsset> m_shaderAsset;
};
} // namespace ShaderManagementConsole