mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-25 09:59:20 +01:00
Add option to import atch files from the mod itself via context.
This commit is contained in:
parent
26a6cc4735
commit
82a1271281
2 changed files with 38 additions and 8 deletions
|
|
@ -13,6 +13,7 @@ public class ModFileCollection : IDisposable, IService
|
|||
private readonly List<FileRegistry> _tex = [];
|
||||
private readonly List<FileRegistry> _shpk = [];
|
||||
private readonly List<FileRegistry> _pbd = [];
|
||||
private readonly List<FileRegistry> _atch = [];
|
||||
|
||||
private readonly SortedSet<FullPath> _missing = [];
|
||||
private readonly HashSet<Utf8GamePath> _usedPaths = [];
|
||||
|
|
@ -41,21 +42,24 @@ public class ModFileCollection : IDisposable, IService
|
|||
public IReadOnlyList<FileRegistry> Pbd
|
||||
=> Ready ? _pbd : [];
|
||||
|
||||
public IReadOnlyList<FileRegistry> Atch
|
||||
=> Ready ? _atch : [];
|
||||
|
||||
public bool Ready { get; private set; } = true;
|
||||
|
||||
public void UpdateAll(Mod mod, IModDataContainer option)
|
||||
{
|
||||
UpdateFiles(mod, new CancellationToken());
|
||||
UpdatePaths(mod, option, false, new CancellationToken());
|
||||
UpdateFiles(mod, CancellationToken.None);
|
||||
UpdatePaths(mod, option, false, CancellationToken.None);
|
||||
}
|
||||
|
||||
public void UpdatePaths(Mod mod, IModDataContainer option)
|
||||
=> UpdatePaths(mod, option, true, new CancellationToken());
|
||||
=> UpdatePaths(mod, option, true, CancellationToken.None);
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
ClearFiles();
|
||||
ClearPaths(false, new CancellationToken());
|
||||
ClearPaths(false, CancellationToken.None);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
@ -135,6 +139,9 @@ public class ModFileCollection : IDisposable, IService
|
|||
case ".pbd":
|
||||
_pbd.Add(registry);
|
||||
break;
|
||||
case ".atch":
|
||||
_atch.Add(registry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -147,6 +154,7 @@ public class ModFileCollection : IDisposable, IService
|
|||
_tex.Clear();
|
||||
_shpk.Clear();
|
||||
_pbd.Clear();
|
||||
_atch.Clear();
|
||||
}
|
||||
|
||||
private void ClearPaths(bool clearRegistries, CancellationToken tok)
|
||||
|
|
|
|||
|
|
@ -75,12 +75,34 @@ public partial class ModEditWindow
|
|||
ImUtf8.Text($"Dragging .atch for {gr.ToName()}...");
|
||||
return true;
|
||||
});
|
||||
ImUtf8.ButtonEx("Import .atch"u8,
|
||||
_dragDropManager.IsDragging ? ""u8 : "Drag a .atch file containinig its race code in the path here to import its values."u8,
|
||||
default,
|
||||
!_dragDropManager.IsDragging);
|
||||
var hasAtch = _editor.Files.Atch.Count > 0;
|
||||
if (ImUtf8.ButtonEx("Import .atch"u8,
|
||||
_dragDropManager.IsDragging
|
||||
? ""u8
|
||||
: hasAtch
|
||||
? "Drag a .atch file containing its race code in the path here to import its values.\n\nClick to select an .atch file from the mod."u8
|
||||
: "Drag a .atch file containing its race code in the path here to import its values."u8, default,
|
||||
!_dragDropManager.IsDragging && !hasAtch)
|
||||
&& hasAtch)
|
||||
ImUtf8.OpenPopup("##atchPopup"u8);
|
||||
if (_dragDropManager.CreateImGuiTarget("atchDrag", out var files, out _) && files.FirstOrDefault() is { } file)
|
||||
_metaDrawers.Atch.ImportFile(file);
|
||||
|
||||
using var popup = ImUtf8.Popup("##atchPopup"u8);
|
||||
if (!popup)
|
||||
return;
|
||||
|
||||
if (!hasAtch)
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var atchFile in _editor.Files.Atch)
|
||||
{
|
||||
if (ImUtf8.Selectable(atchFile.RelPath.Path.Span) && atchFile.File.Exists)
|
||||
_metaDrawers.Atch.ImportFile(atchFile.File.FullName);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawEditHeader(MetaManipulationType type)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue