Fixed ANCS-CMDL extraction regression

This commit is contained in:
Jack Andersen 2015-09-06 11:44:57 -10:00
parent e115eeb74b
commit 35a6ddab14
3 changed files with 43 additions and 7 deletions

View File

@ -26,10 +26,46 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
const HECL::ProjectPath& outPath, const HECL::ProjectPath& outPath,
PAKRouter& pakRouter, PAKRouter& pakRouter,
const typename PAKRouter::EntryType& entry, const typename PAKRouter::EntryType& entry,
const SpecBase& dataspec,
std::function<void(const HECL::SystemChar*)> fileChanged,
bool force=false) bool force=false)
{ {
/* Extract character CMDL/CSKR first */
std::vector<CharacterResInfo<typename PAKRouter::IDType>> chResInfo; std::vector<CharacterResInfo<typename PAKRouter::IDType>> chResInfo;
ancs.getCharacterResInfo(chResInfo); ancs.getCharacterResInfo(chResInfo);
for (const auto& info : chResInfo)
{
const NOD::DiscBase::IPartition::Node* node;
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(info.cmdl, &node);
if (cmdlE)
{
HECL::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
if (force || cmdlPath.getPathType() == HECL::ProjectPath::PT_NONE)
{
if (!conn.createBlend(cmdlPath.getAbsolutePath()))
return false;
HECL::SystemStringView bestNameView(pakRouter.getBestEntryName(*cmdlE));
fileChanged(bestNameView.sys_str().c_str());
typename ANCSDNA::CSKRType cskr;
pakRouter.lookupAndReadDNA(info.cskr, cskr);
typename ANCSDNA::CINFType cinf;
pakRouter.lookupAndReadDNA(info.cinf, cinf);
using RIGPair = std::pair<typename ANCSDNA::CSKRType*, typename ANCSDNA::CINFType*>;
RIGPair rigPair(&cskr, &cinf);
PAKEntryReadStream rs = cmdlE->beginReadStream(*node);
DNACMDL::ReadCMDLToBlender<PAKRouter, MaterialSet, RIGPair, CMDLVersion>
(conn, rs, pakRouter, *cmdlE, dataspec, rigPair);
conn.saveBlend();
}
}
}
HECL::SystemStringView bestNameView(pakRouter.getBestEntryName(entry));
fileChanged(bestNameView.sys_str().c_str());
/* Establish ANCS blend */ /* Establish ANCS blend */
if (!conn.createBlend(outPath.getAbsolutePath())) if (!conn.createBlend(outPath.getAbsolutePath()))

View File

@ -371,13 +371,13 @@ struct ANCS : BigYAML
ai.metaAnim.m_anim->gatherPrimitives(out); ai.metaAnim.m_anim->gatherPrimitives(out);
} }
static bool Extract(const SpecBase&, static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs, PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath, const HECL::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry, const PAK::Entry& entry,
bool force, bool force,
std::function<void(const HECL::SystemChar*)>) std::function<void(const HECL::SystemChar*)> fileChanged)
{ {
HECL::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml")); HECL::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"));
HECL::ProjectPath::PathType yamlType = yamlPath.getPathType(); HECL::ProjectPath::PathType yamlType = yamlPath.getPathType();
@ -402,7 +402,7 @@ struct ANCS : BigYAML
{ {
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, 2> DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, 2>
(conn, ancs, blendPath, pakRouter, entry, force); (conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
} }
} }

View File

@ -208,13 +208,13 @@ struct ANCS : BigYAML
ai.metaAnim.m_anim->gatherPrimitives(out); ai.metaAnim.m_anim->gatherPrimitives(out);
} }
static bool Extract(const SpecBase&, static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs, PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath, const HECL::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, PAKRouter<PAKBridge>& pakRouter,
const DNAMP1::PAK::Entry& entry, const DNAMP1::PAK::Entry& entry,
bool force, bool force,
std::function<void(const HECL::SystemChar*)>) std::function<void(const HECL::SystemChar*)> fileChanged)
{ {
HECL::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml")); HECL::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"));
HECL::ProjectPath::PathType yamlType = yamlPath.getPathType(); HECL::ProjectPath::PathType yamlType = yamlPath.getPathType();
@ -239,7 +239,7 @@ struct ANCS : BigYAML
{ {
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, 4> DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, 4>
(conn, ancs, blendPath, pakRouter, entry, force); (conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
} }
} }