mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-05 06:40:09 +00:00
Correct icon and mesh paths in Lua records
This commit is contained in:
parent
c8fc1afb45
commit
1fb136a417
@ -341,6 +341,7 @@ namespace MWBase
|
||||
virtual std::string correctIconPath(const std::string& path) = 0;
|
||||
virtual std::string correctBookartPath(const std::string& path, int width, int height, bool* exists = nullptr) = 0;
|
||||
virtual std::string correctTexturePath(const std::string& path) = 0;
|
||||
virtual std::string correctMeshPath(const std::string& path) = 0;
|
||||
virtual bool textureExists(const std::string& path) = 0;
|
||||
|
||||
virtual void addCell(MWWorld::CellStore* cell) = 0;
|
||||
|
@ -2140,6 +2140,11 @@ namespace MWGui
|
||||
return Misc::ResourceHelpers::correctTexturePath(path, mResourceSystem->getVFS());
|
||||
}
|
||||
|
||||
std::string WindowManager::correctMeshPath(const std::string& path)
|
||||
{
|
||||
return Misc::ResourceHelpers::correctMeshPath(path, mResourceSystem->getVFS());
|
||||
}
|
||||
|
||||
bool WindowManager::textureExists(const std::string &path)
|
||||
{
|
||||
std::string corrected = Misc::ResourceHelpers::correctTexturePath(path, mResourceSystem->getVFS());
|
||||
|
@ -381,6 +381,7 @@ namespace MWGui
|
||||
std::string correctIconPath(const std::string& path) override;
|
||||
std::string correctBookartPath(const std::string& path, int width, int height, bool* exists = nullptr) override;
|
||||
std::string correctTexturePath(const std::string& path) override;
|
||||
std::string correctMeshPath(const std::string& path) override;
|
||||
bool textureExists(const std::string& path) override;
|
||||
|
||||
void addCell(MWWorld::CellStore* cell) override;
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <components/esm3/loadcrea.hpp>
|
||||
|
||||
#include <apps/openmw/mwworld/esmstore.hpp>
|
||||
#include <apps/openmw/mwbase/windowmanager.hpp>
|
||||
|
||||
#include "../stats.hpp"
|
||||
#include "../luabindings.hpp"
|
||||
@ -24,7 +25,10 @@ namespace MWLua
|
||||
sol::usertype<ESM::Creature> record = context.mLua->sol().new_usertype<ESM::Creature>("ESM3_Creature");
|
||||
record[sol::meta_function::to_string] = [](const ESM::Creature& rec) { return "ESM3_Creature[" + rec.mId + "]"; };
|
||||
record["name"] = sol::readonly_property([](const ESM::Creature& rec) -> std::string { return rec.mName; });
|
||||
record["model"] = sol::readonly_property([](const ESM::Creature& rec) -> std::string { return rec.mModel; });
|
||||
record["model"] = sol::readonly_property([](const ESM::Creature& rec) -> std::string
|
||||
{
|
||||
return MWBase::Environment::get().getWindowManager()->correctMeshPath(rec.mModel);
|
||||
});
|
||||
record["mwscript"] = sol::readonly_property([](const ESM::Creature& rec) -> std::string { return rec.mScript; });
|
||||
record["baseCreature"] = sol::readonly_property([](const ESM::Creature& rec) -> std::string { return rec.mOriginal; });
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <components/esm3/loaddoor.hpp>
|
||||
|
||||
#include <apps/openmw/mwworld/esmstore.hpp>
|
||||
#include <apps/openmw/mwbase/windowmanager.hpp>
|
||||
|
||||
#include "../luabindings.hpp"
|
||||
|
||||
@ -48,7 +49,10 @@ namespace MWLua
|
||||
record[sol::meta_function::to_string] = [](const ESM::Door& rec) -> std::string { return "ESM3_Door[" + rec.mId + "]"; };
|
||||
record["id"] = sol::readonly_property([](const ESM::Door& rec) -> std::string { return rec.mId; });
|
||||
record["name"] = sol::readonly_property([](const ESM::Door& rec) -> std::string { return rec.mName; });
|
||||
record["model"] = sol::readonly_property([](const ESM::Door& rec) -> std::string { return rec.mModel; });
|
||||
record["model"] = sol::readonly_property([](const ESM::Door& rec) -> std::string
|
||||
{
|
||||
return MWBase::Environment::get().getWindowManager()->correctMeshPath(rec.mModel);
|
||||
});
|
||||
record["mwscript"] = sol::readonly_property([](const ESM::Door& rec) -> std::string { return rec.mScript; });
|
||||
record["openSound"] = sol::readonly_property([](const ESM::Door& rec) -> std::string { return rec.mOpenSound; });
|
||||
record["closeSound"] = sol::readonly_property([](const ESM::Door& rec) -> std::string { return rec.mCloseSound; });
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <components/esm3/loadweap.hpp>
|
||||
|
||||
#include <apps/openmw/mwworld/esmstore.hpp>
|
||||
#include <apps/openmw/mwbase/windowmanager.hpp>
|
||||
|
||||
#include "../luabindings.hpp"
|
||||
|
||||
@ -41,8 +42,14 @@ namespace MWLua
|
||||
record[sol::meta_function::to_string] = [](const ESM::Weapon& rec) -> std::string { return "ESM3_Weapon[" + rec.mId + "]"; };
|
||||
record["id"] = sol::readonly_property([](const ESM::Weapon& rec) -> std::string { return rec.mId; });
|
||||
record["name"] = sol::readonly_property([](const ESM::Weapon& rec) -> std::string { return rec.mName; });
|
||||
record["model"] = sol::readonly_property([](const ESM::Weapon& rec) -> std::string { return rec.mModel; });
|
||||
record["icon"] = sol::readonly_property([](const ESM::Weapon& rec) -> std::string { return rec.mIcon; });
|
||||
record["model"] = sol::readonly_property([](const ESM::Weapon& rec) -> std::string
|
||||
{
|
||||
return MWBase::Environment::get().getWindowManager()->correctMeshPath(rec.mModel);
|
||||
});
|
||||
record["icon"] = sol::readonly_property([](const ESM::Weapon& rec) -> std::string
|
||||
{
|
||||
return MWBase::Environment::get().getWindowManager()->correctIconPath(rec.mIcon);
|
||||
});
|
||||
record["enchant"] = sol::readonly_property([](const ESM::Weapon& rec) -> std::string { return rec.mEnchant; });
|
||||
record["mwscript"] = sol::readonly_property([](const ESM::Weapon& rec) -> std::string { return rec.mScript; });
|
||||
record["isMagical"] = sol::readonly_property(
|
||||
|
@ -145,6 +145,11 @@ std::string Misc::ResourceHelpers::correctActorModelPath(const std::string &resP
|
||||
return mdlname;
|
||||
}
|
||||
|
||||
std::string Misc::ResourceHelpers::correctMeshPath(const std::string &resPath, const VFS::Manager* vfs)
|
||||
{
|
||||
return "meshes\\" + resPath;
|
||||
}
|
||||
|
||||
std::string Misc::ResourceHelpers::correctSoundPath(const std::string& resPath, const VFS::Manager* vfs)
|
||||
{
|
||||
std::string sound = resPath;
|
||||
|
@ -24,6 +24,7 @@ namespace Misc
|
||||
std::string correctBookartPath(const std::string &resPath, int width, int height, const VFS::Manager* vfs);
|
||||
/// Use "xfoo.nif" instead of "foo.nif" if available
|
||||
std::string correctActorModelPath(const std::string &resPath, const VFS::Manager* vfs);
|
||||
std::string correctMeshPath(const std::string &resPath, const VFS::Manager* vfs);
|
||||
|
||||
std::string correctSoundPath(const std::string& resPath, const VFS::Manager* vfs);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user