diff --git a/DataSpec/DNACommon/ANIM.cpp b/DataSpec/DNACommon/ANIM.cpp index 58abba4fb..eab50ea45 100644 --- a/DataSpec/DNACommon/ANIM.cpp +++ b/DataSpec/DNACommon/ANIM.cpp @@ -1,6 +1,8 @@ #include "zeus/Math.hpp" #include "ANIM.hpp" +#define DUMP_KEYS 0 + namespace DataSpec { namespace DNAANIM @@ -181,12 +183,24 @@ BitstreamReader::read(const atUint8* data, default: break; } } + for (size_t f=0 ; femplace_back(DequantizeRotation(qr, rotDiv)); +#if DUMP_KEYS + fprintf(stderr, "%d R: %d %d %d %d\t", chan.id, wBit, p[0], p[1], p[2]); +#endif break; } case Channel::Type::Translation: @@ -209,6 +226,9 @@ BitstreamReader::read(const atUint8* data, atInt16 val3 = dequantize(data, chan.q[2]); p[2] += val3; kit->push_back({p[0] * transMult, p[1] * transMult, p[2] * transMult}); +#if DUMP_KEYS + fprintf(stderr, "%d T: %d %d %d\t", chan.id, p[0], p[1], p[2]); +#endif break; } case Channel::Type::Scale: @@ -217,6 +237,9 @@ BitstreamReader::read(const atUint8* data, p[1] += dequantize(data, chan.q[1]); p[2] += dequantize(data, chan.q[2]); kit->push_back({p[0] / float(rotDiv), p[1] / float(rotDiv), p[2] / float(rotDiv)}); +#if DUMP_KEYS + fprintf(stderr, "%d S: %d %d %d\t", chan.id, p[0], p[1], p[2]); +#endif break; } case Channel::Type::KfHead: @@ -243,7 +266,11 @@ BitstreamReader::read(const atUint8* data, ++kit; ++ait; } +#if DUMP_KEYS + fprintf(stderr, "\n"); +#endif } + return chanKeys; } diff --git a/DataSpec/DNACommon/ANIM.hpp b/DataSpec/DNACommon/ANIM.hpp index 14821b2c3..40cd61a06 100644 --- a/DataSpec/DNACommon/ANIM.hpp +++ b/DataSpec/DNACommon/ANIM.hpp @@ -52,6 +52,7 @@ struct Channel KfHead, RotationMP3 } type; + atInt32 id = -1; QuantizedValue i = {}; atUint8 q[4] = {}; }; diff --git a/DataSpec/DNAMP1/ANIM.cpp b/DataSpec/DNAMP1/ANIM.cpp index 22f08077d..bd0796df6 100644 --- a/DataSpec/DNAMP1/ANIM.cpp +++ b/DataSpec/DNAMP1/ANIM.cpp @@ -46,23 +46,22 @@ void ANIM::IANIM::sendANIMToBlender(hecl::BlenderConnection::PyOutStream& os, co "\n"; ANIMOutStream ao = os.beginANIMCurve(); - + { const std::vector& rotKeys = *kit++; std::vector fixedRotKeys; fixedRotKeys.resize(rotKeys.size()); - fprintf(stderr, "alloc %d\n", rotKeys.size()); - + for (int c=0 ; c<4 ; ++c) { size_t idx = 0; for (const DNAANIM::Value& val : rotKeys) fixedRotKeys.at(idx++)[c] = val.v4.vec[c]; } - + for (zeus::CQuaternion& rot : fixedRotKeys) rot = rig.transformRotation(bone.first, rot); - + for (int c=0 ; c<4 ; ++c) { auto frameit = frames.begin(); @@ -70,8 +69,6 @@ void ANIM::IANIM::sendANIMToBlender(hecl::BlenderConnection::PyOutStream& os, co for (const zeus::CQuaternion& val : fixedRotKeys) ao.write(*frameit++, val[c]); } - - fprintf(stderr, "size %d\n", fixedRotKeys.size()); } if (bone.second) @@ -307,6 +304,7 @@ void ANIM::ANIM2::read(athena::io::IStreamReader& reader) channels.emplace_back(); DNAANIM::Channel& chan = channels.back(); chan.type = DNAANIM::Channel::Type::Rotation; + chan.id = desc.id; chan.i[0] = desc.initRX; chan.q[0] = desc.qRX; chan.i[1] = desc.initRY; @@ -321,6 +319,7 @@ void ANIM::ANIM2::read(athena::io::IStreamReader& reader) channels.emplace_back(); DNAANIM::Channel& chan = channels.back(); chan.type = DNAANIM::Channel::Type::Translation; + chan.id = desc.id; chan.i[0] = desc.initTX; chan.q[0] = desc.qTX; chan.i[1] = desc.initTY; diff --git a/DataSpec/SpecMP1.cpp b/DataSpec/SpecMP1.cpp index c290d1249..4e3b4391e 100644 --- a/DataSpec/SpecMP1.cpp +++ b/DataSpec/SpecMP1.cpp @@ -258,8 +258,21 @@ struct SpecMP1 : SpecBase hecl::ClientProcess process; int compIdx = 4; prog = 0; - for (std::pair pair : m_orderedPaks) + for (std::pair& pair : m_orderedPaks) { +#if 0 + const DNAMP1::PAK::Entry* ent = pair.second->getPAK().lookupEntry(UniqueID32("AF974083")); + if (ent) + { + DNAMP1::ANIM anim; + PAKEntryReadStream rs = ent->beginReadStream(pair.second->getNode()); + anim.read(rs); + exit(0); + } + else + continue; +#endif + DNAMP1::PAKBridge& pak = *pair.second; if (!pak.m_doExtract) continue; diff --git a/DataSpec/SpecMP2.cpp b/DataSpec/SpecMP2.cpp index 873cfeec8..b7c1462df 100644 --- a/DataSpec/SpecMP2.cpp +++ b/DataSpec/SpecMP2.cpp @@ -240,7 +240,7 @@ struct SpecMP2 : SpecBase hecl::ClientProcess process; int compIdx = 4; prog = 0; - for (std::pair pair : m_orderedPaks) + for (std::pair& pair : m_orderedPaks) { DNAMP2::PAKBridge& pak = *pair.second; if (!pak.m_doExtract) diff --git a/DataSpec/SpecMP3.cpp b/DataSpec/SpecMP3.cpp index 9bb753707..3e3425492 100644 --- a/DataSpec/SpecMP3.cpp +++ b/DataSpec/SpecMP3.cpp @@ -371,7 +371,7 @@ struct SpecMP3 : SpecBase std::mutex msgLock; hecl::ClientProcess process; prog = 0; - for (std::pair pair : m_orderedPaks) + for (std::pair& pair : m_orderedPaks) { DNAMP3::PAKBridge& pak = *pair.second; if (!pak.m_doExtract) diff --git a/specter b/specter index a1d60af72..95975db3c 160000 --- a/specter +++ b/specter @@ -1 +1 @@ -Subproject commit a1d60af72c17c4df4152f36766ec9e39c9c56200 +Subproject commit 95975db3c8fdf159d8cb771dda6c824801cf7bbc