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,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 ShaderManagementConsole
{
//! Entry point for Shader Management Console Document library.
class ShaderManagementConsoleDocumentModule
: public AZ::Module
{
public:
AZ_RTTI(ShaderManagementConsoleDocumentModule, "{81D7A170-9284-4DE9-8D92-B6B94E8A2BDF}", AZ::Module);
AZ_CLASS_ALLOCATOR(ShaderManagementConsoleDocumentModule, AZ::SystemAllocator, 0);
ShaderManagementConsoleDocumentModule();
//! Add required SystemComponents to the SystemEntity.
AZ::ComponentTypeList GetRequiredSystemComponents() const override;
};
}
@@ -0,0 +1,60 @@
/*
* 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/Asset/AssetCommon.h>
#include <AzCore/std/any.h>
namespace ShaderManagementConsole
{
class ShaderManagementConsoleDocumentNotifications
: public AZ::EBusTraits
{
public:
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
//! Signal that a document was created
//! @param documentId unique id of document for which the notification is sent
virtual void OnDocumentCreated([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a document was destroyed
//! @param documentId unique id of document for which the notification is sent
virtual void OnDocumentDestroyed([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a document was opened
//! @param documentId unique id of document for which the notification is sent
virtual void OnDocumentOpened([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a document was closed
//! @param documentId unique id of document for which the notification is sent
virtual void OnDocumentClosed([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a document was saved
//! @param documentId unique id of document for which the notification is sent
virtual void OnDocumentSaved([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a document was selected
//! @param documentId unique id of document for which the notification is sent
virtual void OnDocumentSelected([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a document was modified
//! @param documentId unique id of document for which the notification is sent
virtual void OnDocumentModified([[maybe_unused]] const AZ::Uuid& documentId) {}
//! Signal that a document undo state was updated
//! @param documentId unique id of document for which the notification is sent
virtual void OnDocumentUndoStateChanged([[maybe_unused]] const AZ::Uuid& documentId) {}
};
using ShaderManagementConsoleDocumentNotificationBus = AZ::EBus<ShaderManagementConsoleDocumentNotifications>;
} // namespace ShaderManagementConsole
@@ -0,0 +1,95 @@
/*
* 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/Asset/AssetCommon.h>
#include <AzCore/Outcome/Outcome.h>
#include <AzCore/std/any.h>
#include <AzCore/std/string/string_view.h>
#include <Atom/RPI.Edit/Shader/ShaderSourceData.h>
#include <Atom/RPI.Edit/Shader/ShaderVariantListSourceData.h>
namespace ShaderManagementConsole
{
using ShaderManagementConsoleDocumentResult = AZ::Outcome<AZStd::string, AZStd::string>;
class ShaderManagementConsoleDocumentRequests
: 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 document
virtual AZStd::string_view GetAbsolutePath() const = 0;
//! Get relative path of document
virtual AZStd::string_view GetRelativePath() const = 0;
//! Get the number of options
virtual size_t GetShaderOptionCount() const = 0;
//! Get the descriptor for the shader option at the specified index
virtual const AZ::RPI::ShaderOptionDescriptor& GetShaderOptionDescriptor(size_t index) const = 0;
//! Get the number of shader variants
virtual size_t GetShaderVariantCount() const = 0;
//! Get the information for the shader variant at the specified index
virtual const AZ::RPI::ShaderVariantListSourceData::VariantInfo& GetShaderVariantInfo(size_t index) const = 0;
//! Load document and related data
//! @param loadPath Absolute path of document to load
virtual ShaderManagementConsoleDocumentResult Open(AZStd::string_view loadPath) = 0;
//! Save document to file
virtual ShaderManagementConsoleDocumentResult Save() = 0;
//! Save document copy
//! @param savePath Absolute path where document is saved
virtual ShaderManagementConsoleDocumentResult SaveAsCopy(AZStd::string_view savePath) = 0;
//! Close document and reset its data
virtual ShaderManagementConsoleDocumentResult Close() = 0;
//! document is loaded
virtual bool IsOpen() const = 0;
//! document 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 document
virtual bool CanUndo() const = 0;
//! Returns true if there are changes that were reversed and can be re-applied to the document
virtual bool CanRedo() const = 0;
//! Restores the previous state of the document
virtual bool Undo() = 0;
//! Restores the next state of the document
virtual bool Redo() = 0;
//! Signal that editing is about to begin, like beginning to drag a slider control
virtual bool BeginEdit() = 0;
//! Signal that editing has completed, like after releasing the mouse button after continuously dragging a slider control
virtual bool EndEdit() = 0;
};
using ShaderManagementConsoleDocumentRequestBus = AZ::EBus<ShaderManagementConsoleDocumentRequests>;
} // namespace ShaderManagementConsole
@@ -0,0 +1,61 @@
/*
* 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 ShaderManagementConsole
{
//! ShaderManagementConsoleDocumentSystemRequestBus provides high level file requests for menus, scripts, etc.
class ShaderManagementConsoleDocumentSystemRequests
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
//! Create a document object
//! @return Uuid of new document, or null Uuid if failed
virtual AZ::Uuid CreateDocument() = 0;
//! Destroy a 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 document for editing
//! @param path document to edit.
//! @return unique id of new document if successful, otherwise null Uuid
virtual AZ::Uuid OpenDocument(AZStd::string_view path) = 0;
//! Close the specified document
//! @param documentId unique id of document to close
virtual bool CloseDocument(const AZ::Uuid& documentId) = 0;
//! Close all documents
virtual bool CloseAllDocuments() = 0;
//! Save the specified document
//! @param documentId unique id of document to save
virtual bool SaveDocument(const AZ::Uuid& documentId) = 0;
//! Save the specified document to a different file
//! @param documentId unique id of document to save
virtual bool SaveDocumentAsCopy(const AZ::Uuid& documentId) = 0;
//! Save all documents
virtual bool SaveAllDocuments() = 0;
};
using ShaderManagementConsoleDocumentSystemRequestBus = AZ::EBus<ShaderManagementConsoleDocumentSystemRequests>;
} // namespace ShaderManagementConsole
@@ -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 ShaderManagementConsole
{
//! Entry point for Shader Management Console Window library.
class ShaderManagementConsoleWindowModule
: public AZ::Module
{
public:
AZ_RTTI(ShaderManagementConsoleWindowModule, "{57D6239C-AE03-4ED8-9125-35C5B1625503}", AZ::Module);
AZ_CLASS_ALLOCATOR(ShaderManagementConsoleWindowModule, AZ::SystemAllocator, 0);
ShaderManagementConsoleWindowModule();
//! 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 ShaderManagementConsole
{
class ShaderManagementConsoleWindowNotifications
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
virtual void OnShaderManagementConsoleWindowClosing() {};
};
using ShaderManagementConsoleWindowNotificationBus = AZ::EBus<ShaderManagementConsoleWindowNotifications>;
} // namespace ShaderManagementConsole
@@ -0,0 +1,39 @@
/*
* 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/std/containers/vector.h>
#include <AzCore/EBus/EBus.h>
#include <AzCore/Asset/AssetCommon.h>
namespace ShaderManagementConsole
{
//! ShaderManagementConsoleWindowRequestBus provides
class ShaderManagementConsoleWindowRequests
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
/// Creates and shows main window
virtual void CreateShaderManagementConsoleWindow() = 0;
//! Destroys main window
virtual void DestroyShaderManagementConsoleWindow() = 0;
virtual void GenerateShaderVariantListForShaderMaterials(const char* shaderFileName) = 0;
};
using ShaderManagementConsoleWindowRequestBus = AZ::EBus<ShaderManagementConsoleWindowRequests>;
} // namespace ShaderManagementConsole