From f9f278f6450a80bebbc50cc459054a4e113d2677 Mon Sep 17 00:00:00 2001 From: Arthur Moore Date: Fri, 6 Jun 2014 07:00:04 -0400 Subject: [PATCH] Fixed a capitalization error. Changed Interpolations to unsigned. Also explained what's happening in the comments. --- components/nif/data.hpp | 2 +- components/nif/niffile.hpp | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/components/nif/data.hpp b/components/nif/data.hpp index 998c88748..e94388768 100644 --- a/components/nif/data.hpp +++ b/components/nif/data.hpp @@ -428,7 +428,7 @@ struct NiKeyframeData : public Record for(size_t i=0;i<3;++i) { //Read concatenates items together. - mXYZ_keys.read(nif,true); + mXYZ_Keys.read(nif,true); } nif->file->warn("XYZ_ROTATION_KEY read, but not used!"); } diff --git a/components/nif/niffile.hpp b/components/nif/niffile.hpp index 5ef8179d5..daec80ea1 100644 --- a/components/nif/niffile.hpp +++ b/components/nif/niffile.hpp @@ -153,14 +153,15 @@ template struct KeyListT { typedef std::vector< KeyT > VecType; - static const int sLinearInterpolation = 1; - static const int sQuadraticInterpolation = 2; - static const int sTBCInterpolation = 3; - static const int sXYZInterpolation = 4; + static const unsigned int sLinearInterpolation = 1; + static const unsigned int sQuadraticInterpolation = 2; + static const unsigned int sTBCInterpolation = 3; + static const unsigned int sXYZInterpolation = 4; unsigned int mInterpolationType; VecType mKeys; + //Read in a KeyGroup (see http://niftools.sourceforge.net/doc/nif/NiKeyframeData.html) void read(NIFStream *nif, bool force=false) { assert(nif); @@ -193,20 +194,22 @@ struct KeyListT { readTBC(nifReference, key); mKeys.push_back(key); } + //XYZ keys aren't actually read here. + //data.hpp sees that the last type read was sXYZInterpolation and: + // Eats a floating point number, then + // Re-runs the read function 3 more times, with force enabled so that the previous values aren't cleared. + // When it does that it's reading in a bunch of sLinearInterpolation keys, not sXYZInterpolation. else if(mInterpolationType == sXYZInterpolation) { //Don't try to read XYZ keys into the wrong part - if(force) - { - readTimeAndValue(nifReference, key); - mKeys.push_back(key); - } - else if ( count != 1 ) + if ( count != 1 ) nif->file->fail("XYZ_ROTATION_KEY count should always be '1' . Retrieved Value: "+Ogre::StringConverter::toString(count)); } - else if ((0 == mInterpolationType)) + else if (0 == mInterpolationType) + { if (count != 0) nif->file->fail("Interpolation type 0 doesn't work with keys"); + } else nif->file->fail("Unhandled interpolation type: "+Ogre::StringConverter::toString(mInterpolationType)); }