mirror of https://github.com/AxioDL/metaforce.git
Multi-intermediate MLVL path; simpler metadata yaml
This commit is contained in:
parent
5df7c188b0
commit
2dad2e2051
|
@ -17,11 +17,12 @@ bool ReadMLVLToBlender(hecl::BlenderConnection& conn,
|
||||||
bool force,
|
bool force,
|
||||||
std::function<void(const hecl::SystemChar*)> fileChanged)
|
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;
|
return true;
|
||||||
|
|
||||||
/* Create World Blend */
|
/* Create World Blend */
|
||||||
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::World))
|
if (!conn.createBlend(blendPath, hecl::BlenderConnection::BlendType::World))
|
||||||
return false;
|
return false;
|
||||||
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
||||||
os.format("import bpy\n"
|
os.format("import bpy\n"
|
||||||
|
|
|
@ -296,7 +296,7 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
|
||||||
case SBIG('ANCS'):
|
case SBIG('ANCS'):
|
||||||
return {ANCS::Extract, {_S(".yaml"), _S(".blend")}, 2};
|
return {ANCS::Extract, {_S(".yaml"), _S(".blend")}, 2};
|
||||||
case SBIG('MLVL'):
|
case SBIG('MLVL'):
|
||||||
return {MLVL::Extract, {_S(".blend")}, 3};
|
return {MLVL::Extract, {_S(".yaml"), _S(".blend")}, 3};
|
||||||
case SBIG('MREA'):
|
case SBIG('MREA'):
|
||||||
return {MREA::Extract, {_S(".blend")}, 4, MREA::Name};
|
return {MREA::Extract, {_S(".blend")}, 4, MREA::Name};
|
||||||
case SBIG('MAPA'):
|
case SBIG('MAPA'):
|
||||||
|
|
|
@ -106,6 +106,28 @@ struct MLVL : BigYAML
|
||||||
Value<atUint32> layerNameOffsetCount;
|
Value<atUint32> layerNameOffsetCount;
|
||||||
Vector<atUint32, DNA_COUNT(layerNameOffsetCount)> layerNameOffsets;
|
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,
|
static bool Extract(const SpecBase& dataSpec,
|
||||||
PAKEntryReadStream& rs,
|
PAKEntryReadStream& rs,
|
||||||
const hecl::ProjectPath& outPath,
|
const hecl::ProjectPath& outPath,
|
||||||
|
@ -118,7 +140,7 @@ struct MLVL : BigYAML
|
||||||
MLVL mlvl;
|
MLVL mlvl;
|
||||||
mlvl.read(rs);
|
mlvl.read(rs);
|
||||||
athena::io::FileWriter writer(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath());
|
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();
|
hecl::BlenderConnection& conn = btok.getBlenderConnection();
|
||||||
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter,
|
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter,
|
||||||
entry, force, fileChanged);
|
entry, force, fileChanged);
|
||||||
|
|
|
@ -228,7 +228,7 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const DNAMP1::PAK& pak, const
|
||||||
case SBIG('ANCS'):
|
case SBIG('ANCS'):
|
||||||
return {ANCS::Extract, {_S(".yaml"), _S(".blend")}, 2};
|
return {ANCS::Extract, {_S(".yaml"), _S(".blend")}, 2};
|
||||||
case SBIG('MLVL'):
|
case SBIG('MLVL'):
|
||||||
return {MLVL::Extract, {_S(".blend")}, 3};
|
return {MLVL::Extract, {_S(".yaml"), _S(".blend")}, 3};
|
||||||
case SBIG('MREA'):
|
case SBIG('MREA'):
|
||||||
return {MREA::Extract, {_S(".blend")}, 4};
|
return {MREA::Extract, {_S(".blend")}, 4};
|
||||||
case SBIG('MAPA'):
|
case SBIG('MAPA'):
|
||||||
|
|
|
@ -237,7 +237,7 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
|
||||||
case SBIG('CHAR'):
|
case SBIG('CHAR'):
|
||||||
return {CHAR::Extract, {_S(".yaml"), _S(".blend")}, 2};
|
return {CHAR::Extract, {_S(".yaml"), _S(".blend")}, 2};
|
||||||
case SBIG('MLVL'):
|
case SBIG('MLVL'):
|
||||||
return {MLVL::Extract, {_S(".blend")}, 3};
|
return {MLVL::Extract, {_S(".yaml"), _S(".blend")}, 3};
|
||||||
case SBIG('MREA'):
|
case SBIG('MREA'):
|
||||||
return {MREA::Extract, {_S(".blend")}, 4};
|
return {MREA::Extract, {_S(".blend")}, 4};
|
||||||
case SBIG('MAPA'):
|
case SBIG('MAPA'):
|
||||||
|
|
|
@ -215,6 +215,20 @@ bool ProjectResourceFactoryBase::AddFileToIndex(const hecl::ProjectPath& path,
|
||||||
#endif
|
#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 */
|
/* Cache in-memory */
|
||||||
const hecl::ProjectPath& usePath = useGlob ? asGlob : path;
|
const hecl::ProjectPath& usePath = useGlob ? asGlob : path;
|
||||||
|
|
|
@ -94,7 +94,12 @@ SObjectTag ProjectResourceFactoryMP1::BuildTagFromPath(const hecl::ProjectPath&
|
||||||
case hecl::BlenderConnection::BlendType::Area:
|
case hecl::BlenderConnection::BlendType::Area:
|
||||||
return {SBIG('MREA'), path.hash().val32()};
|
return {SBIG('MREA'), path.hash().val32()};
|
||||||
case hecl::BlenderConnection::BlendType::World:
|
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()};
|
return {SBIG('MLVL'), path.hash().val32()};
|
||||||
|
}
|
||||||
case hecl::BlenderConnection::BlendType::MapArea:
|
case hecl::BlenderConnection::BlendType::MapArea:
|
||||||
return {SBIG('MAPA'), path.hash().val32()};
|
return {SBIG('MAPA'), path.hash().val32()};
|
||||||
case hecl::BlenderConnection::BlendType::MapUniverse:
|
case hecl::BlenderConnection::BlendType::MapUniverse:
|
||||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit 08a14f35bf8a6381f13f1fa4681e59b30eede946
|
Subproject commit b513ed1ded026067d9ba1ff6908783a0b678ba34
|
Loading…
Reference in New Issue