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
@@ -23,6 +23,8 @@
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
#include <AzToolsFramework/Thumbnails/ThumbnailContext.h>
#include <Atom/RHI/Factory.h>
#include <AtomToolsFramework/Util/Util.h>
#include <Material/MaterialThumbnail.h>
@@ -125,6 +127,17 @@ namespace AZ
QStringList arguments;
arguments.append(sourcePath.c_str());
// Bring the material editor to the foreground if running
arguments.append("--activatewindow");
// Use the same RHI as the main editor
AZ::Name apiName = AZ::RHI::Factory::Get().GetName();
if (!apiName.IsEmpty())
{
arguments.append(QString("--rhi=%1").arg(apiName.GetCStr()));
}
AtomToolsFramework::LaunchTool("MaterialEditor", ".exe", arguments);
}
@@ -139,7 +152,10 @@ namespace AZ
{
m_openMaterialEditorAction = new QAction("Material Editor");
m_openMaterialEditorAction->setShortcut(QKeySequence(Qt::Key_M));
QObject::connect(m_openMaterialEditorAction, &QAction::triggered, m_openMaterialEditorAction, [this]()
m_openMaterialEditorAction->setCheckable(false);
m_openMaterialEditorAction->setChecked(false);
QObject::connect(
m_openMaterialEditorAction, &QAction::triggered, m_openMaterialEditorAction, [this]()
{
OpenInMaterialEditor("");
}