Skip to content

Commit

Permalink
Add texture path generation for hair.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebane1 committed Feb 20, 2023
1 parent d823987 commit 2aab018
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 28 deletions.
Binary file modified .vs/FFXIVLooseTextureCompiler/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file modified .vs/FFXIVLooseTextureCompiler/v17/.suo
Binary file not shown.
6 changes: 3 additions & 3 deletions FFXIVLooseTextureCompiler/FFXIVLooseTextureCompiler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyVersion>1.0.3.4</AssemblyVersion>
<FileVersion>1.0.3.4</FileVersion>
<Version>1.0.3.4</Version>
<AssemblyVersion>1.0.3.5</AssemblyVersion>
<FileVersion>1.0.3.5</FileVersion>
<Version>1.0.3.5</Version>
<RunPostBuildEvent>Always</RunPostBuildEvent>
<Title>FFXIV Loose Texture Compiler</Title>
<Copyright>Lawener Industries</Copyright>
Expand Down
27 changes: 14 additions & 13 deletions FFXIVLooseTextureCompiler/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 31 additions & 9 deletions FFXIVLooseTextureCompiler/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Windows.Interop;
using TypingConnector;

namespace FFXIVLooseTextureCompiler {
Expand Down Expand Up @@ -74,8 +75,8 @@ private void Form1_Load(object sender, EventArgs e) {
glow.FilePath.Enabled = false;
raceCodeBody = new RaceCode();
raceCodeFace = new RaceCode();
for (int i = 0; i < 99; i++) {
facePaint.Items.Add((i + 1) + "");
for (int i = 0; i < 300; i++) {
faceExtra.Items.Add((i + 1) + "");
}
uniqueAuRa.Enabled = false;
raceCodeBody.Masculine = new string[] {
Expand All @@ -98,7 +99,7 @@ private void Form1_Load(object sender, EventArgs e) {
bodyIdentifiers.Add(new RacialBodyIdentifiers("SCALE+", new List<string>() { "", "", "", "", "", "", "raen", "xaela", "", "" }));
bodyIdentifiers.Add(new RacialBodyIdentifiers("TBSE/HRBODY", new List<string>() { "", "", "", "", "", "", "", "", "", "" }));
bodyIdentifiers.Add(new RacialBodyIdentifiers("TAIL", new List<string>() { "1", "2", "3", "4", "5", "6", "7", "8", "", "" }));
baseBodyList.SelectedIndex = genderListBody.SelectedIndex = raceList.SelectedIndex = tailList.SelectedIndex = subRaceList.SelectedIndex = faceType.SelectedIndex = facePart.SelectedIndex = facePaint.SelectedIndex = generationType.SelectedIndex = 0;
baseBodyList.SelectedIndex = genderListBody.SelectedIndex = raceList.SelectedIndex = tailList.SelectedIndex = subRaceList.SelectedIndex = faceType.SelectedIndex = facePart.SelectedIndex = faceExtra.SelectedIndex = generationType.SelectedIndex = 0;
CleanDirectory();
CheckForCommandArguments();
}
Expand Down Expand Up @@ -670,6 +671,22 @@ public string GetFaceTexturePath(int material) {
return "chara/common/texture/catchlight_1.tex";
}
}
public string GetHairTexturePath(int material) {
string hairValue = NumberPadder(faceExtra.SelectedIndex + 1);
string genderCode = (genderListBody.SelectedIndex == 0 ? raceCodeBody.Masculine[raceList.SelectedIndex] : raceCodeBody.Feminine[raceList.SelectedIndex]);
string subRace = (genderListBody.SelectedIndex == 0 ? raceCodeFace.Masculine[subRaceList.SelectedIndex] : raceCodeFace.Feminine[subRaceList.SelectedIndex]);
return "chara/human/c" + genderCode + "/obj/hair/h" + hairValue + "/texture/--c" + genderCode + "h" + hairValue + "_hir" + GetTextureType(material, true) + ".tex";
}

public string NumberPadder(int value) {
int numbersToPad = 4 - value.ToString().Length;
string result = "";
for (int i = 0; i < numbersToPad; i++) {
result += "0";
}
result += value;
return result;
}

public string GetTextureType(int material, bool isface = false) {
switch (material) {
Expand Down Expand Up @@ -859,7 +876,7 @@ private void addBodyEditButton_Click(object sender, EventArgs e) {
private void addFaceButton_Click(object sender, EventArgs e) {
hasDoneReload = false;
TextureSet materialSet = new TextureSet();
materialSet.MaterialSetName = facePart.Text + (facePart.SelectedIndex == 4 ? " " + (facePaint.SelectedIndex + 1) : "") + ", " + (facePart.SelectedIndex != 4 ? genderListBody.Text : "Unisex") + ", " + (facePart.SelectedIndex != 4 ? subRaceList.Text : "Multi Race") + ", " + (facePart.SelectedIndex != 4 ? faceType.Text : "Multi Face");
materialSet.MaterialSetName = facePart.Text + (facePart.SelectedIndex == 4 ? " " + (faceExtra.SelectedIndex + 1) : "") + ", " + (facePart.SelectedIndex != 4 ? genderListBody.Text : "Unisex") + ", " + (facePart.SelectedIndex != 4 ? subRaceList.Text : "Multi Race") + ", " + (facePart.SelectedIndex != 4 ? faceType.Text : "Multi Face");
switch (facePart.SelectedIndex) {
default:
materialSet.InternalDiffusePath = GetFaceTexturePath(0);
Expand All @@ -872,7 +889,12 @@ private void addFaceButton_Click(object sender, EventArgs e) {
materialSet.InternalMultiPath = GetFaceTexturePath(3);
break;
case 4:
materialSet.InternalDiffusePath = "chara/common/texture/decal_face/_decal_" + (facePaint.SelectedIndex + 1) + ".tex";
materialSet.InternalDiffusePath = "chara/common/texture/decal_face/_decal_" + (faceExtra.SelectedIndex + 1) + ".tex";
break;
case 5:
materialSet.MaterialSetName = facePart.Text + " " + (faceExtra.SelectedIndex + 1) + ", " + genderListBody.Text + ", " + subRaceList.Text;
materialSet.InternalNormalPath = GetHairTexturePath(1);
materialSet.InternalMultiPath = GetHairTexturePath(2);
break;

}
Expand Down Expand Up @@ -902,7 +924,7 @@ private void materialList_SelectedIndexChanged(object sender, EventArgs e) {
normal.Enabled = !string.IsNullOrEmpty(materialSet.InternalNormalPath);
multi.Enabled = !string.IsNullOrEmpty(materialSet.InternalMultiPath);
mask.Enabled = bakeNormals.Checked;
glow.Enabled = !materialSet.MaterialSetName.ToLower().Contains("face paint");
glow.Enabled = !materialSet.MaterialSetName.ToLower().Contains("face paint") && !materialSet.MaterialSetName.ToLower().Contains("hair");

if (materialSet.MaterialSetName.ToLower().Contains("eyes")) {
diffuse.LabelName.Text = "normal";
Expand Down Expand Up @@ -1416,12 +1438,12 @@ private void discordButton_Click(object sender, EventArgs e) {
}

private void facePart_SelectedIndexChanged(object sender, EventArgs e) {
if (facePart.SelectedIndex == 4) {
if (facePart.SelectedIndex == 4 || facePart.SelectedIndex == 5) {
asymCheckbox.Enabled = faceType.Enabled = subRaceList.Enabled = false;
facePaint.Enabled = true;
faceExtra.Enabled = true;
} else {
asymCheckbox.Enabled = faceType.Enabled = subRaceList.Enabled = true;
facePaint.Enabled = false;
faceExtra.Enabled = false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"projects": {
"C:\\Users\\stel9\\source\\repos\\FFXIVLooseTextureCompiler\\FFXIVLooseTextureCompiler\\FFXIVLooseTextureCompiler.csproj": {
"version": "1.0.3.4",
"version": "1.0.3.5",
"restore": {
"projectUniqueName": "C:\\Users\\stel9\\source\\repos\\FFXIVLooseTextureCompiler\\FFXIVLooseTextureCompiler\\FFXIVLooseTextureCompiler.csproj",
"projectName": "FFXIVLooseTextureCompiler",
Expand Down
2 changes: 1 addition & 1 deletion FFXIVLooseTextureCompiler/obj/project.assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder": {}
},
"project": {
"version": "1.0.3.4",
"version": "1.0.3.5",
"restore": {
"projectUniqueName": "C:\\Users\\stel9\\source\\repos\\FFXIVLooseTextureCompiler\\FFXIVLooseTextureCompiler\\FFXIVLooseTextureCompiler.csproj",
"projectName": "FFXIVLooseTextureCompiler",
Expand Down
2 changes: 1 addition & 1 deletion FFXIVLooseTextureCompiler/obj/project.nuget.cache
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "nd7nNC7Umu45iRqLbfyRpNgUlgxiqrJsyGE6L33UGswS3r2nEIyCXZlwOe7nu29jVBUzpWi9zSwLumNGkn85yw==",
"dgSpecHash": "ZjDwbYFM8IYidfglrBvTGBpAVaeNFH83GwWM0YpO4lsycqDqHLQeNsPkiQRxEzA69AwEJYvPGycgaBDiNx+1vQ==",
"success": true,
"projectFilePath": "C:\\Users\\stel9\\source\\repos\\FFXIVLooseTextureCompiler\\FFXIVLooseTextureCompiler\\FFXIVLooseTextureCompiler.csproj",
"expectedPackageFiles": [
Expand Down

0 comments on commit 2aab018

Please sign in to comment.