[SMC] UI Updates (#270)
* Update SMC prompt texts. Add progress dialog in shader variant generation script. Add "Generate Shader Variant List" command in context menu for shader files in Asset Browser.
This commit is contained in:
+28
-13
@@ -28,6 +28,7 @@
|
||||
#include <AzToolsFramework/Thumbnails/SourceControlThumbnail.h>
|
||||
#include <AtomToolsFramework/Util/Util.h>
|
||||
|
||||
#include <Atom/RPI.Edit/Shader/ShaderVariantListSourceData.h>
|
||||
#include <Atom/Document/ShaderManagementConsoleDocumentSystemRequestBus.h>
|
||||
|
||||
#include <Source/Window/ShaderManagementConsoleBrowserInteractions.h>
|
||||
@@ -81,7 +82,14 @@ namespace ShaderManagementConsole
|
||||
{
|
||||
menu->addAction("Open", [entry]()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(entry->GetFullPath().c_str()));
|
||||
if (AzFramework::StringFunc::Path::IsExtension(entry->GetFullPath().c_str(), AZ::RPI::ShaderVariantListSourceData::Extension))
|
||||
{
|
||||
ShaderManagementConsoleDocumentSystemRequestBus::Broadcast(&ShaderManagementConsoleDocumentSystemRequestBus::Events::OpenDocument, entry->GetFullPath().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(entry->GetFullPath().c_str()));
|
||||
}
|
||||
});
|
||||
|
||||
menu->addAction("Duplicate...", [entry, caller]()
|
||||
@@ -100,20 +108,27 @@ namespace ShaderManagementConsole
|
||||
}
|
||||
});
|
||||
|
||||
menu->addAction("Run Python on Asset...", [entry]()
|
||||
{
|
||||
const QString script = QFileDialog::getOpenFileName(nullptr, "Run Script", QString(), QString("*.py"));
|
||||
if (!script.isEmpty())
|
||||
{
|
||||
AZStd::vector<AZStd::string_view> pythonArgs { entry->GetFullPath() };
|
||||
AzToolsFramework::EditorPythonRunnerRequestBus::Broadcast(&AzToolsFramework::EditorPythonRunnerRequestBus::Events::ExecuteByFilenameWithArgs, script.toUtf8().constData(), pythonArgs);
|
||||
}
|
||||
});
|
||||
|
||||
menu->addAction(AzQtComponents::fileBrowserActionName(), [entry]()
|
||||
{
|
||||
AzQtComponents::ShowFileOnDesktop(entry->GetFullPath().c_str());
|
||||
});
|
||||
|
||||
menu->addSeparator();
|
||||
menu->addAction("Generate Shader Variant List", [entry]() {
|
||||
const QString script = "@engroot@/Gems/Atom/Tools/ShaderManagementConsole/Scripts/GenerateShaderVariantListForMaterials.py";
|
||||
AZStd::vector<AZStd::string_view> pythonArgs{ entry->GetFullPath() };
|
||||
AzToolsFramework::EditorPythonRunnerRequestBus::Broadcast(&AzToolsFramework::EditorPythonRunnerRequestBus::Events::ExecuteByFilenameWithArgs, script.toUtf8().constData(), pythonArgs);
|
||||
});
|
||||
|
||||
menu->addAction("Run Python on Asset...", [entry]()
|
||||
{
|
||||
const QString script = QFileDialog::getOpenFileName(nullptr, "Run Script", QString(), QString("*.py"));
|
||||
if (!script.isEmpty())
|
||||
{
|
||||
AzQtComponents::ShowFileOnDesktop(entry->GetFullPath().c_str());
|
||||
});
|
||||
AZStd::vector<AZStd::string_view> pythonArgs { entry->GetFullPath() };
|
||||
AzToolsFramework::EditorPythonRunnerRequestBus::Broadcast(&AzToolsFramework::EditorPythonRunnerRequestBus::Events::ExecuteByFilenameWithArgs, script.toUtf8().constData(), pythonArgs);
|
||||
}
|
||||
});
|
||||
|
||||
AddPerforceMenuActions(caller, menu, entry);
|
||||
}
|
||||
|
||||
+1
@@ -368,6 +368,7 @@ namespace ShaderManagementConsole
|
||||
// The document tab contains a table view.
|
||||
auto tableView = new QTableView(m_centralWidget);
|
||||
tableView->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
|
||||
auto model = new QStandardItemModel();
|
||||
tableView->setModel(model);
|
||||
|
||||
Reference in New Issue
Block a user