Atom Tools: Bind exit function for python tests

Signed-off-by: Guthrie Adams <guthadam@amazon.com>
This commit is contained in:
Guthrie Adams
2022-01-17 01:29:23 -06:00
parent 76ff7aec29
commit ced7d1ef54
2 changed files with 10 additions and 1 deletions
@@ -111,6 +111,7 @@ namespace AtomToolsFramework
virtual void ProcessCommandLine(const AZ::CommandLine& commandLine);
static void PyIdleWaitFrames(uint32_t frames);
static void PyExit();
AzToolsFramework::TraceLogger m_traceLogger;
@@ -130,10 +130,13 @@ namespace AtomToolsFramework
->Attribute(AZ::Script::Attributes::Category, "Editor")
->Attribute(AZ::Script::Attributes::Module, "atomtools.general");
};
// The reflection here is based on patterns in CryEditPythonHandler::Reflect
addGeneral(behaviorContext->Method(
"idle_wait_frames", &AtomToolsApplication::PyIdleWaitFrames, nullptr,
"Waits idling for a frames. Primarily used for auto-testing."));
addGeneral(behaviorContext->Method(
"exit", &AtomToolsApplication::PyExit, nullptr,
"Exit application. Primarily used for auto-testing."));
}
}
@@ -564,4 +567,9 @@ namespace AtomToolsFramework
Ticker ticker(&loop, frames);
loop.exec();
}
void AtomToolsApplication::PyExit()
{
AzFramework::ApplicationRequests::Bus::Broadcast(&AzFramework::ApplicationRequests::ExitMainLoop);
}
} // namespace AtomToolsFramework