Skip to content

Commit

Permalink
Major impovements to normal generation. Whenever the tool decides a r…
Browse files Browse the repository at this point in the history
…eload is required it will also redraw after. Bulk Tex Manager will now stay top most.
  • Loading branch information
Sebane1 committed Jan 26, 2023
1 parent 725474b commit bd9fecc
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 14 deletions.
Binary file modified .vs/FFXIVLooseTextureCompiler/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file modified .vs/FFXIVLooseTextureCompiler/v17/.suo
Binary file not shown.
4 changes: 1 addition & 3 deletions FFXIVLooseTextureCompiler/BulkTexManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public partial class BulkTexManager : Form {

public BulkTexManager() {
InitializeComponent();
TopMost = true;
}

private void pictureBox1_Click(object sender, EventArgs e) {
Expand Down Expand Up @@ -105,9 +106,6 @@ private void bulkImport_Click(object sender, EventArgs e) {
if (folderBrowserDialog.ShowDialog() == DialogResult.OK) {
AddFilesRecursively(folderBrowserDialog.SelectedPath, 0, 10);
}
TopMost = true;
BringToFront();
TopMost = false;
}
public void AddFilesRecursively(string path, int recursionCount, int recursionLimit) {
foreach (string file in Directory.GetFiles(path, "*.tex")) {
Expand Down
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.1.0</AssemblyVersion>
<FileVersion>1.0.1.0</FileVersion>
<Version>1.0.1.0</Version>
<AssemblyVersion>1.0.1.1</AssemblyVersion>
<FileVersion>1.0.1.1</FileVersion>
<Version>1.0.1.1</Version>
<RunPostBuildEvent>Always</RunPostBuildEvent>
<Title>FFXIV Loose Texture Compiler</Title>
<Copyright>Lawener Industries</Copyright>
Expand Down
10 changes: 8 additions & 2 deletions FFXIVLooseTextureCompiler/ImageProcessing/Normal.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using KVImage;
using System;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.Linq;
Expand Down Expand Up @@ -37,6 +38,7 @@ public static Bitmap Calculate(string file) {
}
public static Bitmap Calculate(Bitmap file) {
Bitmap image = file;
image.RotateFlip(RotateFlipType.RotateNoneFlipX);
#region Global Variables
int w = image.Width - 1;
int h = image.Height - 1;
Expand All @@ -46,6 +48,7 @@ public static Bitmap Calculate(Bitmap file) {
float sample_d;
float x_vector;
float y_vector;
Bitmap finalNormal = new Bitmap(image.Width, image.Height);
Bitmap normal = new Bitmap(image.Width, image.Height);
#endregion
for (int y = 0; y < h + 1; y++) {
Expand All @@ -60,7 +63,10 @@ public static Bitmap Calculate(Bitmap file) {
normal.SetPixel(x, y, col);
}
}
return normal;
normal.RotateFlip(RotateFlipType.RotateNoneFlipX);
Bitmap normal2 = new Bitmap(normal);
KVImage.ImageBlender imageBlender = new KVImage.ImageBlender();
return imageBlender.BlendImages(normal, 0, 0, normal.Width, normal.Height, Contrast.AdjustContrast(normal2, 120), 0, 0, KVImage.ImageBlender.BlendOperation.Blend_Overlay); ;
}
}
}
12 changes: 9 additions & 3 deletions FFXIVLooseTextureCompiler/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,12 @@ private void generateButton_Click(object sender, EventArgs e) {
Hook.SendString(@"/penumbra reload");
Thread.Sleep(100);
Hook.SendSyncKey(Keys.Enter);
Thread.Sleep(2000);
Hook.SendSyncKey(Keys.Enter);
Thread.Sleep(500);
Hook.SendString(@"/penumbra redraw");
Thread.Sleep(100);
Hook.SendSyncKey(Keys.Enter);
generatedOnce = true;
}
TopMost = true;
Expand Down Expand Up @@ -383,7 +389,7 @@ public void ExportTex(string inputFile, string outputFile, ExportType exportType
output.Save(stream, ImageFormat.Png);
normalCache.Add(diffuseNormal, output);
} catch {
MessageBox.Show("Warning, normal conversion failed. Check that your files are correct.", VersionText);
MessageBox.Show("Warning, normal merging failed. Check that your files are correct and the same dimensions", VersionText);
normal.Save(stream, ImageFormat.Png);
normalCache.Add(diffuseNormal, normal);
}
Expand Down Expand Up @@ -456,7 +462,7 @@ public void ExportTex(string inputFile, string outputFile, ExportType exportType
output.Save(stream, ImageFormat.Png);
normalCache.Add(diffuseNormal, output);
} catch {
MessageBox.Show("Warning, normal conversion failed. Check that your files are correct.", VersionText);
MessageBox.Show("Warning, normal merging failed. Check that your files are correct and the same dimensions", VersionText);
normal.Save(stream, ImageFormat.Png);
normalCache.Add(diffuseNormal, normal);
}
Expand Down Expand Up @@ -527,7 +533,7 @@ public void ExportTex(string inputFile, string outputFile, ExportType exportType
output.Save(stream, ImageFormat.Png);
normalCache.Add(diffuseNormal, output);
} catch {
MessageBox.Show("Warning, normal conversion failed. Check that your files are correct.", VersionText);
MessageBox.Show("Warning, normal merging failed. Check that your files are correct and the same dimensions", VersionText);
normal.Save(stream, ImageFormat.Png);
normalCache.Add(diffuseNormal, normal);
}
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.1",
"version": "1.0.1.1",
"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.1",
"version": "1.0.1.1",
"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": "ZfldN2Fdij0tg5oWPs4DvwraEYCTHkqfBLs6yKCnoh+fHj4yM9viLH3o4cmQLXkjvztxowzJrQuWHeTuZjkPfA==",
"dgSpecHash": "lvTY8r0O+AxRRdAAOBKCXjt8EVdE1T0AQvlZsWJOnJH6kk1ee68qxsGc9Ab/UDdZKiwxUtgLWZl7nNIfUSouUA==",
"success": true,
"projectFilePath": "C:\\Users\\stel9\\source\\repos\\FFXIVLooseTextureCompiler\\FFXIVLooseTextureCompiler\\FFXIVLooseTextureCompiler.csproj",
"expectedPackageFiles": [
Expand Down

0 comments on commit bd9fecc

Please sign in to comment.