|
|
@ -153,14 +153,15 @@ template<typename T, T (NIFStream::*getValue)()>
|
|
|
|
struct KeyListT {
|
|
|
|
struct KeyListT {
|
|
|
|
typedef std::vector< KeyT<T> > VecType;
|
|
|
|
typedef std::vector< KeyT<T> > VecType;
|
|
|
|
|
|
|
|
|
|
|
|
static const int sLinearInterpolation = 1;
|
|
|
|
static const unsigned int sLinearInterpolation = 1;
|
|
|
|
static const int sQuadraticInterpolation = 2;
|
|
|
|
static const unsigned int sQuadraticInterpolation = 2;
|
|
|
|
static const int sTBCInterpolation = 3;
|
|
|
|
static const unsigned int sTBCInterpolation = 3;
|
|
|
|
static const int sXYZInterpolation = 4;
|
|
|
|
static const unsigned int sXYZInterpolation = 4;
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int mInterpolationType;
|
|
|
|
unsigned int mInterpolationType;
|
|
|
|
VecType mKeys;
|
|
|
|
VecType mKeys;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Read in a KeyGroup (see http://niftools.sourceforge.net/doc/nif/NiKeyframeData.html)
|
|
|
|
void read(NIFStream *nif, bool force=false)
|
|
|
|
void read(NIFStream *nif, bool force=false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
assert(nif);
|
|
|
|
assert(nif);
|
|
|
@ -193,20 +194,22 @@ struct KeyListT {
|
|
|
|
readTBC(nifReference, key);
|
|
|
|
readTBC(nifReference, key);
|
|
|
|
mKeys.push_back(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)
|
|
|
|
else if(mInterpolationType == sXYZInterpolation)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//Don't try to read XYZ keys into the wrong part
|
|
|
|
//Don't try to read XYZ keys into the wrong part
|
|
|
|
if(force)
|
|
|
|
if ( count != 1 )
|
|
|
|
{
|
|
|
|
|
|
|
|
readTimeAndValue(nifReference, key);
|
|
|
|
|
|
|
|
mKeys.push_back(key);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ( count != 1 )
|
|
|
|
|
|
|
|
nif->file->fail("XYZ_ROTATION_KEY count should always be '1' . Retrieved Value: "+Ogre::StringConverter::toString(count));
|
|
|
|
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)
|
|
|
|
if (count != 0)
|
|
|
|
nif->file->fail("Interpolation type 0 doesn't work with keys");
|
|
|
|
nif->file->fail("Interpolation type 0 doesn't work with keys");
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
nif->file->fail("Unhandled interpolation type: "+Ogre::StringConverter::toString(mInterpolationType));
|
|
|
|
nif->file->fail("Unhandled interpolation type: "+Ogre::StringConverter::toString(mInterpolationType));
|
|
|
|
}
|
|
|
|
}
|
|
|
|