mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-13 12:14:17 +01:00
Merge branch 'xivdev:master' into master
This commit is contained in:
commit
29757e9a36
7 changed files with 149 additions and 13 deletions
|
|
@ -1 +1 @@
|
||||||
Subproject commit 315258f4f8a59d744aa4d2d1f8c31d410d041729
|
Subproject commit 6848397dd77cfcdbff1accd860d5b7e95f8c9fe5
|
||||||
75
Penumbra/Collections/CollectionAutoSelector.cs
Normal file
75
Penumbra/Collections/CollectionAutoSelector.cs
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
using Dalamud.Plugin.Services;
|
||||||
|
using OtterGui.Services;
|
||||||
|
using Penumbra.Collections.Manager;
|
||||||
|
using Penumbra.GameData.Interop;
|
||||||
|
using Penumbra.Interop.PathResolving;
|
||||||
|
|
||||||
|
namespace Penumbra.Collections;
|
||||||
|
|
||||||
|
public sealed class CollectionAutoSelector : IService, IDisposable
|
||||||
|
{
|
||||||
|
private readonly Configuration _config;
|
||||||
|
private readonly ActiveCollections _collections;
|
||||||
|
private readonly IClientState _clientState;
|
||||||
|
private readonly CollectionResolver _resolver;
|
||||||
|
private readonly ObjectManager _objects;
|
||||||
|
|
||||||
|
public CollectionAutoSelector(Configuration config, ActiveCollections collections, IClientState clientState, CollectionResolver resolver,
|
||||||
|
ObjectManager objects)
|
||||||
|
{
|
||||||
|
_config = config;
|
||||||
|
_collections = collections;
|
||||||
|
_clientState = clientState;
|
||||||
|
_resolver = resolver;
|
||||||
|
_objects = objects;
|
||||||
|
|
||||||
|
if (_config.AutoSelectCollection)
|
||||||
|
Attach();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Disposed { get; private set; }
|
||||||
|
|
||||||
|
public void SetAutomaticSelection(bool value)
|
||||||
|
{
|
||||||
|
_config.AutoSelectCollection = value;
|
||||||
|
if (value)
|
||||||
|
Attach();
|
||||||
|
else
|
||||||
|
Detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Attach()
|
||||||
|
{
|
||||||
|
if (Disposed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_clientState.Login += OnLogin;
|
||||||
|
Select();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnLogin()
|
||||||
|
=> Select();
|
||||||
|
|
||||||
|
private void Detach()
|
||||||
|
=> _clientState.Login -= OnLogin;
|
||||||
|
|
||||||
|
private void Select()
|
||||||
|
{
|
||||||
|
if (!_objects[0].IsCharacter)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var collection = _resolver.PlayerCollection();
|
||||||
|
Penumbra.Log.Debug($"Setting current collection to {collection.Identifier} through automatic collection selection.");
|
||||||
|
_collections.SetCollection(collection, CollectionType.Current);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (Disposed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Disposed = true;
|
||||||
|
Detach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -56,6 +56,8 @@ public class Configuration : IPluginConfiguration, ISavable, IService
|
||||||
public bool HideUiWhenUiHidden { get; set; } = false;
|
public bool HideUiWhenUiHidden { get; set; } = false;
|
||||||
public bool UseDalamudUiTextureRedirection { get; set; } = true;
|
public bool UseDalamudUiTextureRedirection { get; set; } = true;
|
||||||
|
|
||||||
|
public bool AutoSelectCollection { get; set; } = false;
|
||||||
|
|
||||||
public bool ShowModsInLobby { get; set; } = true;
|
public bool ShowModsInLobby { get; set; } = true;
|
||||||
public bool UseCharacterCollectionInMainWindow { get; set; } = true;
|
public bool UseCharacterCollectionInMainWindow { get; set; } = true;
|
||||||
public bool UseCharacterCollectionsInCards { get; set; } = true;
|
public bool UseCharacterCollectionsInCards { get; set; } = true;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using Dalamud.Plugin.Services;
|
||||||
using Lumina.Excel.Sheets;
|
using Lumina.Excel.Sheets;
|
||||||
using OtterGui.Log;
|
using OtterGui.Log;
|
||||||
using OtterGui.Services;
|
using OtterGui.Services;
|
||||||
|
using Penumbra.GameData.Data;
|
||||||
using Penumbra.Mods.Manager;
|
using Penumbra.Mods.Manager;
|
||||||
using Penumbra.String.Classes;
|
using Penumbra.String.Classes;
|
||||||
using Notification = OtterGui.Classes.Notification;
|
using Notification = OtterGui.Classes.Notification;
|
||||||
|
|
@ -29,7 +30,7 @@ public class MessageService(Logger log, IUiBuilder builder, IChatGui chat, INoti
|
||||||
new TextPayload($"{(char)SeIconChar.LinkMarker}"),
|
new TextPayload($"{(char)SeIconChar.LinkMarker}"),
|
||||||
new UIForegroundPayload(0),
|
new UIForegroundPayload(0),
|
||||||
new UIGlowPayload(0),
|
new UIGlowPayload(0),
|
||||||
new TextPayload(item.Name.ExtractText()),
|
new TextPayload(item.Name.ExtractTextExtended()),
|
||||||
new RawPayload([0x02, 0x27, 0x07, 0xCF, 0x01, 0x01, 0x01, 0xFF, 0x01, 0x03]),
|
new RawPayload([0x02, 0x27, 0x07, 0xCF, 0x01, 0x01, 0x01, 0xFF, 0x01, 0x03]),
|
||||||
new RawPayload([0x02, 0x13, 0x02, 0xEC, 0x03]),
|
new RawPayload([0x02, 0x13, 0x02, 0xEC, 0x03]),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -202,10 +202,9 @@ public partial class MtrlTab
|
||||||
if (Mtrl.Table == null)
|
if (Mtrl.Table == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!ImUtf8.IconButton(FontAwesomeIcon.Paste, "Import an exported row from your clipboard onto this row."u8,
|
if (ImUtf8.IconButton(FontAwesomeIcon.Paste,
|
||||||
|
"Import an exported row from your clipboard onto this row.\n\nRight-Click for more options."u8,
|
||||||
ImGui.GetFrameHeight() * Vector2.One, disabled))
|
ImGui.GetFrameHeight() * Vector2.One, disabled))
|
||||||
return false;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var text = ImGui.GetClipboardText();
|
var text = ImGui.GetClipboardText();
|
||||||
|
|
@ -226,6 +225,57 @@ public partial class MtrlTab
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ColorTablePasteFromClipboardContext(rowIdx, disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
private unsafe bool ColorTablePasteFromClipboardContext(int rowIdx, bool disabled)
|
||||||
|
{
|
||||||
|
if (!disabled && ImGui.IsItemClicked(ImGuiMouseButton.Right))
|
||||||
|
ImUtf8.OpenPopup("context"u8);
|
||||||
|
|
||||||
|
using var context = ImUtf8.Popup("context"u8);
|
||||||
|
if (!context)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
using var _ = ImRaii.Disabled(disabled);
|
||||||
|
|
||||||
|
IColorTable.ValueTypes copy = 0;
|
||||||
|
IColorDyeTable.ValueTypes dyeCopy = 0;
|
||||||
|
if (ImUtf8.Selectable("Import Colors Only"u8))
|
||||||
|
{
|
||||||
|
copy = IColorTable.ValueTypes.Colors;
|
||||||
|
dyeCopy = IColorDyeTable.ValueTypes.Colors;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImUtf8.Selectable("Import Other Values Only"u8))
|
||||||
|
{
|
||||||
|
copy = ~IColorTable.ValueTypes.Colors;
|
||||||
|
dyeCopy = ~IColorDyeTable.ValueTypes.Colors;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (copy == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var text = ImGui.GetClipboardText();
|
||||||
|
var data = Convert.FromBase64String(text);
|
||||||
|
var row = Mtrl.Table!.RowAsHalves(rowIdx);
|
||||||
|
var halves = new Span<Half>(Unsafe.AsPointer(ref data[0]), row.Length);
|
||||||
|
var dyeRow = Mtrl.DyeTable != null ? Mtrl.DyeTable.RowAsBytes(rowIdx) : [];
|
||||||
|
if (!Mtrl.Table.MergeSpecificValues(row, halves, copy))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Mtrl.DyeTable?.MergeSpecificValues(dyeRow, data.AsSpan(row.Length * 2), dyeCopy);
|
||||||
|
|
||||||
|
UpdateColorTableRowPreview(rowIdx);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ColorTablePairHighlightButton(int pairIdx, bool disabled)
|
private void ColorTablePairHighlightButton(int pairIdx, bool disabled)
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,6 @@ public class PenumbraChangelog : IUiService
|
||||||
|
|
||||||
private static void Add1_3_0_0(Changelog log)
|
private static void Add1_3_0_0(Changelog log)
|
||||||
=> log.NextVersion("Version 1.3.0.0")
|
=> log.NextVersion("Version 1.3.0.0")
|
||||||
|
|
||||||
.RegisterHighlight("The textures tab in the advanced editing window can now import and export .tga files.")
|
.RegisterHighlight("The textures tab in the advanced editing window can now import and export .tga files.")
|
||||||
.RegisterEntry("BC4 and BC6 textures can now also be imported.", 1)
|
.RegisterEntry("BC4 and BC6 textures can now also be imported.", 1)
|
||||||
.RegisterHighlight("Added item swapping from and to the Glasses slot.")
|
.RegisterHighlight("Added item swapping from and to the Glasses slot.")
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ using OtterGui.Raii;
|
||||||
using OtterGui.Services;
|
using OtterGui.Services;
|
||||||
using OtterGui.Widgets;
|
using OtterGui.Widgets;
|
||||||
using Penumbra.Api;
|
using Penumbra.Api;
|
||||||
|
using Penumbra.Collections;
|
||||||
using Penumbra.Interop.Services;
|
using Penumbra.Interop.Services;
|
||||||
using Penumbra.Mods.Manager;
|
using Penumbra.Mods.Manager;
|
||||||
using Penumbra.Services;
|
using Penumbra.Services;
|
||||||
|
|
@ -46,6 +47,7 @@ public class SettingsTab : ITab, IUiService
|
||||||
private readonly PredefinedTagManager _predefinedTagManager;
|
private readonly PredefinedTagManager _predefinedTagManager;
|
||||||
private readonly CrashHandlerService _crashService;
|
private readonly CrashHandlerService _crashService;
|
||||||
private readonly MigrationSectionDrawer _migrationDrawer;
|
private readonly MigrationSectionDrawer _migrationDrawer;
|
||||||
|
private readonly CollectionAutoSelector _autoSelector;
|
||||||
|
|
||||||
private int _minimumX = int.MaxValue;
|
private int _minimumX = int.MaxValue;
|
||||||
private int _minimumY = int.MaxValue;
|
private int _minimumY = int.MaxValue;
|
||||||
|
|
@ -57,7 +59,7 @@ public class SettingsTab : ITab, IUiService
|
||||||
CharacterUtility characterUtility, ResidentResourceManager residentResources, ModExportManager modExportManager, HttpApi httpApi,
|
CharacterUtility characterUtility, ResidentResourceManager residentResources, ModExportManager modExportManager, HttpApi httpApi,
|
||||||
DalamudSubstitutionProvider dalamudSubstitutionProvider, FileCompactor compactor, DalamudConfigService dalamudConfig,
|
DalamudSubstitutionProvider dalamudSubstitutionProvider, FileCompactor compactor, DalamudConfigService dalamudConfig,
|
||||||
IDataManager gameData, PredefinedTagManager predefinedTagConfig, CrashHandlerService crashService,
|
IDataManager gameData, PredefinedTagManager predefinedTagConfig, CrashHandlerService crashService,
|
||||||
MigrationSectionDrawer migrationDrawer)
|
MigrationSectionDrawer migrationDrawer, CollectionAutoSelector autoSelector)
|
||||||
{
|
{
|
||||||
_pluginInterface = pluginInterface;
|
_pluginInterface = pluginInterface;
|
||||||
_config = config;
|
_config = config;
|
||||||
|
|
@ -80,6 +82,7 @@ public class SettingsTab : ITab, IUiService
|
||||||
_predefinedTagManager = predefinedTagConfig;
|
_predefinedTagManager = predefinedTagConfig;
|
||||||
_crashService = crashService;
|
_crashService = crashService;
|
||||||
_migrationDrawer = migrationDrawer;
|
_migrationDrawer = migrationDrawer;
|
||||||
|
_autoSelector = autoSelector;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawHeader()
|
public void DrawHeader()
|
||||||
|
|
@ -421,6 +424,10 @@ public class SettingsTab : ITab, IUiService
|
||||||
/// <summary> Draw all settings that do not fit into other categories. </summary>
|
/// <summary> Draw all settings that do not fit into other categories. </summary>
|
||||||
private void DrawMiscSettings()
|
private void DrawMiscSettings()
|
||||||
{
|
{
|
||||||
|
Checkbox("Automatically Select Character-Associated Collection",
|
||||||
|
"On every login, automatically select the collection associated with the current character as the current collection for editing.",
|
||||||
|
_config.AutoSelectCollection, _autoSelector.SetAutomaticSelection);
|
||||||
|
|
||||||
Checkbox("Print Chat Command Success Messages to Chat",
|
Checkbox("Print Chat Command Success Messages to Chat",
|
||||||
"Chat Commands usually print messages on failure but also on success to confirm your action. You can disable this here.",
|
"Chat Commands usually print messages on failure but also on success to confirm your action. You can disable this here.",
|
||||||
_config.PrintSuccessfulCommandsToChat, v => _config.PrintSuccessfulCommandsToChat = v);
|
_config.PrintSuccessfulCommandsToChat, v => _config.PrintSuccessfulCommandsToChat = v);
|
||||||
|
|
@ -816,13 +823,15 @@ public class SettingsTab : ITab, IUiService
|
||||||
if (ImGuiUtil.DrawDisabledButton("Compress Existing Files", Vector2.Zero,
|
if (ImGuiUtil.DrawDisabledButton("Compress Existing Files", Vector2.Zero,
|
||||||
"Try to compress all files in your root directory. This will take a while.",
|
"Try to compress all files in your root directory. This will take a while.",
|
||||||
_compactor.MassCompactRunning || !_modManager.Valid))
|
_compactor.MassCompactRunning || !_modManager.Valid))
|
||||||
_compactor.StartMassCompact(_modManager.BasePath.EnumerateFiles("*.*", SearchOption.AllDirectories), CompressionAlgorithm.Xpress8K, true);
|
_compactor.StartMassCompact(_modManager.BasePath.EnumerateFiles("*.*", SearchOption.AllDirectories), CompressionAlgorithm.Xpress8K,
|
||||||
|
true);
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
if (ImGuiUtil.DrawDisabledButton("Decompress Existing Files", Vector2.Zero,
|
if (ImGuiUtil.DrawDisabledButton("Decompress Existing Files", Vector2.Zero,
|
||||||
"Try to decompress all files in your root directory. This will take a while.",
|
"Try to decompress all files in your root directory. This will take a while.",
|
||||||
_compactor.MassCompactRunning || !_modManager.Valid))
|
_compactor.MassCompactRunning || !_modManager.Valid))
|
||||||
_compactor.StartMassCompact(_modManager.BasePath.EnumerateFiles("*.*", SearchOption.AllDirectories), CompressionAlgorithm.None, true);
|
_compactor.StartMassCompact(_modManager.BasePath.EnumerateFiles("*.*", SearchOption.AllDirectories), CompressionAlgorithm.None,
|
||||||
|
true);
|
||||||
|
|
||||||
if (_compactor.MassCompactRunning)
|
if (_compactor.MassCompactRunning)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue