diff --git a/Code/Tools/ProjectManager/Source/PythonBindings.cpp b/Code/Tools/ProjectManager/Source/PythonBindings.cpp index 2c2c143845..e4642c95e0 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindings.cpp +++ b/Code/Tools/ProjectManager/Source/PythonBindings.cpp @@ -508,6 +508,42 @@ namespace O3DE::ProjectManager } } + bool PythonBindings::AddGemToProject(const QString& gemPath, const QString& projectPath) + { + bool result = ExecuteWithLock([&] { + pybind11::str pyGemPath = gemPath.toStdString(); + pybind11::str pyProjectPath = projectPath.toStdString(); + + m_registration.attr("add_gem_to_project")( + pybind11::none(), // gem_name + pyGemPath, + pybind11::none(), // gem_target + pybind11::none(), // project_name + pyProjectPath + ); + }); + + return result; + } + + bool PythonBindings::RemoveGemFromProject(const QString& gemPath, const QString& projectPath) + { + bool result = ExecuteWithLock([&] { + pybind11::str pyGemPath = gemPath.toStdString(); + pybind11::str pyProjectPath = projectPath.toStdString(); + + m_registration.attr("remove_gem_to_project")( + pybind11::none(), // gem_name + pyGemPath, + pybind11::none(), // gem_target + pybind11::none(), // project_name + pyProjectPath + ); + }); + + return result; + } + bool PythonBindings::UpdateProject([[maybe_unused]] const ProjectInfo& projectInfo) { return false; diff --git a/Code/Tools/ProjectManager/Source/PythonBindings.h b/Code/Tools/ProjectManager/Source/PythonBindings.h index ffabf99b49..892e13a65b 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindings.h +++ b/Code/Tools/ProjectManager/Source/PythonBindings.h @@ -47,6 +47,8 @@ namespace O3DE::ProjectManager AZ::Outcome GetProject(const QString& path) override; AZ::Outcome> GetProjects() override; bool UpdateProject(const ProjectInfo& projectInfo) override; + bool AddGemToProject(const QString& gemPath, const QString& projectPath) override; + bool RemoveGemFromProject(const QString& gemPath, const QString& projectPath) override; // ProjectTemplate AZ::Outcome> GetProjectTemplates() override; diff --git a/Code/Tools/ProjectManager/Source/PythonBindingsInterface.h b/Code/Tools/ProjectManager/Source/PythonBindingsInterface.h index 2377da1461..b5c8f1a76a 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindingsInterface.h +++ b/Code/Tools/ProjectManager/Source/PythonBindingsInterface.h @@ -96,6 +96,22 @@ namespace O3DE::ProjectManager */ virtual bool UpdateProject(const ProjectInfo& projectInfo) = 0; + /** + * Add a gem to a project + * @param gemPath the absolute path to the gem + * @param projectPath the absolute path to the project + * @return true on success, false on failure + */ + virtual bool AddGemToProject(const QString& gemPath, const QString& projectPath) = 0; + + /** + * Remove gem to a project + * @param gemPath the absolute path to the gem + * @param projectPath the absolute path to the project + * @return true on success, false on failure + */ + virtual bool RemoveGemFromProject(const QString& gemPath, const QString& projectPath) = 0; + // Project Templates