From bc36269617cff8bac9c54bce078c6eea31199bc8 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 26 Mar 2016 14:58:36 +0100 Subject: [PATCH] When a controller is present more than once in the same keyframe file, pick the first one (Fixes #2719) --- 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 0847a368d..9db672d9e 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -333,7 +333,10 @@ namespace NifOsg osg::ref_ptr callback(new NifOsg::KeyframeController(key->data.getPtr())); callback->setFunction(boost::shared_ptr(new NifOsg::ControllerFunction(key))); - target.mKeyframeControllers[strdata->string] = callback; + if (target.mKeyframeControllers.find(strdata->string) != target.mKeyframeControllers.end()) + std::cerr << "Warning: controller " << strdata->string << " present more than once in " << nif->getFilename() << ", ignoring later version" << std::endl; + else + target.mKeyframeControllers[strdata->string] = callback; } }