mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 08:53:52 +00:00
Merge branch 'fixosga' into 'master'
Fix collada animation issues See merge request OpenMW/openmw!467
This commit is contained in:
commit
ecdd5f1437
3 changed files with 4 additions and 10 deletions
|
@ -782,8 +782,6 @@ namespace MWRender
|
||||||
NodeMap::const_iterator found = nodeMap.find("bip01");
|
NodeMap::const_iterator found = nodeMap.find("bip01");
|
||||||
if (found == nodeMap.end())
|
if (found == nodeMap.end())
|
||||||
found = nodeMap.find("root bone");
|
found = nodeMap.find("root bone");
|
||||||
if (found == nodeMap.end())
|
|
||||||
found = nodeMap.find("root");
|
|
||||||
|
|
||||||
if (found != nodeMap.end())
|
if (found != nodeMap.end())
|
||||||
mAccumRoot = found->second;
|
mAccumRoot = found->second;
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace Resource
|
||||||
|
|
||||||
void RetrieveAnimationsVisitor::apply(osg::Node& node)
|
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();
|
osg::ref_ptr<SceneUtil::OsgAnimationController> callback = new SceneUtil::OsgAnimationController();
|
||||||
|
|
||||||
|
@ -40,8 +40,6 @@ namespace Resource
|
||||||
std::string animationName = animation->getName();
|
std::string animationName = animation->getName();
|
||||||
std::string start = animationName + std::string(": start");
|
std::string start = animationName + std::string(": start");
|
||||||
std::string stop = animationName + std::string(": stop");
|
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();
|
const osgAnimation::ChannelList& channels = animation->getChannels();
|
||||||
for (const auto& channel: channels)
|
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"
|
// 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(startTime, std::move(start));
|
||||||
mTarget.mTextKeys.emplace(stopTime, std::move(stop));
|
mTarget.mTextKeys.emplace(stopTime, std::move(stop));
|
||||||
mTarget.mTextKeys.emplace(startTime, std::move(loopstart));
|
|
||||||
mTarget.mTextKeys.emplace(stopTime, std::move(loopstop));
|
|
||||||
|
|
||||||
SceneUtil::EmulatedAnimation emulatedAnimation;
|
SceneUtil::EmulatedAnimation emulatedAnimation;
|
||||||
emulatedAnimation.mStartTime = startTime;
|
emulatedAnimation.mStartTime = startTime;
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace SceneUtil
|
||||||
{
|
{
|
||||||
osgAnimation::UpdateMatrixTransform* umt = dynamic_cast<osgAnimation::UpdateMatrixTransform*>(cb);
|
osgAnimation::UpdateMatrixTransform* umt = dynamic_cast<osgAnimation::UpdateMatrixTransform*>(cb);
|
||||||
if (umt)
|
if (umt)
|
||||||
if (node.getName() != "root") link(umt);
|
if (node.getName() != "bip01") link(umt);
|
||||||
cb = cb->getNestedCallback();
|
cb = cb->getNestedCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ namespace SceneUtil
|
||||||
//Find the correct animation based on time
|
//Find the correct animation based on time
|
||||||
for (const EmulatedAnimation& emulatedAnimation : mEmulatedAnimations)
|
for (const EmulatedAnimation& emulatedAnimation : mEmulatedAnimations)
|
||||||
{
|
{
|
||||||
if (time > emulatedAnimation.mStartTime && time < emulatedAnimation.mStopTime)
|
if (time >= emulatedAnimation.mStartTime && time <= emulatedAnimation.mStopTime)
|
||||||
{
|
{
|
||||||
newTime = time - emulatedAnimation.mStartTime;
|
newTime = time - emulatedAnimation.mStartTime;
|
||||||
animationName = emulatedAnimation.mName;
|
animationName = emulatedAnimation.mName;
|
||||||
|
@ -133,7 +133,7 @@ namespace SceneUtil
|
||||||
|
|
||||||
for (const auto& channel: channels)
|
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()) )
|
if ( osgAnimation::MatrixLinearSampler* templateSampler = dynamic_cast<osgAnimation::MatrixLinearSampler*> (channel->getSampler()) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue