2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2015-08-14 03:00:51 +00:00
|
|
|
|
|
|
|
#include "DNAMP2.hpp"
|
2018-06-29 20:21:36 +00:00
|
|
|
#include "DataSpec/DNACommon/ANIM.hpp"
|
|
|
|
#include "DataSpec/DNACommon/RigInverter.hpp"
|
2015-08-14 03:00:51 +00:00
|
|
|
#include "CINF.hpp"
|
|
|
|
|
2017-12-29 08:08:12 +00:00
|
|
|
namespace DataSpec::DNAMP2
|
2015-08-14 03:00:51 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
struct ANIM : BigDNA
|
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
AT_DECL_EXPLICIT_DNA
|
2015-08-14 03:00:51 +00:00
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
struct IANIM : BigDNAV
|
2015-08-14 03:00:51 +00:00
|
|
|
{
|
|
|
|
Delete expl;
|
|
|
|
atUint32 m_version;
|
|
|
|
IANIM(atUint32 version) : m_version(version) {}
|
|
|
|
|
2015-08-15 04:12:15 +00:00
|
|
|
std::vector<std::pair<atUint32, std::tuple<bool,bool,bool>>> bones;
|
2015-08-14 03:00:51 +00:00
|
|
|
std::vector<atUint32> frames;
|
|
|
|
std::vector<DNAANIM::Channel> channels;
|
|
|
|
std::vector<std::vector<DNAANIM::Value>> chanKeys;
|
|
|
|
float mainInterval = 0.0;
|
2016-09-06 05:52:51 +00:00
|
|
|
bool looping = false;
|
2015-08-14 03:00:51 +00:00
|
|
|
|
2017-12-29 08:08:12 +00:00
|
|
|
void sendANIMToBlender(hecl::blender::PyOutStream&, const DNAANIM::RigInverter<CINF>& rig) const;
|
2015-08-14 03:00:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ANIM0 : IANIM
|
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
AT_DECL_EXPLICIT_DNA
|
|
|
|
AT_DECL_DNAV
|
2015-08-14 03:00:51 +00:00
|
|
|
ANIM0() : IANIM(0) {}
|
|
|
|
|
|
|
|
struct Header : BigDNA
|
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
AT_DECL_DNA
|
2015-08-14 03:00:51 +00:00
|
|
|
Value<float> duration;
|
|
|
|
Value<atUint32> unk0;
|
|
|
|
Value<float> interval;
|
|
|
|
Value<atUint32> unk1;
|
|
|
|
Value<atUint32> keyCount;
|
|
|
|
Value<atUint32> unk2;
|
|
|
|
Value<atUint32> boneSlotCount;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ANIM2 : IANIM
|
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
AT_DECL_EXPLICIT_DNA
|
|
|
|
AT_DECL_DNAV
|
2015-08-14 03:00:51 +00:00
|
|
|
ANIM2() : IANIM(2) {}
|
|
|
|
|
|
|
|
struct Header : BigDNA
|
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
AT_DECL_DNA
|
2015-08-14 03:00:51 +00:00
|
|
|
Value<atUint32> scratchSize;
|
2016-08-26 22:23:59 +00:00
|
|
|
Value<atUint16> unk1;
|
2015-08-14 03:00:51 +00:00
|
|
|
Value<float> duration;
|
|
|
|
Value<float> interval;
|
2016-08-26 22:23:59 +00:00
|
|
|
Value<atUint32> rootBoneId = 3;
|
2016-08-27 21:16:44 +00:00
|
|
|
Value<atUint32> looping = 0;
|
2015-08-14 03:00:51 +00:00
|
|
|
Value<atUint32> rotDiv;
|
|
|
|
Value<float> translationMult;
|
2016-08-26 22:23:59 +00:00
|
|
|
Value<float> scaleMult;
|
2015-08-14 03:00:51 +00:00
|
|
|
Value<atUint32> boneChannelCount;
|
2016-08-26 22:23:59 +00:00
|
|
|
Value<atUint32> unk3 = 1;
|
2015-08-14 03:00:51 +00:00
|
|
|
Value<atUint32> keyBitmapBitCount;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ChannelDesc : BigDNA
|
|
|
|
{
|
|
|
|
Delete expl;
|
2015-08-15 04:12:15 +00:00
|
|
|
Value<atUint8> id = 0;
|
2015-08-14 03:00:51 +00:00
|
|
|
Value<atUint16> keyCount1 = 0;
|
2017-02-02 01:54:38 +00:00
|
|
|
Value<atInt16> initRX = 0;
|
2015-08-14 03:00:51 +00:00
|
|
|
Value<atUint8> qRX = 0;
|
2017-02-02 01:54:38 +00:00
|
|
|
Value<atInt16> initRY = 0;
|
2015-08-14 03:00:51 +00:00
|
|
|
Value<atUint8> qRY = 0;
|
2017-02-02 01:54:38 +00:00
|
|
|
Value<atInt16> initRZ = 0;
|
2015-08-14 03:00:51 +00:00
|
|
|
Value<atUint8> qRZ = 0;
|
|
|
|
Value<atUint16> keyCount2 = 0;
|
2017-02-02 01:54:38 +00:00
|
|
|
Value<atInt16> initTX = 0;
|
2015-08-14 03:00:51 +00:00
|
|
|
Value<atUint8> qTX = 0;
|
2017-02-02 01:54:38 +00:00
|
|
|
Value<atInt16> initTY = 0;
|
2015-08-14 03:00:51 +00:00
|
|
|
Value<atUint8> qTY = 0;
|
2017-02-02 01:54:38 +00:00
|
|
|
Value<atInt16> initTZ = 0;
|
2015-08-14 03:00:51 +00:00
|
|
|
Value<atUint8> qTZ = 0;
|
2015-08-15 04:12:15 +00:00
|
|
|
Value<atUint16> keyCount3 = 0;
|
2017-02-02 01:54:38 +00:00
|
|
|
Value<atInt16> initSX = 0;
|
2015-08-15 04:12:15 +00:00
|
|
|
Value<atUint8> qSX = 0;
|
2017-02-02 01:54:38 +00:00
|
|
|
Value<atInt16> initSY = 0;
|
2015-08-15 04:12:15 +00:00
|
|
|
Value<atUint8> qSY = 0;
|
2017-02-02 01:54:38 +00:00
|
|
|
Value<atInt16> initSZ = 0;
|
2015-08-15 04:12:15 +00:00
|
|
|
Value<atUint8> qSZ = 0;
|
2015-08-14 03:00:51 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void read(athena::io::IStreamReader& reader)
|
2015-08-14 03:00:51 +00:00
|
|
|
{
|
2015-08-15 04:12:15 +00:00
|
|
|
id = reader.readUByte();
|
2015-08-14 03:00:51 +00:00
|
|
|
keyCount1 = reader.readUint16Big();
|
2015-08-15 04:12:15 +00:00
|
|
|
if (keyCount1)
|
|
|
|
{
|
2017-02-02 01:54:38 +00:00
|
|
|
initRX = reader.readInt16Big();
|
2015-08-15 04:12:15 +00:00
|
|
|
qRX = reader.readUByte();
|
2017-02-02 01:54:38 +00:00
|
|
|
initRY = reader.readInt16Big();
|
2015-08-15 04:12:15 +00:00
|
|
|
qRY = reader.readUByte();
|
2017-02-02 01:54:38 +00:00
|
|
|
initRZ = reader.readInt16Big();
|
2015-08-15 04:12:15 +00:00
|
|
|
qRZ = reader.readUByte();
|
|
|
|
}
|
2015-08-14 03:00:51 +00:00
|
|
|
keyCount2 = reader.readUint16Big();
|
|
|
|
if (keyCount2)
|
|
|
|
{
|
2017-02-02 01:54:38 +00:00
|
|
|
initTX = reader.readInt16Big();
|
2015-08-14 03:00:51 +00:00
|
|
|
qTX = reader.readUByte();
|
2017-02-02 01:54:38 +00:00
|
|
|
initTY = reader.readInt16Big();
|
2015-08-14 03:00:51 +00:00
|
|
|
qTY = reader.readUByte();
|
2017-02-02 01:54:38 +00:00
|
|
|
initTZ = reader.readInt16Big();
|
2015-08-14 03:00:51 +00:00
|
|
|
qTZ = reader.readUByte();
|
|
|
|
}
|
2015-08-15 04:12:15 +00:00
|
|
|
keyCount3 = reader.readUint16Big();
|
|
|
|
if (keyCount3)
|
|
|
|
{
|
2017-02-02 01:54:38 +00:00
|
|
|
initSX = reader.readInt16Big();
|
2015-08-15 04:12:15 +00:00
|
|
|
qSX = reader.readUByte();
|
2017-02-02 01:54:38 +00:00
|
|
|
initSY = reader.readInt16Big();
|
2015-08-15 04:12:15 +00:00
|
|
|
qSY = reader.readUByte();
|
2017-02-02 01:54:38 +00:00
|
|
|
initSZ = reader.readInt16Big();
|
2015-08-15 04:12:15 +00:00
|
|
|
qSZ = reader.readUByte();
|
|
|
|
}
|
2015-08-14 03:00:51 +00:00
|
|
|
}
|
2016-03-04 23:04:53 +00:00
|
|
|
void write(athena::io::IStreamWriter& writer) const
|
2015-08-14 03:00:51 +00:00
|
|
|
{
|
2015-08-15 04:12:15 +00:00
|
|
|
writer.writeUByte(id);
|
2015-08-14 03:00:51 +00:00
|
|
|
writer.writeUint16Big(keyCount1);
|
2015-08-15 04:12:15 +00:00
|
|
|
if (keyCount1)
|
|
|
|
{
|
2017-02-02 01:54:38 +00:00
|
|
|
writer.writeInt16Big(initRX);
|
2015-08-15 04:12:15 +00:00
|
|
|
writer.writeUByte(qRX);
|
2017-02-02 01:54:38 +00:00
|
|
|
writer.writeInt16Big(initRY);
|
2015-08-15 04:12:15 +00:00
|
|
|
writer.writeUByte(qRY);
|
2017-02-02 01:54:38 +00:00
|
|
|
writer.writeInt16Big(initRZ);
|
2015-08-15 04:12:15 +00:00
|
|
|
writer.writeUByte(qRZ);
|
|
|
|
}
|
2015-08-14 03:00:51 +00:00
|
|
|
writer.writeUint16Big(keyCount2);
|
|
|
|
if (keyCount2)
|
|
|
|
{
|
2017-02-02 01:54:38 +00:00
|
|
|
writer.writeInt16Big(initTX);
|
2015-08-14 03:00:51 +00:00
|
|
|
writer.writeUByte(qTX);
|
2017-02-02 01:54:38 +00:00
|
|
|
writer.writeInt16Big(initTY);
|
2015-08-14 03:00:51 +00:00
|
|
|
writer.writeUByte(qTY);
|
2017-02-02 01:54:38 +00:00
|
|
|
writer.writeInt16Big(initTZ);
|
2015-08-14 03:00:51 +00:00
|
|
|
writer.writeUByte(qTZ);
|
|
|
|
}
|
2015-08-15 04:12:15 +00:00
|
|
|
writer.writeUint16Big(keyCount3);
|
|
|
|
if (keyCount3)
|
|
|
|
{
|
2017-02-02 01:54:38 +00:00
|
|
|
writer.writeInt16Big(initSX);
|
2015-08-15 04:12:15 +00:00
|
|
|
writer.writeUByte(qSX);
|
2017-02-02 01:54:38 +00:00
|
|
|
writer.writeInt16Big(initSY);
|
2015-08-15 04:12:15 +00:00
|
|
|
writer.writeUByte(qSY);
|
2017-02-02 01:54:38 +00:00
|
|
|
writer.writeInt16Big(initSZ);
|
2015-08-15 04:12:15 +00:00
|
|
|
writer.writeUByte(qSZ);
|
|
|
|
}
|
2015-08-14 03:00:51 +00:00
|
|
|
}
|
2015-10-18 04:08:45 +00:00
|
|
|
size_t binarySize(size_t __isz) const
|
|
|
|
{
|
|
|
|
__isz += 7;
|
|
|
|
if (keyCount1)
|
|
|
|
__isz += 9;
|
|
|
|
if (keyCount2)
|
|
|
|
__isz += 9;
|
|
|
|
if (keyCount3)
|
|
|
|
__isz += 9;
|
|
|
|
return __isz;
|
|
|
|
}
|
2015-08-14 03:00:51 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
std::unique_ptr<IANIM> m_anim;
|
2015-10-18 04:08:45 +00:00
|
|
|
|
2017-12-29 08:08:12 +00:00
|
|
|
void sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter<CINF>& rig, bool) const
|
2015-08-14 03:00:51 +00:00
|
|
|
{
|
2016-04-07 03:40:25 +00:00
|
|
|
m_anim->sendANIMToBlender(os, rig);
|
2015-08-14 03:00:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|