1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-17 10:21:11 +00:00

NpcAnimation: Assign parent animation time sources to body part controllers (bug #4822)

This commit is contained in:
Alexei Kotov 2023-12-13 20:59:31 +03:00
parent 7e3270abc9
commit 2628b02b4e
4 changed files with 5 additions and 5 deletions

View File

@ -14,6 +14,7 @@
Bug #4743: PlayGroup doesn't play non-looping animations correctly Bug #4743: PlayGroup doesn't play non-looping animations correctly
Bug #4754: Stack of ammunition cannot be equipped partially Bug #4754: Stack of ammunition cannot be equipped partially
Bug #4816: GetWeaponDrawn returns 1 before weapon is attached Bug #4816: GetWeaponDrawn returns 1 before weapon is attached
Bug #4822: Non-weapon equipment and body parts can't inherit time from parent animation
Bug #5057: Weapon swing sound plays at same pitch whether it hits or misses Bug #5057: Weapon swing sound plays at same pitch whether it hits or misses
Bug #5062: Root bone rotations for NPC animation don't work the same as for creature animation Bug #5062: Root bone rotations for NPC animation don't work the same as for creature animation
Bug #5066: Quirks with starting and stopping scripted animations Bug #5066: Quirks with starting and stopping scripted animations

View File

@ -315,6 +315,7 @@ namespace MWRender
if (node == nullptr) if (node == nullptr)
return; return;
// This is used to avoid playing animations intended for equipped weapons on holstered weapons.
SceneUtil::ForceControllerSourcesVisitor removeVisitor(std::make_shared<NullAnimationTime>()); SceneUtil::ForceControllerSourcesVisitor removeVisitor(std::make_shared<NullAnimationTime>());
node->accept(removeVisitor); node->accept(removeVisitor);
} }
@ -346,9 +347,7 @@ namespace MWRender
if (mesh.empty() || boneName.empty()) if (mesh.empty() || boneName.empty())
return; return;
// If the scabbard is not found, use a weapon mesh as fallback. // If the scabbard is not found, use the weapon mesh as fallback.
// Note: it is unclear how to handle time for controllers attached to bodyparts, so disable them for now.
// We use the similar approach for other bodyparts.
scabbardName = scabbardName.replace(scabbardName.size() - 4, 4, "_sh.nif"); scabbardName = scabbardName.replace(scabbardName.size() - 4, 4, "_sh.nif");
bool isEnchanted = !weapon->getClass().getEnchantment(*weapon).empty(); bool isEnchanted = !weapon->getClass().getEnchantment(*weapon).empty();
if (!mResourceSystem->getVFS()->exists(scabbardName)) if (!mResourceSystem->getVFS()->exists(scabbardName))

View File

@ -168,7 +168,7 @@ namespace MWRender
if (slot == MWWorld::InventoryStore::Slot_CarriedRight) if (slot == MWWorld::InventoryStore::Slot_CarriedRight)
source = mWeaponAnimationTime; source = mWeaponAnimationTime;
else else
source = std::make_shared<NullAnimationTime>(); source = mAnimationTimePtr[0];
SceneUtil::AssignControllerSourcesVisitor assignVisitor(source); SceneUtil::AssignControllerSourcesVisitor assignVisitor(source);
attached->accept(assignVisitor); attached->accept(assignVisitor);

View File

@ -851,7 +851,7 @@ namespace MWRender
if (type == ESM::PRT_Weapon) if (type == ESM::PRT_Weapon)
src = mWeaponAnimationTime; src = mWeaponAnimationTime;
else else
src = std::make_shared<NullAnimationTime>(); src = mAnimationTimePtr[0];
SceneUtil::AssignControllerSourcesVisitor assignVisitor(src); SceneUtil::AssignControllerSourcesVisitor assignVisitor(src);
node->accept(assignVisitor); node->accept(assignVisitor);
} }