2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 15:47:46 +00:00

Lots of reverse naming functionality added

This commit is contained in:
Jack Andersen
2015-10-26 14:19:03 -10:00
parent fa8b48d43e
commit d46f44cefa
92 changed files with 2396 additions and 41 deletions

View File

@@ -360,7 +360,6 @@ struct MaterialSet : BigDNA
case ANIM_HSTRIP:
case ANIM_VSTRIP:
return __isz + 20;
break;
case ANIM_ROTATION:
case ANIM_MODE_WHO_MUST_NOT_BE_NAMED:
return __isz + 12;
@@ -411,6 +410,49 @@ struct MaterialSet : BigDNA
DNACMDL::ReadMaterialSetToBlender_1_2(os, *this, pakRouter, entry, setIdx);
}
template <class PAKRouter>
void nameTextures(PAKRouter& pakRouter, const char* prefix, int setIdx) const
{
int matIdx = 0;
for (const Material& mat : materials)
{
int stageIdx = 0;
for (const Material::TEVStage& stage : mat.tevStages)
{
const Material::TEVStageTexInfo& texInfo = mat.tevStageTexInfo[stageIdx];
if (texInfo.texSlot == 0xff)
{
++stageIdx;
continue;
}
const NOD::Node* node;
typename PAKRouter::EntryType* texEntry = (typename PAKRouter::EntryType*)
pakRouter.lookupEntry(head.textureIDs[mat.textureIdxs[texInfo.texSlot]], &node);
if (texEntry->name.size())
{
if (texEntry->name.size() < 5 || texEntry->name.compare(0, 5, "mult_"))
texEntry->name = "mult_" + texEntry->name;
++stageIdx;
continue;
}
if (setIdx < 0)
texEntry->name = HECL::Format("%s_%d_%d", prefix, matIdx, stageIdx);
else
texEntry->name = HECL::Format("%s_%d_%d_%d", prefix, setIdx, matIdx, stageIdx);
if (mat.flags.lightmap() && stageIdx == 0)
{
texEntry->name += "light";
++stageIdx;
continue;
}
++stageIdx;
}
++matIdx;
}
}
};
}