Multi-intermediate MLVL path; simpler metadata yaml

This commit is contained in:
Jack Andersen 2016-09-30 16:57:09 -10:00
parent 5df7c188b0
commit 2dad2e2051
8 changed files with 49 additions and 7 deletions

View File

@ -17,11 +17,12 @@ bool ReadMLVLToBlender(hecl::BlenderConnection& conn,
bool force,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
if (!force && outPath.isFile())
hecl::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"), true);
if (!force && blendPath.isFile())
return true;
/* Create World Blend */
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::World))
if (!conn.createBlend(blendPath, hecl::BlenderConnection::BlendType::World))
return false;
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"

View File

@ -296,7 +296,7 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
case SBIG('ANCS'):
return {ANCS::Extract, {_S(".yaml"), _S(".blend")}, 2};
case SBIG('MLVL'):
return {MLVL::Extract, {_S(".blend")}, 3};
return {MLVL::Extract, {_S(".yaml"), _S(".blend")}, 3};
case SBIG('MREA'):
return {MREA::Extract, {_S(".blend")}, 4, MREA::Name};
case SBIG('MAPA'):

View File

@ -106,6 +106,28 @@ struct MLVL : BigYAML
Value<atUint32> layerNameOffsetCount;
Vector<atUint32, DNA_COUNT(layerNameOffsetCount)> layerNameOffsets;
void readMeta(athena::io::YAMLDocReader& __dna_docin)
{
/* worldNameId */
__dna_docin.enumerate("worldNameId", worldNameId);
/* worldSkyboxId */
__dna_docin.enumerate("worldSkyboxId", worldSkyboxId);
/* audioGroupCount squelched */
/* audioGroups */
audioGroupCount = __dna_docin.enumerate("audioGroups", audioGroups);
}
void writeMeta(athena::io::YAMLDocWriter& __dna_docout) const
{
/* worldNameId */
__dna_docout.enumerate("worldNameId", worldNameId);
/* worldSkyboxId */
__dna_docout.enumerate("worldSkyboxId", worldSkyboxId);
/* audioGroupCount squelched */
/* audioGroups */
__dna_docout.enumerate("audioGroups", audioGroups);
}
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const hecl::ProjectPath& outPath,
@ -118,7 +140,7 @@ struct MLVL : BigYAML
MLVL mlvl;
mlvl.read(rs);
athena::io::FileWriter writer(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath());
mlvl.toYAMLStream(writer);
mlvl.toYAMLStream(writer, static_cast<YAMLWriteMemFn>(&MLVL::writeMeta));
hecl::BlenderConnection& conn = btok.getBlenderConnection();
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter,
entry, force, fileChanged);

View File

@ -228,7 +228,7 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const DNAMP1::PAK& pak, const
case SBIG('ANCS'):
return {ANCS::Extract, {_S(".yaml"), _S(".blend")}, 2};
case SBIG('MLVL'):
return {MLVL::Extract, {_S(".blend")}, 3};
return {MLVL::Extract, {_S(".yaml"), _S(".blend")}, 3};
case SBIG('MREA'):
return {MREA::Extract, {_S(".blend")}, 4};
case SBIG('MAPA'):

View File

@ -237,7 +237,7 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
case SBIG('CHAR'):
return {CHAR::Extract, {_S(".yaml"), _S(".blend")}, 2};
case SBIG('MLVL'):
return {MLVL::Extract, {_S(".blend")}, 3};
return {MLVL::Extract, {_S(".yaml"), _S(".blend")}, 3};
case SBIG('MREA'):
return {MREA::Extract, {_S(".blend")}, 4};
case SBIG('MAPA'):

View File

@ -215,6 +215,20 @@ bool ProjectResourceFactoryBase::AddFileToIndex(const hecl::ProjectPath& path,
#endif
}
}
else if (pathTag.type == SBIG('MLVL'))
{
/* Transform tag to glob */
pathTag = {SBIG('MLVL'), asGlob.hash().val32()};
useGlob = true;
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(_S(".MAPW"));
SObjectTag pathTag = BuildTagFromPath(subPath, m_backgroundBlender);
m_tagToPath[pathTag] = subPath;
m_pathToTag[subPath.hash()] = pathTag;
#if DUMP_CACHE_FILL
DumpCacheAdd(pathTag, subPath);
#endif
}
/* Cache in-memory */
const hecl::ProjectPath& usePath = useGlob ? asGlob : path;

View File

@ -94,7 +94,12 @@ SObjectTag ProjectResourceFactoryMP1::BuildTagFromPath(const hecl::ProjectPath&
case hecl::BlenderConnection::BlendType::Area:
return {SBIG('MREA'), path.hash().val32()};
case hecl::BlenderConnection::BlendType::World:
{
if (path.getAuxInfo().size())
if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".MAPW")))
return {SBIG('MAPW'), path.hash().val32()};
return {SBIG('MLVL'), path.hash().val32()};
}
case hecl::BlenderConnection::BlendType::MapArea:
return {SBIG('MAPA'), path.hash().val32()};
case hecl::BlenderConnection::BlendType::MapUniverse:

2
hecl

@ -1 +1 @@
Subproject commit 08a14f35bf8a6381f13f1fa4681e59b30eede946
Subproject commit b513ed1ded026067d9ba1ff6908783a0b678ba34