1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 07:53:53 +00:00

Use correctMeshPath instead of string constants

This commit is contained in:
uramer 2022-05-13 19:28:53 +02:00
parent 1fb136a417
commit fd7965d77f
32 changed files with 103 additions and 56 deletions

View file

@ -122,7 +122,7 @@ namespace NavMeshTool
{ {
try try
{ {
return bulletShapeManager.getShape("meshes/" + model); return bulletShapeManager.getShape(Misc::ResourceHelpers::correctMeshPath(model, &vfs));
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {

View file

@ -60,7 +60,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }
@ -145,7 +145,8 @@ namespace MWClass
for (const ESM::Creature &iter : store.get<ESM::Creature>()) for (const ESM::Creature &iter : store.get<ESM::Creature>())
{ {
if (!iter.mModel.empty() && Misc::StringUtils::ciEqual(model, "meshes\\" + iter.mModel)) if (!iter.mModel.empty() && Misc::StringUtils::ciEqual(model,
MWBase::Environment::get().getWindowManager()->correctMeshPath(iter.mModel)))
{ {
creatureId = !iter.mOriginal.empty() ? iter.mOriginal : iter.mId; creatureId = !iter.mOriginal.empty() ? iter.mOriginal : iter.mId;
break; break;

View file

@ -38,7 +38,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }

View file

@ -46,7 +46,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }

View file

@ -5,6 +5,9 @@
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
namespace MWClass namespace MWClass
{ {
BodyPart::BodyPart() BodyPart::BodyPart()
@ -42,7 +45,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }

View file

@ -43,7 +43,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }

View file

@ -41,7 +41,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }

View file

@ -123,7 +123,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }

View file

@ -184,7 +184,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }
@ -626,7 +626,8 @@ namespace MWClass
for (const ESM::Creature &creature : store.get<ESM::Creature>()) for (const ESM::Creature &creature : store.get<ESM::Creature>())
{ {
if (creature.mId != ourId && creature.mOriginal != ourId && !creature.mModel.empty() if (creature.mId != ourId && creature.mOriginal != ourId && !creature.mModel.empty()
&& Misc::StringUtils::ciEqual(model, "meshes\\" + creature.mModel)) && Misc::StringUtils::ciEqual(model,
MWBase::Environment::get().getWindowManager()->correctMeshPath(creature.mModel)))
{ {
const std::string& fallbackId = !creature.mOriginal.empty() ? creature.mOriginal : creature.mId; const std::string& fallbackId = !creature.mOriginal.empty() ? creature.mOriginal : creature.mId;
sound = store.get<ESM::SoundGenerator>().begin(); sound = store.get<ESM::SoundGenerator>().begin();

View file

@ -99,7 +99,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }

View file

@ -40,7 +40,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }

View file

@ -71,7 +71,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }

View file

@ -40,7 +40,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }

View file

@ -50,7 +50,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }

View file

@ -443,19 +443,19 @@ namespace MWClass
models.emplace_back(Settings::Manager::getString("xbaseanim", "Models")); models.emplace_back(Settings::Manager::getString("xbaseanim", "Models"));
if (!npc->mBase->mModel.empty()) if (!npc->mBase->mModel.empty())
models.push_back("meshes/"+npc->mBase->mModel); models.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(npc->mBase->mModel));
if (!npc->mBase->mHead.empty()) if (!npc->mBase->mHead.empty())
{ {
const ESM::BodyPart* head = MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>().search(npc->mBase->mHead); const ESM::BodyPart* head = MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>().search(npc->mBase->mHead);
if (head) if (head)
models.push_back("meshes/"+head->mModel); models.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(head->mModel));
} }
if (!npc->mBase->mHair.empty()) if (!npc->mBase->mHair.empty())
{ {
const ESM::BodyPart* hair = MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>().search(npc->mBase->mHair); const ESM::BodyPart* hair = MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>().search(npc->mBase->mHair);
if (hair) if (hair)
models.push_back("meshes/"+hair->mModel); models.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(hair->mModel));
} }
bool female = (npc->mBase->mFlags & ESM::NPC::Female); bool female = (npc->mBase->mFlags & ESM::NPC::Female);
@ -493,7 +493,7 @@ namespace MWClass
partname = female ? it->mMale : it->mFemale; partname = female ? it->mMale : it->mFemale;
const ESM::BodyPart* part = MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>().search(partname); const ESM::BodyPart* part = MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>().search(partname);
if (part && !part->mModel.empty()) if (part && !part->mModel.empty())
models.push_back("meshes/"+part->mModel); models.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(part->mModel));
} }
} }
} }
@ -506,7 +506,7 @@ namespace MWClass
{ {
const ESM::BodyPart* part = *it; const ESM::BodyPart* part = *it;
if (part && !part->mModel.empty()) if (part && !part->mModel.empty())
models.push_back("meshes/"+part->mModel); models.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(part->mModel));
} }
} }

View file

@ -42,7 +42,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }

View file

@ -40,7 +40,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }

View file

@ -37,7 +37,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }

View file

@ -11,6 +11,9 @@
#include "../mwrender/renderinginterface.hpp" #include "../mwrender/renderinginterface.hpp"
#include "../mwrender/vismask.hpp" #include "../mwrender/vismask.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
namespace MWClass namespace MWClass
{ {
Static::Static() Static::Static()
@ -43,7 +46,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }

View file

@ -46,7 +46,7 @@ namespace MWClass
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
return "meshes\\" + model; return MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
} }
return ""; return "";
} }

View file

@ -17,6 +17,7 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwrender/animation.hpp" #include "../mwrender/animation.hpp"
@ -261,7 +262,9 @@ namespace MWMechanics
const ESM::Static* reflectStatic = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>().find("VFX_Reflect"); const ESM::Static* reflectStatic = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>().find("VFX_Reflect");
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(ptr); MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(ptr);
if(animation && !reflectStatic->mModel.empty()) if(animation && !reflectStatic->mModel.empty())
animation->addEffect("meshes\\" + reflectStatic->mModel, ESM::MagicEffect::Reflect, false, std::string()); animation->addEffect(
MWBase::Environment::get().getWindowManager()->correctMeshPath(reflectStatic->mModel),
ESM::MagicEffect::Reflect, false, std::string());
caster.getClass().getCreatureStats(caster).getActiveSpells().addSpell(*reflected); caster.getClass().getCreatureStats(caster).getActiveSpells().addSpell(*reflected);
} }
if(removedSpell) if(removedSpell)

View file

@ -203,7 +203,9 @@ void soulTrap(const MWWorld::Ptr& creature)
const ESM::Static* fx = world->getStore().get<ESM::Static>() const ESM::Static* fx = world->getStore().get<ESM::Static>()
.search("VFX_Soul_Trap"); .search("VFX_Soul_Trap");
if (fx) if (fx)
world->spawnEffect("meshes\\" + fx->mModel, "", creature.getRefData().getPosition().asVec3()); world->spawnEffect(
MWBase::Environment::get().getWindowManager()->correctMeshPath(fx->mModel),
"", creature.getRefData().getPosition().asVec3());
MWBase::Environment::get().getSoundManager()->playSound3D(creature.getRefData().getPosition().asVec3(), "conjuration hit", 1.f, 1.f); MWBase::Environment::get().getSoundManager()->playSound3D(creature.getRefData().getPosition().asVec3(), "conjuration hit", 1.f, 1.f);
return; //remove to get vanilla behaviour return; //remove to get vanilla behaviour
@ -1745,7 +1747,8 @@ namespace MWMechanics
const ESM::Static* fx = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>() const ESM::Static* fx = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>()
.search("VFX_Summon_End"); .search("VFX_Summon_End");
if (fx) if (fx)
MWBase::Environment::get().getWorld()->spawnEffect("meshes\\" + fx->mModel, MWBase::Environment::get().getWorld()->spawnEffect(
MWBase::Environment::get().getWindowManager()->correctMeshPath(fx->mModel),
"", ptr.getRefData().getPosition().asVec3()); "", ptr.getRefData().getPosition().asVec3());
// Remove the summoned creature's summoned creatures as well // Remove the summoned creature's summoned creatures as well

View file

@ -1433,10 +1433,14 @@ bool CharacterController::updateState(CharacterState idle)
for (size_t iter = 0; iter < effects.size(); ++iter) // play hands vfx for each effect for (size_t iter = 0; iter < effects.size(); ++iter) // play hands vfx for each effect
{ {
if (mAnimation->getNode("Bip01 L Hand")) if (mAnimation->getNode("Bip01 L Hand"))
mAnimation->addEffect("meshes\\" + castStatic->mModel, -1, false, "Bip01 L Hand", effect->mParticle); mAnimation->addEffect(
MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel),
-1, false, "Bip01 L Hand", effect->mParticle);
if (mAnimation->getNode("Bip01 R Hand")) if (mAnimation->getNode("Bip01 R Hand"))
mAnimation->addEffect("meshes\\" + castStatic->mModel, -1, false, "Bip01 R Hand", effect->mParticle); mAnimation->addEffect(
MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel),
-1, false, "Bip01 R Hand", effect->mParticle);
} }
const ESM::ENAMstruct &firstEffect = effects.at(0); // first effect used for casting animation const ESM::ENAMstruct &firstEffect = effects.at(0); // first effect used for casting animation

View file

@ -476,13 +476,17 @@ namespace MWMechanics
castStatic = store.get<ESM::Static>().find ("VFX_DefaultCast"); castStatic = store.get<ESM::Static>().find ("VFX_DefaultCast");
// check if the effect was already added // check if the effect was already added
if (std::find(addedEffects.begin(), addedEffects.end(), "meshes\\" + castStatic->mModel) != addedEffects.end()) if (std::find(addedEffects.begin(), addedEffects.end(),
MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel))
!= addedEffects.end())
continue; continue;
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(mCaster); MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(mCaster);
if (animation) if (animation)
{ {
animation->addEffect("meshes\\" + castStatic->mModel, effect->mIndex, false, "", effect->mParticle); animation->addEffect(
MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel),
effect->mIndex, false, "", effect->mParticle);
} }
else else
{ {
@ -511,7 +515,9 @@ namespace MWMechanics
scale *= npcScaleVec.z(); scale *= npcScaleVec.z();
} }
scale = std::max(scale, 1.f); scale = std::max(scale, 1.f);
MWBase::Environment::get().getWorld()->spawnEffect("meshes\\" + castStatic->mModel, effect->mParticle, pos, scale); MWBase::Environment::get().getWorld()->spawnEffect(
MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel),
effect->mParticle, pos, scale);
} }
if (animation && !mCaster.getClass().isActor()) if (animation && !mCaster.getClass().isActor())
@ -521,7 +527,7 @@ namespace MWMechanics
"alteration", "conjuration", "destruction", "illusion", "mysticism", "restoration" "alteration", "conjuration", "destruction", "illusion", "mysticism", "restoration"
}; };
addedEffects.push_back("meshes\\" + castStatic->mModel); addedEffects.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel));
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager(); MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
if(!effect->mCastSound.empty()) if(!effect->mCastSound.empty())
@ -559,7 +565,9 @@ namespace MWMechanics
{ {
// Don't play particle VFX unless the effect is new or it should be looping. // Don't play particle VFX unless the effect is new or it should be looping.
if (playNonLooping || loop) if (playNonLooping || loop)
anim->addEffect("meshes\\" + castStatic->mModel, magicEffect.mIndex, loop, "", magicEffect.mParticle); anim->addEffect(
MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel),
magicEffect.mIndex, loop, "", magicEffect.mParticle);
} }
} }
} }

View file

@ -272,7 +272,9 @@ namespace
const ESM::Static* absorbStatic = esmStore.get<ESM::Static>().find("VFX_Absorb"); const ESM::Static* absorbStatic = esmStore.get<ESM::Static>().find("VFX_Absorb");
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target); MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target);
if (animation && !absorbStatic->mModel.empty()) if (animation && !absorbStatic->mModel.empty())
animation->addEffect( "meshes\\" + absorbStatic->mModel, ESM::MagicEffect::SpellAbsorption, false, std::string()); animation->addEffect(
MWBase::Environment::get().getWindowManager()->correctMeshPath(absorbStatic->mModel),
ESM::MagicEffect::SpellAbsorption, false, std::string());
const ESM::Spell* spell = esmStore.get<ESM::Spell>().search(spellId); const ESM::Spell* spell = esmStore.get<ESM::Spell>().search(spellId);
int spellCost = 0; int spellCost = 0;
if (spell) if (spell)
@ -430,7 +432,7 @@ void applyMagicEffect(const MWWorld::Ptr& target, const MWWorld::Ptr& caster, co
anim->removeEffect(effect.mEffectId); anim->removeEffect(effect.mEffectId);
const ESM::Static* fx = world->getStore().get<ESM::Static>().search("VFX_Summon_end"); const ESM::Static* fx = world->getStore().get<ESM::Static>().search("VFX_Summon_end");
if (fx) if (fx)
anim->addEffect("meshes\\" + fx->mModel, -1); anim->addEffect(MWBase::Environment::get().getWindowManager()->correctMeshPath(fx->mModel), -1);
} }
} }
else if (caster == getPlayer()) else if (caster == getPlayer())

View file

@ -5,6 +5,7 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwworld/esmstore.hpp" #include "../mwworld/esmstore.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
@ -85,7 +86,7 @@ namespace MWMechanics
{ {
const ESM::Static* fx = world->getStore().get<ESM::Static>().search("VFX_Summon_Start"); const ESM::Static* fx = world->getStore().get<ESM::Static>().search("VFX_Summon_Start");
if (fx) if (fx)
anim->addEffect("meshes\\" + fx->mModel, -1, false); anim->addEffect(MWBase::Environment::get().getWindowManager()->correctMeshPath(fx->mModel), -1, false);
} }
} }
catch (std::exception& e) catch (std::exception& e)

View file

@ -24,6 +24,7 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
@ -127,7 +128,7 @@ std::string ActorAnimation::getShieldMesh(const MWWorld::ConstPtr& shield, bool
if (bodypart == nullptr || bodypart->mData.mType != ESM::BodyPart::MT_Armor) if (bodypart == nullptr || bodypart->mData.mType != ESM::BodyPart::MT_Armor)
return std::string(); return std::string();
if (!bodypart->mModel.empty()) if (!bodypart->mModel.empty())
return "meshes\\" + bodypart->mModel; return MWBase::Environment::get().getWindowManager()->correctMeshPath(bodypart->mModel);
} }
} }
} }

View file

@ -39,6 +39,7 @@
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "camera.hpp" #include "camera.hpp"
#include "rotatecontroller.hpp" #include "rotatecontroller.hpp"
@ -80,7 +81,7 @@ std::string getVampireHead(const std::string& race, bool female)
const ESM::BodyPart* bodyPart = sVampireMapping[thisCombination]; const ESM::BodyPart* bodyPart = sVampireMapping[thisCombination];
if (!bodyPart) if (!bodyPart)
return std::string(); return std::string();
return "meshes\\" + bodyPart->mModel; return MWBase::Environment::get().getWindowManager()->correctMeshPath(bodyPart->mModel);
} }
} }
@ -467,7 +468,7 @@ void NpcAnimation::updateNpcBase()
{ {
const ESM::BodyPart* bp = store.get<ESM::BodyPart>().search(headName); const ESM::BodyPart* bp = store.get<ESM::BodyPart>().search(headName);
if (bp) if (bp)
mHeadModel = "meshes\\" + bp->mModel; mHeadModel = MWBase::Environment::get().getWindowManager()->correctMeshPath(bp->mModel);
else else
Log(Debug::Warning) << "Warning: Failed to load body part '" << headName << "'"; Log(Debug::Warning) << "Warning: Failed to load body part '" << headName << "'";
} }
@ -476,7 +477,7 @@ void NpcAnimation::updateNpcBase()
{ {
const ESM::BodyPart* bp = store.get<ESM::BodyPart>().search(hairName); const ESM::BodyPart* bp = store.get<ESM::BodyPart>().search(hairName);
if (bp) if (bp)
mHairModel = "meshes\\" + bp->mModel; mHairModel = MWBase::Environment::get().getWindowManager()->correctMeshPath(bp->mModel);
else else
Log(Debug::Warning) << "Warning: Failed to load body part '" << hairName << "'"; Log(Debug::Warning) << "Warning: Failed to load body part '" << hairName << "'";
} }
@ -493,7 +494,8 @@ void NpcAnimation::updateNpcBase()
std::string smodel = defaultSkeleton; std::string smodel = defaultSkeleton;
if (!is1stPerson && !isWerewolf && !mNpc->mModel.empty()) if (!is1stPerson && !isWerewolf && !mNpc->mModel.empty())
smodel = Misc::ResourceHelpers::correctActorModelPath("meshes\\" + mNpc->mModel, mResourceSystem->getVFS()); smodel = Misc::ResourceHelpers::correctActorModelPath(
MWBase::Environment::get().getWindowManager()->correctMeshPath(mNpc->mModel), mResourceSystem->getVFS());
setObjectRoot(smodel, true, true, false); setObjectRoot(smodel, true, true, false);
@ -653,8 +655,8 @@ void NpcAnimation::updateParts()
if(store != inv.end() && (part=*store).getType() == ESM::Light::sRecordId) if(store != inv.end() && (part=*store).getType() == ESM::Light::sRecordId)
{ {
const ESM::Light *light = part.get<ESM::Light>()->mBase; const ESM::Light *light = part.get<ESM::Light>()->mBase;
addOrReplaceIndividualPart(ESM::PRT_Shield, MWWorld::InventoryStore::Slot_CarriedLeft, addOrReplaceIndividualPart(ESM::PRT_Shield, MWWorld::InventoryStore::Slot_CarriedLeft, 1,
1, "meshes\\"+light->mModel, false, nullptr, true); MWBase::Environment::get().getWindowManager()->correctMeshPath(light->mModel), false, nullptr, true);
if (mObjectParts[ESM::PRT_Shield]) if (mObjectParts[ESM::PRT_Shield])
addExtraLight(mObjectParts[ESM::PRT_Shield]->getNode()->asGroup(), light); addExtraLight(mObjectParts[ESM::PRT_Shield]->getNode()->asGroup(), light);
} }
@ -674,7 +676,7 @@ void NpcAnimation::updateParts()
const ESM::BodyPart* bodypart = parts[part]; const ESM::BodyPart* bodypart = parts[part];
if(bodypart) if(bodypart)
addOrReplaceIndividualPart((ESM::PartReferenceType)part, -1, 1, addOrReplaceIndividualPart((ESM::PartReferenceType)part, -1, 1,
"meshes\\"+bodypart->mModel); MWBase::Environment::get().getWindowManager()->correctMeshPath(bodypart->mModel));
} }
} }
@ -904,7 +906,8 @@ void NpcAnimation::addPartGroup(int group, int priority, const std::vector<ESM::
} }
if(bodypart) if(bodypart)
addOrReplaceIndividualPart((ESM::PartReferenceType)part.mPart, group, priority, "meshes\\"+bodypart->mModel, enchantedGlow, glowColor); addOrReplaceIndividualPart((ESM::PartReferenceType)part.mPart, group, priority,
MWBase::Environment::get().getWindowManager()->correctMeshPath(bodypart->mModel), enchantedGlow, glowColor);
else else
reserveIndividualPart((ESM::PartReferenceType)part.mPart, group, priority); reserveIndividualPart((ESM::PartReferenceType)part.mPart, group, priority);
} }

View file

@ -31,6 +31,7 @@
#include "apps/openmw/mwworld/esmstore.hpp" #include "apps/openmw/mwworld/esmstore.hpp"
#include "apps/openmw/mwbase/environment.hpp" #include "apps/openmw/mwbase/environment.hpp"
#include "apps/openmw/mwbase/world.hpp" #include "apps/openmw/mwbase/world.hpp"
#include "apps/openmw/mwbase/windowmanager.hpp"
#include "vismask.hpp" #include "vismask.hpp"
@ -528,7 +529,7 @@ namespace MWRender
int type = store.findStatic(ref.mRefID); int type = store.findStatic(ref.mRefID);
std::string model = getModel(type, ref.mRefID, store); std::string model = getModel(type, ref.mRefID, store);
if (model.empty()) continue; if (model.empty()) continue;
model = "meshes/" + model; model = MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
if (activeGrid && type != ESM::REC_STAT) if (activeGrid && type != ESM::REC_STAT)
{ {

View file

@ -4,6 +4,9 @@
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
#include <components/esm3/readerscache.hpp> #include <components/esm3/readerscache.hpp>
#include <apps/openmw/mwbase/environment.hpp>
#include <apps/openmw/mwbase/windowmanager.hpp>
namespace MWWorld namespace MWWorld
{ {
void GroundcoverStore::init(const Store<ESM::Static>& statics, const Files::Collections& fileCollections, const std::vector<std::string>& groundcoverFiles, ToUTF8::Utf8Encoder* encoder) void GroundcoverStore::init(const Store<ESM::Static>& statics, const Files::Collections& fileCollections, const std::vector<std::string>& groundcoverFiles, ToUTF8::Utf8Encoder* encoder)
@ -18,13 +21,15 @@ namespace MWWorld
for (const ESM::Static& stat : statics) for (const ESM::Static& stat : statics)
{ {
std::string id = Misc::StringUtils::lowerCase(stat.mId); std::string id = Misc::StringUtils::lowerCase(stat.mId);
mMeshCache[id] = "meshes\\" + Misc::StringUtils::lowerCase(stat.mModel); mMeshCache[id] = Misc::StringUtils::lowerCase(
MWBase::Environment::get().getWindowManager()->correctMeshPath(stat.mModel));
} }
for (const ESM::Static& stat : content.mStatics) for (const ESM::Static& stat : content.mStatics)
{ {
std::string id = Misc::StringUtils::lowerCase(stat.mId); std::string id = Misc::StringUtils::lowerCase(stat.mId);
mMeshCache[id] = "meshes\\" + Misc::StringUtils::lowerCase(stat.mModel); mMeshCache[id] = Misc::StringUtils::lowerCase(
MWBase::Environment::get().getWindowManager()->correctMeshPath(stat.mModel));
} }
for (const ESM::Cell& cell : content.mCells) for (const ESM::Cell& cell : content.mCells)

View file

@ -32,6 +32,7 @@
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwmechanics/combat.hpp" #include "../mwmechanics/combat.hpp"
#include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/creaturestats.hpp"
@ -218,7 +219,8 @@ namespace MWWorld
SceneUtil::FindByNameVisitor findVisitor(nodeName.str()); SceneUtil::FindByNameVisitor findVisitor(nodeName.str());
attachTo->accept(findVisitor); attachTo->accept(findVisitor);
if (findVisitor.mFoundNode) if (findVisitor.mFoundNode)
mResourceSystem->getSceneManager()->getInstance("meshes\\" + weapon->mModel, findVisitor.mFoundNode); mResourceSystem->getSceneManager()->getInstance(
MWBase::Environment::get().getWindowManager()->correctMeshPath(weapon->mModel), findVisitor.mFoundNode);
} }
if (createLight) if (createLight)
@ -318,7 +320,8 @@ namespace MWWorld
// in case there are multiple effects, the model is a dummy without geometry. Use the second effect for physics shape // in case there are multiple effects, the model is a dummy without geometry. Use the second effect for physics shape
if (state.mIdMagic.size() > 1) if (state.mIdMagic.size() > 1)
model = "meshes\\" + MWBase::Environment::get().getWorld()->getStore().get<ESM::Weapon>().find(state.mIdMagic[1])->mModel; model = MWBase::Environment::get().getWindowManager()->correctMeshPath(
MWBase::Environment::get().getWorld()->getStore().get<ESM::Weapon>().find(state.mIdMagic[1])->mModel);
state.mProjectileId = mPhysics->addProjectile(caster, pos, model, true); state.mProjectileId = mPhysics->addProjectile(caster, pos, model, true);
state.mToDelete = false; state.mToDelete = false;
mMagicBolts.push_back(state); mMagicBolts.push_back(state);

View file

@ -3683,7 +3683,8 @@ namespace MWWorld
if (texture.empty()) if (texture.empty())
texture = Fallback::Map::getString("Blood_Texture_0"); texture = Fallback::Map::getString("Blood_Texture_0");
std::string model = "meshes\\" + Fallback::Map::getString("Blood_Model_" + std::to_string(Misc::Rng::rollDice(3))); // [0, 2] std::string model = MWBase::Environment::get().getWindowManager()->correctMeshPath(
Fallback::Map::getString("Blood_Model_" + std::to_string(Misc::Rng::rollDice(3)))); // [0, 2]
mRendering->spawnEffect(model, texture, worldPosition, 1.0f, false); mRendering->spawnEffect(model, texture, worldPosition, 1.0f, false);
} }
@ -3722,11 +3723,15 @@ namespace MWWorld
if (effectInfo.mArea <= 0) if (effectInfo.mArea <= 0)
{ {
if (effectInfo.mRange == ESM::RT_Target) if (effectInfo.mRange == ESM::RT_Target)
mRendering->spawnEffect("meshes\\" + areaStatic->mModel, texture, origin, 1.0f); mRendering->spawnEffect(
MWBase::Environment::get().getWindowManager()->correctMeshPath(areaStatic->mModel),
texture, origin, 1.0f);
continue; continue;
} }
else else
mRendering->spawnEffect("meshes\\" + areaStatic->mModel, texture, origin, static_cast<float>(effectInfo.mArea * 2)); mRendering->spawnEffect(
MWBase::Environment::get().getWindowManager()->correctMeshPath(areaStatic->mModel),
texture, origin, static_cast<float>(effectInfo.mArea * 2));
// Play explosion sound (make sure to use NoTrack, since we will delete the projectile now) // Play explosion sound (make sure to use NoTrack, since we will delete the projectile now)
static const std::string schools[] = { static const std::string schools[] = {