Add filter to texturedrawer.

This commit is contained in:
Ottermandias 2023-08-13 14:30:06 +02:00
parent af536b3423
commit cf3810a1b8
3 changed files with 77 additions and 59 deletions

View file

@ -6,7 +6,6 @@ using System.Threading.Tasks;
using ImGuiNET;
using OtterGui;
using OtterGui.Raii;
using OtterGui.Tasks;
using OtterTex;
using Penumbra.Import.Textures;
@ -16,9 +15,10 @@ public partial class ModEditWindow
{
private readonly TextureManager _textures;
private readonly Texture _left = new();
private readonly Texture _right = new();
private readonly CombinedTexture _center;
private readonly Texture _left = new();
private readonly Texture _right = new();
private readonly CombinedTexture _center;
private readonly TextureDrawer.PathSelectCombo _textureSelectCombo;
private bool _overlayCollapsed = true;
private bool _addMipMaps = true;
@ -47,11 +47,10 @@ public partial class ModEditWindow
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);
var files = _editor.Files.Tex.SelectMany(f => f.SubModUsage.Select(p => (p.Item2.ToString(), true))
.Prepend((f.File.FullName, false)));
TextureDrawer.PathSelectBox(_textures, tex, "##combo",
"Select the textures included in this mod on your drive or the ones they replace from the game files.", files,
_mod.ModPath.FullName.Length + 1);
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);

View file

@ -520,22 +520,22 @@ public partial class ModEditWindow : Window, IDisposable
public ModEditWindow(PerformanceTracker performance, FileDialogService fileDialog, ItemSwapTab itemSwapTab, IDataManager gameData,
Configuration config, ModEditor editor, ResourceTreeFactory resourceTreeFactory, MetaFileManager metaFileManager,
StainService stainService, ActiveCollections activeCollections, UiBuilder uiBuilder, DalamudServices dalamud, ModMergeTab modMergeTab,
StainService stainService, ActiveCollections activeCollections, DalamudServices dalamud, ModMergeTab modMergeTab,
CommunicatorService communicator, TextureManager textures)
: base(WindowBaseLabel)
{
_performance = performance;
_itemSwapTab = itemSwapTab;
_config = config;
_editor = editor;
_metaFileManager = metaFileManager;
_stainService = stainService;
_activeCollections = activeCollections;
_dalamud = dalamud;
_modMergeTab = modMergeTab;
_communicator = communicator;
_textures = textures;
_fileDialog = fileDialog;
_performance = performance;
_itemSwapTab = itemSwapTab;
_config = config;
_editor = editor;
_metaFileManager = metaFileManager;
_stainService = stainService;
_activeCollections = activeCollections;
_dalamud = dalamud;
_modMergeTab = modMergeTab;
_communicator = communicator;
_textures = textures;
_fileDialog = fileDialog;
_materialTab = new FileEditor<MtrlTab>(this, gameData, config, _fileDialog, "Materials", ".mtrl",
() => _editor.Files.Mtrl, DrawMaterialPanel, () => _mod?.ModPath.FullName ?? string.Empty,
bytes => new MtrlTab(this, new MtrlFile(bytes)));
@ -544,8 +544,9 @@ public partial class ModEditWindow : Window, IDisposable
_shaderPackageTab = new FileEditor<ShpkTab>(this, gameData, config, _fileDialog, "Shaders", ".shpk",
() => _editor.Files.Shpk, DrawShaderPackagePanel, () => _mod?.ModPath.FullName ?? string.Empty,
bytes => new ShpkTab(_fileDialog, bytes));
_center = new CombinedTexture(_left, _right);
_quickImportViewer = new ResourceTreeViewer(_config, resourceTreeFactory, 2, OnQuickImportRefresh, DrawQuickImportActions);
_center = new CombinedTexture(_left, _right);
_textureSelectCombo = new TextureDrawer.PathSelectCombo(textures, editor);
_quickImportViewer = new ResourceTreeViewer(_config, resourceTreeFactory, 2, OnQuickImportRefresh, DrawQuickImportActions);
_communicator.ModPathChanged.Subscribe(OnModPathChanged, ModPathChanged.Priority.ModEditWindow);
}