2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 13:44:56 +00:00

Initially working CEnvFxManager

This commit is contained in:
Jack Andersen
2018-11-01 22:16:16 -10:00
parent 93e9e2f6f1
commit 98c7525176
28 changed files with 1179 additions and 77 deletions

View File

@@ -33,6 +33,7 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn,
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
if (force || cmdlPath.isNone())
{
cmdlPath.makeDirChain(false);
if (!conn.createBlend(cmdlPath, hecl::blender::BlendType::Mesh))
return false;
@@ -70,6 +71,7 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn,
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
if (force || cmdlPath.isNone())
{
cmdlPath.makeDirChain(false);
if (!conn.createBlend(cmdlPath, hecl::blender::BlendType::Mesh))
return false;

View File

@@ -652,6 +652,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os,
{
MaterialSet matSet;
matSet.read(reader);
matSet.ensureTexturesExtracted(pakRouter);
GetVertexAttributes(matSet, vertAttribs);
}
}

View File

@@ -23,6 +23,25 @@ struct MaterialSet : BigDNA
void addTexture(const UniqueID32& id) {textureIDs.push_back(id); ++textureCount;}
void addMaterialEndOff(atUint32 off) {materialEndOffs.push_back(off); ++materialCount;}
template <class PAKBRIDGE>
void ensureTexturesExtracted(PAKRouter<PAKBRIDGE>& pakRouter) const
{
for (const auto& id : textureIDs)
{
const nod::Node* node;
const PAK::Entry* texEntry = pakRouter.lookupEntry(id, &node);
if (!texEntry)
continue;
hecl::ProjectPath txtrPath = pakRouter.getWorking(texEntry);
if (txtrPath.isNone())
{
txtrPath.makeDirChain(false);
PAKEntryReadStream rs = texEntry->beginReadStream(*node);
TXTR::Extract(rs, txtrPath);
}
}
}
} head;
struct Material : BigDNA
@@ -352,6 +371,10 @@ struct MaterialSet : BigDNA
}
}
void ensureTexturesExtracted(PAKRouter<PAKBridge>& pakRouter) const
{
head.ensureTexturesExtracted(pakRouter);
}
};
struct HMDLMaterialSet : BigDNA

View File

@@ -71,6 +71,11 @@ struct MaterialSet : BigDNA
{
DNACMDL::ReadMaterialSetToBlender_1_2(os, *this, pakRouter, entry, setIdx);
}
void ensureTexturesExtracted(PAKRouter<PAKBridge>& pakRouter) const
{
head.ensureTexturesExtracted(pakRouter);
}
};
}

View File

@@ -198,6 +198,8 @@ struct MaterialSet : BigDNA
{
DNACMDL::ReadMaterialSetToBlender_3(os, *this, pakRouter, entry, setIdx);
}
void ensureTexturesExtracted(PAKRouter<PAKBridge>& pakRouter) const {}
};
}