mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-20 07:41:33 +00:00
Read BSAnimNote/BSAnimNotes
This commit is contained in:
parent
c5a11f0c9f
commit
5f4a0c3bf1
7 changed files with 67 additions and 3 deletions
|
@ -122,11 +122,13 @@ namespace Nif
|
||||||
mStringPalette.read(nif);
|
mStringPalette.read(nif);
|
||||||
else if (nif->getVersion() >= NIFFile::NIFVersion::VER_BGS && nif->getBethVersion() >= 24)
|
else if (nif->getVersion() >= NIFFile::NIFVersion::VER_BGS && nif->getBethVersion() >= 24)
|
||||||
{
|
{
|
||||||
uint16_t numAnimNotes = 1;
|
|
||||||
if (nif->getBethVersion() >= 29)
|
if (nif->getBethVersion() >= 29)
|
||||||
nif->read(numAnimNotes);
|
mAnimNotesList.resize(nif->get<uint16_t>());
|
||||||
|
else
|
||||||
|
mAnimNotesList.resize(1);
|
||||||
|
|
||||||
nif->skip(4 * numAnimNotes); // BSAnimNotes links
|
for (auto& notes : mAnimNotesList)
|
||||||
|
notes.read(nif);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ namespace Nif
|
||||||
bool mPlayBackwards{ false };
|
bool mPlayBackwards{ false };
|
||||||
NiControllerManagerPtr mManager;
|
NiControllerManagerPtr mManager;
|
||||||
NiStringPalettePtr mStringPalette;
|
NiStringPalettePtr mStringPalette;
|
||||||
|
BSAnimNotesList mAnimNotesList;
|
||||||
|
|
||||||
void read(NIFStream* nif) override;
|
void read(NIFStream* nif) override;
|
||||||
void post(Reader& nif) override;
|
void post(Reader& nif) override;
|
||||||
|
|
|
@ -614,4 +614,31 @@ namespace Nif
|
||||||
nif->read(mSphere);
|
nif->read(mSphere);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BSAnimNote::read(NIFStream* nif)
|
||||||
|
{
|
||||||
|
mType = static_cast<Type>(nif->get<uint32_t>());
|
||||||
|
nif->read(mTime);
|
||||||
|
if (mType == Type::GrabIK)
|
||||||
|
{
|
||||||
|
nif->read(mArm);
|
||||||
|
}
|
||||||
|
else if (mType == Type::LookIK)
|
||||||
|
{
|
||||||
|
nif->read(mGain);
|
||||||
|
nif->read(mState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSAnimNotes::read(NIFStream* nif)
|
||||||
|
{
|
||||||
|
mList.resize(nif->get<uint16_t>());
|
||||||
|
for (auto& note : mList)
|
||||||
|
note.read(nif);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSAnimNotes::post(Reader& nif)
|
||||||
|
{
|
||||||
|
postRecordList(nif, mList);
|
||||||
|
}
|
||||||
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
|
|
|
@ -449,5 +449,31 @@ namespace Nif
|
||||||
void read(NIFStream* nif) override;
|
void read(NIFStream* nif) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct BSAnimNote : public Record
|
||||||
|
{
|
||||||
|
enum class Type : uint32_t
|
||||||
|
{
|
||||||
|
Invalid = 0,
|
||||||
|
GrabIK = 1,
|
||||||
|
LookIK = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
Type mType;
|
||||||
|
float mTime;
|
||||||
|
uint32_t mArm;
|
||||||
|
float mGain;
|
||||||
|
uint32_t mState;
|
||||||
|
|
||||||
|
void read(NIFStream* nif) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BSAnimNotes : public Record
|
||||||
|
{
|
||||||
|
BSAnimNoteList mList;
|
||||||
|
|
||||||
|
void read(NIFStream* nif) override;
|
||||||
|
void post(Reader& nif) override;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -212,6 +212,8 @@ namespace Nif
|
||||||
{ "NiTransformData", &construct<NiKeyframeData, RC_NiKeyframeData> },
|
{ "NiTransformData", &construct<NiKeyframeData, RC_NiKeyframeData> },
|
||||||
|
|
||||||
// Bethesda
|
// Bethesda
|
||||||
|
{ "BSAnimNote", &construct<BSAnimNote, RC_BSAnimNote> },
|
||||||
|
{ "BSAnimNotes", &construct<BSAnimNotes, RC_BSAnimNotes> },
|
||||||
{ "BSPackedAdditionalGeometryData",
|
{ "BSPackedAdditionalGeometryData",
|
||||||
&construct<NiAdditionalGeometryData, RC_BSPackedAdditionalGeometryData> },
|
&construct<NiAdditionalGeometryData, RC_BSPackedAdditionalGeometryData> },
|
||||||
{ "BSShaderTextureSet", &construct<BSShaderTextureSet, RC_BSShaderTextureSet> },
|
{ "BSShaderTextureSet", &construct<BSShaderTextureSet, RC_BSShaderTextureSet> },
|
||||||
|
|
|
@ -73,6 +73,8 @@ namespace Nif
|
||||||
RC_bhkSimpleShapePhantom,
|
RC_bhkSimpleShapePhantom,
|
||||||
RC_bhkSphereShape,
|
RC_bhkSphereShape,
|
||||||
RC_bhkStiffSpringConstraint,
|
RC_bhkStiffSpringConstraint,
|
||||||
|
RC_BSAnimNote,
|
||||||
|
RC_BSAnimNotes,
|
||||||
RC_BSBehaviorGraphExtraData,
|
RC_BSBehaviorGraphExtraData,
|
||||||
RC_BSBound,
|
RC_BSBound,
|
||||||
RC_BSBoneLODExtraData,
|
RC_BSBoneLODExtraData,
|
||||||
|
|
|
@ -165,6 +165,8 @@ namespace Nif
|
||||||
struct BSMultiBound;
|
struct BSMultiBound;
|
||||||
struct BSMultiBoundData;
|
struct BSMultiBoundData;
|
||||||
struct BSSkinBoneData;
|
struct BSSkinBoneData;
|
||||||
|
struct BSAnimNote;
|
||||||
|
struct BSAnimNotes;
|
||||||
|
|
||||||
using NiAVObjectPtr = RecordPtrT<NiAVObject>;
|
using NiAVObjectPtr = RecordPtrT<NiAVObject>;
|
||||||
using ExtraPtr = RecordPtrT<Extra>;
|
using ExtraPtr = RecordPtrT<Extra>;
|
||||||
|
@ -231,6 +233,8 @@ namespace Nif
|
||||||
using NiControllerSequenceList = RecordListT<NiControllerSequence>;
|
using NiControllerSequenceList = RecordListT<NiControllerSequence>;
|
||||||
using NiPSysModifierList = RecordListT<NiPSysModifier>;
|
using NiPSysModifierList = RecordListT<NiPSysModifier>;
|
||||||
using NiTriBasedGeomList = RecordListT<NiTriBasedGeom>;
|
using NiTriBasedGeomList = RecordListT<NiTriBasedGeom>;
|
||||||
|
using BSAnimNoteList = RecordListT<BSAnimNote>;
|
||||||
|
using BSAnimNotesList = RecordListT<BSAnimNotes>;
|
||||||
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue