|
|
|
@ -7,43 +7,6 @@
|
|
|
|
|
|
|
|
|
|
namespace Nif
|
|
|
|
|
{
|
|
|
|
|
void NiSkinInstance::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
data.read(nif);
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 101))
|
|
|
|
|
partitions.read(nif);
|
|
|
|
|
root.read(nif);
|
|
|
|
|
readRecordList(nif, bones);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiSkinInstance::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
data.post(nif);
|
|
|
|
|
partitions.post(nif);
|
|
|
|
|
root.post(nif);
|
|
|
|
|
postRecordList(nif, bones);
|
|
|
|
|
|
|
|
|
|
if (data.empty() || root.empty())
|
|
|
|
|
throw Nif::Exception("NiSkinInstance missing root or data", nif.getFilename());
|
|
|
|
|
|
|
|
|
|
if (bones.size() != data->bones.size())
|
|
|
|
|
throw Nif::Exception("Mismatch in NiSkinData bone count", nif.getFilename());
|
|
|
|
|
|
|
|
|
|
for (auto& bone : bones)
|
|
|
|
|
{
|
|
|
|
|
if (bone.empty())
|
|
|
|
|
throw Nif::Exception("Oops: Missing bone! Don't know how to handle this.", nif.getFilename());
|
|
|
|
|
bone->setBone();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BSDismemberSkinInstance::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiSkinInstance::read(nif);
|
|
|
|
|
unsigned int numPartitions = nif->getUInt();
|
|
|
|
|
nif->skip(4 * numPartitions); // Body part information
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiGeometryData::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 114))
|
|
|
|
@ -121,6 +84,7 @@ namespace Nif
|
|
|
|
|
void NiTriBasedGeomData::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiGeometryData::read(nif);
|
|
|
|
|
|
|
|
|
|
mNumTriangles = nif->getUShort();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -174,6 +138,7 @@ namespace Nif
|
|
|
|
|
void NiLinesData::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiGeometryData::read(nif);
|
|
|
|
|
|
|
|
|
|
size_t num = vertices.size();
|
|
|
|
|
std::vector<uint8_t> flags;
|
|
|
|
|
nif->readVector(flags, num);
|
|
|
|
@ -326,6 +291,48 @@ namespace Nif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiSkinInstance::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
mData.read(nif);
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 101))
|
|
|
|
|
mPartitions.read(nif);
|
|
|
|
|
mRoot.read(nif);
|
|
|
|
|
readRecordList(nif, mBones);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiSkinInstance::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
mData.post(nif);
|
|
|
|
|
mPartitions.post(nif);
|
|
|
|
|
mRoot.post(nif);
|
|
|
|
|
postRecordList(nif, mBones);
|
|
|
|
|
|
|
|
|
|
if (mData.empty() || mRoot.empty())
|
|
|
|
|
throw Nif::Exception("NiSkinInstance missing root or data", nif.getFilename());
|
|
|
|
|
|
|
|
|
|
if (mBones.size() != mData->bones.size())
|
|
|
|
|
throw Nif::Exception("Mismatch in NiSkinData bone count", nif.getFilename());
|
|
|
|
|
|
|
|
|
|
for (auto& bone : mBones)
|
|
|
|
|
{
|
|
|
|
|
if (bone.empty())
|
|
|
|
|
throw Nif::Exception("Oops: Missing bone! Don't know how to handle this.", nif.getFilename());
|
|
|
|
|
bone->setBone();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BSDismemberSkinInstance::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiSkinInstance::read(nif);
|
|
|
|
|
|
|
|
|
|
mParts.resize(nif->get<uint32_t>());
|
|
|
|
|
for (BodyPart& part : mParts)
|
|
|
|
|
{
|
|
|
|
|
nif->read(part.mFlags);
|
|
|
|
|
nif->read(part.mType);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiSkinData::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
trafo.rotation = nif->getMatrix3();
|
|
|
|
|