From 6b48acaf0e29232150c9beaf3faaf4fe97c44672 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 1 Feb 2016 21:01:17 +0100 Subject: [PATCH] Don't optimize TriShapes with controllers (Fixes #3143) --- components/nifosg/nifloader.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 5c28bbc7e..f4dae52c3 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -394,7 +394,10 @@ namespace NifOsg if (node->getDataVariance() == osg::Object::STATIC // For TriShapes, we can only collapse the node, but not completely remove it, // if the link to animated collision shapes is supposed to stay intact. - && (nifNode->recType != Nif::RC_NiTriShape || !skipMeshes)) + && (nifNode->recType != Nif::RC_NiTriShape || !skipMeshes) + // Don't optimize drawables with controllers, that creates issues when we want to deep copy controllers without deep copying the drawable that holds the controller. + // A deep copy of controllers may be needed to independently animate multiple copies of the same mesh. + && !node->getUpdateCallback()) { if (node->getNumParents() && nifNode->trafo.isIdentity()) {