metaforce/DataSpec/DNAMP3/CMDL.cpp

31 lines
1.2 KiB
C++
Raw Permalink Normal View History

2017-12-29 08:08:12 +00:00
#include "CMDL.hpp"
#include "hecl/Blender/Connection.hpp"
2018-12-08 05:30:43 +00:00
namespace DataSpec::DNAMP3 {
2017-12-29 08:08:12 +00:00
2018-12-08 05:30:43 +00:00
bool CMDL::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry, bool, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)>) {
/* Check for RigPair */
CINF cinf;
CSKR cskr;
2019-10-01 07:38:03 +00:00
using RigPair = std::pair<std::pair<UniqueID64, CSKR*>, std::pair<UniqueID64, CINF*>>;
RigPair loadRp = {};
if (const typename CharacterAssociations<UniqueID64>::RigPair* rp = pakRouter.lookupCMDLRigPair(entry.id)) {
pakRouter.lookupAndReadDNA(rp->cskr, cskr);
pakRouter.lookupAndReadDNA(rp->cinf, cinf);
loadRp.first = {rp->cskr, &cskr};
loadRp.second = {rp->cinf, &cinf};
2018-12-08 05:30:43 +00:00
}
2017-12-29 08:08:12 +00:00
2018-12-08 05:30:43 +00:00
/* Do extract */
hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.createBlend(outPath, hecl::blender::BlendType::Mesh))
return false;
2019-10-01 07:38:03 +00:00
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, RigPair, DNACMDL::SurfaceHeader_3, 5>(
2018-12-08 05:30:43 +00:00
conn, rs, pakRouter, entry, dataSpec, loadRp);
return conn.saveBlend();
2017-12-29 08:08:12 +00:00
}
2018-12-08 05:30:43 +00:00
} // namespace DataSpec::DNAMP3