mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +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 UseDalamudUiTextureRedirection { get; set; } = true;
|
||||
|
||||
public bool AutoSelectCollection { get; set; } = false;
|
||||
|
||||
public bool ShowModsInLobby { get; set; } = true;
|
||||
public bool UseCharacterCollectionInMainWindow { get; set; } = true;
|
||||
public bool UseCharacterCollectionsInCards { get; set; } = true;
|
||||
|
|
@ -100,7 +102,7 @@ public class Configuration : IPluginConfiguration, ISavable, IService
|
|||
public bool UseFileSystemCompression { get; set; } = true;
|
||||
public bool EnableHttpApi { get; set; } = true;
|
||||
|
||||
public bool MigrateImportedModelsToV6 { get; set; } = true;
|
||||
public bool MigrateImportedModelsToV6 { get; set; } = true;
|
||||
public bool MigrateImportedMaterialsToLegacy { get; set; } = true;
|
||||
|
||||
public string DefaultModImportPath { get; set; } = string.Empty;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using Dalamud.Plugin.Services;
|
|||
using Lumina.Excel.Sheets;
|
||||
using OtterGui.Log;
|
||||
using OtterGui.Services;
|
||||
using Penumbra.GameData.Data;
|
||||
using Penumbra.Mods.Manager;
|
||||
using Penumbra.String.Classes;
|
||||
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 UIForegroundPayload(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, 0x13, 0x02, 0xEC, 0x03]),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -202,24 +202,74 @@ public partial class MtrlTab
|
|||
if (Mtrl.Table == null)
|
||||
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))
|
||||
try
|
||||
{
|
||||
var text = ImGui.GetClipboardText();
|
||||
var data = Convert.FromBase64String(text);
|
||||
var row = Mtrl.Table.RowAsBytes(rowIdx);
|
||||
var dyeRow = Mtrl.DyeTable != null ? Mtrl.DyeTable.RowAsBytes(rowIdx) : [];
|
||||
if (data.Length != row.Length && data.Length != row.Length + dyeRow.Length)
|
||||
return false;
|
||||
|
||||
data.AsSpan(0, row.Length).TryCopyTo(row);
|
||||
data.AsSpan(row.Length).TryCopyTo(dyeRow);
|
||||
|
||||
UpdateColorTableRowPreview(rowIdx);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
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.RowAsBytes(rowIdx);
|
||||
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 (data.Length != row.Length && data.Length != row.Length + dyeRow.Length)
|
||||
if (!Mtrl.Table.MergeSpecificValues(row, halves, copy))
|
||||
return false;
|
||||
|
||||
data.AsSpan(0, row.Length).TryCopyTo(row);
|
||||
data.AsSpan(row.Length).TryCopyTo(dyeRow);
|
||||
Mtrl.DyeTable?.MergeSpecificValues(dyeRow, data.AsSpan(row.Length * 2), dyeCopy);
|
||||
|
||||
UpdateColorTableRowPreview(rowIdx);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ public class PenumbraChangelog : IUiService
|
|||
|
||||
private static void Add1_3_0_0(Changelog log)
|
||||
=> log.NextVersion("Version 1.3.0.0")
|
||||
|
||||
.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)
|
||||
.RegisterHighlight("Added item swapping from and to the Glasses slot.")
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ using OtterGui.Raii;
|
|||
using OtterGui.Services;
|
||||
using OtterGui.Widgets;
|
||||
using Penumbra.Api;
|
||||
using Penumbra.Collections;
|
||||
using Penumbra.Interop.Services;
|
||||
using Penumbra.Mods.Manager;
|
||||
using Penumbra.Services;
|
||||
|
|
@ -46,6 +47,7 @@ public class SettingsTab : ITab, IUiService
|
|||
private readonly PredefinedTagManager _predefinedTagManager;
|
||||
private readonly CrashHandlerService _crashService;
|
||||
private readonly MigrationSectionDrawer _migrationDrawer;
|
||||
private readonly CollectionAutoSelector _autoSelector;
|
||||
|
||||
private int _minimumX = int.MaxValue;
|
||||
private int _minimumY = int.MaxValue;
|
||||
|
|
@ -57,7 +59,7 @@ public class SettingsTab : ITab, IUiService
|
|||
CharacterUtility characterUtility, ResidentResourceManager residentResources, ModExportManager modExportManager, HttpApi httpApi,
|
||||
DalamudSubstitutionProvider dalamudSubstitutionProvider, FileCompactor compactor, DalamudConfigService dalamudConfig,
|
||||
IDataManager gameData, PredefinedTagManager predefinedTagConfig, CrashHandlerService crashService,
|
||||
MigrationSectionDrawer migrationDrawer)
|
||||
MigrationSectionDrawer migrationDrawer, CollectionAutoSelector autoSelector)
|
||||
{
|
||||
_pluginInterface = pluginInterface;
|
||||
_config = config;
|
||||
|
|
@ -80,6 +82,7 @@ public class SettingsTab : ITab, IUiService
|
|||
_predefinedTagManager = predefinedTagConfig;
|
||||
_crashService = crashService;
|
||||
_migrationDrawer = migrationDrawer;
|
||||
_autoSelector = autoSelector;
|
||||
}
|
||||
|
||||
public void DrawHeader()
|
||||
|
|
@ -421,6 +424,10 @@ public class SettingsTab : ITab, IUiService
|
|||
/// <summary> Draw all settings that do not fit into other categories. </summary>
|
||||
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",
|
||||
"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);
|
||||
|
|
@ -816,13 +823,15 @@ public class SettingsTab : ITab, IUiService
|
|||
if (ImGuiUtil.DrawDisabledButton("Compress Existing Files", Vector2.Zero,
|
||||
"Try to compress all files in your root directory. This will take a while.",
|
||||
_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();
|
||||
if (ImGuiUtil.DrawDisabledButton("Decompress Existing Files", Vector2.Zero,
|
||||
"Try to decompress all files in your root directory. This will take a while.",
|
||||
_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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue