From 6d13e83278691240fd80845f481f4647358f54e3 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Wed, 2 Sep 2015 15:45:15 -1000 Subject: [PATCH] redundant save removal, better extract reporting --- DataSpec/DNACommon/ANCS.hpp | 5 +++++ DataSpec/DNACommon/PAK.hpp | 12 +++++++++--- DataSpec/DNAMP1/ANCS.hpp | 6 +++--- DataSpec/DNAMP1/CMDL.hpp | 3 ++- DataSpec/DNAMP1/CMDLMaterials.cpp | 4 ---- DataSpec/DNAMP2/ANCS.hpp | 6 +++--- DataSpec/DNAMP2/CMDL.hpp | 3 ++- DataSpec/DNAMP3/CMDL.hpp | 3 ++- DataSpec/DNAMP3/PAK.cpp | 3 --- NODLib | 2 +- hecl | 2 +- 11 files changed, 28 insertions(+), 21 deletions(-) diff --git a/DataSpec/DNACommon/ANCS.hpp b/DataSpec/DNACommon/ANCS.hpp index 40d89b0ae..ee261a680 100644 --- a/DataSpec/DNACommon/ANCS.hpp +++ b/DataSpec/DNACommon/ANCS.hpp @@ -27,6 +27,7 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn, PAKRouter& pakRouter, const typename PAKRouter::EntryType& entry, const SpecBase& dataspec, + std::function fileChanged, bool force=false) { /* Extract character CMDL/CSKR first */ @@ -44,6 +45,8 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn, if (!conn.createBlend(cmdlPath.getAbsolutePath())) return false; + fileChanged(pakRouter.getBestEntryName(*cmdlE).c_str()); + typename ANCSDNA::CSKRType cskr; pakRouter.lookupAndReadDNA(info.cskr, cskr); typename ANCSDNA::CINFType cinf; @@ -60,6 +63,8 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn, } } + fileChanged(pakRouter.getBestEntryName(entry).c_str()); + /* Establish ANCS blend */ if (!conn.createBlend(outPath.getAbsolutePath())) return false; diff --git a/DataSpec/DNACommon/PAK.hpp b/DataSpec/DNACommon/PAK.hpp index e1271d490..487c49315 100644 --- a/DataSpec/DNACommon/PAK.hpp +++ b/DataSpec/DNACommon/PAK.hpp @@ -92,7 +92,8 @@ struct ResExtractor { std::function func_a; std::function&, - const typename PAKBRIDGE::PAKType::Entry&, bool)> func_b; + const typename PAKBRIDGE::PAKType::Entry&, bool, + std::function)> func_b; const HECL::SystemChar* fileExts[4]; unsigned weight; }; @@ -339,7 +340,8 @@ public: continue; HECL::SystemStringView bestName(getBestEntryName(*item.second)); - progress(bestName.sys_str().c_str(), ++count / fsz); + float thisFac = ++count / fsz; + progress(bestName.sys_str().c_str(), thisFac); HECL::ProjectPath cooked = getCooked(item.second); if (force || cooked.getPathType() == HECL::ProjectPath::PT_NONE) @@ -364,7 +366,11 @@ public: if (force || working.getPathType() == HECL::ProjectPath::PT_NONE) { PAKEntryReadStream s = item.second->beginReadStream(*m_node); - extractor.func_b(m_dataSpec, s, working, *this, *item.second, force); + extractor.func_b(m_dataSpec, s, working, *this, *item.second, force, + [&progress, thisFac](const HECL::SystemChar* update) + { + progress(update, thisFac); + }); } } } diff --git a/DataSpec/DNAMP1/ANCS.hpp b/DataSpec/DNAMP1/ANCS.hpp index ae7ebc774..394a77930 100644 --- a/DataSpec/DNAMP1/ANCS.hpp +++ b/DataSpec/DNAMP1/ANCS.hpp @@ -376,7 +376,8 @@ struct ANCS : BigYAML const HECL::ProjectPath& outPath, PAKRouter& pakRouter, const PAK::Entry& entry, - bool force) + bool force, + std::function fileChanged) { HECL::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml")); HECL::ProjectPath::PathType yamlType = yamlPath.getPathType(); @@ -401,8 +402,7 @@ struct ANCS : BigYAML { HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); DNAANCS::ReadANCSToBlender, ANCS, MaterialSet, 2> - (conn, ancs, blendPath, pakRouter, entry, dataSpec, force); - conn.saveBlend(); + (conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force); } } diff --git a/DataSpec/DNAMP1/CMDL.hpp b/DataSpec/DNAMP1/CMDL.hpp index 48910aa4d..9d44879f2 100644 --- a/DataSpec/DNAMP1/CMDL.hpp +++ b/DataSpec/DNAMP1/CMDL.hpp @@ -20,7 +20,8 @@ struct CMDL const HECL::ProjectPath& outPath, PAKRouter& pakRouter, const PAK::Entry& entry, - bool force) + bool force, + std::function fileChanged) { HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); if (!conn.createBlend(outPath.getAbsolutePath())) diff --git a/DataSpec/DNAMP1/CMDLMaterials.cpp b/DataSpec/DNAMP1/CMDLMaterials.cpp index 33c4dc5f7..1d426af2b 100644 --- a/DataSpec/DNAMP1/CMDLMaterials.cpp +++ b/DataSpec/DNAMP1/CMDLMaterials.cpp @@ -231,10 +231,6 @@ static void AddKcolor(Stream& out, const GX::Color& col, unsigned idx) } -static void add_link(Stream& out, const char* a, const char* b) -{ - out.format("new_nodetree.links.new(%s, %s)\n", a, b); -} enum CombinerType { diff --git a/DataSpec/DNAMP2/ANCS.hpp b/DataSpec/DNAMP2/ANCS.hpp index f72cc9884..befecd60c 100644 --- a/DataSpec/DNAMP2/ANCS.hpp +++ b/DataSpec/DNAMP2/ANCS.hpp @@ -213,7 +213,8 @@ struct ANCS : BigYAML const HECL::ProjectPath& outPath, PAKRouter& pakRouter, const DNAMP1::PAK::Entry& entry, - bool force) + bool force, + std::function fileChanged) { HECL::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml")); HECL::ProjectPath::PathType yamlType = yamlPath.getPathType(); @@ -238,8 +239,7 @@ struct ANCS : BigYAML { HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); DNAANCS::ReadANCSToBlender, ANCS, MaterialSet, 4> - (conn, ancs, blendPath, pakRouter, entry, dataSpec, force); - conn.saveBlend(); + (conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force); } } diff --git a/DataSpec/DNAMP2/CMDL.hpp b/DataSpec/DNAMP2/CMDL.hpp index 3e3efd1a8..3bf655b52 100644 --- a/DataSpec/DNAMP2/CMDL.hpp +++ b/DataSpec/DNAMP2/CMDL.hpp @@ -20,7 +20,8 @@ struct CMDL const HECL::ProjectPath& outPath, PAKRouter& pakRouter, const DNAMP1::PAK::Entry& entry, - bool force) + bool force, + std::function fileChanged) { HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); if (!conn.createBlend(outPath.getAbsolutePath())) diff --git a/DataSpec/DNAMP3/CMDL.hpp b/DataSpec/DNAMP3/CMDL.hpp index e96d9ace1..2568bf823 100644 --- a/DataSpec/DNAMP3/CMDL.hpp +++ b/DataSpec/DNAMP3/CMDL.hpp @@ -20,7 +20,8 @@ struct CMDL const HECL::ProjectPath& outPath, PAKRouter& pakRouter, const PAK::Entry& entry, - bool force) + bool force, + std::function fileChanged) { HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); if (!conn.createBlend(outPath.getAbsolutePath())) diff --git a/DataSpec/DNAMP3/PAK.cpp b/DataSpec/DNAMP3/PAK.cpp index a0d003c70..37c4edafd 100644 --- a/DataSpec/DNAMP3/PAK.cpp +++ b/DataSpec/DNAMP3/PAK.cpp @@ -30,10 +30,7 @@ void PAK::read(Athena::io::IStreamReader& reader) m_nameEntries.emplace_back(); m_nameEntries.back().read(reader); } - atUint64 start = reader.position(); reader.seek(strgBase + strgSz, Athena::Begin); - atUint64 end = reader.position(); - atUint64 diff = end - start; atUint32 count = reader.readUint32Big(); m_entries.clear(); diff --git a/NODLib b/NODLib index 539eb5de8..e4f502be5 160000 --- a/NODLib +++ b/NODLib @@ -1 +1 @@ -Subproject commit 539eb5de80a00ec1aca0613983e1cac2e53cea96 +Subproject commit e4f502be580f3258bf0a26b1511afb36eaff111a diff --git a/hecl b/hecl index 6d3925cdc..6cba28dac 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 6d3925cdc0dddd39b7a83c66d0a594a882ee38b4 +Subproject commit 6cba28daca25c3216d5f0b99af69c5c84c11aa9d