From b4552d47f6e9f70d2b17c607210fd4840d592df0 Mon Sep 17 00:00:00 2001 From: Petr Mikheev Date: Fri, 6 Oct 2023 15:41:51 +0200 Subject: [PATCH] Don't use ESM4 mHeadFeamleParts; switch from manually adding "meshes\\" to `correctMeshPath` --- apps/openmw/mwclass/esm4npc.cpp | 9 ++++++--- apps/openmw/mwrender/esm4npcanimation.cpp | 6 ++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwclass/esm4npc.cpp b/apps/openmw/mwclass/esm4npc.cpp index 8bca91a519..c5857c489a 100644 --- a/apps/openmw/mwclass/esm4npc.cpp +++ b/apps/openmw/mwclass/esm4npc.cpp @@ -8,6 +8,8 @@ #include #include +#include + #include "../mwworld/customdata.hpp" #include "../mwworld/esmstore.hpp" @@ -146,12 +148,13 @@ namespace MWClass if (!ptr.getRefData().getCustomData()) return ""; const ESM4NpcCustomData& data = ptr.getRefData().getCustomData()->asESM4NpcCustomData(); + const VFS::Manager* vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); if (data.mTraits->mIsTES4) - return "meshes\\" + data.mTraits->mModel; + return Misc::ResourceHelpers::correctMeshPath(data.mTraits->mModel, vfs); if (data.mIsFemale) - return "meshes\\" + data.mRace->mModelFemale; + return Misc::ResourceHelpers::correctMeshPath(data.mRace->mModelFemale, vfs); else - return "meshes\\" + data.mRace->mModelMale; + return Misc::ResourceHelpers::correctMeshPath(data.mRace->mModelMale, vfs); } std::string_view ESM4Npc::getName(const MWWorld::ConstPtr& ptr) const diff --git a/apps/openmw/mwrender/esm4npcanimation.cpp b/apps/openmw/mwrender/esm4npcanimation.cpp index 0a4d3c9b64..a7e311b388 100644 --- a/apps/openmw/mwrender/esm4npcanimation.cpp +++ b/apps/openmw/mwrender/esm4npcanimation.cpp @@ -22,9 +22,7 @@ namespace MWRender const MWWorld::Ptr& ptr, osg::ref_ptr parentNode, Resource::ResourceSystem* resourceSystem) : Animation(ptr, std::move(parentNode), resourceSystem) { - std::string smodel - = Misc::ResourceHelpers::correctMeshPath(mPtr.getClass().getModel(mPtr), mResourceSystem->getVFS()); - setObjectRoot(smodel, true, true, false); + setObjectRoot(mPtr.getClass().getModel(mPtr), true, true, false); updateParts(); } @@ -71,7 +69,7 @@ namespace MWRender for (const ESM4::Race::BodyPart& bodyPart : (isFemale ? race->mBodyPartsFemale : race->mBodyPartsMale)) insertPart(bodyPart.mesh); - for (const ESM4::Race::BodyPart& bodyPart : (isFemale ? race->mHeadPartsFemale : race->mHeadParts)) + for (const ESM4::Race::BodyPart& bodyPart : race->mHeadParts) insertPart(bodyPart.mesh); if (!traits->mHair.isZeroOrUnset()) {