ATOM-15451 always bring material editor and foreground when launching

Bus, command line option, and handler to activate material editor window
Made sure that material editor action in Ly tools menu is not checked/checkable
Ly editor pushes command line option to use the same RHI

https://jira.agscollab.com/browse/LYN-2610
https://jira.agscollab.com/browse/ATOM-15451
https://jira.agscollab.com/browse/ATOM-13742
This commit is contained in:
guthadam
2021-05-04 01:27:12 -05:00
parent edf8ab4822
commit 80f692118b
6 changed files with 40 additions and 1 deletions
@@ -45,6 +45,7 @@
#include <Atom/Window/MaterialEditorWindowModule.h>
#include <Atom/Window/MaterialEditorWindowFactoryRequestBus.h>
#include <Atom/Window/MaterialEditorWindowRequestBus.h>
#include <AzCore/Utils/Utils.h>
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT
@@ -309,6 +310,13 @@ namespace MaterialEditor
void MaterialEditorApplication::ProcessCommandLine(const AZ::CommandLine& commandLine)
{
const AZStd::string activateWindowSwitchName = "activatewindow";
if (commandLine.HasSwitch(activateWindowSwitchName))
{
MaterialEditor::MaterialEditorWindowRequestBus::Broadcast(
&MaterialEditor::MaterialEditorWindowRequestBus::Handler::ActivateWindow);
}
const AZStd::string timeoputSwitchName = "timeout";
if (commandLine.HasSwitch(timeoputSwitchName))
{
@@ -438,6 +446,10 @@ namespace MaterialEditor
// Handle commmand line params from connected socket
if (buffer.startsWith("ProcessCommandLine:"))
{
// Bring the material editor to the foreground
MaterialEditor::MaterialEditorWindowRequestBus::Broadcast(
&MaterialEditor::MaterialEditorWindowRequestBus::Handler::ActivateWindow);
// Remove header and parse commands
AZStd::string params(buffer.data(), buffer.size());
params = params.substr(strlen("ProcessCommandLine:"));