diff --git a/LooseTextureCompilerCore b/LooseTextureCompilerCore index 610931a4d..2f6fbb28d 160000 --- a/LooseTextureCompilerCore +++ b/LooseTextureCompilerCore @@ -1 +1 @@ -Subproject commit 610931a4db50027a51b724324da2573405433149 +Subproject commit 2f6fbb28dbbeddfc6f6ee23db3ff5a205247a7d4 diff --git a/Penumbra/Api/PenumbraIpcProviders.cs b/Penumbra/Api/PenumbraIpcProviders.cs index 87de6a0c6..2934c538b 100644 --- a/Penumbra/Api/PenumbraIpcProviders.cs +++ b/Penumbra/Api/PenumbraIpcProviders.cs @@ -1,12 +1,10 @@ using Dalamud.Game.ClientState.Objects.Types; -using Dalamud.Plugin; using Penumbra.GameData.Enums; using Penumbra.Api.Enums; using Penumbra.Api.Helpers; using Penumbra.Collections.Manager; using Penumbra.Mods.Manager; using Penumbra.Services; -using Penumbra.Util; namespace Penumbra.Api; diff --git a/Penumbra/Import/Textures/BaseImage.cs b/Penumbra/Import/Textures/BaseImage.cs index 4f8c5305c..e43eca032 100644 --- a/Penumbra/Import/Textures/BaseImage.cs +++ b/Penumbra/Import/Textures/BaseImage.cs @@ -1,5 +1,6 @@ using Lumina.Data.Files; using OtterTex; +using Penumbra.Api.Enums; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; @@ -34,7 +35,7 @@ public TextureType Type => Image switch { null => TextureType.Unknown, - ScratchImage => TextureType.Dds, + ScratchImage => TextureType.AsIsDds, Image => TextureType.Png, _ => TextureType.Unknown, }; diff --git a/Penumbra/Import/Textures/CombinedTexture.cs b/Penumbra/Import/Textures/CombinedTexture.cs index 23e646267..32323ba83 100644 --- a/Penumbra/Import/Textures/CombinedTexture.cs +++ b/Penumbra/Import/Textures/CombinedTexture.cs @@ -1,3 +1,8 @@ +using FFXIVLooseTextureCompiler.ImageProcessing; +using SixLabors.ImageSharp; +using SixLabors.ImageSharp.Formats.Png; +using SixLabors.ImageSharp.PixelFormats; + namespace Penumbra.Import.Textures; public partial class CombinedTexture : IDisposable @@ -138,15 +143,6 @@ public void Update() break; } } - - private void Clean() - { - _centerStorage.Dispose(); - _current = null; - SaveTask = Task.CompletedTask; - _mode = Mode.Empty; - } - public void ImageToEyeMaps(string path, string textureCompilerDLC) { if (!IsLoaded || _current == null) @@ -156,15 +152,14 @@ public void ImageToEyeMaps(string path, string textureCompilerDLC) try { - var image = Image.LoadPixelData(_current.RGBAPixels, _current.TextureWrap!.Width, + var image = Image.LoadPixelData(_current.RgbaPixels, _current.TextureWrap!.Width, _current.TextureWrap!.Height); image.Save(path, new PngEncoder() { CompressionLevel = PngCompressionLevel.NoCompression }); ImageManipulation.ConvertToEyeMaps(path, textureCompilerDLC); - SaveException = null; } catch (Exception e) { - SaveException = e; + } } internal void EyeMultiToGrayscale(string path) @@ -176,16 +171,15 @@ internal void EyeMultiToGrayscale(string path) try { - var image = Image.LoadPixelData(_current.RGBAPixels, _current.TextureWrap!.Width, + var image = Image.LoadPixelData(_current.RgbaPixels, _current.TextureWrap!.Width, _current.TextureWrap!.Height); image.Save(path, new PngEncoder() { CompressionLevel = PngCompressionLevel.NoCompression }); - Bitmap multi = TexLoader.ResolveBitmap(path); + System.Drawing.Bitmap multi = TexLoader.ResolveBitmap(path); ImageManipulation.ExtractRed(multi).Save(ImageManipulation.AddSuffix(path, "_grayscale")); - SaveException = null; } catch (Exception e) { - SaveException = e; + } } @@ -198,16 +192,22 @@ public void AtramentumLuminisDiffuseToGlowMap(string path) try { - var image = Image.LoadPixelData(_current.RGBAPixels, _current.TextureWrap!.Width, + var image = Image.LoadPixelData(_current.RgbaPixels, _current.TextureWrap!.Width, _current.TextureWrap!.Height); image.Save(path, new PngEncoder() { CompressionLevel = PngCompressionLevel.NoCompression }); - Bitmap diffuse = TexLoader.ResolveBitmap(path); - AtramentumLuminisGlow.ExtractGlowMapFromDiffuse(diffuse).Save(path, ImageFormat.Png); - SaveException = null; + System.Drawing.Bitmap diffuse = TexLoader.ResolveBitmap(path); + AtramentumLuminisGlow.ExtractGlowMapFromDiffuse(diffuse).Save(path, System.Drawing.Imaging.ImageFormat.Png); } catch (Exception e) { - SaveException = e; + } } + private void Clean() + { + _centerStorage.Dispose(); + _current = null; + SaveTask = Task.CompletedTask; + _mode = Mode.Empty; + } } diff --git a/Penumbra/Import/Textures/Texture.cs b/Penumbra/Import/Textures/Texture.cs index fe1d33713..d2cf83d94 100644 --- a/Penumbra/Import/Textures/Texture.cs +++ b/Penumbra/Import/Textures/Texture.cs @@ -2,7 +2,6 @@ using OtterTex; namespace Penumbra.Import.Textures; - public enum TextureType { Unknown, @@ -11,9 +10,9 @@ public enum TextureType Png, Bitmap, } - public sealed class Texture : IDisposable { + // Path to the file we tried to load. public string Path = string.Empty; diff --git a/Penumbra/Import/Textures/TextureManager.cs b/Penumbra/Import/Textures/TextureManager.cs index 31c3275e6..c853d68bb 100644 --- a/Penumbra/Import/Textures/TextureManager.cs +++ b/Penumbra/Import/Textures/TextureManager.cs @@ -5,6 +5,7 @@ using OtterGui.Log; using OtterGui.Tasks; using OtterTex; +using Penumbra.Api.Enums; using SixLabors.ImageSharp; using SixLabors.ImageSharp.Formats.Png; using SixLabors.ImageSharp.PixelFormats; diff --git a/Penumbra/Penumbra.csproj b/Penumbra/Penumbra.csproj index ec4331136..528b5dae8 100644 --- a/Penumbra/Penumbra.csproj +++ b/Penumbra/Penumbra.csproj @@ -69,15 +69,17 @@ - + + +