Skip to content

Commit 4f6228b

Browse files
committed
Hroth tail stuff and a catch for mdl import.
1 parent ea403ed commit 4f6228b

File tree

2 files changed

+39
-18
lines changed

2 files changed

+39
-18
lines changed

xivModdingFramework/Cache/XivDependencyRoot.cs

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,23 @@ public XivDependencyRootInfo GetOtherSlot(string slot)
6868
};
6969
}
7070

71+
public bool IsHumanMaterialVersionException()
72+
{
73+
if (PrimaryType == XivItemType.human)
74+
{
75+
if(SecondaryType != null &&
76+
(SecondaryType == XivItemType.tail || SecondaryType == XivItemType.body))
77+
{
78+
if(PrimaryId == XivRace.Hrothgar_Female.GetRaceCodeInt()
79+
|| PrimaryId == XivRace.Hrothgar_Male.GetRaceCodeInt())
80+
{
81+
return true;
82+
}
83+
}
84+
}
85+
return false;
86+
}
87+
7188
/// <summary>
7289
/// Converts this dependency root into a raw string entry.
7390
/// </summary>
@@ -733,9 +750,28 @@ public async Task<List<string>> GetMaterialFiles(int materialVariant = -1, ModTr
733750

734751
index = await tx.GetIndexFile(df);
735752
modlist = await tx.GetModList();
736-
737753
var materials = new HashSet<string>();
738-
if (Info.PrimaryType == XivItemType.human && Info.SecondaryType == XivItemType.body)
754+
755+
if (Info.IsHumanMaterialVersionException())
756+
{
757+
// Special Hrothgar Cases.
758+
var primary = Info.PrimaryId.ToString("D4");
759+
var secondary = Info.SecondaryId.Value.ToString("D4");
760+
var path = $"chara/human/c{primary}/obj/body/b{secondary}/material/v0001/mt_c{primary}b{secondary}_a.mtrl";
761+
if(Info.SecondaryType == XivItemType.tail)
762+
{
763+
path = $"chara/human/c{primary}/obj/tail/t{secondary}/material/v0001/mt_c{primary}t{secondary}_a.mtrl";
764+
}
765+
766+
materials.Add(path);
767+
for (int i = 2; i <= 5; i++)
768+
{
769+
materials.Add(path.Replace("/v0001/", "/v000" + i + "/"));
770+
}
771+
772+
materialVariant = -1;
773+
}
774+
else if (Info.PrimaryType == XivItemType.human && Info.SecondaryType == XivItemType.body)
739775
{
740776
// Bleargh. So here's the exception of exception class. Because the "models" in human body are
741777
// are so sparse and all over the place, relying on them is impossible. Thankfully, body types only ever
@@ -745,27 +781,12 @@ public async Task<List<string>> GetMaterialFiles(int materialVariant = -1, ModTr
745781
var path = $"chara/human/c{primary}/obj/body/b{body}/material/v0001/mt_c{primary}b{body}_a.mtrl";
746782

747783
// Just validate it exists and call it a day.
748-
749784
var exists = index.FileExists(path);
750785
if (exists)
751786
{
752787
materials.Add(path);
753788
}
754789

755-
// XXX: I noticed female hrothgar also have patterns so I'm gonna put them here too
756-
if (Info.PrimaryId == XivRace.Hrothgar_Male.GetRaceCodeInt()
757-
|| Info.PrimaryId == XivRace.Hrothgar_Female.GetRaceCodeInt()
758-
)
759-
{
760-
// JK, Hrothgar actually have 5 material sets (that's how their fur pattern stuff is set)
761-
for (int i = 2; i <= 5; i++)
762-
{
763-
var mSet = i.ToString().PadLeft(4, '0');
764-
path = $"chara/human/c{primary}/obj/body/b{body}/material/v{mSet}/mt_c{primary}b{body}_a.mtrl";
765-
materials.Add(path);
766-
}
767-
}
768-
769790
materialVariant = -1;
770791
}
771792
else if (Info.PrimaryType == XivItemType.human && Info.SecondaryType != XivItemType.hair && Info.SecondaryId > 100)

xivModdingFramework/Models/DataContainers/TTModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2963,7 +2963,7 @@ public static void CheckCommonUserErrors(TTModel model, Action<bool, string> log
29632963
loggingFunction(true, "Mesh: " + mIdx + " Part: " + pIdx + " has a fully black Vertex Color channel. This can have unexpected results on in-game rendering. Was this intended?");
29642964
}
29652965

2966-
if (fullWhiteColor && m.Material.Contains("_iri_"))
2966+
if (fullWhiteColor && m.Material != null && m.Material.Contains("_iri_"))
29672967
{
29682968
loggingFunction(true, "Mesh: " + mIdx + " Part: " + pIdx + " has a fully white Vertex Color channel on an Iris material. This will break Heterochromia and cause discoloration. Was this intended?");
29692969
}

0 commit comments

Comments
 (0)