diff --git a/src/runner/proxypluginwrappers.cpp b/src/runner/proxypluginwrappers.cpp index a54d11e..76106af 100644 --- a/src/runner/proxypluginwrappers.cpp +++ b/src/runner/proxypluginwrappers.cpp @@ -133,6 +133,19 @@ void IPluginDiagnoseWrapper::invalidate() } /// end IPluginDiagnose Wrapper ///////////////////////////////////// +/// IPluginFileMapper Wrapper + + +COMMON_I_PLUGIN_WRAPPER_DEFINITIONS(IPluginFileMapperWrapper) + +MappingType IPluginFileMapperWrapper::mappings() const +{ + try { + return this->get_override("mappings")(); + } PYCATCH; +} +/// end IPluginFileMapper Wrapper +///////////////////////////////////// /// IPluginGame Wrapper diff --git a/src/runner/proxypluginwrappers.h b/src/runner/proxypluginwrappers.h index f76e7a1..0c01c3a 100644 --- a/src/runner/proxypluginwrappers.h +++ b/src/runner/proxypluginwrappers.h @@ -3,6 +3,7 @@ #include +#include #include #include #include @@ -52,6 +53,20 @@ public: }; +// Even though the base interface is not an IPlugin or QObject, this has to be because we have no way to pass Mod Organizer a plugin that implements multiple interfaces. +// QObject must be the first base class because moc assumes the first base class is a QObject +class IPluginFileMapperWrapper : public QObject, public MOBase::IPluginFileMapper, public MOBase::IPlugin, public boost::python::wrapper +{ + Q_OBJECT + Q_INTERFACES(MOBase::IPlugin MOBase::IPluginFileMapper) + +public: + virtual MappingType mappings() const override; + + COMMON_I_PLUGIN_WRAPPER_DECLARATIONS +}; + + class IPluginGameWrapper : public MOBase::IPluginGame, public boost::python::wrapper { Q_OBJECT Q_INTERFACES(MOBase::IPlugin MOBase::IPluginGame) diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index eb0ad3d..ee1de22 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -989,6 +989,19 @@ BOOST_PYTHON_MODULE(mobase) .def("_invalidate", &IPluginDiagnoseWrapper::invalidate) ; + bpy::class_("Mapping") + .def_readwrite("source", &Mapping::source) + .def_readwrite("destination", &Mapping::destination) + .def_readwrite("isDirectory", &Mapping::isDirectory) + .def_readwrite("createTarget", &Mapping::createTarget) + ; + + std_vector_from_python_obj(); + + bpy::class_("IPluginFileMapper") + .def("mappings", bpy::pure_virtual(&MOBase::IPluginFileMapper::mappings)) + ; + bpy::enum_("LoadOrderMechanism") .value("FileTime", MOBase::IPluginGame::LoadOrderMechanism::FileTime) .value("PluginsTxt", MOBase::IPluginGame::LoadOrderMechanism::PluginsTxt) @@ -1202,6 +1215,8 @@ QObject *PythonRunner::instantiate(const QString &pluginName) TRY_PLUGIN_TYPE(IPluginGame, pluginObj); // Must try the wrapper because it's only a plugin extension interface in C++, so doesn't extend QObject TRY_PLUGIN_TYPE(IPluginDiagnoseWrapper, pluginObj); + // Must try the wrapper because it's only a plugin extension interface in C++, so doesn't extend QObject + TRY_PLUGIN_TYPE(IPluginFileMapperWrapper, pluginObj); TRY_PLUGIN_TYPE(IPluginInstallerCustom, pluginObj); TRY_PLUGIN_TYPE(IPluginTool, pluginObj); } catch (const bpy::error_already_set&) {