Using GetBuildTargetName() and other fixes
Signed-off-by: Dayo Lawal <lawalfua@amazon.com>
This commit is contained in:
+2
-5
@@ -11,11 +11,9 @@
|
||||
#include <AtomToolsFramework/Communication/LocalSocket.h>
|
||||
#include <AzCore/Component/Entity.h>
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
#include <AzCore/Debug/TraceMessageBus.h>
|
||||
#include <AzCore/UserSettings/UserSettingsProvider.h>
|
||||
#include <AzFramework/Application/Application.h>
|
||||
#include <AzFramework/Asset/AssetSystemBus.h>
|
||||
#include <AzFramework/Logging/LogFile.h>
|
||||
#include <AzQtComponents/Application/AzQtApplication.h>
|
||||
#include <AzToolsFramework/API/AssetDatabaseBus.h>
|
||||
#include <AzToolsFramework/API/EditorPythonConsoleBus.h>
|
||||
@@ -81,7 +79,7 @@ namespace AtomToolsFramework
|
||||
void OnExceptionMessage(AZStd::string_view message) override;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual AZStd::string_view GetBuildTargetName() {return targetName;};
|
||||
virtual AZStd::string_view GetBuildTargetName() {return m_targetName;};
|
||||
|
||||
virtual void LoadSettings();
|
||||
virtual void UnloadSettings();
|
||||
@@ -91,9 +89,8 @@ namespace AtomToolsFramework
|
||||
virtual void StartInternal();
|
||||
|
||||
static void PyIdleWaitFrames(uint32_t frames);
|
||||
void setTargetName(AZStd::string newTargetName);
|
||||
|
||||
AZStd::string targetName = "AtomTools";
|
||||
AZStd::string m_targetName = "AtomTools";
|
||||
|
||||
AzToolsFramework::TraceLogger m_traceLogger;
|
||||
|
||||
|
||||
+14
-19
@@ -119,7 +119,7 @@ namespace AtomToolsFramework
|
||||
|
||||
void AtomToolsApplication::CreateStaticModules(AZStd::vector<AZ::Module*>& outModules)
|
||||
{
|
||||
Application::CreateStaticModules(outModules);
|
||||
Base::CreateStaticModules(outModules);
|
||||
outModules.push_back(aznew AzToolsFramework::AzToolsFrameworkModule);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace AtomToolsFramework
|
||||
AzFramework::AssetSystemStatusBus::Handler::BusConnect();
|
||||
AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusConnect();
|
||||
|
||||
AzFramework::Application::StartCommon(systemEntity);
|
||||
Base::StartCommon(systemEntity);
|
||||
|
||||
StartInternal();
|
||||
|
||||
@@ -141,12 +141,12 @@ namespace AtomToolsFramework
|
||||
AzToolsFramework::AssetDatabase::AssetDatabaseRequestsBus::Handler::BusDisconnect();
|
||||
|
||||
AzFramework::AssetSystemRequestBus::Broadcast(&AzFramework::AssetSystem::AssetSystemRequests::StartDisconnectingAssetProcessor);
|
||||
Application::Destroy();
|
||||
Base::Destroy();
|
||||
}
|
||||
|
||||
void AtomToolsApplication::CompileCriticalAssets(const AZStd::vector<AZStd::string> &assetFiltersArray)
|
||||
{
|
||||
AZ_TracePrintf(targetName.c_str(), "Compiling critical assets.\n");
|
||||
AZ_TracePrintf(m_targetName.c_str(), "Compiling critical assets.\n");
|
||||
|
||||
QStringList failedAssets;
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace AtomToolsFramework
|
||||
// So the asset id won't be found right after CompileAssetSync call.
|
||||
for (const AZStd::string& assetFilters : assetFiltersArray)
|
||||
{
|
||||
AZ_TracePrintf("AtomTools", "Compiling critical asset matching: %s.\n", assetFilters.c_str());
|
||||
AZ_TracePrintf(m_targetName.c_str(), "Compiling critical asset matching: %s.\n", assetFilters.c_str());
|
||||
|
||||
// Wait for the asset be compiled
|
||||
AzFramework::AssetSystem::AssetStatus status = AzFramework::AssetSystem::AssetStatus_Unknown;
|
||||
@@ -187,7 +187,7 @@ namespace AtomToolsFramework
|
||||
AZ_Assert(context, "No serialize context");
|
||||
|
||||
char resolvedPath[AZ_MAX_PATH_LEN] = "";
|
||||
AZStd::string fileName = "@user@/" + targetName + "UserSettings.xml";
|
||||
AZStd::string fileName = "@user@/" + m_targetName + "UserSettings.xml";
|
||||
|
||||
AZ::IO::FileIOBase::GetInstance()->ResolvePath(
|
||||
fileName.c_str(), resolvedPath, AZ_ARRAY_SIZE(resolvedPath));
|
||||
@@ -202,7 +202,7 @@ namespace AtomToolsFramework
|
||||
AZ_Assert(context, "No serialize context");
|
||||
|
||||
char resolvedPath[AZ_MAX_PATH_LEN] = "";
|
||||
AZStd::string fileName = "@user@/" + targetName + "UserSettings.xml";
|
||||
AZStd::string fileName = "@user@/" + m_targetName + "UserSettings.xml";
|
||||
|
||||
AZ::IO::FileIOBase::GetInstance()->ResolvePath(fileName.c_str(), resolvedPath, AZ_MAX_PATH_LEN);
|
||||
|
||||
@@ -230,12 +230,12 @@ namespace AtomToolsFramework
|
||||
{
|
||||
const AZStd::string& timeoutValue = commandLine.GetSwitchValue(timeoputSwitchName, 0);
|
||||
const uint32_t timeoutInMs = atoi(timeoutValue.c_str());
|
||||
AZ_Printf(targetName.c_str(), "Timeout scheduled, shutting down in %u ms", timeoutInMs);
|
||||
AZ_Printf(m_targetName.c_str(), "Timeout scheduled, shutting down in %u ms", timeoutInMs);
|
||||
QTimer::singleShot(
|
||||
timeoutInMs,
|
||||
[this]
|
||||
{
|
||||
AZ_Printf(targetName.c_str(), "Timeout reached, shutting down");
|
||||
AZ_Printf(m_targetName.c_str(), "Timeout reached, shutting down");
|
||||
ExitMainLoop();
|
||||
});
|
||||
}
|
||||
@@ -248,7 +248,7 @@ namespace AtomToolsFramework
|
||||
const AZStd::string runPythonScriptPath = commandLine.GetSwitchValue(runPythonScriptSwitchName, runPythonScriptIndex);
|
||||
AZStd::vector<AZStd::string_view> runPythonArgs;
|
||||
|
||||
AZ_Printf(targetName.c_str(), "Launching script: %s", runPythonScriptPath.c_str());
|
||||
AZ_Printf(m_targetName.c_str(), "Launching script: %s", runPythonScriptPath.c_str());
|
||||
AzToolsFramework::EditorPythonRunnerRequestBus::Broadcast(
|
||||
&AzToolsFramework::EditorPythonRunnerRequestBus::Events::ExecuteByFilenameWithArgs, runPythonScriptPath, runPythonArgs);
|
||||
}
|
||||
@@ -323,7 +323,7 @@ namespace AtomToolsFramework
|
||||
return;
|
||||
}
|
||||
|
||||
AZStd::string fileName = targetName + ".log";
|
||||
AZStd::string fileName = m_targetName + ".log";
|
||||
|
||||
m_traceLogger.WriteStartupLog(fileName.c_str());
|
||||
|
||||
@@ -374,7 +374,7 @@ namespace AtomToolsFramework
|
||||
void AtomToolsApplication::Stop()
|
||||
{
|
||||
UnloadSettings();
|
||||
AzFramework::Application::Stop();
|
||||
Base::Stop();
|
||||
}
|
||||
|
||||
void AtomToolsApplication::QueryApplicationType(AZ::ApplicationTypeQuery& appType) const
|
||||
@@ -394,7 +394,7 @@ namespace AtomToolsFramework
|
||||
|
||||
for (auto& line : lines)
|
||||
{
|
||||
AZ_TracePrintf(targetName.c_str(), "Python: %s\n", line.c_str());
|
||||
AZ_TracePrintf(m_targetName.c_str(), "Python: %s\n", line.c_str());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -407,7 +407,7 @@ namespace AtomToolsFramework
|
||||
|
||||
void AtomToolsApplication::OnExceptionMessage([[maybe_unused]] AZStd::string_view message)
|
||||
{
|
||||
AZ_Error(targetName.c_str(), false, "Python: " AZ_STRING_FORMAT, AZ_STRING_ARG(message));
|
||||
AZ_Error(m_targetName.c_str(), false, "Python: " AZ_STRING_FORMAT, AZ_STRING_ARG(message));
|
||||
}
|
||||
|
||||
// Copied from PyIdleWaitFrames in CryEdit.cpp
|
||||
@@ -444,9 +444,4 @@ namespace AtomToolsFramework
|
||||
Ticker ticker(&loop, frames);
|
||||
loop.exec();
|
||||
}
|
||||
|
||||
void AtomToolsApplication::setTargetName(AZStd::string newTargetName)
|
||||
{
|
||||
targetName = newTargetName;
|
||||
}
|
||||
} // namespace AtomToolsFramework
|
||||
|
||||
@@ -51,7 +51,7 @@ AZ_POP_DISABLE_WARNING
|
||||
namespace MaterialEditor
|
||||
{
|
||||
//! This function returns the build system target name of "MaterialEditor
|
||||
AZStd::string_view GetBuildTargetName()
|
||||
AZStd::string_view MaterialEditorApplication::GetBuildTargetName()
|
||||
{
|
||||
#if !defined (LY_CMAKE_TARGET)
|
||||
#error "LY_CMAKE_TARGET must be defined in order to add this source file to a CMake executable target"
|
||||
@@ -75,7 +75,7 @@ namespace MaterialEditor
|
||||
|
||||
{
|
||||
QApplication::setApplicationName("O3DE Material Editor");
|
||||
setTargetName("MaterialEditor");
|
||||
m_targetName = GetBuildTargetName();
|
||||
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddBuildSystemTargetSpecialization(
|
||||
*AZ::SettingsRegistry::Get(), GetBuildTargetName());
|
||||
@@ -139,7 +139,7 @@ namespace MaterialEditor
|
||||
AzFramework::AssetSystem::ConnectionSettings connectionSettings;
|
||||
AzFramework::AssetSystem::ReadConnectionSettingsFromSettingsRegistry(connectionSettings);
|
||||
connectionSettings.m_connectionDirection = AzFramework::AssetSystem::ConnectionSettings::ConnectionDirection::ConnectToAssetProcessor;
|
||||
connectionSettings.m_connectionIdentifier = targetName.c_str();
|
||||
connectionSettings.m_connectionIdentifier = GetBuildTargetName();
|
||||
connectionSettings.m_loggingCallback = []([[maybe_unused]] AZStd::string_view logData)
|
||||
{
|
||||
AZ_TracePrintf("Material Editor", "%.*s", aznumeric_cast<int>(logData.size()), logData.data());
|
||||
@@ -147,12 +147,12 @@ namespace MaterialEditor
|
||||
AzFramework::AssetSystemRequestBus::BroadcastResult(connectedToAssetProcessor,
|
||||
&AzFramework::AssetSystemRequestBus::Events::EstablishAssetProcessorConnection, connectionSettings);
|
||||
|
||||
// List of common asset filters for things that need to be compiled to run the material editor
|
||||
// Some of these things will not be necessary once we have proper support for queued asset loading and reloading
|
||||
const AZStd::vector<AZStd::string> assetFiltersArray = { "passes/", "config/", "MaterialEditor/" };
|
||||
|
||||
if (connectedToAssetProcessor)
|
||||
{
|
||||
// List of common asset filters for things that need to be compiled to run the material editor
|
||||
// Some of these things will not be necessary once we have proper support for queued asset loading and reloading
|
||||
const AZStd::vector<AZStd::string> assetFiltersArray = { "passes/", "config/", "MaterialEditor/" };
|
||||
|
||||
CompileCriticalAssets(assetFiltersArray);
|
||||
}
|
||||
|
||||
@@ -168,33 +168,6 @@ namespace MaterialEditor
|
||||
&MaterialEditor::MaterialEditorWindowRequestBus::Handler::ActivateWindow);
|
||||
}
|
||||
|
||||
const AZStd::string timeoputSwitchName = "timeout";
|
||||
if (commandLine.HasSwitch(timeoputSwitchName))
|
||||
{
|
||||
const AZStd::string& timeoutValue = commandLine.GetSwitchValue(timeoputSwitchName, 0);
|
||||
const uint32_t timeoutInMs = atoi(timeoutValue.c_str());
|
||||
AZ_Printf("MaterialEditor", "Timeout scheduled, shutting down in %u ms", timeoutInMs);
|
||||
QTimer::singleShot(timeoutInMs, [this] {
|
||||
AZ_Printf("MaterialEditor", "Timeout reached, shutting down");
|
||||
ExitMainLoop();
|
||||
});
|
||||
}
|
||||
|
||||
// Process command line options for running one or more python scripts on startup
|
||||
const AZStd::string runPythonScriptSwitchName = "runpython";
|
||||
size_t runPythonScriptCount = commandLine.GetNumSwitchValues(runPythonScriptSwitchName);
|
||||
for (size_t runPythonScriptIndex = 0; runPythonScriptIndex < runPythonScriptCount; ++runPythonScriptIndex)
|
||||
{
|
||||
const AZStd::string runPythonScriptPath = commandLine.GetSwitchValue(runPythonScriptSwitchName, runPythonScriptIndex);
|
||||
AZStd::vector<AZStd::string_view> runPythonArgs;
|
||||
|
||||
AZ_Printf("MaterialEditor", "Launching script: %s", runPythonScriptPath.c_str());
|
||||
AzToolsFramework::EditorPythonRunnerRequestBus::Broadcast(
|
||||
&AzToolsFramework::EditorPythonRunnerRequestBus::Events::ExecuteByFilenameWithArgs,
|
||||
runPythonScriptPath,
|
||||
runPythonArgs);
|
||||
}
|
||||
|
||||
// Process command line options for opening one or more material documents on startup
|
||||
size_t openDocumentCount = commandLine.GetNumMiscValues();
|
||||
for (size_t openDocumentIndex = 0; openDocumentIndex < openDocumentCount; ++openDocumentIndex)
|
||||
@@ -205,11 +178,7 @@ namespace MaterialEditor
|
||||
MaterialDocumentSystemRequestBus::Broadcast(&MaterialDocumentSystemRequestBus::Events::OpenDocument, openDocumentPath);
|
||||
}
|
||||
|
||||
const AZStd::string exitAfterCommandsSwitchName = "exitaftercommands";
|
||||
if (commandLine.HasSwitch(exitAfterCommandsSwitchName))
|
||||
{
|
||||
ExitMainLoop();
|
||||
}
|
||||
Base::ProcessCommandLine(commandLine);
|
||||
}
|
||||
|
||||
void MaterialEditorApplication::StartInternal()
|
||||
|
||||
@@ -54,5 +54,6 @@ namespace MaterialEditor
|
||||
|
||||
void ProcessCommandLine(const AZ::CommandLine& commandLine) override;
|
||||
void StartInternal() override;
|
||||
AZStd::string_view GetBuildTargetName() override;
|
||||
};
|
||||
} // namespace MaterialEditor
|
||||
|
||||
+6
-17
@@ -47,7 +47,7 @@ AZ_POP_DISABLE_WARNING
|
||||
|
||||
namespace ShaderManagementConsole
|
||||
{
|
||||
AZStd::string_view GetBuildTargetName()
|
||||
AZStd::string_view ShaderManagementConsoleApplication::GetBuildTargetName()
|
||||
{
|
||||
#if !defined (LY_CMAKE_TARGET)
|
||||
#error "LY_CMAKE_TARGET must be defined in order to add this source file to a CMake executable target"
|
||||
@@ -70,7 +70,7 @@ namespace ShaderManagementConsole
|
||||
: AtomToolsApplication(argc, argv)
|
||||
{
|
||||
QApplication::setApplicationName("O3DE Shader Management Console");
|
||||
setTargetName("ShaderManagementConsole");
|
||||
m_targetName = GetBuildTargetName();
|
||||
|
||||
// The settings registry has been created at this point, so add the CMake target
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddBuildSystemTargetSpecialization(
|
||||
@@ -125,29 +125,18 @@ namespace ShaderManagementConsole
|
||||
};
|
||||
AzFramework::AssetSystemRequestBus::Broadcast(ConnectToAssetProcessorWithIdentifier);
|
||||
|
||||
// List of common asset filters for things that need to be compiled to run the material editor
|
||||
// Some of these things will not be necessary once we have proper support for queued asset loading and reloading
|
||||
const AZStd::vector<AZStd::string> assetFiltersArray = { "passes/", "config/"};
|
||||
|
||||
if (connected)
|
||||
{
|
||||
// List of common asset filters for things that need to be compiled to run the material editor
|
||||
// Some of these things will not be necessary once we have proper support for queued asset loading and reloading
|
||||
const AZStd::vector<AZStd::string> assetFiltersArray = { "passes/", "config/" };
|
||||
|
||||
CompileCriticalAssets(assetFiltersArray);
|
||||
}
|
||||
|
||||
AzFramework::AssetSystemStatusBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
// bool ShaderManagementConsoleApplication::OnPrintf(const char* window, const char* /*message*/)
|
||||
// {
|
||||
// // Suppress spam from the Source Control system
|
||||
// if (0 == strncmp(window, AzToolsFramework::SCC_WINDOW, AZ_ARRAY_SIZE(AzToolsFramework::SCC_WINDOW)))
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
|
||||
void ShaderManagementConsoleApplication::ProcessCommandLine()
|
||||
{
|
||||
// Process command line options for running one or more python scripts on startup
|
||||
|
||||
+1
@@ -55,5 +55,6 @@ namespace ShaderManagementConsole
|
||||
|
||||
void ProcessCommandLine();
|
||||
void StartInternal() override;
|
||||
AZStd::string_view GetBuildTargetName() override;
|
||||
};
|
||||
} // namespace ShaderManagementConsole
|
||||
|
||||
Reference in New Issue
Block a user