redundant save removal, better extract reporting

This commit is contained in:
Jack Andersen 2015-09-02 15:45:15 -10:00
parent 5951b60e0a
commit 6d13e83278
11 changed files with 28 additions and 21 deletions

View File

@ -27,6 +27,7 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
PAKRouter& pakRouter, PAKRouter& pakRouter,
const typename PAKRouter::EntryType& entry, const typename PAKRouter::EntryType& entry,
const SpecBase& dataspec, const SpecBase& dataspec,
std::function<void(const HECL::SystemChar*)> fileChanged,
bool force=false) bool force=false)
{ {
/* Extract character CMDL/CSKR first */ /* Extract character CMDL/CSKR first */
@ -44,6 +45,8 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
if (!conn.createBlend(cmdlPath.getAbsolutePath())) if (!conn.createBlend(cmdlPath.getAbsolutePath()))
return false; return false;
fileChanged(pakRouter.getBestEntryName(*cmdlE).c_str());
typename ANCSDNA::CSKRType cskr; typename ANCSDNA::CSKRType cskr;
pakRouter.lookupAndReadDNA(info.cskr, cskr); pakRouter.lookupAndReadDNA(info.cskr, cskr);
typename ANCSDNA::CINFType cinf; typename ANCSDNA::CINFType cinf;
@ -60,6 +63,8 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
} }
} }
fileChanged(pakRouter.getBestEntryName(entry).c_str());
/* Establish ANCS blend */ /* Establish ANCS blend */
if (!conn.createBlend(outPath.getAbsolutePath())) if (!conn.createBlend(outPath.getAbsolutePath()))
return false; return false;

View File

@ -92,7 +92,8 @@ struct ResExtractor
{ {
std::function<bool(const SpecBase&, PAKEntryReadStream&, const HECL::ProjectPath&)> func_a; std::function<bool(const SpecBase&, PAKEntryReadStream&, const HECL::ProjectPath&)> func_a;
std::function<bool(const SpecBase&, PAKEntryReadStream&, const HECL::ProjectPath&, PAKRouter<PAKBRIDGE>&, std::function<bool(const SpecBase&, PAKEntryReadStream&, const HECL::ProjectPath&, PAKRouter<PAKBRIDGE>&,
const typename PAKBRIDGE::PAKType::Entry&, bool)> func_b; const typename PAKBRIDGE::PAKType::Entry&, bool,
std::function<void(const HECL::SystemChar*)>)> func_b;
const HECL::SystemChar* fileExts[4]; const HECL::SystemChar* fileExts[4];
unsigned weight; unsigned weight;
}; };
@ -339,7 +340,8 @@ public:
continue; continue;
HECL::SystemStringView bestName(getBestEntryName(*item.second)); 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); HECL::ProjectPath cooked = getCooked(item.second);
if (force || cooked.getPathType() == HECL::ProjectPath::PT_NONE) if (force || cooked.getPathType() == HECL::ProjectPath::PT_NONE)
@ -364,7 +366,11 @@ public:
if (force || working.getPathType() == HECL::ProjectPath::PT_NONE) if (force || working.getPathType() == HECL::ProjectPath::PT_NONE)
{ {
PAKEntryReadStream s = item.second->beginReadStream(*m_node); 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);
});
} }
} }
} }

View File

@ -376,7 +376,8 @@ struct ANCS : BigYAML
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*)> 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();
@ -401,8 +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, dataSpec, force); (conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
conn.saveBlend();
} }
} }

View File

@ -20,7 +20,8 @@ struct CMDL
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*)> fileChanged)
{ {
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
if (!conn.createBlend(outPath.getAbsolutePath())) if (!conn.createBlend(outPath.getAbsolutePath()))

View File

@ -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 enum CombinerType
{ {

View File

@ -213,7 +213,8 @@ struct ANCS : BigYAML
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*)> 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();
@ -238,8 +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, dataSpec, force); (conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
conn.saveBlend();
} }
} }

View File

@ -20,7 +20,8 @@ struct CMDL
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*)> fileChanged)
{ {
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
if (!conn.createBlend(outPath.getAbsolutePath())) if (!conn.createBlend(outPath.getAbsolutePath()))

View File

@ -20,7 +20,8 @@ struct CMDL
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*)> fileChanged)
{ {
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
if (!conn.createBlend(outPath.getAbsolutePath())) if (!conn.createBlend(outPath.getAbsolutePath()))

View File

@ -30,10 +30,7 @@ void PAK::read(Athena::io::IStreamReader& reader)
m_nameEntries.emplace_back(); m_nameEntries.emplace_back();
m_nameEntries.back().read(reader); m_nameEntries.back().read(reader);
} }
atUint64 start = reader.position();
reader.seek(strgBase + strgSz, Athena::Begin); reader.seek(strgBase + strgSz, Athena::Begin);
atUint64 end = reader.position();
atUint64 diff = end - start;
atUint32 count = reader.readUint32Big(); atUint32 count = reader.readUint32Big();
m_entries.clear(); m_entries.clear();

2
NODLib

@ -1 +1 @@
Subproject commit 539eb5de80a00ec1aca0613983e1cac2e53cea96 Subproject commit e4f502be580f3258bf0a26b1511afb36eaff111a

2
hecl

@ -1 +1 @@
Subproject commit 6d3925cdc0dddd39b7a83c66d0a594a882ee38b4 Subproject commit 6cba28daca25c3216d5f0b99af69c5c84c11aa9d