2015-08-11 23:32:02 +00:00
|
|
|
#ifndef _DNAMP1_ANIM_HPP_
|
|
|
|
#define _DNAMP1_ANIM_HPP_
|
|
|
|
|
2015-08-13 07:29:00 +00:00
|
|
|
#include "BlenderConnection.hpp"
|
2015-08-11 23:32:02 +00:00
|
|
|
#include "DNAMP1.hpp"
|
|
|
|
#include "../DNACommon/ANIM.hpp"
|
2015-08-13 07:29:00 +00:00
|
|
|
#include "CINF.hpp"
|
2015-08-11 23:32:02 +00:00
|
|
|
|
2016-02-13 09:02:47 +00:00
|
|
|
namespace DataSpec
|
2015-08-11 23:32:02 +00:00
|
|
|
{
|
|
|
|
namespace DNAMP1
|
|
|
|
{
|
|
|
|
|
|
|
|
struct ANIM : BigDNA
|
|
|
|
{
|
|
|
|
Delete expl;
|
|
|
|
|
|
|
|
struct IANIM : BigDNA
|
|
|
|
{
|
|
|
|
Delete expl;
|
|
|
|
atUint32 m_version;
|
|
|
|
IANIM(atUint32 version) : m_version(version) {}
|
|
|
|
|
|
|
|
std::vector<std::pair<atUint32, bool>> bones;
|
2015-08-13 21:29:07 +00:00
|
|
|
std::vector<atUint32> frames;
|
2015-08-11 23:32:02 +00:00
|
|
|
std::vector<DNAANIM::Channel> channels;
|
|
|
|
std::vector<std::vector<DNAANIM::Value>> chanKeys;
|
|
|
|
float mainInterval = 0.0;
|
|
|
|
UniqueID32 evnt;
|
2015-08-13 07:29:00 +00:00
|
|
|
|
|
|
|
void sendANIMToBlender(HECL::BlenderConnection::PyOutStream&, const CINF&) const;
|
2015-08-11 23:32:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ANIM0 : IANIM
|
|
|
|
{
|
|
|
|
DECL_EXPLICIT_DNA
|
|
|
|
ANIM0() : IANIM(0) {}
|
|
|
|
|
|
|
|
struct Header : BigDNA
|
|
|
|
{
|
|
|
|
DECL_DNA
|
|
|
|
Value<float> duration;
|
|
|
|
Value<atUint32> unk0;
|
|
|
|
Value<float> interval;
|
|
|
|
Value<atUint32> unk1;
|
|
|
|
Value<atUint32> keyCount;
|
2015-08-14 03:00:51 +00:00
|
|
|
Value<atUint32> unk2;
|
|
|
|
Value<atUint32> boneSlotCount;
|
2015-08-11 23:32:02 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ANIM2 : IANIM
|
|
|
|
{
|
|
|
|
DECL_EXPLICIT_DNA
|
|
|
|
ANIM2() : IANIM(2) {}
|
|
|
|
|
|
|
|
struct Header : BigDNA
|
|
|
|
{
|
|
|
|
DECL_DNA
|
|
|
|
Value<atUint32> scratchSize;
|
|
|
|
UniqueID32 evnt;
|
|
|
|
Value<atUint32> unk0;
|
|
|
|
Value<float> duration;
|
|
|
|
Value<float> interval;
|
|
|
|
Value<atUint32> unk1;
|
|
|
|
Value<atUint32> unk2;
|
|
|
|
Value<atUint32> rotDiv;
|
|
|
|
Value<float> translationMult;
|
|
|
|
Value<atUint32> boneChannelCount;
|
|
|
|
Value<atUint32> unk3;
|
|
|
|
Value<atUint32> keyBitmapBitCount;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ChannelDesc : BigDNA
|
|
|
|
{
|
|
|
|
Delete expl;
|
|
|
|
Value<atUint32> id = 0;
|
|
|
|
Value<atUint16> keyCount1 = 0;
|
|
|
|
Value<atUint16> initRX = 0;
|
|
|
|
Value<atUint8> qRX = 0;
|
|
|
|
Value<atUint16> initRY = 0;
|
|
|
|
Value<atUint8> qRY = 0;
|
|
|
|
Value<atUint16> initRZ = 0;
|
|
|
|
Value<atUint8> qRZ = 0;
|
|
|
|
Value<atUint16> keyCount2 = 0;
|
|
|
|
Value<atUint16> initTX = 0;
|
|
|
|
Value<atUint8> qTX = 0;
|
|
|
|
Value<atUint16> initTY = 0;
|
|
|
|
Value<atUint8> qTY = 0;
|
|
|
|
Value<atUint16> initTZ = 0;
|
|
|
|
Value<atUint8> qTZ = 0;
|
|
|
|
|
|
|
|
void read(Athena::io::IStreamReader& reader)
|
|
|
|
{
|
2015-08-14 03:00:51 +00:00
|
|
|
id = reader.readUint32Big();
|
|
|
|
keyCount1 = reader.readUint16Big();
|
|
|
|
initRX = reader.readUint16Big();
|
2015-08-11 23:32:02 +00:00
|
|
|
qRX = reader.readUByte();
|
2015-08-14 03:00:51 +00:00
|
|
|
initRY = reader.readUint16Big();
|
2015-08-11 23:32:02 +00:00
|
|
|
qRY = reader.readUByte();
|
2015-08-14 03:00:51 +00:00
|
|
|
initRZ = reader.readUint16Big();
|
2015-08-11 23:32:02 +00:00
|
|
|
qRZ = reader.readUByte();
|
2015-08-14 03:00:51 +00:00
|
|
|
keyCount2 = reader.readUint16Big();
|
2015-08-11 23:32:02 +00:00
|
|
|
if (keyCount2)
|
|
|
|
{
|
2015-08-14 03:00:51 +00:00
|
|
|
initTX = reader.readUint16Big();
|
2015-08-11 23:32:02 +00:00
|
|
|
qTX = reader.readUByte();
|
2015-08-14 03:00:51 +00:00
|
|
|
initTY = reader.readUint16Big();
|
2015-08-11 23:32:02 +00:00
|
|
|
qTY = reader.readUByte();
|
2015-08-14 03:00:51 +00:00
|
|
|
initTZ = reader.readUint16Big();
|
2015-08-11 23:32:02 +00:00
|
|
|
qTZ = reader.readUByte();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void write(Athena::io::IStreamWriter& writer) const
|
|
|
|
{
|
2015-08-14 03:00:51 +00:00
|
|
|
writer.writeUint32Big(id);
|
|
|
|
writer.writeUint16Big(keyCount1);
|
|
|
|
writer.writeUint16Big(initRX);
|
2015-08-11 23:32:02 +00:00
|
|
|
writer.writeUByte(qRX);
|
2015-08-14 03:00:51 +00:00
|
|
|
writer.writeUint16Big(initRY);
|
2015-08-11 23:32:02 +00:00
|
|
|
writer.writeUByte(qRY);
|
2015-08-14 03:00:51 +00:00
|
|
|
writer.writeUint16Big(initRZ);
|
2015-08-11 23:32:02 +00:00
|
|
|
writer.writeUByte(qRZ);
|
2015-08-14 03:00:51 +00:00
|
|
|
writer.writeUint16Big(keyCount2);
|
2015-08-11 23:32:02 +00:00
|
|
|
if (keyCount2)
|
|
|
|
{
|
2015-08-14 03:00:51 +00:00
|
|
|
writer.writeUint16Big(initTX);
|
2015-08-11 23:32:02 +00:00
|
|
|
writer.writeUByte(qTX);
|
2015-08-14 03:00:51 +00:00
|
|
|
writer.writeUint16Big(initTY);
|
2015-08-11 23:32:02 +00:00
|
|
|
writer.writeUByte(qTY);
|
2015-08-14 03:00:51 +00:00
|
|
|
writer.writeUint16Big(initTZ);
|
2015-08-11 23:32:02 +00:00
|
|
|
writer.writeUByte(qTZ);
|
|
|
|
}
|
|
|
|
}
|
2015-10-18 04:08:45 +00:00
|
|
|
size_t binarySize(size_t __isz) const
|
|
|
|
{
|
|
|
|
__isz += 17;
|
|
|
|
if (keyCount2)
|
|
|
|
__isz += 9;
|
|
|
|
return __isz;
|
|
|
|
}
|
2015-08-11 23:32:02 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
std::unique_ptr<IANIM> m_anim;
|
|
|
|
void read(Athena::io::IStreamReader& reader)
|
|
|
|
{
|
2015-08-14 03:00:51 +00:00
|
|
|
atUint32 version = reader.readUint32Big();
|
2015-08-11 23:32:02 +00:00
|
|
|
switch (version)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
m_anim.reset(new struct ANIM0);
|
|
|
|
m_anim->read(reader);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
m_anim.reset(new struct ANIM2);
|
|
|
|
m_anim->read(reader);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Log.report(LogVisor::Error, "unrecognized ANIM version");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void write(Athena::io::IStreamWriter& writer) const
|
|
|
|
{
|
2015-08-14 03:00:51 +00:00
|
|
|
writer.writeUint32Big(m_anim->m_version);
|
2015-08-11 23:32:02 +00:00
|
|
|
m_anim->write(writer);
|
|
|
|
}
|
2015-08-13 07:29:00 +00:00
|
|
|
|
2015-10-18 04:08:45 +00:00
|
|
|
size_t binarySize(size_t __isz) const
|
|
|
|
{
|
|
|
|
return m_anim->binarySize(__isz + 4);
|
|
|
|
}
|
|
|
|
|
2015-09-29 02:00:28 +00:00
|
|
|
void sendANIMToBlender(HECL::BlenderConnection::PyOutStream& os, const CINF& cinf, bool) const
|
2015-08-13 07:29:00 +00:00
|
|
|
{
|
|
|
|
m_anim->sendANIMToBlender(os, cinf);
|
|
|
|
}
|
|
|
|
|
2015-08-11 23:32:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // _DNAMP1_ANIM_HPP_
|