[ftue_auto_register] add logic to auto register engine if it is not already

main
scottr 5 years ago
parent 7ced53cf58
commit 78afc45709

@ -286,6 +286,30 @@ namespace O3DE::ProjectManager
m_registration = pybind11::module::import("cmake.Tools.registration");
m_engineTemplate = pybind11::module::import("cmake.Tools.engine_template");
// register the current engine if it isn't already
bool registerThis = true;
auto allEngines = m_registration.attr("get_engines")();
if (pybind11::isinstance<pybind11::list>(allEngines))
{
for (const auto& engine : allEngines)
{
AZ::IO::FixedMaxPath enginePath(Py_To_String(engine["path"]));
if (enginePath.Compare(m_enginePath) == 0)
{
registerThis = false;
break;
}
}
}
if (registerThis)
{
auto registrationResult = m_registration.attr("register")(m_enginePath.c_str());
AZ_Error("ProjectManagerWindow", registrationResult.cast<int>() == 0,
"Registration of this engine failed!");
}
return result == 0 && !PyErr_Occurred();
} catch ([[maybe_unused]] const std::exception& e)
{

Loading…
Cancel
Save