30fee96c43
Renamed document related buses and components to have generic names Added a base document class with default implementation from which other application specific documents can be derived to work with the document system Added document factory function registration to the document system request bus so that each application can specify the type of document it creates Updated all comments and messaging to only refer to documents, not materials or material documents Updated material editor and shader management console to conform to the new buses This will provide a first pass of a common interface for a document management system that can be shared by multiple applications Corrected status bar message copy and paste errors Updated all test scripts to use the new buses Signed-off-by: Guthrie Adams <guthadam@amazon.com>
76 lines
3.1 KiB
C++
76 lines
3.1 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
|
|
*
|
|
*/
|
|
|
|
#include <Atom/Document/ShaderManagementConsoleDocumentModule.h>
|
|
#include <Atom/Window/ShaderManagementConsoleWindowModule.h>
|
|
#include <AtomToolsFramework/Document/AtomToolsDocumentSystemRequestBus.h>
|
|
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
|
#include <ShaderManagementConsoleApplication.h>
|
|
#include <ShaderManagementConsole_Traits_Platform.h>
|
|
|
|
namespace ShaderManagementConsole
|
|
{
|
|
//! This function returns the build system target name of "ShaderManagementConsole"
|
|
AZStd::string ShaderManagementConsoleApplication::GetBuildTargetName() const
|
|
{
|
|
#if !defined(LY_CMAKE_TARGET)
|
|
#error "LY_CMAKE_TARGET must be defined in order to add this source file to a CMake executable target"
|
|
#endif
|
|
return AZStd::string_view{ LY_CMAKE_TARGET };
|
|
}
|
|
|
|
const char* ShaderManagementConsoleApplication::GetCurrentConfigurationName() const
|
|
{
|
|
#if defined(_RELEASE)
|
|
return "ReleaseShaderManagementConsole";
|
|
#elif defined(_DEBUG)
|
|
return "DebugShaderManagementConsole";
|
|
#else
|
|
return "ProfileShaderManagementConsole";
|
|
#endif
|
|
}
|
|
|
|
ShaderManagementConsoleApplication::ShaderManagementConsoleApplication(int* argc, char*** argv)
|
|
: AtomToolsApplication(argc, argv)
|
|
{
|
|
QApplication::setApplicationName("O3DE Shader Management Console");
|
|
|
|
// The settings registry has been created at this point, so add the CMake target
|
|
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddBuildSystemTargetSpecialization(
|
|
*AZ::SettingsRegistry::Get(), GetBuildTargetName());
|
|
}
|
|
|
|
void ShaderManagementConsoleApplication::CreateStaticModules(AZStd::vector<AZ::Module*>& outModules)
|
|
{
|
|
Base::CreateStaticModules(outModules);
|
|
outModules.push_back(aznew ShaderManagementConsoleDocumentModule);
|
|
outModules.push_back(aznew ShaderManagementConsoleWindowModule);
|
|
}
|
|
|
|
AZStd::vector<AZStd::string> ShaderManagementConsoleApplication::GetCriticalAssetFilters() const
|
|
{
|
|
return AZStd::vector<AZStd::string>({ "passes/", "config/" });
|
|
}
|
|
|
|
void ShaderManagementConsoleApplication::ProcessCommandLine(const AZ::CommandLine& commandLine)
|
|
{
|
|
// Process command line options for opening one or more documents on startup
|
|
size_t openDocumentCount = commandLine.GetNumMiscValues();
|
|
for (size_t openDocumentIndex = 0; openDocumentIndex < openDocumentCount; ++openDocumentIndex)
|
|
{
|
|
const AZStd::string openDocumentPath = commandLine.GetMiscValue(openDocumentIndex);
|
|
|
|
AZ_Printf(GetBuildTargetName().c_str(), "Opening document: %s", openDocumentPath.c_str());
|
|
AtomToolsFramework::AtomToolsDocumentSystemRequestBus::Broadcast(
|
|
&AtomToolsFramework::AtomToolsDocumentSystemRequestBus::Events::OpenDocument, openDocumentPath);
|
|
}
|
|
|
|
Base::ProcessCommandLine(commandLine);
|
|
}
|
|
} // namespace ShaderManagementConsole
|