Remove unused vfs argument from correctMeshPath

macos_ci_fix
elsid 5 months ago
parent 5d53eb7566
commit 81a483fc7f
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -131,7 +131,7 @@ namespace NavMeshTool
osg::ref_ptr<const Resource::BulletShape> shape = [&] {
try
{
return bulletShapeManager.getShape(Misc::ResourceHelpers::correctMeshPath(model, &vfs));
return bulletShapeManager.getShape(Misc::ResourceHelpers::correctMeshPath(model));
}
catch (const std::exception& e)
{

@ -145,12 +145,11 @@ namespace MWClass
= getModel(ptr); // Assume it's not empty, since we wouldn't have gotten the soundgen otherwise
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::RefId* creatureId = nullptr;
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
for (const ESM::Creature& iter : store.get<ESM::Creature>())
{
if (!iter.mModel.empty()
&& Misc::StringUtils::ciEqual(model, Misc::ResourceHelpers::correctMeshPath(iter.mModel, vfs)))
&& Misc::StringUtils::ciEqual(model, Misc::ResourceHelpers::correctMeshPath(iter.mModel)))
{
creatureId = !iter.mOriginal.empty() ? &iter.mOriginal : &iter.mId;
break;

@ -1,8 +1,6 @@
#ifndef OPENMW_MWCLASS_CLASSMODEL_H
#define OPENMW_MWCLASS_CLASSMODEL_H
#include "../mwbase/environment.hpp"
#include "../mwworld/livecellref.hpp"
#include "../mwworld/ptr.hpp"
@ -19,8 +17,7 @@ namespace MWClass
const MWWorld::LiveCellRef<Class>* ref = ptr.get<Class>();
if (!ref->mBase->mModel.empty())
return Misc::ResourceHelpers::correctMeshPath(
ref->mBase->mModel, MWBase::Environment::get().getResourceSystem()->getVFS());
return Misc::ResourceHelpers::correctMeshPath(ref->mBase->mModel);
return {};
}

@ -644,12 +644,10 @@ namespace MWClass
const std::string model = getModel(ptr);
if (!model.empty())
{
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
for (const ESM::Creature& creature : store.get<ESM::Creature>())
{
if (creature.mId != ourId && creature.mOriginal != ourId && !creature.mModel.empty()
&& Misc::StringUtils::ciEqual(
model, Misc::ResourceHelpers::correctMeshPath(creature.mModel, vfs)))
&& Misc::StringUtils::ciEqual(model, Misc::ResourceHelpers::correctMeshPath(creature.mModel)))
{
const ESM::RefId& fallbackId = !creature.mOriginal.empty() ? creature.mOriginal : creature.mId;
sound = store.get<ESM::SoundGenerator>().begin();

@ -6,6 +6,8 @@
#include <components/esm4/loadtree.hpp>
#include <components/misc/strings/algorithm.hpp>
#include "../mwbase/environment.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwworld/cellstore.hpp"

@ -175,8 +175,7 @@ namespace MWClass
model = data.mTraits->mModel;
else
model = data.mIsFemale ? data.mRace->mModelFemale : data.mRace->mModelMale;
const VFS::Manager* vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
return Misc::ResourceHelpers::correctMeshPath(model, vfs);
return Misc::ResourceHelpers::correctMeshPath(model);
}
std::string_view ESM4Npc::getName(const MWWorld::ConstPtr& ptr) const

@ -431,24 +431,22 @@ namespace MWClass
models.push_back(Settings::models().mXbaseanimfemale);
models.push_back(Settings::models().mXbaseanim);
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
if (!npc->mBase->mModel.empty())
models.push_back(Misc::ResourceHelpers::correctMeshPath(npc->mBase->mModel, vfs));
models.push_back(Misc::ResourceHelpers::correctMeshPath(npc->mBase->mModel));
if (!npc->mBase->mHead.empty())
{
const ESM::BodyPart* head
= MWBase::Environment::get().getESMStore()->get<ESM::BodyPart>().search(npc->mBase->mHead);
if (head)
models.push_back(Misc::ResourceHelpers::correctMeshPath(head->mModel, vfs));
models.push_back(Misc::ResourceHelpers::correctMeshPath(head->mModel));
}
if (!npc->mBase->mHair.empty())
{
const ESM::BodyPart* hair
= MWBase::Environment::get().getESMStore()->get<ESM::BodyPart>().search(npc->mBase->mHair);
if (hair)
models.push_back(Misc::ResourceHelpers::correctMeshPath(hair->mModel, vfs));
models.push_back(Misc::ResourceHelpers::correctMeshPath(hair->mModel));
}
bool female = (npc->mBase->mFlags & ESM::NPC::Female);
@ -487,7 +485,7 @@ namespace MWClass
const ESM::BodyPart* part
= MWBase::Environment::get().getESMStore()->get<ESM::BodyPart>().search(partname);
if (part && !part->mModel.empty())
models.push_back(Misc::ResourceHelpers::correctMeshPath(part->mModel, vfs));
models.push_back(Misc::ResourceHelpers::correctMeshPath(part->mModel));
}
}
}
@ -501,7 +499,7 @@ namespace MWClass
{
const ESM::BodyPart* part = *it;
if (part && !part->mModel.empty())
models.push_back(Misc::ResourceHelpers::correctMeshPath(part->mModel, vfs));
models.push_back(Misc::ResourceHelpers::correctMeshPath(part->mModel));
}
}
}

@ -43,8 +43,6 @@ namespace MWLua
{
void addActivatorBindings(sol::table activator, const Context& context)
{
auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
activator["createRecordDraft"] = tableToActivator;
addRecordFunctionBinding<ESM::Activator>(activator, context);
@ -54,8 +52,8 @@ namespace MWLua
record["id"]
= sol::readonly_property([](const ESM::Activator& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Activator& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Activator& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
record["model"] = sol::readonly_property([](const ESM::Activator& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel);
});
record["mwscript"] = sol::readonly_property(
[](const ESM::Activator& rec) -> std::string { return rec.mScript.serializeText(); });

@ -38,8 +38,8 @@ namespace MWLua
record["id"]
= sol::readonly_property([](const ESM::Apparatus& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Apparatus& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Apparatus& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
record["model"] = sol::readonly_property([](const ESM::Apparatus& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel);
});
record["mwscript"] = sol::readonly_property(
[](const ESM::Apparatus& rec) -> std::string { return rec.mScript.serializeText(); });

@ -95,9 +95,8 @@ namespace MWLua
record["id"]
= sol::readonly_property([](const ESM::Armor& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Armor& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Armor& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
});
record["model"] = sol::readonly_property(
[](const ESM::Armor& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); });
record["icon"] = sol::readonly_property([vfs](const ESM::Armor& rec) -> std::string {
return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs);
});

@ -104,9 +104,8 @@ namespace MWLua
record["id"]
= sol::readonly_property([](const ESM::Book& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Book& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Book& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
});
record["model"] = sol::readonly_property(
[](const ESM::Book& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); });
record["mwscript"]
= sol::readonly_property([](const ESM::Book& rec) -> std::string { return rec.mScript.serializeText(); });
record["icon"] = sol::readonly_property([vfs](const ESM::Book& rec) -> std::string {

@ -90,9 +90,8 @@ namespace MWLua
record["id"]
= sol::readonly_property([](const ESM::Clothing& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Clothing& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Clothing& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
});
record["model"] = sol::readonly_property(
[](const ESM::Clothing& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); });
record["icon"] = sol::readonly_property([vfs](const ESM::Clothing& rec) -> std::string {
return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs);
});

@ -5,10 +5,7 @@
#include <components/misc/resourcehelpers.hpp>
#include <components/resource/resourcesystem.hpp>
#include <apps/openmw/mwbase/environment.hpp>
#include <apps/openmw/mwbase/world.hpp>
#include <apps/openmw/mwworld/class.hpp>
#include <apps/openmw/mwworld/esmstore.hpp>
namespace sol
{
@ -42,8 +39,6 @@ namespace MWLua
};
container["capacity"] = container["getCapacity"]; // for compatibility; should be removed later
auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
addRecordFunctionBinding<ESM::Container>(container, context);
sol::usertype<ESM::Container> record = context.mLua->sol().new_usertype<ESM::Container>("ESM3_Container");
@ -53,8 +48,8 @@ namespace MWLua
record["id"]
= sol::readonly_property([](const ESM::Container& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Container& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Container& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
record["model"] = sol::readonly_property([](const ESM::Container& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel);
});
record["mwscript"] = sol::readonly_property(
[](const ESM::Container& rec) -> std::string { return rec.mScript.serializeText(); });

@ -29,8 +29,6 @@ namespace MWLua
{ "Humanoid", ESM::Creature::Humanoid },
}));
auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
addRecordFunctionBinding<ESM::Creature>(creature, context);
sol::usertype<ESM::Creature> record = context.mLua->sol().new_usertype<ESM::Creature>("ESM3_Creature");
@ -39,9 +37,8 @@ namespace MWLua
record["id"]
= sol::readonly_property([](const ESM::Creature& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Creature& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Creature& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
});
record["model"] = sol::readonly_property(
[](const ESM::Creature& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); });
record["mwscript"] = sol::readonly_property(
[](const ESM::Creature& rec) -> std::string { return rec.mScript.serializeText(); });
record["baseCreature"] = sol::readonly_property(

@ -55,8 +55,6 @@ namespace MWLua
return sol::make_object(lua, LCell{ &cell });
};
auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
addRecordFunctionBinding<ESM::Door>(door, context);
sol::usertype<ESM::Door> record = context.mLua->sol().new_usertype<ESM::Door>("ESM3_Door");
@ -65,9 +63,8 @@ namespace MWLua
record["id"]
= sol::readonly_property([](const ESM::Door& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Door& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Door& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
});
record["model"] = sol::readonly_property(
[](const ESM::Door& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); });
record["mwscript"]
= sol::readonly_property([](const ESM::Door& rec) -> std::string { return rec.mScript.serializeText(); });
record["openSound"] = sol::readonly_property(
@ -95,8 +92,6 @@ namespace MWLua
return sol::make_object(lua, LCell{ &cell });
};
auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
addRecordFunctionBinding<ESM4::Door>(door, context, "ESM4Door");
sol::usertype<ESM4::Door> record = context.mLua->sol().new_usertype<ESM4::Door>("ESM4_Door");
@ -106,9 +101,8 @@ namespace MWLua
record["id"] = sol::readonly_property(
[](const ESM4::Door& rec) -> std::string { return ESM::RefId(rec.mId).serializeText(); });
record["name"] = sol::readonly_property([](const ESM4::Door& rec) -> std::string { return rec.mFullName; });
record["model"] = sol::readonly_property([vfs](const ESM4::Door& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
});
record["model"] = sol::readonly_property(
[](const ESM4::Door& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); });
record["isAutomatic"] = sol::readonly_property(
[](const ESM4::Door& rec) -> bool { return rec.mDoorFlags & ESM4::Door::Flag_AutomaticDoor; });
}

@ -33,8 +33,8 @@ namespace MWLua
record["id"]
= sol::readonly_property([](const ESM::Ingredient& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Ingredient& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Ingredient& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
record["model"] = sol::readonly_property([](const ESM::Ingredient& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel);
});
record["mwscript"] = sol::readonly_property(
[](const ESM::Ingredient& rec) -> std::string { return rec.mScript.serializeText(); });

@ -31,9 +31,8 @@ namespace MWLua
record["id"]
= sol::readonly_property([](const ESM::Light& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Light& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Light& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
});
record["model"] = sol::readonly_property(
[](const ESM::Light& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); });
record["icon"] = sol::readonly_property([vfs](const ESM::Light& rec) -> std::string {
return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs);
});

@ -31,9 +31,8 @@ namespace MWLua
record["id"]
= sol::readonly_property([](const ESM::Lockpick& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Lockpick& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Lockpick& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
});
record["model"] = sol::readonly_property(
[](const ESM::Lockpick& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); });
record["mwscript"] = sol::readonly_property(
[](const ESM::Lockpick& rec) -> std::string { return rec.mScript.serializeText(); });
record["icon"] = sol::readonly_property([vfs](const ESM::Lockpick& rec) -> std::string {

@ -83,8 +83,8 @@ namespace MWLua
record["id"] = sol::readonly_property(
[](const ESM::Miscellaneous& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Miscellaneous& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Miscellaneous& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
record["model"] = sol::readonly_property([](const ESM::Miscellaneous& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel);
});
record["mwscript"] = sol::readonly_property(
[](const ESM::Miscellaneous& rec) -> std::string { return rec.mScript.serializeText(); });

@ -73,9 +73,8 @@ namespace MWLua
record["id"]
= sol::readonly_property([](const ESM::Potion& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Potion& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Potion& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
});
record["model"] = sol::readonly_property(
[](const ESM::Potion& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); });
record["icon"] = sol::readonly_property([vfs](const ESM::Potion& rec) -> std::string {
return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs);
});

@ -31,9 +31,8 @@ namespace MWLua
record["id"]
= sol::readonly_property([](const ESM::Probe& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Probe& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Probe& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
});
record["model"] = sol::readonly_property(
[](const ESM::Probe& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); });
record["mwscript"]
= sol::readonly_property([](const ESM::Probe& rec) -> std::string { return rec.mScript.serializeText(); });
record["icon"] = sol::readonly_property([vfs](const ESM::Probe& rec) -> std::string {

@ -6,8 +6,6 @@
#include <components/resource/resourcesystem.hpp>
#include <apps/openmw/mwbase/environment.hpp>
#include <apps/openmw/mwbase/world.hpp>
#include <apps/openmw/mwworld/esmstore.hpp>
namespace sol
{
@ -31,9 +29,8 @@ namespace MWLua
record["id"]
= sol::readonly_property([](const ESM::Repair& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Repair& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Repair& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
});
record["model"] = sol::readonly_property(
[](const ESM::Repair& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); });
record["mwscript"]
= sol::readonly_property([](const ESM::Repair& rec) -> std::string { return rec.mScript.serializeText(); });
record["icon"] = sol::readonly_property([vfs](const ESM::Repair& rec) -> std::string {

@ -21,8 +21,6 @@ namespace MWLua
{
void addStaticBindings(sol::table stat, const Context& context)
{
auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
addRecordFunctionBinding<ESM::Static>(stat, context);
sol::usertype<ESM::Static> record = context.mLua->sol().new_usertype<ESM::Static>("ESM3_Static");
@ -30,8 +28,7 @@ namespace MWLua
= [](const ESM::Static& rec) -> std::string { return "ESM3_Static[" + rec.mId.toDebugString() + "]"; };
record["id"]
= sol::readonly_property([](const ESM::Static& rec) -> std::string { return rec.mId.serializeText(); });
record["model"] = sol::readonly_property([vfs](const ESM::Static& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
});
record["model"] = sol::readonly_property(
[](const ESM::Static& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); });
}
}

@ -6,8 +6,6 @@
#include <components/misc/resourcehelpers.hpp>
#include <components/resource/resourcesystem.hpp>
#include "apps/openmw/mwworld/esmstore.hpp"
namespace sol
{
template <>
@ -21,9 +19,6 @@ namespace MWLua
void addESM4TerminalBindings(sol::table term, const Context& context)
{
auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
addRecordFunctionBinding<ESM4::Terminal>(term, context, "ESM4Terminal");
sol::usertype<ESM4::Terminal> record = context.mLua->sol().new_usertype<ESM4::Terminal>("ESM4_Terminal");
@ -38,8 +33,8 @@ namespace MWLua
record["resultText"]
= sol::readonly_property([](const ESM4::Terminal& rec) -> std::string { return rec.mResultText; });
record["name"] = sol::readonly_property([](const ESM4::Terminal& rec) -> std::string { return rec.mFullName; });
record["model"] = sol::readonly_property([vfs](const ESM4::Terminal& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
record["model"] = sol::readonly_property([](const ESM4::Terminal& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel);
});
}
}

@ -129,9 +129,8 @@ namespace MWLua
record["id"]
= sol::readonly_property([](const ESM::Weapon& rec) -> std::string { return rec.mId.serializeText(); });
record["name"] = sol::readonly_property([](const ESM::Weapon& rec) -> std::string { return rec.mName; });
record["model"] = sol::readonly_property([vfs](const ESM::Weapon& rec) -> std::string {
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
});
record["model"] = sol::readonly_property(
[](const ESM::Weapon& rec) -> std::string { return Misc::ResourceHelpers::correctMeshPath(rec.mModel); });
record["icon"] = sol::readonly_property([vfs](const ESM::Weapon& rec) -> std::string {
return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs);
});

@ -321,11 +321,8 @@ namespace MWMechanics
ESM::RefId::stringRefId("VFX_Reflect"));
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(ptr);
if (animation && !reflectStatic->mModel.empty())
{
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
animation->addEffect(Misc::ResourceHelpers::correctMeshPath(reflectStatic->mModel, vfs),
animation->addEffect(Misc::ResourceHelpers::correctMeshPath(reflectStatic->mModel),
ESM::MagicEffect::Reflect, false);
}
caster.getClass().getCreatureStats(caster).getActiveSpells().addSpell(*reflected);
}
if (removedSpell)

@ -211,11 +211,8 @@ namespace
const ESM::Static* const fx
= world->getStore().get<ESM::Static>().search(ESM::RefId::stringRefId("VFX_Soul_Trap"));
if (fx != nullptr)
{
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
world->spawnEffect(Misc::ResourceHelpers::correctMeshPath(fx->mModel, vfs), "",
world->spawnEffect(Misc::ResourceHelpers::correctMeshPath(fx->mModel), "",
creature.getRefData().getPosition().asVec3());
}
MWBase::Environment::get().getSoundManager()->playSound3D(
creature.getRefData().getPosition().asVec3(), ESM::RefId::stringRefId("conjuration hit"), 1.f, 1.f);
@ -1825,12 +1822,8 @@ namespace MWMechanics
const ESM::Static* fx = MWBase::Environment::get().getESMStore()->get<ESM::Static>().search(
ESM::RefId::stringRefId("VFX_Summon_End"));
if (fx)
{
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
MWBase::Environment::get().getWorld()->spawnEffect(
Misc::ResourceHelpers::correctMeshPath(fx->mModel, vfs), "",
ptr.getRefData().getPosition().asVec3());
}
Misc::ResourceHelpers::correctMeshPath(fx->mModel), "", ptr.getRefData().getPosition().asVec3());
// Remove the summoned creature's summoned creatures as well
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);

@ -1615,18 +1615,13 @@ namespace MWMechanics
const ESM::Static* castStatic
= world->getStore().get<ESM::Static>().find(ESM::RefId::stringRefId("VFX_Hands"));
const VFS::Manager* const vfs
= MWBase::Environment::get().getResourceSystem()->getVFS();
if (mAnimation->getNode("Bip01 L Hand"))
mAnimation->addEffect(
Misc::ResourceHelpers::correctMeshPath(castStatic->mModel, vfs), -1, false,
"Bip01 L Hand", effect->mParticle);
mAnimation->addEffect(Misc::ResourceHelpers::correctMeshPath(castStatic->mModel),
-1, false, "Bip01 L Hand", effect->mParticle);
if (mAnimation->getNode("Bip01 R Hand"))
mAnimation->addEffect(
Misc::ResourceHelpers::correctMeshPath(castStatic->mModel, vfs), -1, false,
"Bip01 R Hand", effect->mParticle);
mAnimation->addEffect(Misc::ResourceHelpers::correctMeshPath(castStatic->mModel),
-1, false, "Bip01 R Hand", effect->mParticle);
}
// first effect used for casting animation
const ESM::ENAMstruct& firstEffect = effects->front();

@ -41,7 +41,6 @@ namespace MWMechanics
const ESM::EffectList& effects, const MWWorld::Ptr& ignore, ESM::RangeType rangeType) const
{
const auto world = MWBase::Environment::get().getWorld();
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
std::map<MWWorld::Ptr, std::vector<ESM::ENAMstruct>> toApply;
int index = -1;
for (const ESM::ENAMstruct& effectInfo : effects.mList)
@ -75,12 +74,12 @@ namespace MWMechanics
{
if (effectInfo.mRange == ESM::RT_Target)
world->spawnEffect(
Misc::ResourceHelpers::correctMeshPath(areaStatic->mModel, vfs), texture, mHitPosition, 1.0f);
Misc::ResourceHelpers::correctMeshPath(areaStatic->mModel), texture, mHitPosition, 1.0f);
continue;
}
else
world->spawnEffect(Misc::ResourceHelpers::correctMeshPath(areaStatic->mModel, vfs), texture,
mHitPosition, static_cast<float>(effectInfo.mArea * 2));
world->spawnEffect(Misc::ResourceHelpers::correctMeshPath(areaStatic->mModel), texture, mHitPosition,
static_cast<float>(effectInfo.mArea * 2));
// Play explosion sound (make sure to use NoTrack, since we will delete the projectile now)
{
@ -532,7 +531,6 @@ namespace MWMechanics
{
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
std::vector<std::string> addedEffects;
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
for (const ESM::ENAMstruct& effectData : effects)
{
@ -547,15 +545,15 @@ namespace MWMechanics
// check if the effect was already added
if (std::find(addedEffects.begin(), addedEffects.end(),
Misc::ResourceHelpers::correctMeshPath(castStatic->mModel, vfs))
Misc::ResourceHelpers::correctMeshPath(castStatic->mModel))
!= addedEffects.end())
continue;
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(mCaster);
if (animation)
{
animation->addEffect(Misc::ResourceHelpers::correctMeshPath(castStatic->mModel, vfs), effect->mIndex,
false, {}, effect->mParticle);
animation->addEffect(Misc::ResourceHelpers::correctMeshPath(castStatic->mModel), effect->mIndex, false,
{}, effect->mParticle);
}
else
{
@ -585,13 +583,13 @@ namespace MWMechanics
}
scale = std::max(scale, 1.f);
MWBase::Environment::get().getWorld()->spawnEffect(
Misc::ResourceHelpers::correctMeshPath(castStatic->mModel, vfs), effect->mParticle, pos, scale);
Misc::ResourceHelpers::correctMeshPath(castStatic->mModel), effect->mParticle, pos, scale);
}
if (animation && !mCaster.getClass().isActor())
animation->addSpellCastGlow(effect);
addedEffects.push_back(Misc::ResourceHelpers::correctMeshPath(castStatic->mModel, vfs));
addedEffects.push_back(Misc::ResourceHelpers::correctMeshPath(castStatic->mModel));
MWBase::SoundManager* sndMgr = MWBase::Environment::get().getSoundManager();
if (!effect->mCastSound.empty())
@ -628,11 +626,8 @@ namespace MWMechanics
{
// Don't play particle VFX unless the effect is new or it should be looping.
if (playNonLooping || loop)
{
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
anim->addEffect(Misc::ResourceHelpers::correctMeshPath(castStatic->mModel, vfs), magicEffect.mIndex,
loop, {}, magicEffect.mParticle);
}
anim->addEffect(Misc::ResourceHelpers::correctMeshPath(castStatic->mModel), magicEffect.mIndex, loop,
{}, magicEffect.mParticle);
}
}
}

@ -285,11 +285,8 @@ namespace
const ESM::Static* absorbStatic = esmStore.get<ESM::Static>().find(ESM::RefId::stringRefId("VFX_Absorb"));
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target);
if (animation && !absorbStatic->mModel.empty())
{
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
animation->addEffect(Misc::ResourceHelpers::correctMeshPath(absorbStatic->mModel, vfs),
ESM::MagicEffect::SpellAbsorption, false);
}
animation->addEffect(
Misc::ResourceHelpers::correctMeshPath(absorbStatic->mModel), ESM::MagicEffect::SpellAbsorption, false);
const ESM::Spell* spell = esmStore.get<ESM::Spell>().search(spellId);
int spellCost = 0;
if (spell)
@ -461,10 +458,7 @@ namespace MWMechanics
const ESM::Static* fx
= world->getStore().get<ESM::Static>().search(ESM::RefId::stringRefId("VFX_Summon_end"));
if (fx)
{
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
anim->addEffect(Misc::ResourceHelpers::correctMeshPath(fx->mModel, vfs), -1);
}
anim->addEffect(Misc::ResourceHelpers::correctMeshPath(fx->mModel), -1);
}
}
else if (caster == getPlayer())

@ -105,10 +105,7 @@ namespace MWMechanics
const ESM::Static* fx
= world->getStore().get<ESM::Static>().search(ESM::RefId::stringRefId("VFX_Summon_Start"));
if (fx)
{
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
anim->addEffect(Misc::ResourceHelpers::correctMeshPath(fx->mModel, vfs), -1, false);
}
anim->addEffect(Misc::ResourceHelpers::correctMeshPath(fx->mModel), -1, false);
}
}
catch (std::exception& e)

@ -130,8 +130,7 @@ namespace MWRender
if (bodypart == nullptr || bodypart->mData.mType != ESM::BodyPart::MT_Armor)
return std::string();
if (!bodypart->mModel.empty())
return Misc::ResourceHelpers::correctMeshPath(
bodypart->mModel, MWBase::Environment::get().getResourceSystem()->getVFS());
return Misc::ResourceHelpers::correctMeshPath(bodypart->mModel);
}
}
}

@ -12,8 +12,8 @@
#include <components/resource/resourcesystem.hpp>
#include <components/resource/scenemanager.hpp>
#include "../mwbase/environment.hpp"
#include "../mwclass/esm4npc.hpp"
#include "../mwworld/customdata.hpp"
#include "../mwworld/esmstore.hpp"
namespace MWRender
@ -51,7 +51,7 @@ namespace MWRender
if (model.empty())
return;
mResourceSystem->getSceneManager()->getInstance(
Misc::ResourceHelpers::correctMeshPath(model, mResourceSystem->getVFS()), mObjectRoot.get());
Misc::ResourceHelpers::correctMeshPath(model), mObjectRoot.get());
}
template <class Record>

@ -48,7 +48,7 @@
namespace
{
std::string getVampireHead(const ESM::RefId& race, bool female, const VFS::Manager& vfs)
std::string getVampireHead(const ESM::RefId& race, bool female)
{
static std::map<std::pair<ESM::RefId, int>, const ESM::BodyPart*> sVampireMapping;
@ -78,7 +78,7 @@ namespace
const ESM::BodyPart* bodyPart = sVampireMapping[thisCombination];
if (!bodyPart)
return std::string();
return Misc::ResourceHelpers::correctMeshPath(bodyPart->mModel, &vfs);
return Misc::ResourceHelpers::correctMeshPath(bodyPart->mModel);
}
}
@ -467,7 +467,7 @@ namespace MWRender
{
const ESM::BodyPart* bp = store.get<ESM::BodyPart>().search(headName);
if (bp)
mHeadModel = Misc::ResourceHelpers::correctMeshPath(bp->mModel, mResourceSystem->getVFS());
mHeadModel = Misc::ResourceHelpers::correctMeshPath(bp->mModel);
else
Log(Debug::Warning) << "Warning: Failed to load body part '" << headName << "'";
}
@ -476,12 +476,12 @@ namespace MWRender
{
const ESM::BodyPart* bp = store.get<ESM::BodyPart>().search(hairName);
if (bp)
mHairModel = Misc::ResourceHelpers::correctMeshPath(bp->mModel, mResourceSystem->getVFS());
mHairModel = Misc::ResourceHelpers::correctMeshPath(bp->mModel);
else
Log(Debug::Warning) << "Warning: Failed to load body part '" << hairName << "'";
}
const std::string vampireHead = getVampireHead(mNpc->mRace, isFemale, *mResourceSystem->getVFS());
const std::string vampireHead = getVampireHead(mNpc->mRace, isFemale);
if (!isWerewolf && isVampire && !vampireHead.empty())
mHeadModel = vampireHead;
@ -494,8 +494,7 @@ namespace MWRender
std::string smodel = defaultSkeleton;
if (!is1stPerson && !isWerewolf && !mNpc->mModel.empty())
smodel = Misc::ResourceHelpers::correctActorModelPath(
Misc::ResourceHelpers::correctMeshPath(mNpc->mModel, mResourceSystem->getVFS()),
mResourceSystem->getVFS());
Misc::ResourceHelpers::correctMeshPath(mNpc->mModel), mResourceSystem->getVFS());
setObjectRoot(smodel, true, true, false);
@ -646,9 +645,8 @@ namespace MWRender
if (store != inv.end() && (part = *store).getType() == ESM::Light::sRecordId)
{
const ESM::Light* light = part.get<ESM::Light>()->mBase;
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
addOrReplaceIndividualPart(ESM::PRT_Shield, MWWorld::InventoryStore::Slot_CarriedLeft, 1,
Misc::ResourceHelpers::correctMeshPath(light->mModel, vfs), false, nullptr, true);
Misc::ResourceHelpers::correctMeshPath(light->mModel), false, nullptr, true);
if (mObjectParts[ESM::PRT_Shield])
addExtraLight(mObjectParts[ESM::PRT_Shield]->getNode()->asGroup(), SceneUtil::LightCommon(*light));
}
@ -666,13 +664,9 @@ namespace MWRender
{
if (mPartPriorities[part] < 1)
{
const ESM::BodyPart* bodypart = parts[part];
if (bodypart)
{
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
if (const ESM::BodyPart* bodypart = parts[part])
addOrReplaceIndividualPart(static_cast<ESM::PartReferenceType>(part), -1, 1,
Misc::ResourceHelpers::correctMeshPath(bodypart->mModel, vfs));
}
Misc::ResourceHelpers::correctMeshPath(bodypart->mModel));
}
}
@ -901,11 +895,8 @@ namespace MWRender
}
if (bodypart)
{
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
addOrReplaceIndividualPart(static_cast<ESM::PartReferenceType>(part.mPart), group, priority,
Misc::ResourceHelpers::correctMeshPath(bodypart->mModel, vfs), enchantedGlow, glowColor);
}
Misc::ResourceHelpers::correctMeshPath(bodypart->mModel), enchantedGlow, glowColor);
else
reserveIndividualPart((ESM::PartReferenceType)part.mPart, group, priority);
}

@ -623,7 +623,7 @@ namespace MWRender
std::string model = getModel(type, ref.mRefID, store);
if (model.empty())
continue;
model = Misc::ResourceHelpers::correctMeshPath(model, mSceneManager->getVFS());
model = Misc::ResourceHelpers::correctMeshPath(model);
if (activeGrid && type != ESM::REC_STAT)
{

@ -26,8 +26,6 @@ namespace MWWorld
const ::EsmLoader::EsmData content
= ::EsmLoader::loadEsmData(query, groundcoverFiles, fileCollections, readers, encoder, listener);
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
static constexpr std::string_view prefix = "grass\\";
for (const ESM::Static& stat : statics)
{
@ -35,7 +33,7 @@ namespace MWWorld
std::replace(model.begin(), model.end(), '/', '\\');
if (!model.starts_with(prefix))
continue;
mMeshCache[stat.mId] = Misc::ResourceHelpers::correctMeshPath(model, vfs);
mMeshCache[stat.mId] = Misc::ResourceHelpers::correctMeshPath(model);
}
for (const ESM::Static& stat : content.mStatics)
@ -44,7 +42,7 @@ namespace MWWorld
std::replace(model.begin(), model.end(), '/', '\\');
if (!model.starts_with(prefix))
continue;
mMeshCache[stat.mId] = Misc::ResourceHelpers::correctMeshPath(model, vfs);
mMeshCache[stat.mId] = Misc::ResourceHelpers::correctMeshPath(model);
}
for (const ESM::Cell& cell : content.mCells)

@ -210,8 +210,6 @@ namespace MWWorld
if (state.mIdMagic.size() > 1)
{
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
for (size_t iter = 1; iter != state.mIdMagic.size(); ++iter)
{
std::ostringstream nodeName;
@ -223,7 +221,7 @@ namespace MWWorld
attachTo->accept(findVisitor);
if (findVisitor.mFoundNode)
mResourceSystem->getSceneManager()->getInstance(
Misc::ResourceHelpers::correctMeshPath(weapon->mModel, vfs), findVisitor.mFoundNode);
Misc::ResourceHelpers::correctMeshPath(weapon->mModel), findVisitor.mFoundNode);
}
}
@ -331,8 +329,7 @@ namespace MWWorld
if (state.mIdMagic.size() > 1)
{
model = Misc::ResourceHelpers::correctMeshPath(
MWBase::Environment::get().getESMStore()->get<ESM::Weapon>().find(state.mIdMagic[1])->mModel,
MWBase::Environment::get().getResourceSystem()->getVFS());
MWBase::Environment::get().getESMStore()->get<ESM::Weapon>().find(state.mIdMagic[1])->mModel);
}
state.mProjectileId = mPhysics->addProjectile(caster, pos, model, true);
state.mToDelete = false;

@ -3632,9 +3632,8 @@ namespace MWWorld
if (texture.empty())
texture = Fallback::Map::getString("Blood_Texture_0");
std::string model = Misc::ResourceHelpers::correctMeshPath(
std::string{ Fallback::Map::getString("Blood_Model_" + std::to_string(Misc::Rng::rollDice(3))) }, // [0, 2]
mResourceSystem->getVFS());
std::string model = Misc::ResourceHelpers::correctMeshPath(std::string{
Fallback::Map::getString("Blood_Model_" + std::to_string(Misc::Rng::rollDice(3))) } /*[0, 2]*/);
mRendering->spawnEffect(model, texture, worldPosition, 1.0f, false);
}

@ -159,7 +159,7 @@ std::string Misc::ResourceHelpers::correctActorModelPath(const std::string& resP
return mdlname;
}
std::string Misc::ResourceHelpers::correctMeshPath(std::string_view resPath, const VFS::Manager* vfs)
std::string Misc::ResourceHelpers::correctMeshPath(std::string_view resPath)
{
std::string res = "meshes\\";
res.append(resPath);

@ -33,7 +33,7 @@ namespace Misc
std::string correctActorModelPath(const std::string& resPath, const VFS::Manager* vfs);
// Adds "meshes\\".
std::string correctMeshPath(std::string_view resPath, const VFS::Manager* vfs);
std::string correctMeshPath(std::string_view resPath);
// Adds "sound\\".
std::string correctSoundPath(const std::string& resPath);

Loading…
Cancel
Save