1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-02 18:41:33 +00:00

Fix NiSkinData loading for >4.2.1.0

This commit is contained in:
Alexei Dobrohotov 2023-05-23 00:58:59 +03:00
parent 1b5e904285
commit a983977e6a

View file

@ -338,9 +338,9 @@ namespace Nif
&& nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 0))
partitions.read(nif);
// Has vertex weights flag
if (nif->getVersion() > NIFStream::generateVersion(4, 2, 1, 0) && !nif->getBoolean())
return;
bool hasVertexWeights = true;
if (nif->getVersion() > NIFStream::generateVersion(4, 2, 1, 0))
hasVertexWeights = nif->getBoolean();
bones.resize(boneNum);
for (BoneInfo& bi : bones)
@ -351,8 +351,12 @@ namespace Nif
bi.boundSphereCenter = nif->getVector3();
bi.boundSphereRadius = nif->getFloat();
// Number of vertex weights
bi.weights.resize(nif->getUShort());
size_t numVertices = nif->getUShort();
if (!hasVertexWeights)
continue;
bi.weights.resize(numVertices);
for (size_t j = 0; j < bi.weights.size(); j++)
{
bi.weights[j].vertex = nif->getUShort();