Skip to content

Commit 7b86673

Browse files
committed
Adjust progress reporting.
1 parent 5962dc3 commit 7b86673

File tree

4 files changed

+137
-23
lines changed

4 files changed

+137
-23
lines changed

‎FFXIVLooseTextureCompiler/MainForm.Designer.cs‎

Lines changed: 32 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎FFXIVLooseTextureCompiler/MainForm.cs‎

Lines changed: 100 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,28 @@ public MainWindow() {
8282
GetPenumbraPath();
8383
Text += " " + Program.Version;
8484
textureProcessor = new TextureProcessor();
85+
textureProcessor.OnProgressReport += TextureProcessor_OnProgressReport;
8586
textureProcessor.OnProgressChange += TextureProcessor_OnProgressChange;
8687
textureProcessor.OnLaunchedXnormal += TextureProcessor_OnLaunchedXnormal;
8788
textureProcessor.OnStartedProcessing += TextureProcessor_OnStartedProcessing;
8889
textureProcessor.OnError += TextureProcessor_OnError;
8990
Racial.RacePaths.otopopNoticeTriggered += RacePaths_otopopNoticeTriggered;
9091
}
9192

93+
private void TextureProcessor_OnProgressReport(object? sender, string e) {
94+
if (generateButton.InvokeRequired) {
95+
Action safeWrite = delegate { ProgressReport(e); };
96+
generateButton.Invoke(safeWrite);
97+
} else {
98+
exportLabel.AutoSize = true;
99+
exportLabel.Text = e;
100+
Console.WriteLine(e);
101+
}
102+
}
103+
public void ProgressReport(string text) {
104+
exportLabel.AutoSize = true;
105+
exportLabel.Text = text;
106+
}
92107
private void TextureProcessor_OnError(object? sender, string e) {
93108
MessageBox.Show(e);
94109
}
@@ -1013,13 +1028,22 @@ private void addCustomPathButton_Click(object sender, EventArgs e) {
10131028
}
10141029
}
10151030

1016-
private void materialListContextMenu_Opening(object sender, System.ComponentModel.CancelEventArgs e) {
1031+
private void textureSetListContextMenu_Opening(object sender, System.ComponentModel.CancelEventArgs e) {
10171032
if (textureList.Items.Count < 1 || textureList.SelectedIndex < 0) {
10181033
e.Cancel = true;
1019-
materialListContextMenu.Close();
1034+
textureSetListContextMenu.Close();
10201035
} else {
1021-
omniExportModeToolStripMenuItem.Text = (textureList.SelectedItem as TextureSet).OmniExportMode
1036+
var textureSet = (textureList.SelectedItem as TextureSet);
1037+
omniExportModeToolStripMenuItem.Text = textureSet.OmniExportMode
10221038
? "Disable Universal Compatibility" : "Enable Universal Compatibility";
1039+
1040+
if (textureSet.InternalBasePath.ToLower().Contains("bibo") ||
1041+
textureSet.InternalBasePath.ToLower().Contains("gen3") ||
1042+
textureSet.InternalBasePath.ToLower().Contains("body")) {
1043+
swapRaceToolStripMenuItem.Visible = true;
1044+
} else {
1045+
swapRaceToolStripMenuItem.Visible = false;
1046+
}
10231047
}
10241048
}
10251049

@@ -2273,6 +2297,25 @@ private void duplicateToolStripMenuItem_Click(object sender, EventArgs e) {
22732297
newTextureSet.IgnoreNormalGeneration = textureSet.IgnoreNormalGeneration;
22742298
newTextureSet.IgnoreMaskGeneration = textureSet.IgnoreMaskGeneration;
22752299
newTextureSet.OmniExportMode = textureSet.OmniExportMode;
2300+
2301+
List<string> layers = new List<string>();
2302+
foreach (var item in textureSet.BaseOverlays) {
2303+
layers.Add(item);
2304+
}
2305+
newTextureSet.BaseOverlays = layers;
2306+
2307+
layers = new List<string>();
2308+
foreach (var item in textureSet.NormalOverlays) {
2309+
layers.Add(item);
2310+
}
2311+
newTextureSet.NormalOverlays = layers;
2312+
2313+
layers = new List<string>();
2314+
foreach (var item in textureSet.MaskOverlays) {
2315+
layers.Add(item);
2316+
}
2317+
newTextureSet.MaskOverlays = layers;
2318+
22762319
textureList.Items.Add(newTextureSet);
22772320
textureList.SelectedIndex = textureList.Items.Count - 1;
22782321
}
@@ -3022,8 +3065,61 @@ private void tail4MaleToolStripMenuItem_Click(object sender, EventArgs e) {
30223065
}
30233066
}
30243067

3025-
private void eyeToolsToolStripMenuItem_Click(object sender, EventArgs e) {
3068+
private void legacyAuRaMapsToDawntrailToolStripMenuItem_Click(object sender, EventArgs e) {
3069+
OpenFileDialog openFileDialog = new OpenFileDialog();
3070+
openFileDialog.Filter = "Texture File|*.png;*.tga;*.dds;*.bmp;*.tex;";
3071+
MessageBox.Show("Please select Au Ra diffuse (skin) texture");
3072+
if (openFileDialog.ShowDialog() == DialogResult.OK) {
3073+
var diffuse = openFileDialog.FileName;
3074+
MessageBox.Show("Please select Au Ra normal (blue/red) texture");
3075+
if (openFileDialog.ShowDialog() == DialogResult.OK) {
3076+
var normal = openFileDialog.FileName;
3077+
MessageBox.Show("Please select Au Ra multi (orange/green) texture");
3078+
if (openFileDialog.ShowDialog() == DialogResult.OK) {
3079+
var multi = openFileDialog.FileName;
3080+
var normalImage = TexIO.ResolveBitmap(normal);
3081+
var normalR = ImageManipulation.ExtractRed(normalImage);
3082+
var normalG = ImageManipulation.ExtractGreen(normalImage);
3083+
var normalB = ImageManipulation.ExtractRed(TexIO.ResolveBitmap(multi));
3084+
var normalA = ImageManipulation.ExtractAlpha(normalImage);
3085+
TexIO.SaveBitmap(ImageManipulation.MergeGrayscalesToRGBA(normalR, normalG, normalB, normalA), ImageManipulation.AddSuffix(normal, "_dawntrail_normal"));
3086+
TexIO.SaveBitmap(ImageManipulation.ConvertBaseToDawntrailSkinMulti(TexIO.ResolveBitmap(diffuse)), ImageManipulation.AddSuffix(multi, "_dawntrail_mask"));
3087+
MessageBox.Show("Au Ra textures successfully converted! Your diffuse texture did not require conversion and is the same.", VersionText);
3088+
try {
3089+
Process.Start(new System.Diagnostics.ProcessStartInfo() {
3090+
FileName = Path.GetDirectoryName(openFileDialog.FileName),
3091+
UseShellExecute = true,
3092+
Verb = "OPEN"
3093+
});
3094+
} catch {
3095+
3096+
}
3097+
}
3098+
}
3099+
}
3100+
}
3101+
3102+
private void swapRaceToolStripMenuItem_Click(object sender, EventArgs e) {
3103+
var textureSet = (textureList.SelectedItem as TextureSet);
3104+
hasDoneReload = false;
3105+
string previousTextureSetName = textureSet.TextureSetName;
3106+
textureSet.TextureSetName = baseBodyList.Text + (baseBodyList.Text.ToLower().Contains("tail") ? " " +
3107+
(tailList.SelectedIndex + 1) : "") + ", " + (raceList.SelectedIndex == 3 ? "Unisex" : genderList.Text)
3108+
+ ", " + raceList.Text;
3109+
3110+
if (previousTextureSetName == textureSet.GroupName) {
3111+
textureSet.GroupName = textureSet.TextureSetName;
3112+
}
3113+
3114+
AddBodyPaths(textureSet);
3115+
RefreshList();
3116+
HasSaved = false;
3117+
}
3118+
3119+
private void swapRaceToolStripMenuItem_VisibleChanged(object sender, EventArgs e) {
3120+
if (swapRaceToolStripMenuItem.Visible) {
30263121

3122+
}
30273123
}
30283124
}
30293125
}

‎FFXIVLooseTextureCompiler/MainForm.resx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<root>
33
<!--
4-
Microsoft ResX Schema
4+
Microsoft ResX Schema
55
66
Version 2.0
77
@@ -48,7 +48,7 @@
4848
value : The object must be serialized with
4949
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
5050
: and then encoded with base64 encoding.
51-
51+
5252
mimetype: application/x-microsoft.net.object.soap.base64
5353
value : The object must be serialized with
5454
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
@@ -129,7 +129,7 @@
129129
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
130130
<value>16, 21</value>
131131
</metadata>
132-
<metadata name="materialListContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
132+
<metadata name="textureSetListContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
133133
<value>132, 17</value>
134134
</metadata>
135135
<metadata name="ffxivRefreshTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
@@ -151,7 +151,7 @@
151151
<value>1188, 17</value>
152152
</metadata>
153153
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
154-
<value>25</value>
154+
<value>60</value>
155155
</metadata>
156156
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
157157
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

0 commit comments

Comments
 (0)