From 3195716a2c7cae7d34c5da5c360cf4c068aa9ba1 Mon Sep 17 00:00:00 2001 From: Nelsson Huotari Date: Tue, 15 Dec 2020 13:49:25 +0200 Subject: [PATCH 1/3] Don't force loop textkey --- components/resource/keyframemanager.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/components/resource/keyframemanager.cpp b/components/resource/keyframemanager.cpp index 41b10bd65..0ffe59712 100644 --- a/components/resource/keyframemanager.cpp +++ b/components/resource/keyframemanager.cpp @@ -40,8 +40,6 @@ namespace Resource std::string animationName = animation->getName(); std::string start = animationName + std::string(": start"); std::string stop = animationName + std::string(": stop"); - std::string loopstart = animationName + std::string(": loop start"); - std::string loopstop = animationName + std::string(": loop stop"); const osgAnimation::ChannelList& channels = animation->getChannels(); for (const auto& channel: channels) @@ -60,8 +58,6 @@ namespace Resource // Keywords can be stuff like Loop, Equip, Unequip, Block, InventoryHandtoHand, InventoryWeaponOneHand, PickProbe, Slash, Thrust, Chop... even "Slash Small Follow" mTarget.mTextKeys.emplace(startTime, std::move(start)); mTarget.mTextKeys.emplace(stopTime, std::move(stop)); - mTarget.mTextKeys.emplace(startTime, std::move(loopstart)); - mTarget.mTextKeys.emplace(stopTime, std::move(loopstop)); SceneUtil::EmulatedAnimation emulatedAnimation; emulatedAnimation.mStartTime = startTime; From 6c1f6169c0e191dd2a6c6414f484e031470a0e96 Mon Sep 17 00:00:00 2001 From: Nelsson Huotari Date: Tue, 15 Dec 2020 13:50:19 +0200 Subject: [PATCH 2/3] Fix root movement glitch --- components/sceneutil/osgacontroller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/sceneutil/osgacontroller.cpp b/components/sceneutil/osgacontroller.cpp index d77b8d666..f0eb7da6f 100644 --- a/components/sceneutil/osgacontroller.cpp +++ b/components/sceneutil/osgacontroller.cpp @@ -117,7 +117,7 @@ namespace SceneUtil //Find the correct animation based on time for (const EmulatedAnimation& emulatedAnimation : mEmulatedAnimations) { - if (time > emulatedAnimation.mStartTime && time < emulatedAnimation.mStopTime) + if (time >= emulatedAnimation.mStartTime && time <= emulatedAnimation.mStopTime) { newTime = time - emulatedAnimation.mStartTime; animationName = emulatedAnimation.mName; From 8b2bf12e8fa55327ac9896c741ef366993a87570 Mon Sep 17 00:00:00 2001 From: Nelsson Huotari Date: Tue, 15 Dec 2020 13:51:49 +0200 Subject: [PATCH 3/3] Use bip01 for root bone name --- apps/openmw/mwrender/animation.cpp | 2 -- components/resource/keyframemanager.cpp | 2 +- components/sceneutil/osgacontroller.cpp | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 8c9f5f493..f8ff3780d 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -782,8 +782,6 @@ namespace MWRender NodeMap::const_iterator found = nodeMap.find("bip01"); if (found == nodeMap.end()) found = nodeMap.find("root bone"); - if (found == nodeMap.end()) - found = nodeMap.find("root"); if (found != nodeMap.end()) mAccumRoot = found->second; diff --git a/components/resource/keyframemanager.cpp b/components/resource/keyframemanager.cpp index 0ffe59712..d739392e8 100644 --- a/components/resource/keyframemanager.cpp +++ b/components/resource/keyframemanager.cpp @@ -21,7 +21,7 @@ namespace Resource void RetrieveAnimationsVisitor::apply(osg::Node& node) { - if (node.libraryName() == std::string("osgAnimation") && node.className() == std::string("Bone") && node.getName() == std::string("root")) + if (node.libraryName() == std::string("osgAnimation") && node.className() == std::string("Bone") && node.getName() == std::string("bip01")) { osg::ref_ptr callback = new SceneUtil::OsgAnimationController(); diff --git a/components/sceneutil/osgacontroller.cpp b/components/sceneutil/osgacontroller.cpp index f0eb7da6f..37aa525af 100644 --- a/components/sceneutil/osgacontroller.cpp +++ b/components/sceneutil/osgacontroller.cpp @@ -83,7 +83,7 @@ namespace SceneUtil { osgAnimation::UpdateMatrixTransform* umt = dynamic_cast(cb); if (umt) - if (node.getName() != "root") link(umt); + if (node.getName() != "bip01") link(umt); cb = cb->getNestedCallback(); } @@ -133,7 +133,7 @@ namespace SceneUtil for (const auto& channel: channels) { - if (channel->getTargetName() != "root" || channel->getName() != "transform") continue; + if (channel->getTargetName() != "bip01" || channel->getName() != "transform") continue; if ( osgAnimation::MatrixLinearSampler* templateSampler = dynamic_cast (channel->getSampler()) ) {