Disable UI for textures when converting.

This commit is contained in:
Ottermandias 2023-08-22 14:18:29 +02:00
parent ebaa42f311
commit ad830dc56e
4 changed files with 30 additions and 20 deletions

@ -1 +1 @@
Subproject commit ad67dfcd95912d171f2c9576d70d328bdd68b1ca
Subproject commit 36df7a87680eecde48801a38271f0ed8696233ed

View file

@ -42,6 +42,7 @@ public class DalamudSubstitutionProvider : IDisposable
public void ResetSubstitutions(IEnumerable<Utf8GamePath> paths)
{
// TODO fix
//var transformed = paths
// .Where(p => (p.Path.StartsWith("ui/"u8) || p.Path.StartsWith("common/font/"u8)) && p.Path.EndsWith(".tex"u8))
// .Select(p => p.ToString());

View file

@ -186,8 +186,7 @@ public sealed class TextureManager : SingleTaskQueue, IDisposable
CombinedTexture.TextureSaveType.AsIs when image.Type is TextureType.Dds => AddMipMaps(image.AsDds!, _mipMaps),
CombinedTexture.TextureSaveType.Bitmap => ConvertToRgbaDds(image, _mipMaps, cancel, rgba, width, height),
CombinedTexture.TextureSaveType.BC3 => ConvertToCompressedDds(image, _mipMaps, false, cancel, rgba, width, height),
CombinedTexture.TextureSaveType.BC7 =>
ConvertToCompressedDds(image, _mipMaps, true, cancel, rgba, width, height),
CombinedTexture.TextureSaveType.BC7 => ConvertToCompressedDds(image, _mipMaps, true, cancel, rgba, width, height),
_ => throw new Exception("Wrong save type."),
};
@ -344,10 +343,11 @@ public sealed class TextureManager : SingleTaskQueue, IDisposable
if (numMips == input.Meta.MipLevels)
return input;
var ec = input.GenerateMipMaps(out var ret, numMips,
(Dalamud.Utility.Util.IsLinux() ? FilterFlags.ForceNonWIC : 0) | FilterFlags.SeparateAlpha);
var flags = (Dalamud.Utility.Util.IsLinux() ? FilterFlags.ForceNonWIC : 0) | FilterFlags.SeparateAlpha;
var ec = input.GenerateMipMaps(out var ret, numMips, flags);
if (ec != ErrorCode.Ok)
throw new Exception($"Could not create the requested {numMips} mip maps, maybe retry with the top-right checkbox unchecked:\n{ec}");
throw new Exception(
$"Could not create the requested {numMips} mip maps (input has {input.Meta.MipLevels}) with flags [{flags}], maybe retry with the top-right checkbox unchecked:\n{ec}");
return ret;
}

View file

@ -5,11 +5,13 @@ using System.IO;
using System.Linq;
using System.Numerics;
using System.Threading.Tasks;
using Dalamud.Interface;
using ImGuiNET;
using OtterGui;
using OtterGui.Raii;
using OtterTex;
using Penumbra.Import.Textures;
using Penumbra.UI.Classes;
namespace Penumbra.UI.AdvancedWindow;
@ -48,18 +50,21 @@ public partial class ModEditWindow
ImGuiUtil.DrawTextButton(label, new Vector2(-1, 0), ImGui.GetColorU32(ImGuiCol.FrameBg));
ImGui.NewLine();
TextureDrawer.PathInputBox(_textures, tex, ref tex.TmpPath, "##input", "Import Image...",
"Can import game paths as well as your own files.", _mod!.ModPath.FullName, _fileDialog, _config.DefaultModImportPath);
if (_textureSelectCombo.Draw("##combo",
"Select the textures included in this mod on your drive or the ones they replace from the game files.", tex.Path,
_mod.ModPath.FullName.Length + 1, out var newPath)
&& newPath != tex.Path)
tex.Load(_textures, newPath);
using (var disabled = ImRaii.Disabled(!_center.SaveTask.IsCompleted))
{
TextureDrawer.PathInputBox(_textures, tex, ref tex.TmpPath, "##input", "Import Image...",
"Can import game paths as well as your own files.", _mod!.ModPath.FullName, _fileDialog, _config.DefaultModImportPath);
if (_textureSelectCombo.Draw("##combo",
"Select the textures included in this mod on your drive or the ones they replace from the game files.", tex.Path,
_mod.ModPath.FullName.Length + 1, out var newPath)
&& newPath != tex.Path)
tex.Load(_textures, newPath);
if (tex == _left)
_center.DrawMatrixInputLeft(size.X);
else
_center.DrawMatrixInputRight(size.X);
if (tex == _left)
_center.DrawMatrixInputLeft(size.X);
else
_center.DrawMatrixInputRight(size.X);
}
ImGui.NewLine();
using var child2 = ImRaii.Child("image");
@ -177,8 +182,6 @@ public partial class ModEditWindow
{
ImGui.NewLine();
}
ImGui.NewLine();
}
switch (_center.SaveTask.Status)
@ -186,7 +189,8 @@ public partial class ModEditWindow
case TaskStatus.WaitingForActivation:
case TaskStatus.WaitingToRun:
case TaskStatus.Running:
ImGui.TextUnformatted("Computing...");
ImGuiUtil.DrawTextButton("Computing...", -Vector2.UnitX, Colors.PressEnterWarningBg);
break;
case TaskStatus.Canceled:
case TaskStatus.Faulted:
@ -196,8 +200,13 @@ public partial class ModEditWindow
ImGuiUtil.TextWrapped(_center.SaveTask.Exception?.ToString() ?? "Unknown Error");
break;
}
default:
ImGui.Dummy(new Vector2(1, ImGui.GetFrameHeight()));
break;
}
ImGui.NewLine();
using var child2 = ImRaii.Child("image");
if (child2)
_center.Draw(_textures, imageSize);