Skip to content

Commit

Permalink
Attempt to fix some texture errors.
Browse files Browse the repository at this point in the history
Get penumbra to compile again.

# This is a combination of 105 commits.

Add support for the DalamudSubstitutionProvider for textures.

# The commit message xivdev#9 will be skipped:

# Attempt to fix some texture errors.

# The commit message xivdev#10 will be skipped:

# Get penumbra to compile again.

# The commit message xivdev#11 will be skipped:

# Submodule update

# The commit message xivdev#12 will be skipped:

# Disable UI for textures when converting.

# The commit message xivdev#13 will be skipped:

# Update DirectXTex/OtterTex

# The commit message xivdev#14 will be skipped:

# Keep the texture alive during write.

# The commit message xivdev#15 will be skipped:

# [CI] Updating repo.json for 0.7.3.2

# The commit message xivdev#16 will be skipped:

# Explain comment.

# The commit message xivdev#17 will be skipped:

# Add some unnamed mounts to actor identification.

# The commit message xivdev#18 will be skipped:

# Material editor: improve color accuracy

# The commit message xivdev#19 will be skipped:

# Material editor: live-preview changes

# The commit message xivdev#20 will be skipped:

# Material editor 2099

# The commit message xivdev#21 will be skipped:

# Material editor: better color constants

# The commit message xivdev#22 will be skipped:

# Update GameData

# The commit message xivdev#23 will be skipped:

# Material editor: Allow negatives again with R²G²B²
#
# There seems to be people using it.

# The commit message xivdev#24 will be skipped:

# Material editor: tweak colorset highlighting
#
# Make the frequency framerate-independent, set it to 1 Hz, and decrease the dynamic range.
#
# Thanks @StoiaCode for feedback!

# The commit message xivdev#25 will be skipped:

# Material editor: tear down previewers bound to a CharacterBase that goes away

# The commit message xivdev#26 will be skipped:

# Add a few texture manipulation tools.

# The commit message xivdev#27 will be skipped:

# Small cleanup, auto-formatting.

# The commit message xivdev#28 will be skipped:

# Textures: Un-merge save buttons, make ignore unselectable

# The commit message xivdev#29 will be skipped:

# Textures: Renumber CombineOps.
#
# Positive values in this enum also double as indices into the labels and tooltip arrays.
#
# (confirmed skill issue moment)

# The commit message xivdev#30 will be skipped:

# Textures: Automatic resizing

# The commit message xivdev#31 will be skipped:

# Textures: Add a matrix preset that drops alpha

# The commit message xivdev#32 will be skipped:

# Textures: PR xivdev#327 feedback

# The commit message xivdev#33 will be skipped:

# Textures: PR xivdev#327 feedback

# The commit message xivdev#34 will be skipped:

# Textures: Refactor resizing code

# The commit message xivdev#35 will be skipped:

# Textures: Simplify away _targetPixels

# The commit message xivdev#36 will be skipped:

# Slight restructuring.

# The commit message xivdev#37 will be skipped:

#  Skin Fixer (fixes modding of skin.shpk)

# The commit message xivdev#38 will be skipped:

# Skin Fixer: Make resolving skin.shpk for new draw objects async

# The commit message xivdev#39 will be skipped:

# Skin Fixer: Fix potential ref leak + add SRH
#
# `SafeResourceHandle` wraps a `ResourceHandle*` with auto `IncRef` / `DecRef`, to further help prevent leaks.

# The commit message xivdev#40 will be skipped:

# Use better event in SkinFixer and some cleanup.

# The commit message xivdev#41 will be skipped:

# Remove Finalize from FileEditor.

# The commit message xivdev#42 will be skipped:

# Some formatting in Materials.Shpk.

# The commit message xivdev#43 will be skipped:

# Small cleanup in ResolveContext.

# The commit message xivdev#44 will be skipped:

# Auto-formatting and some cleanup.

# The commit message xivdev#45 will be skipped:

# Restructure Live Preview.

# The commit message xivdev#46 will be skipped:

# Fix slash direction in material path.

# The commit message xivdev#47 will be skipped:

# [CI] Updating repo.json for testing_0.7.3.3

# The commit message xivdev#48 will be skipped:

# Fix newtonsoft not playing well with records with strings.

# The commit message xivdev#49 will be skipped:

# Cleanup

# The commit message xivdev#50 will be skipped:

# Check for drawObject != null before invoking draw object created event.

# The commit message xivdev#51 will be skipped:

# Fix variant gamepath.

# The commit message xivdev#52 will be skipped:

# Material editor: use a SafeHandle for texture swapping

# The commit message #53 will be skipped:

# Material editor: Customizable highlight color

# The commit message xivdev#54 will be skipped:

# Material editor: Vector field spacing

# The commit message xivdev#55 will be skipped:

# Fix compiler warning

# The commit message xivdev#56 will be skipped:

# [CI] Updating repo.json for testing_0.7.3.4

# The commit message xivdev#57 will be skipped:

# Resource Tree: Improve mtrl and sklb support

# The commit message xivdev#58 will be skipped:

# Resource Tree: Deduplicate nodes, add skp

# The commit message xivdev#59 will be skipped:

# Resource Tree: Add ChangedItem-like icons, make UI prettier

# The commit message xivdev#60 will be skipped:

# Resource Tree: Make skp child of sklb

# The commit message xivdev#61 will be skipped:

# Resource Tree: Fix shared model fold state

# The commit message xivdev#62 will be skipped:

# Some auto-formatting and ROS iteration for lookups.

# The commit message #63 will be skipped:

# Resource Tree: Use `/`s for game actual paths

# The commit message xivdev#64 will be skipped:

# Skin Fixer: Switch to a passive approach.
#
# Do not load skin.shpk for ourselves as it causes a race condition.
# Instead, inspect the materials' ShPk names.

# The commit message xivdev#65 will be skipped:

# Some formatting, use ConcurrentSet explicitly for clarity.

# The commit message xivdev#66 will be skipped:

# [CI] Updating repo.json for testing_0.7.3.5

# The commit message xivdev#67 will be skipped:

# Add Emotes to Changed Items.

# The commit message xivdev#68 will be skipped:

# [CI] Updating repo.json for testing_0.7.3.6

# The commit message xivdev#69 will be skipped:

# Fix changed item flags for emotes.

# The commit message #70 will be skipped:

# Update GameData for new parsing.

# The commit message xivdev#71 will be skipped:

# Fix CS update creating ambiguous reference.

# The commit message xivdev#72 will be skipped:

# Add Player and Interface to quick select collections and rework their tooltips and names slightly.

# The commit message xivdev#73 will be skipped:

# [CI] Updating repo.json for testing_0.7.3.7

# The commit message xivdev#74 will be skipped:

# Allow drag & drop of multiple mods or folders with Control.

# The commit message xivdev#75 will be skipped:

# [CI] Updating repo.json for testing_0.7.3.8

# The commit message xivdev#76 will be skipped:

# Fix click check for selectables.

# The commit message xivdev#77 will be skipped:

# [CI] Updating repo.json for testing_0.7.3.9

# The commit message xivdev#78 will be skipped:

# Add Filesystem Compression as a toggle and button. Also some auto-formatting.

# The commit message xivdev#79 will be skipped:

# [CI] Updating repo.json for testing_0.7.3.10

# The commit message xivdev#80 will be skipped:

# Add Compacting to API AddMod.

# The commit message xivdev#81 will be skipped:

# Add key checks to restoring from backup or deleting backups.

# The commit message xivdev#82 will be skipped:

# Material Editor: Split ColorTable apart from ColorSet

# The commit message xivdev#83 will be skipped:

# GameData Commit.

# The commit message xivdev#84 will be skipped:

# Auto Formatting.

# The commit message xivdev#85 will be skipped:

# Use System global usings.

# The commit message xivdev#86 will be skipped:

# Make line endings explicit in editorconfig and share in sub projects, also apply editorconfig everywhere and move some namespaces.

# The commit message xivdev#87 will be skipped:

# ResourceTree improvements + IPC
#
# - Moves ResourceType enum out of GameData as discussed on Discord ;
# - Adds new color coding for local player and non-networked objects on On-Screen ;
# - Adds ResourceTree-related IPC ;
# - Fixes xivdev#342.

# The commit message xivdev#88 will be skipped:

# ResourceTree IPC: Remove mergeSameCollection.

# The commit message xivdev#89 will be skipped:

# ResourceTree: Avoid enumerating the whole object table in some cases

# The commit message #90 will be skipped:

# Move IPC Arguments around.

# The commit message xivdev#91 will be skipped:

# Rename ResourceType file.

# The commit message xivdev#92 will be skipped:

# Remove enums folder from csproj?!

# The commit message xivdev#93 will be skipped:

# Fix params bug.

# The commit message #94 will be skipped:

# Api nuget version.

# The commit message xivdev#95 will be skipped:

# Add load state to resource watcher.

# The commit message xivdev#96 will be skipped:

# [CI] Updating repo.json for testing_0.7.3.11

# The commit message xivdev#97 will be skipped:

# Add CalculateHeight Hook

# The commit message xivdev#98 will be skipped:

# ResourceTree: Reverse-resolve in bulk

# The commit message xivdev#99 will be skipped:

# Remove some allocations from resource tree.

# The commit message xivdev#100 will be skipped:

# Update OtterGui.

# The commit message xivdev#101 will be skipped:

# Fix ambiguous reference for no fucking reason.

# The commit message xivdev#102 will be skipped:

# [CI] Updating repo.json for testing_0.7.3.12

# The commit message xivdev#103 will be skipped:

# Add automatic restore from backup for sort_order and active_collections for now.

# The commit message xivdev#104 will be skipped:

# Material Editor: Extend live preview.

# The commit message xivdev#105 will be skipped:

# Optimize ResourceTree somewhat.
  • Loading branch information
Sebane1 committed Sep 22, 2023
1 parent 48f7cfe commit af0ea43
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 28 deletions.
2 changes: 0 additions & 2 deletions Penumbra/Api/PenumbraIpcProviders.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
3 changes: 2 additions & 1 deletion Penumbra/Import/Textures/BaseImage.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Lumina.Data.Files;
using OtterTex;
using Penumbra.Api.Enums;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;

Expand Down Expand Up @@ -34,7 +35,7 @@ public TextureType Type
=> Image switch
{
null => TextureType.Unknown,
ScratchImage => TextureType.Dds,
ScratchImage => TextureType.AsIsDds,

Check failure on line 38 in Penumbra/Import/Textures/BaseImage.cs

View workflow job for this annotation

GitHub Actions / build

'TextureType' does not contain a definition for 'AsIsDds'

Check failure on line 38 in Penumbra/Import/Textures/BaseImage.cs

View workflow job for this annotation

GitHub Actions / build

'TextureType' does not contain a definition for 'AsIsDds'
Image<Rgba32> => TextureType.Png,
_ => TextureType.Unknown,
};
Expand Down
42 changes: 21 additions & 21 deletions Penumbra/Import/Textures/CombinedTexture.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -156,15 +152,14 @@ public void ImageToEyeMaps(string path, string textureCompilerDLC)

try
{
var image = Image.LoadPixelData<Rgba32>(_current.RGBAPixels, _current.TextureWrap!.Width,
var image = Image.LoadPixelData<Rgba32>(_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)
Expand All @@ -176,16 +171,15 @@ internal void EyeMultiToGrayscale(string path)

try
{
var image = Image.LoadPixelData<Rgba32>(_current.RGBAPixels, _current.TextureWrap!.Width,
var image = Image.LoadPixelData<Rgba32>(_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;

}
}

Expand All @@ -198,16 +192,22 @@ public void AtramentumLuminisDiffuseToGlowMap(string path)

try
{
var image = Image.LoadPixelData<Rgba32>(_current.RGBAPixels, _current.TextureWrap!.Width,
var image = Image.LoadPixelData<Rgba32>(_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;
}
}
3 changes: 1 addition & 2 deletions Penumbra/Import/Textures/Texture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using OtterTex;

namespace Penumbra.Import.Textures;

public enum TextureType
{
Unknown,
Expand All @@ -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;

Expand Down
1 change: 1 addition & 0 deletions Penumbra/Import/Textures/TextureManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion Penumbra/Penumbra.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,17 @@

<ItemGroup>
<PackageReference Include="EmbedIO" Version="3.4.3" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.2" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
<PackageReference Include="SharpCompress" Version="0.33.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\LooseTextureCompilerCore\LooseTextureCompilerCore.csproj" />
<ProjectReference Include="..\OtterGui\OtterGui.csproj" />
<ProjectReference Include="..\Penumbra.GameData\Penumbra.GameData.csproj" />
<ProjectReference Include="..\Penumbra.Api\Penumbra.Api.csproj" />
<ProjectReference Include="..\Penumbra.String\Penumbra.String.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit af0ea43

Please sign in to comment.