1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-28 21:09:42 +00:00

Unify first/third-person animation choice logic (#8179)

Re-enable first-person female/beast-specific animations
Use dehardcoded argonian swim animation path
This commit is contained in:
Alexei Kotov 2024-09-28 12:35:45 +03:00
parent ac21cf3bb3
commit 963b7ec742

View file

@ -484,15 +484,24 @@ namespace MWRender
bool is1stPerson = mViewMode == VM_FirstPerson; bool is1stPerson = mViewMode == VM_FirstPerson;
bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0; bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0;
std::string_view base;
if (!isWerewolf)
{
if (!is1stPerson)
base = Settings::models().mXbaseanim.get().value();
else
base = Settings::models().mXbaseanim1st.get().value();
}
const std::string defaultSkeleton = Misc::ResourceHelpers::correctActorModelPath( const std::string defaultSkeleton = Misc::ResourceHelpers::correctActorModelPath(
getActorSkeleton(is1stPerson, isFemale, isBeast, isWerewolf), mResourceSystem->getVFS()); getActorSkeleton(is1stPerson, isFemale, isBeast, isWerewolf), mResourceSystem->getVFS());
std::string smodel = defaultSkeleton; std::string smodel = defaultSkeleton;
bool isBase = !isWerewolf; bool isCustomModel = false;
if (!is1stPerson && !isWerewolf && !mNpc->mModel.empty()) if (!is1stPerson && !isWerewolf && !mNpc->mModel.empty())
{ {
std::string model = Misc::ResourceHelpers::correctMeshPath(mNpc->mModel); std::string model = Misc::ResourceHelpers::correctMeshPath(mNpc->mModel);
isBase = isDefaultActorSkeleton(model); isCustomModel = !isDefaultActorSkeleton(model);
smodel = Misc::ResourceHelpers::correctActorModelPath(model, mResourceSystem->getVFS()); smodel = Misc::ResourceHelpers::correctActorModelPath(model, mResourceSystem->getVFS());
} }
@ -500,33 +509,21 @@ namespace MWRender
updateParts(); updateParts();
if (!is1stPerson) if (!base.empty())
{
const std::string& base = Settings::models().mXbaseanim.get().value();
if (!isWerewolf)
addAnimSource(base, smodel); addAnimSource(base, smodel);
if (!isBase) if (defaultSkeleton != base)
{
addAnimSource(defaultSkeleton, smodel); addAnimSource(defaultSkeleton, smodel);
addAnimSource(smodel, smodel);
}
else if (base != defaultSkeleton)
{
addAnimSource(defaultSkeleton, smodel);
}
if (!isWerewolf && isBeast && mNpc->mRace.contains("argonian")) if (isCustomModel)
addAnimSource("meshes\\xargonian_swimkna.nif", smodel);
}
else
{
if (!isWerewolf)
addAnimSource(Settings::models().mXbaseanim1st.get().value(), smodel);
if (!isBase)
addAnimSource(smodel, smodel); addAnimSource(smodel, smodel);
const bool customArgonianSwim = !is1stPerson && !isWerewolf && isBeast && mNpc->mRace.contains("argonian");
if (customArgonianSwim)
addAnimSource(Settings::models().mXargonianswimkna.get().value(), smodel);
if (is1stPerson)
{
mObjectRoot->setNodeMask(Mask_FirstPerson); mObjectRoot->setNodeMask(Mask_FirstPerson);
mObjectRoot->addCullCallback(new OverrideFieldOfViewCallback(mFirstPersonFieldOfView)); mObjectRoot->addCullCallback(new OverrideFieldOfViewCallback(mFirstPersonFieldOfView));
} }