Rotations for KeyframeData in NIFs should be optional
An example of affected mesh: PlanetTaris.nif
Our current code assumes that rotation keys for all three directions should present:
void NiKeyframeData::read(NIFStream *nif)
{
mRotations = std::make_shared<QuaternionKeyMap>();
mRotations->read(nif);
if(mRotations->mInterpolationType == InterpolationType_XYZ)
{
//Chomp unused float
if (nif->getVersion() <= NIFStream::generateVersion(10,1,0,0))
nif->getFloat();
mXRotations = std::make_shared<FloatKeyMap>();
mYRotations = std::make_shared<FloatKeyMap>();
mZRotations = std::make_shared<FloatKeyMap>();
mXRotations->read(nif, true);
mYRotations->read(nif, true);
mZRotations->read(nif, true);
}
mTranslations = std::make_shared<Vector3KeyMap>();
mTranslations->read(nif);
mScales = std::make_shared<FloatKeyMap>();
mScales->read(nif);
}
But attached mesh has only Z keys, so data parsing goes wrong in OpenMW. vanilla engine and NifSkope load the mesh fine.
Removing optional "true" arguments (which force further parsing even if there is no data) allows attached mesh to load, but it is an old code and changing it may have side effects.
Edited by Andrei Kortunov