mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-16 16:20:53 +00:00
Merge branch 'fixosga' into 'master'
Fix collada animation issues See merge request OpenMW/openmw!467
This commit is contained in:
commit
ecdd5f1437
@ -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;
|
||||
|
@ -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<SceneUtil::OsgAnimationController> callback = new SceneUtil::OsgAnimationController();
|
||||
|
||||
@ -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;
|
||||
|
@ -83,7 +83,7 @@ namespace SceneUtil
|
||||
{
|
||||
osgAnimation::UpdateMatrixTransform* umt = dynamic_cast<osgAnimation::UpdateMatrixTransform*>(cb);
|
||||
if (umt)
|
||||
if (node.getName() != "root") link(umt);
|
||||
if (node.getName() != "bip01") link(umt);
|
||||
cb = cb->getNestedCallback();
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -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<osgAnimation::MatrixLinearSampler*> (channel->getSampler()) )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user