From 7e0df01c836868bc39badd6fd9753ed8d3228850 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 26 Jul 2018 14:43:18 +0400 Subject: [PATCH 1/2] Do not optimize animated shapes (bug #3950) --- CHANGELOG.md | 1 + components/nifosg/nifloader.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1f00cccd..1fa1329a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Bug #3876: Landscape texture painting is misaligned Bug #3897: Have Goodbye give all choices the effects of Goodbye Bug #3911: [macOS] Typing in the "Content List name" dialog box produces double characters + Bug #3950: FLATTEN_STATIC_TRANSFORMS optimization breaks animated collision shapes Bug #3993: Terrain texture blending map is not upscaled Bug #3997: Almalexia doesn't pace Bug #4036: Weird behaviour of AI packages if package target has non-unique ID diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index aada21fce..8353779a8 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -547,6 +547,11 @@ namespace NifOsg node->setDataVariance(osg::Object::DYNAMIC); } + if (nifNode->recType == Nif::RC_NiTriShape && isAnimated) // the same thing for animated NiTriShapes + { + node->setDataVariance(osg::Object::DYNAMIC); + } + osg::ref_ptr composite = new SceneUtil::CompositeStateSetUpdater; applyNodeProperties(nifNode, node, composite, imageManager, boundTextures, animflags); From bc82dbbd1bb58596fa3499f415357dcf22001639 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 28 Jul 2018 16:18:51 +0400 Subject: [PATCH 2/2] Do not try to find missing animated collision shape again and again --- apps/openmw/mwphysics/physicssystem.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index e2fa7be54..ae8d76a80 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -626,7 +626,6 @@ namespace MWPhysics assert (mShapeInstance->getCollisionShape()->isCompound()); btCompoundShape* compound = static_cast(mShapeInstance->getCollisionShape()); - for (std::map::const_iterator it = mShapeInstance->mAnimatedShapes.begin(); it != mShapeInstance->mAnimatedShapes.end(); ++it) { int recIndex = it->first; @@ -640,6 +639,9 @@ namespace MWPhysics if (!visitor.mFound) { std::cerr << "Error: animateCollisionShapes can't find node " << recIndex << " for " << mPtr.getCellRef().getRefId() << std::endl; + + // Remove nonexistent nodes from animated shapes map and early out + mShapeInstance->mAnimatedShapes.erase(recIndex); return; } osg::NodePath nodePath = visitor.mFoundPath;