Merge branch 'avpalette' into 'master'

Read NiDefaultAVObjectPalette

See merge request OpenMW/openmw!2698
7220-lua-add-a-general-purpose-lexical-parser
psi29a 2 years ago
commit 76dfb1b1b4

@ -174,6 +174,7 @@ namespace Nif
{ "NiAlphaAccumulator", &construct<NiAlphaAccumulator, RC_NiAlphaAccumulator> },
{ "NiSequence", &construct<NiSequence, RC_NiSequence> },
{ "NiControllerSequence", &construct<NiControllerSequence, RC_NiControllerSequence> },
{ "NiDefaultAVObjectPalette", &construct<NiDefaultAVObjectPalette, RC_NiDefaultAVObjectPalette> },
};
}

@ -291,4 +291,19 @@ namespace Nif
else
mMode = (flags >> 5) & 0x3;
}
void NiDefaultAVObjectPalette::read(NIFStream* nif)
{
mScene.read(nif);
size_t numObjects = nif->getUInt();
for (size_t i = 0; i < numObjects; i++)
mObjects[nif->getSizedString()].read(nif);
}
void NiDefaultAVObjectPalette::post(Reader& nif)
{
mScene.post(nif);
for (auto& object : mObjects)
object.second.post(nif);
}
}

@ -1,6 +1,8 @@
#ifndef OPENMW_COMPONENTS_NIF_NODE_HPP
#define OPENMW_COMPONENTS_NIF_NODE_HPP
#include <unordered_map>
#include <osg/Plane>
#include "base.hpp"
@ -273,5 +275,14 @@ namespace Nif
void read(NIFStream* nif) override;
};
struct NiDefaultAVObjectPalette : Record
{
NodePtr mScene;
std::unordered_map<std::string, NodePtr> mObjects;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
} // Namespace
#endif

@ -151,6 +151,7 @@ namespace Nif
RC_NiMultiTargetTransformController,
RC_NiSequence,
RC_NiControllerSequence,
RC_NiDefaultAVObjectPalette,
};
/// Base class for all records

Loading…
Cancel
Save