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,
const typename PAKRouter::EntryType& entry,
const SpecBase& dataspec,
std::function<void(const HECL::SystemChar*)> 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;

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&, 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];
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);
});
}
}
}

View File

@ -376,7 +376,8 @@ struct ANCS : BigYAML
const HECL::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force)
bool force,
std::function<void(const HECL::SystemChar*)> 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<PAKRouter<PAKBridge>, ANCS, MaterialSet, 2>
(conn, ancs, blendPath, pakRouter, entry, dataSpec, force);
conn.saveBlend();
(conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
}
}

View File

@ -20,7 +20,8 @@ struct CMDL
const HECL::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force)
bool force,
std::function<void(const HECL::SystemChar*)> fileChanged)
{
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
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
{

View File

@ -213,7 +213,8 @@ struct ANCS : BigYAML
const HECL::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
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::PathType yamlType = yamlPath.getPathType();
@ -238,8 +239,7 @@ struct ANCS : BigYAML
{
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, 4>
(conn, ancs, blendPath, pakRouter, entry, dataSpec, force);
conn.saveBlend();
(conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
}
}

View File

@ -20,7 +20,8 @@ struct CMDL
const HECL::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const DNAMP1::PAK::Entry& entry,
bool force)
bool force,
std::function<void(const HECL::SystemChar*)> fileChanged)
{
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
if (!conn.createBlend(outPath.getAbsolutePath()))

View File

@ -20,7 +20,8 @@ struct CMDL
const HECL::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force)
bool force,
std::function<void(const HECL::SystemChar*)> fileChanged)
{
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
if (!conn.createBlend(outPath.getAbsolutePath()))

View File

@ -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();

2
NODLib

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

2
hecl

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