mirror of
https://github.com/ModOrganizer2/modorganizer-plugin_python.git
synced 2026-07-27 14:03:33 -07:00
Merge pull request #36 from Holt59/mod-data-content
Add ModDataContent to the python interface.
This commit is contained in:
@@ -108,6 +108,17 @@ bool ModDataCheckerWrapper::dataLooksValid(std::shared_ptr<const MOBase::IFileTr
|
||||
|
||||
/// end ModDataChecker Wrapper
|
||||
/////////////////////////////
|
||||
/// ModDataContent Wrapper
|
||||
|
||||
std::vector<ModDataContent::Content> ModDataContentWrapper::getAllContents() const {
|
||||
return basicWrapperFunctionImplementation<std::vector<Content>>(this, "getAllContents");
|
||||
}
|
||||
std::vector<int> ModDataContentWrapper::getContentsFor(std::shared_ptr<const MOBase::IFileTree> fileTree) const {
|
||||
return basicWrapperFunctionImplementation<std::vector<int>>(this, "getContentsFor", fileTree);
|
||||
}
|
||||
|
||||
/// end ModDataContent Wrapper
|
||||
/////////////////////////////
|
||||
/// SaveGameInfo Wrapper
|
||||
|
||||
|
||||
@@ -281,6 +292,21 @@ void registerGameFeaturesPythonConverters()
|
||||
.def("dataLooksValid", bpy::pure_virtual(&ModDataChecker::dataLooksValid))
|
||||
;
|
||||
|
||||
{
|
||||
bpy::scope scope = bpy::class_<ModDataContentWrapper, boost::noncopyable>("ModDataContent")
|
||||
.def("getAllContents", bpy::pure_virtual(&ModDataContent::getAllContents))
|
||||
.def("getContentsFor", bpy::pure_virtual(&ModDataContent::getContentsFor))
|
||||
;
|
||||
|
||||
bpy::class_<ModDataContent::Content>("Content", bpy::init<int, QString, QString, bpy::optional<bool>>())
|
||||
.add_property("id", &ModDataContent::Content::id)
|
||||
.add_property("name", &ModDataContent::Content::name)
|
||||
.add_property("icon", &ModDataContent::Content::icon)
|
||||
.def("isOnlyForFilter", &ModDataContent::Content::isOnlyForFilter)
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
bpy::class_<SaveGameInfoWrapper, boost::noncopyable>("SaveGameInfo")
|
||||
.def("getSaveGameInfo", bpy::pure_virtual(&SaveGameInfo::getSaveGameInfo), bpy::return_value_policy<bpy::manage_new_object>())
|
||||
.def("getMissingAssets", bpy::pure_virtual(&SaveGameInfo::getMissingAssets))
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <gameplugins.h>
|
||||
#include <localsavegames.h>
|
||||
#include <moddatachecker.h>
|
||||
#include <moddatacontent.h>
|
||||
#include <savegameinfo.h>
|
||||
#include <scriptextender.h>
|
||||
#include <unmanagedmods.h>
|
||||
@@ -23,6 +24,7 @@ using MpGameFeaturesList = boost::mp11::mp_list<
|
||||
GamePlugins,
|
||||
LocalSavegames,
|
||||
ModDataChecker,
|
||||
ModDataContent,
|
||||
SaveGameInfo,
|
||||
ScriptExtender,
|
||||
UnmanagedMods
|
||||
@@ -83,7 +85,18 @@ public:
|
||||
static constexpr const char* className = "ModDataCheckerWrapper";
|
||||
using boost::python::wrapper<ModDataChecker>::get_override;
|
||||
|
||||
virtual bool dataLooksValid(std::shared_ptr<const MOBase::IFileTree> fileTree) const;
|
||||
virtual bool dataLooksValid(std::shared_ptr<const MOBase::IFileTree> fileTree) const override;
|
||||
};
|
||||
|
||||
class ModDataContentWrapper : public ModDataContent, public boost::python::wrapper<ModDataContent>
|
||||
{
|
||||
public:
|
||||
static constexpr const char* className = "ModDataContentWrapper";
|
||||
using boost::python::wrapper<ModDataContent>::get_override;
|
||||
|
||||
virtual std::vector<Content> getAllContents() const override;
|
||||
virtual std::vector<int> getContentsFor(std::shared_ptr<const MOBase::IFileTree> fileTree) const override;
|
||||
|
||||
};
|
||||
|
||||
class SaveGameInfoWrapper : public SaveGameInfo, public boost::python::wrapper<SaveGameInfo>
|
||||
|
||||
@@ -92,6 +92,7 @@ BOOST_PYTHON_MODULE(mobase)
|
||||
bpy::register_ptr_to_python<std::shared_ptr<const IFileTree>>();
|
||||
|
||||
// Containers:
|
||||
utils::register_sequence_container<std::vector<int>>();
|
||||
utils::register_sequence_container<QList<ExecutableInfo>>();
|
||||
utils::register_sequence_container<QList<PluginSetting>>();
|
||||
utils::register_sequence_container<QList<ModRepositoryFileInfo>>();
|
||||
@@ -99,6 +100,7 @@ BOOST_PYTHON_MODULE(mobase)
|
||||
utils::register_sequence_container<QList<QFileInfo>>();
|
||||
utils::register_sequence_container<QList<QVariant>>(); // Required for QVariant since this is QVariantList.
|
||||
utils::register_sequence_container<std::vector<std::shared_ptr<const MOBase::FileTreeEntry>>>();
|
||||
utils::register_sequence_container<std::vector<ModDataContent::Content>>();
|
||||
|
||||
utils::register_sequence_container<std::vector<unsigned int>>();
|
||||
utils::register_sequence_container<std::vector<Mapping>>();
|
||||
|
||||
Reference in New Issue
Block a user