+12
-4
@@ -11,6 +11,7 @@
|
||||
#include <AtomToolsFramework/Util/Util.h>
|
||||
#include <AtomToolsFramework/Application/AtomToolsApplication.h>
|
||||
#include <AtomToolsFramework/Window/AtomToolsMainWindowFactoryRequestBus.h>
|
||||
#include <AtomToolsFramework/Window/AtomToolsMainWindowRequestBus.h>
|
||||
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
@@ -70,6 +71,8 @@ namespace AtomToolsFramework
|
||||
AtomToolsApplication ::~AtomToolsApplication()
|
||||
{
|
||||
AtomToolsMainWindowNotificationBus::Handler::BusDisconnect();
|
||||
AzToolsFramework::AssetDatabase::AssetDatabaseRequestsBus::Handler::BusDisconnect();
|
||||
AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
void AtomToolsApplication::CreateReflectionManager()
|
||||
@@ -93,14 +96,12 @@ namespace AtomToolsFramework
|
||||
|
||||
if (auto behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
auto targetName = GetBuildTargetName();
|
||||
|
||||
// this will put these methods into the 'azlmbr.AtomTools.general' module
|
||||
auto addGeneral = [targetName](AZ::BehaviorContext::GlobalMethodBuilder methodBuilder)
|
||||
auto addGeneral = [](AZ::BehaviorContext::GlobalMethodBuilder methodBuilder)
|
||||
{
|
||||
methodBuilder->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation)
|
||||
->Attribute(AZ::Script::Attributes::Category, "Editor")
|
||||
->Attribute(AZ::Script::Attributes::Module, targetName);
|
||||
->Attribute(AZ::Script::Attributes::Module, "atomtools.general");
|
||||
};
|
||||
// The reflection here is based on patterns in CryEditPythonHandler::Reflect
|
||||
addGeneral(behaviorContext->Method(
|
||||
@@ -288,6 +289,13 @@ namespace AtomToolsFramework
|
||||
|
||||
void AtomToolsApplication::ProcessCommandLine(const AZ::CommandLine& commandLine)
|
||||
{
|
||||
const AZStd::string activateWindowSwitchName = "activatewindow";
|
||||
if (commandLine.HasSwitch(activateWindowSwitchName))
|
||||
{
|
||||
AtomToolsFramework::AtomToolsMainWindowRequestBus::Broadcast(
|
||||
&AtomToolsFramework::AtomToolsMainWindowRequestBus::Handler::ActivateWindow);
|
||||
}
|
||||
|
||||
const AZStd::string timeoputSwitchName = "timeout";
|
||||
if (commandLine.HasSwitch(timeoputSwitchName))
|
||||
{
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <Atom/Window/MaterialEditorWindowModule.h>
|
||||
|
||||
#include <AtomToolsFramework/Util/Util.h>
|
||||
#include <AtomToolsFramework/Window/AtomToolsMainWindowRequestBus.h>
|
||||
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
@@ -76,16 +75,11 @@ namespace MaterialEditor
|
||||
{
|
||||
QApplication::setApplicationName("O3DE Material Editor");
|
||||
|
||||
// The settings registry has been created at this point, so add the CMake target
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddBuildSystemTargetSpecialization(
|
||||
*AZ::SettingsRegistry::Get(), GetBuildTargetName());
|
||||
}
|
||||
|
||||
MaterialEditorApplication::~MaterialEditorApplication()
|
||||
{
|
||||
AzToolsFramework::AssetDatabase::AssetDatabaseRequestsBus::Handler::BusDisconnect();
|
||||
AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
void MaterialEditorApplication::CreateStaticModules(AZStd::vector<AZ::Module*>& outModules)
|
||||
{
|
||||
Base::CreateStaticModules(outModules);
|
||||
@@ -101,13 +95,6 @@ namespace MaterialEditor
|
||||
|
||||
void MaterialEditorApplication::ProcessCommandLine(const AZ::CommandLine& commandLine)
|
||||
{
|
||||
const AZStd::string activateWindowSwitchName = "activatewindow";
|
||||
if (commandLine.HasSwitch(activateWindowSwitchName))
|
||||
{
|
||||
AtomToolsFramework::AtomToolsMainWindowRequestBus::Broadcast(
|
||||
&AtomToolsFramework::AtomToolsMainWindowRequestBus::Handler::ActivateWindow);
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace MaterialEditor
|
||||
using Base = AtomToolsFramework::AtomToolsApplication;
|
||||
|
||||
MaterialEditorApplication(int* argc, char*** argv);
|
||||
virtual ~MaterialEditorApplication();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AzFramework::Application
|
||||
|
||||
@@ -114,11 +114,11 @@ def SetCameraPitch(pitch):
|
||||
azlmbr.render.ArcBallControllerRequestBus(azlmbr.bus.Broadcast, 'SetPitch', pitch)
|
||||
|
||||
def IdleFrames(numFrames):
|
||||
azlmbr.materialeditor.general.idle_wait_frames(numFrames)
|
||||
azlmbr.atomtools.general.idle_wait_frames(numFrames)
|
||||
|
||||
def CaptureScreenshot(screenshotOutputPath):
|
||||
print("Capturing screenshot to " + screenshotOutputPath + " ...")
|
||||
return ScreenshotHelper(azlmbr.materialeditor.general.idle_wait_frames).capture_screenshot_blocking(screenshotOutputPath)
|
||||
return ScreenshotHelper(azlmbr.atomtools.general.idle_wait_frames).capture_screenshot_blocking(screenshotOutputPath)
|
||||
|
||||
def ResizeViewport(width, height):
|
||||
# This locks the size of the render target to the desired resolution
|
||||
|
||||
+21
-36
@@ -6,6 +6,18 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Atom/Document/ShaderManagementConsoleDocumentModule.h>
|
||||
#include <Atom/Document/ShaderManagementConsoleDocumentSystemRequestBus.h>
|
||||
#include <Atom/RPI.Edit/Common/AssetUtils.h>
|
||||
#include <Atom/RPI.Public/RPISystemInterface.h>
|
||||
#include <Atom/Window/ShaderManagementConsoleWindowModule.h>
|
||||
|
||||
#include <AtomToolsFramework/Util/Util.h>
|
||||
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
#include <AzFramework/IO/LocalFileIO.h>
|
||||
#include <AzFramework/Network/AssetProcessorConnection.h>
|
||||
@@ -23,30 +35,17 @@
|
||||
#include <AzToolsFramework/UI/PropertyEditor/PropertyManagerComponent.h>
|
||||
#include <AzToolsFramework/SourceControl/SourceControlAPI.h>
|
||||
|
||||
#include <AtomToolsFramework/Util/Util.h>
|
||||
|
||||
#include <Atom/RPI.Edit/Common/AssetUtils.h>
|
||||
#include <Atom/RPI.Public/RPISystemInterface.h>
|
||||
|
||||
#include <Source/ShaderManagementConsoleApplication.h>
|
||||
#include <ShaderManagementConsole_Traits_Platform.h>
|
||||
|
||||
#include <Atom/Document/ShaderManagementConsoleDocumentModule.h>
|
||||
#include <Atom/Document/ShaderManagementConsoleDocumentSystemRequestBus.h>
|
||||
|
||||
#include <Atom/Window/ShaderManagementConsoleWindowModule.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
|
||||
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT
|
||||
#include <QFileInfo>
|
||||
#include <QObject>
|
||||
#include <QMessageBox>
|
||||
AZ_POP_DISABLE_WARNING
|
||||
|
||||
namespace ShaderManagementConsole
|
||||
{
|
||||
//! This function returns the build system target name of "ShaderManagementConsole"
|
||||
AZStd::string ShaderManagementConsoleApplication::GetBuildTargetName() const
|
||||
{
|
||||
#if !defined (LY_CMAKE_TARGET)
|
||||
@@ -76,12 +75,6 @@ namespace ShaderManagementConsole
|
||||
*AZ::SettingsRegistry::Get(), GetBuildTargetName());
|
||||
}
|
||||
|
||||
ShaderManagementConsoleApplication::~ShaderManagementConsoleApplication()
|
||||
{
|
||||
AzToolsFramework::AssetDatabase::AssetDatabaseRequestsBus::Handler::BusDisconnect();
|
||||
AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
void ShaderManagementConsoleApplication::CreateStaticModules(AZStd::vector<AZ::Module*>& outModules)
|
||||
{
|
||||
Base::CreateStaticModules(outModules);
|
||||
@@ -94,27 +87,19 @@ namespace ShaderManagementConsole
|
||||
return AZStd::vector<AZStd::string>({ "passes/", "config/" });
|
||||
}
|
||||
|
||||
void ShaderManagementConsoleApplication::ProcessCommandLine()
|
||||
void ShaderManagementConsoleApplication::ProcessCommandLine(const AZ::CommandLine& commandLine)
|
||||
{
|
||||
// Process command line options for running one or more python scripts on startup
|
||||
const AZStd::string runPythonScriptSwitchName = "runpython";
|
||||
size_t runPythonScriptCount = m_commandLine.GetNumSwitchValues(runPythonScriptSwitchName);
|
||||
for (size_t runPythonScriptIndex = 0; runPythonScriptIndex < runPythonScriptCount; ++runPythonScriptIndex)
|
||||
{
|
||||
const AZStd::string runPythonScriptPath = m_commandLine.GetSwitchValue(runPythonScriptSwitchName, runPythonScriptIndex);
|
||||
AZStd::vector<AZStd::string_view> runPythonArgs;
|
||||
AzToolsFramework::EditorPythonRunnerRequestBus::Broadcast(
|
||||
&AzToolsFramework::EditorPythonRunnerRequestBus::Events::ExecuteByFilenameWithArgs,
|
||||
runPythonScriptPath,
|
||||
runPythonArgs);
|
||||
}
|
||||
|
||||
// Process command line options for opening one or more documents on startup
|
||||
size_t openDocumentCount = m_commandLine.GetNumMiscValues();
|
||||
for (size_t openDocumentIndex = 0; openDocumentIndex < openDocumentCount; ++openDocumentIndex)
|
||||
{
|
||||
const AZStd::string openDocumentPath = m_commandLine.GetMiscValue(openDocumentIndex);
|
||||
ShaderManagementConsoleDocumentSystemRequestBus::Broadcast(&ShaderManagementConsoleDocumentSystemRequestBus::Events::OpenDocument, openDocumentPath);
|
||||
const AZStd::string openDocumentPath = commandLine.GetMiscValue(openDocumentIndex);
|
||||
|
||||
AZ_Printf(GetBuildTargetName().c_str(), "Opening document: %s", openDocumentPath.c_str());
|
||||
ShaderManagementConsoleDocumentSystemRequestBus::Broadcast(
|
||||
&ShaderManagementConsoleDocumentSystemRequestBus::Events::OpenDocument, openDocumentPath);
|
||||
}
|
||||
|
||||
Base::ProcessCommandLine(commandLine);
|
||||
}
|
||||
} // namespace ShaderManagementConsole
|
||||
|
||||
+1
-2
@@ -24,7 +24,6 @@ namespace ShaderManagementConsole
|
||||
using Base = AtomToolsFramework::AtomToolsApplication;
|
||||
|
||||
ShaderManagementConsoleApplication(int* argc, char*** argv);
|
||||
virtual ~ShaderManagementConsoleApplication();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AzFramework::Application
|
||||
@@ -32,7 +31,7 @@ namespace ShaderManagementConsole
|
||||
const char* GetCurrentConfigurationName() const override;
|
||||
|
||||
private:
|
||||
void ProcessCommandLine();
|
||||
void ProcessCommandLine(const AZ::CommandLine& commandLine);
|
||||
AZStd::string GetBuildTargetName() const override;
|
||||
AZStd::vector<AZStd::string> GetCriticalAssetFilters() const override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user