diff --git a/Luna b/Luna index be965fc1..8fab2f16 160000 --- a/Luna +++ b/Luna @@ -1 +1 @@ -Subproject commit be965fc152dea611f6a952c5afb2047f0cb89dc2 +Subproject commit 8fab2f1622f6ccfdab34462bd3ebe7b4947c0589 diff --git a/Penumbra.Api b/Penumbra.Api index 648b6fc2..97fe622e 160000 --- a/Penumbra.Api +++ b/Penumbra.Api @@ -1 +1 @@ -Subproject commit 648b6fc2ce600a95ab2b2ced27e1639af2b04502 +Subproject commit 97fe622e4ec0a5469a26aba8a8c3933fa8ef7fd6 diff --git a/Penumbra.GameData b/Penumbra.GameData index f589b17f..3ea62e44 160000 --- a/Penumbra.GameData +++ b/Penumbra.GameData @@ -1 +1 @@ -Subproject commit f589b17f19c9b15fe91147a369d2480bffa75ea5 +Subproject commit 3ea62e440aff15a856d5555bb8a0dd1862c40f59 diff --git a/Penumbra/Api/Api/ApiHelpers.cs b/Penumbra/Api/Api/ApiHelpers.cs index a04e2dd3..e0961aa5 100644 --- a/Penumbra/Api/Api/ApiHelpers.cs +++ b/Penumbra/Api/Api/ApiHelpers.cs @@ -1,4 +1,3 @@ -using OtterGui.Log; using Penumbra.Api.Enums; using Penumbra.Collections; using Penumbra.Collections.Manager; @@ -45,7 +44,7 @@ public class ApiHelpers( } [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] - internal static PenumbraApiEc Return(PenumbraApiEc ec, LazyString args, [CallerMemberName] string name = "Unknown") + internal static PenumbraApiEc Return(PenumbraApiEc ec, Lazy args, [CallerMemberName] string name = "Unknown") { if (ec is PenumbraApiEc.Success or PenumbraApiEc.NothingChanged) Penumbra.Log.Verbose($"[{name}] Called with {args}, returned {ec}."); @@ -55,12 +54,12 @@ public class ApiHelpers( } [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] - internal static LazyString Args(params object[] arguments) + internal static Lazy Args(params object[] arguments) { if (arguments.Length == 0) - return new LazyString(() => "no arguments"); + return new Lazy("no arguments"); - return new LazyString(() => + return new Lazy(() => { var sb = new StringBuilder(); for (var i = 0; i < arguments.Length / 2; ++i) diff --git a/Penumbra/Api/Api/EditingApi.cs b/Penumbra/Api/Api/EditingApi.cs index 7fffbbb6..31c4a44e 100644 --- a/Penumbra/Api/Api/EditingApi.cs +++ b/Penumbra/Api/Api/EditingApi.cs @@ -18,6 +18,12 @@ public class EditingApi(TextureManager textureManager) : IPenumbraApiEditing, Lu TextureType.Bc3Dds => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC3, mipMaps, false, inputFile, outputFile), TextureType.Bc7Tex => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC7, mipMaps, true, inputFile, outputFile), TextureType.Bc7Dds => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC7, mipMaps, false, inputFile, outputFile), + TextureType.Bc1Tex => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC1, mipMaps, true, inputFile, outputFile), + TextureType.Bc1Dds => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC1, mipMaps, false, inputFile, outputFile), + TextureType.Bc4Tex => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC4, mipMaps, true, inputFile, outputFile), + TextureType.Bc4Dds => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC4, mipMaps, false, inputFile, outputFile), + TextureType.Bc5Tex => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC5, mipMaps, true, inputFile, outputFile), + TextureType.Bc5Dds => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC5, mipMaps, false, inputFile, outputFile), _ => Task.FromException(new Exception($"Invalid input value {textureType}.")), }; @@ -35,6 +41,12 @@ public class EditingApi(TextureManager textureManager) : IPenumbraApiEditing, Lu TextureType.Bc3Dds => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC3, mipMaps, false, new BaseImage(), outputFile, rgbaData, width, rgbaData.Length / 4 / width), TextureType.Bc7Tex => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC7, mipMaps, true, new BaseImage(), outputFile, rgbaData, width, rgbaData.Length / 4 / width), TextureType.Bc7Dds => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC7, mipMaps, false, new BaseImage(), outputFile, rgbaData, width, rgbaData.Length / 4 / width), + TextureType.Bc1Tex => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC1, mipMaps, true, new BaseImage(), outputFile, rgbaData, width, rgbaData.Length / 4 / width), + TextureType.Bc1Dds => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC1, mipMaps, false, new BaseImage(), outputFile, rgbaData, width, rgbaData.Length / 4 / width), + TextureType.Bc4Tex => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC4, mipMaps, true, new BaseImage(), outputFile, rgbaData, width, rgbaData.Length / 4 / width), + TextureType.Bc4Dds => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC4, mipMaps, false, new BaseImage(), outputFile, rgbaData, width, rgbaData.Length / 4 / width), + TextureType.Bc5Tex => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC5, mipMaps, true, new BaseImage(), outputFile, rgbaData, width, rgbaData.Length / 4 / width), + TextureType.Bc5Dds => textureManager.SaveAs(CombinedTexture.TextureSaveType.BC5, mipMaps, false, new BaseImage(), outputFile, rgbaData, width, rgbaData.Length / 4 / width), _ => Task.FromException(new Exception($"Invalid input value {textureType}.")), }; // @formatter:on diff --git a/Penumbra/Api/Api/MetaApi.cs b/Penumbra/Api/Api/MetaApi.cs index 8d7ffc6c..0ec0582e 100644 --- a/Penumbra/Api/Api/MetaApi.cs +++ b/Penumbra/Api/Api/MetaApi.cs @@ -1,7 +1,7 @@ using Dalamud.Plugin.Services; +using Luna; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using OtterGui; using Penumbra.Collections; using Penumbra.Collections.Cache; using Penumbra.GameData.Files.AtchStructs; @@ -13,7 +13,7 @@ using Penumbra.Meta.Manipulations; namespace Penumbra.Api.Api; public class MetaApi(IFramework framework, CollectionResolver collectionResolver, ApiHelpers helpers) - : IPenumbraApiMeta, Luna.IApiService + : IPenumbraApiMeta, IApiService { public string GetPlayerMetaManipulations() { @@ -69,7 +69,7 @@ public class MetaApi(IFramework framework, CollectionResolver collectionResolver MetaDictionary.SerializeTo(array, cache.Atr.Select(kvp => new KeyValuePair(kvp.Key, kvp.Value.Entry))); } - return Functions.ToCompressedBase64(array, 0); + return CompressionFunctions.ToCompressedBase64(array, 0); } private static unsafe string CompressMetaManipulationsV1(ModCollection? collection) diff --git a/Penumbra/Api/Api/RedrawApi.cs b/Penumbra/Api/Api/RedrawApi.cs index 54a1e0aa..6cad99dd 100644 --- a/Penumbra/Api/Api/RedrawApi.cs +++ b/Penumbra/Api/Api/RedrawApi.cs @@ -1,6 +1,6 @@ using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Plugin.Services; -using OtterGui.Services; +using Luna; using Penumbra.Api.Enums; using Penumbra.Interop.Services; diff --git a/Penumbra/Api/Api/TemporaryApi.cs b/Penumbra/Api/Api/TemporaryApi.cs index eaf270da..77a57e60 100644 --- a/Penumbra/Api/Api/TemporaryApi.cs +++ b/Penumbra/Api/Api/TemporaryApi.cs @@ -1,4 +1,3 @@ -using OtterGui.Log; using Penumbra.Api.Enums; using Penumbra.Collections; using Penumbra.Collections.Manager; @@ -159,7 +158,7 @@ public class TemporaryApi( } private (PenumbraApiEc ErrorCode, (bool, bool, int, Dictionary>)? Settings, string Source) QueryTemporaryModSettings( - in LazyString args, ModCollection collection, string modDirectory, string modName, int key) + Lazy args, ModCollection collection, string modDirectory, string modName, int key) { if (!modManager.TryGetMod(modDirectory, modName, out var mod)) return (ApiHelpers.Return(PenumbraApiEc.ModMissing, args), null, string.Empty); @@ -180,8 +179,7 @@ public class TemporaryApi( public PenumbraApiEc SetTemporaryModSettings(Guid collectionId, string modDirectory, string modName, bool inherit, bool enabled, - int priority, - IReadOnlyDictionary> options, string source, int key) + int priority, IReadOnlyDictionary> options, string source, int key) { var args = ApiHelpers.Args("CollectionId", collectionId, "ModDirectory", modDirectory, "ModName", modName, "Inherit", inherit, "Enabled", enabled, @@ -205,7 +203,7 @@ public class TemporaryApi( return SetTemporaryModSettings(args, collection, modDirectory, modName, inherit, enabled, priority, options, source, key); } - private PenumbraApiEc SetTemporaryModSettings(in LazyString args, ModCollection collection, string modDirectory, string modName, + private PenumbraApiEc SetTemporaryModSettings(Lazy args, ModCollection collection, string modDirectory, string modName, bool inherit, bool enabled, int priority, IReadOnlyDictionary> options, string source, int key) { if (collection.Identity.Index <= 0) @@ -218,7 +216,7 @@ public class TemporaryApi( if (collection.GetTempSettings(mod.Index) is { Lock: > 0 } oldSettings && oldSettings.Lock != key) return ApiHelpers.Return(PenumbraApiEc.TemporarySettingDisallowed, args); - var newSettings = new TemporaryModSettings() + var newSettings = new TemporaryModSettings { ForceInherit = inherit, Enabled = enabled, @@ -263,7 +261,7 @@ public class TemporaryApi( return RemoveTemporaryModSettings(args, collection, modDirectory, modName, key); } - private PenumbraApiEc RemoveTemporaryModSettings(in LazyString args, ModCollection collection, string modDirectory, string modName, int key) + private PenumbraApiEc RemoveTemporaryModSettings(Lazy args, ModCollection collection, string modDirectory, string modName, int key) { if (collection.Identity.Index <= 0) return ApiHelpers.Return(PenumbraApiEc.NothingChanged, args); @@ -298,7 +296,7 @@ public class TemporaryApi( return RemoveAllTemporaryModSettings(args, collection, key); } - private PenumbraApiEc RemoveAllTemporaryModSettings(in LazyString args, ModCollection collection, int key) + private PenumbraApiEc RemoveAllTemporaryModSettings(Lazy args, ModCollection collection, int key) { if (collection.Identity.Index <= 0) return ApiHelpers.Return(PenumbraApiEc.NothingChanged, args); diff --git a/Penumbra/Api/IpcLaunchingProvider.cs b/Penumbra/Api/IpcLaunchingProvider.cs index 5bc40fca..84cb37d1 100644 --- a/Penumbra/Api/IpcLaunchingProvider.cs +++ b/Penumbra/Api/IpcLaunchingProvider.cs @@ -1,11 +1,11 @@ using Dalamud.Plugin; -using OtterGui.Log; +using Luna; using Penumbra.Api.Api; using Serilog.Events; namespace Penumbra.Api; -public sealed class IpcLaunchingProvider : Luna.IApiService +public sealed class IpcLaunchingProvider : IApiService { public IpcLaunchingProvider(IDalamudPluginInterface pi, Logger log) { diff --git a/Penumbra/Api/IpcProviders.cs b/Penumbra/Api/IpcProviders.cs index ad168bff..caca8f98 100644 --- a/Penumbra/Api/IpcProviders.cs +++ b/Penumbra/Api/IpcProviders.cs @@ -1,4 +1,5 @@ using Dalamud.Plugin; +using Luna; using Penumbra.Api.Api; using Penumbra.Api.Helpers; using Penumbra.Communication; @@ -6,7 +7,7 @@ using CharacterUtility = Penumbra.Interop.Services.CharacterUtility; namespace Penumbra.Api; -public sealed class IpcProviders : IDisposable, Luna.IApiService +public sealed class IpcProviders : IDisposable, IApiService, IRequiredService { private readonly List _providers; diff --git a/Penumbra/Api/IpcTester/CollectionsIpcTester.cs b/Penumbra/Api/IpcTester/CollectionsIpcTester.cs index 3ab87780..5143639b 100644 --- a/Penumbra/Api/IpcTester/CollectionsIpcTester.cs +++ b/Penumbra/Api/IpcTester/CollectionsIpcTester.cs @@ -1,9 +1,7 @@ using Dalamud.Plugin; using ImSharp; -using OtterGui; using Penumbra.Api.Enums; using Penumbra.Api.IpcSubscribers; -using Penumbra.Collections.Manager; using Penumbra.GameData.Data; namespace Penumbra.Api.IpcTester; @@ -11,7 +9,6 @@ namespace Penumbra.Api.IpcTester; public class CollectionsIpcTester(IDalamudPluginInterface pi) : Luna.IUiService { private int _objectIdx; - private string _collectionIdString = string.Empty; private Guid? _collectionId; private bool _allowCreation = true; private bool _allowDeletion = true; @@ -28,7 +25,7 @@ public class CollectionsIpcTester(IDalamudPluginInterface pi) : Luna.IUiService if (!_) return; - ImGuiUtil.GenericEnumCombo("Collection Type", 200, _type, out _type, t => ((CollectionType)t).ToName()); + EnumCombo.Instance.Draw("Collection Type"u8, ref _type, default, 200 * Im.Style.GlobalScale); Im.Input.Scalar("Object Index##Collections"u8, ref _objectIdx); if (_collectionId.HasValue) { @@ -57,7 +54,7 @@ public class CollectionsIpcTester(IDalamudPluginInterface pi) : Luna.IUiService table.NextRow(); table.DrawColumn(GetCollectionsByIdentifier.Label); table.DrawColumn("Collection Identifier"u8); - var collectionList = new GetCollectionsByIdentifier(pi).Invoke(_collectionIdString); + var collectionList = new GetCollectionsByIdentifier(pi).Invoke(_collectionId.GetValueOrDefault().ToString()); if (collectionList.Count == 0) { DrawCollection(table, null); diff --git a/Penumbra/Api/IpcTester/EditingIpcTester.cs b/Penumbra/Api/IpcTester/EditingIpcTester.cs index 8ec9e86f..4e719693 100644 --- a/Penumbra/Api/IpcTester/EditingIpcTester.cs +++ b/Penumbra/Api/IpcTester/EditingIpcTester.cs @@ -1,7 +1,5 @@ -using Dalamud.Bindings.ImGui; using Dalamud.Plugin; -using OtterGui; -using OtterGui.Raii; +using ImSharp; using Penumbra.Api.Enums; using Penumbra.Api.IpcSubscribers; @@ -22,48 +20,35 @@ public class EditingIpcTester(IDalamudPluginInterface pi) : Luna.IUiService public void Draw() { - using var _ = ImRaii.TreeNode("Editing"); + using var _ = Im.Tree.Node("Editing"u8); if (!_) return; - ImGui.InputTextWithHint("##inputPath", "Input Texture Path...", ref _inputPath, 256); - ImGui.InputTextWithHint("##outputPath", "Output Texture Path...", ref _outputPath, 256); - ImGui.InputTextWithHint("##inputPath2", "Input Texture Path 2...", ref _inputPath2, 256); - ImGui.InputTextWithHint("##outputPath2", "Output Texture Path 2...", ref _outputPath2, 256); - TypeCombo(); - ImGui.Checkbox("Add MipMaps", ref _mipMaps); + Im.Input.Text("##inputPath"u8, ref _inputPath, "Input Texture Path..."u8); + Im.Input.Text("##outputPath"u8, ref _outputPath, "Output Texture Path..."u8); + Im.Input.Text("##inputPath2"u8, ref _inputPath2, "Input Texture Path 2..."u8); + Im.Input.Text("##outputPath2"u8, ref _outputPath2, "Output Texture Path 2..."u8); + EnumCombo.Instance.Draw("Convert To"u8, ref _typeSelector, StringU8.Empty, 200 * Im.Style.GlobalScale); + Im.Checkbox("Add MipMaps"u8, ref _mipMaps); - using var table = ImRaii.Table("...", 3, ImGuiTableFlags.SizingFixedFit); + using var table = Im.Table.Begin("..."u8, 3, TableFlags.SizingFixedFit); if (!table) return; - IpcTester.DrawIntro(ConvertTextureFile.Label, (string)"Convert Texture 1"); - if (ImGuiUtil.DrawDisabledButton("Save 1", Vector2.Zero, string.Empty, _task1 is { IsCompleted: false })) + IpcTester.DrawIntro(ConvertTextureFile.Label, "Convert Texture 1"u8); + if (ImEx.Button("Save 1"u8, Vector2.Zero, StringU8.Empty, _task1 is { IsCompleted: false })) _task1 = new ConvertTextureFile(pi).Invoke(_inputPath, _outputPath, _typeSelector, _mipMaps); - ImGui.SameLine(); - ImGui.TextUnformatted(_task1 == null ? "Not Initiated" : _task1.Status.ToString()); - if (ImGui.IsItemHovered() && _task1?.Status == TaskStatus.Faulted) - ImGui.SetTooltip(_task1.Exception?.ToString()); + Im.Line.Same(); + Im.Text(_task1 is null ? "Not Initiated"u8 : $"{_task1.Status}"); + if (Im.Item.Hovered() && _task1?.Status is TaskStatus.Faulted) + Im.Tooltip.Set($"{_task1.Exception}"); - IpcTester.DrawIntro(ConvertTextureFile.Label, (string)"Convert Texture 2"); - if (ImGuiUtil.DrawDisabledButton("Save 2", Vector2.Zero, string.Empty, _task2 is { IsCompleted: false })) + IpcTester.DrawIntro(ConvertTextureFile.Label, "Convert Texture 2"u8); + if (ImEx.Button("Save 2"u8, Vector2.Zero, StringU8.Empty, _task2 is { IsCompleted: false })) _task2 = new ConvertTextureFile(pi).Invoke(_inputPath2, _outputPath2, _typeSelector, _mipMaps); - ImGui.SameLine(); - ImGui.TextUnformatted(_task2 == null ? "Not Initiated" : _task2.Status.ToString()); - if (ImGui.IsItemHovered() && _task2?.Status == TaskStatus.Faulted) - ImGui.SetTooltip(_task2.Exception?.ToString()); - } - - private void TypeCombo() - { - using var combo = ImRaii.Combo("Convert To", _typeSelector.ToString()); - if (!combo) - return; - - foreach (var value in Enum.GetValues()) - { - if (ImGui.Selectable(value.ToString(), _typeSelector == value)) - _typeSelector = value; - } + Im.Line.Same(); + Im.Text(_task2 is null ? "Not Initiated"u8 : $"{_task2.Status}"); + if (Im.Item.Hovered() && _task2?.Status is TaskStatus.Faulted) + Im.Tooltip.Set($"{_task2.Exception}"); } } diff --git a/Penumbra/Api/IpcTester/GameStateIpcTester.cs b/Penumbra/Api/IpcTester/GameStateIpcTester.cs index 4692b020..800e7f77 100644 --- a/Penumbra/Api/IpcTester/GameStateIpcTester.cs +++ b/Penumbra/Api/IpcTester/GameStateIpcTester.cs @@ -1,11 +1,8 @@ -using Dalamud.Bindings.ImGui; -using Dalamud.Interface; using Dalamud.Plugin; -using OtterGui.Raii; +using ImSharp; using Penumbra.Api.Enums; using Penumbra.Api.Helpers; using Penumbra.Api.IpcSubscribers; -using Penumbra.String; namespace Penumbra.Api.IpcTester; @@ -16,14 +13,14 @@ public class GameStateIpcTester : Luna.IUiService, IDisposable public readonly EventSubscriber CharacterBaseCreated; public readonly EventSubscriber GameObjectResourcePathResolved; - private string _lastCreatedGameObjectName = string.Empty; + private StringU8 _lastCreatedGameObjectName = StringU8.Empty; private nint _lastCreatedDrawObject = nint.Zero; private DateTimeOffset _lastCreatedGameObjectTime = DateTimeOffset.MaxValue; private string _lastResolvedGamePath = string.Empty; private string _lastResolvedFullPath = string.Empty; - private string _lastResolvedObject = string.Empty; + private StringU8 _lastResolvedObject = StringU8.Empty; private DateTimeOffset _lastResolvedGamePathTime = DateTimeOffset.MaxValue; - private string _currentDrawObjectString = string.Empty; + private StringU8 _currentDrawObjectString = StringU8.Empty; private nint _currentDrawObject = nint.Zero; private int _currentCutsceneActor; private int _currentCutsceneParent; @@ -49,63 +46,58 @@ public class GameStateIpcTester : Luna.IUiService, IDisposable public void Draw() { - using var _ = ImRaii.TreeNode("Game State"); + using var _ = Im.Tree.Node("Game State"u8); if (!_) return; - if (ImGui.InputTextWithHint("##drawObject", "Draw Object Address..", ref _currentDrawObjectString, 16, - ImGuiInputTextFlags.CharsHexadecimal)) + if (Im.Input.Text("##drawObject"u8, ref _currentDrawObjectString, "Draw Object Address.."u8, InputTextFlags.CharsHexadecimal)) _currentDrawObject = nint.TryParse(_currentDrawObjectString, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var tmp) ? tmp : nint.Zero; - ImGui.InputInt("Cutscene Actor", ref _currentCutsceneActor, 0); - ImGui.InputInt("Cutscene Parent", ref _currentCutsceneParent, 0); + Im.Input.Scalar("Cutscene Actor"u8, ref _currentCutsceneActor); + Im.Input.Scalar("Cutscene Parent"u8, ref _currentCutsceneParent); if (_cutsceneError is not PenumbraApiEc.Success) { - ImGui.SameLine(); - ImGui.TextUnformatted("Invalid Argument on last Call"); + Im.Line.Same(); + Im.Text("Invalid Argument on last Call"u8); } - using var table = ImRaii.Table(string.Empty, 3, ImGuiTableFlags.SizingFixedFit); + using var table = Im.Table.Begin(StringU8.Empty, 3, TableFlags.SizingFixedFit); if (!table) return; - IpcTester.DrawIntro(GetDrawObjectInfo.Label, "Draw Object Info"); + IpcTester.DrawIntro(GetDrawObjectInfo.Label, "Draw Object Info"u8); if (_currentDrawObject == nint.Zero) { - ImGui.TextUnformatted("Invalid"); + Im.Text("Invalid"u8); } else { var (ptr, (collectionId, collectionName)) = new GetDrawObjectInfo(_pi).Invoke(_currentDrawObject); - ImGui.TextUnformatted(ptr == nint.Zero ? $"No Actor Associated, {collectionName}" : $"{ptr:X}, {collectionName}"); - ImGui.SameLine(); - using (ImRaii.PushFont(UiBuilder.MonoFont)) - { - ImGui.TextUnformatted(collectionId.ToString()); - } + Im.Text(ptr == nint.Zero ? $"No Actor Associated, {collectionName}" : $"{ptr:X}, {collectionName}"); + Im.Line.Same(); + ImEx.MonoText($"{collectionId}"); } - IpcTester.DrawIntro(GetCutsceneParentIndex.Label, "Cutscene Parent"); - ImGui.TextUnformatted(new GetCutsceneParentIndex(_pi).Invoke(_currentCutsceneActor).ToString()); + IpcTester.DrawIntro(GetCutsceneParentIndex.Label, "Cutscene Parent"u8); + Im.Text($"{new GetCutsceneParentIndex(_pi).Invoke(_currentCutsceneActor)}"); - IpcTester.DrawIntro(SetCutsceneParentIndex.Label, "Cutscene Parent"); - if (ImGui.Button("Set Parent")) + IpcTester.DrawIntro(SetCutsceneParentIndex.Label, "Cutscene Parent"u8); + if (Im.Button("Set Parent"u8)) _cutsceneError = new SetCutsceneParentIndex(_pi) .Invoke(_currentCutsceneActor, _currentCutsceneParent); - IpcTester.DrawIntro(CreatingCharacterBase.Label, "Last Drawobject created"); + IpcTester.DrawIntro(CreatingCharacterBase.Label, "Last Drawobject created"u8); if (_lastCreatedGameObjectTime < DateTimeOffset.Now) - ImGui.TextUnformatted(_lastCreatedDrawObject != nint.Zero + Im.Text(_lastCreatedDrawObject != nint.Zero ? $"0x{_lastCreatedDrawObject:X} for <{_lastCreatedGameObjectName}> at {_lastCreatedGameObjectTime}" : $"NULL for <{_lastCreatedGameObjectName}> at {_lastCreatedGameObjectTime}"); - IpcTester.DrawIntro(IpcSubscribers.GameObjectResourcePathResolved.Label, "Last GamePath resolved"); + IpcTester.DrawIntro(IpcSubscribers.GameObjectResourcePathResolved.Label, "Last GamePath resolved"u8); if (_lastResolvedGamePathTime < DateTimeOffset.Now) - ImGui.TextUnformatted( - $"{_lastResolvedGamePath} -> {_lastResolvedFullPath} for <{_lastResolvedObject}> at {_lastResolvedGamePathTime}"); + Im.Text($"{_lastResolvedGamePath} -> {_lastResolvedFullPath} for <{_lastResolvedObject}> at {_lastResolvedGamePathTime}"); } private void UpdateLastCreated(nint gameObject, Guid _, nint _2, nint _3, nint _4) @@ -130,9 +122,9 @@ public class GameStateIpcTester : Luna.IUiService, IDisposable _lastResolvedGamePathTime = DateTimeOffset.Now; } - private static unsafe string GetObjectName(nint gameObject) + private static unsafe StringU8 GetObjectName(nint gameObject) { var obj = (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)gameObject; - return obj != null && obj->Name[0] != 0 ? new ByteString(obj->Name).ToString() : "Unknown"; + return new StringU8(obj is not null && obj->Name[0] != 0 ? obj->Name : "Unknown"u8); } } diff --git a/Penumbra/Api/IpcTester/IpcTester.cs b/Penumbra/Api/IpcTester/IpcTester.cs index 654ee905..3348750e 100644 --- a/Penumbra/Api/IpcTester/IpcTester.cs +++ b/Penumbra/Api/IpcTester/IpcTester.cs @@ -1,12 +1,10 @@ using Dalamud.Plugin.Services; -using Dalamud.Bindings.ImGui; using ImSharp; using Penumbra.Api.Api; namespace Penumbra.Api.IpcTester; public class IpcTester( - IpcProviders ipcProviders, IPenumbraApi api, PluginStateIpcTester pluginStateIpcTester, UiIpcTester uiIpcTester, @@ -22,9 +20,8 @@ public class IpcTester( ResourceTreeIpcTester resourceTreeIpcTester, IFramework framework) : Luna.IUiService { - private readonly IpcProviders _ipcProviders = ipcProviders; - private DateTime _lastUpdate; - private bool _subscribed = false; + private DateTime _lastUpdate; + private bool _subscribed; public void Draw() { @@ -33,7 +30,7 @@ public class IpcTester( _lastUpdate = framework.LastUpdateUTC.AddSeconds(1); Subscribe(); - ImGui.TextUnformatted($"API Version: {api.ApiVersion.Breaking}.{api.ApiVersion.Feature:D4}"); + Im.Text($"API Version: {api.ApiVersion.Breaking}.{api.ApiVersion.Feature:D4}"); collectionsIpcTester.Draw(); editingIpcTester.Draw(); gameStateIpcTester.Draw(); @@ -57,12 +54,9 @@ public class IpcTester( internal static void DrawIntro(Utf8StringHandler label, Utf8StringHandler info) { - ImGui.TableNextRow(); - ImGui.TableNextColumn(); - Im.Text(ref label); - ImGui.TableNextColumn(); - Im.Text(ref info); - ImGui.TableNextColumn(); + Im.Table.NextRow(); + Im.Table.DrawColumn(ref label); + Im.Table.DrawColumn(ref info); } private void Subscribe() diff --git a/Penumbra/Api/IpcTester/MetaIpcTester.cs b/Penumbra/Api/IpcTester/MetaIpcTester.cs index 32a3134b..57fca5fa 100644 --- a/Penumbra/Api/IpcTester/MetaIpcTester.cs +++ b/Penumbra/Api/IpcTester/MetaIpcTester.cs @@ -1,7 +1,5 @@ -using Dalamud.Bindings.ImGui; using Dalamud.Plugin; -using OtterGui.Raii; -using OtterGui.Text; +using ImSharp; using Penumbra.Api.Api; using Penumbra.Api.IpcSubscribers; using Penumbra.Meta.Manipulations; @@ -17,35 +15,34 @@ public class MetaIpcTester(IDalamudPluginInterface pi) : Luna.IUiService public void Draw() { - using var _ = ImRaii.TreeNode("Meta"); + using var _ = Im.Tree.Node("Meta"u8); if (!_) return; - ImGui.InputInt("##metaIdx", ref _gameObjectIndex, 0, 0); - if (ImUtf8.InputText("##metaText"u8, ref _metaBase64, "Base64 Metadata..."u8)) - if (!MetaApi.ConvertManips(_metaBase64, out _metaDict!, out _parsedVersion)) - _metaDict ??= new MetaDictionary(); + Im.Input.Scalar("##metaIdx"u8, ref _gameObjectIndex); + if (Im.Input.Text("##metaText"u8, ref _metaBase64, "Base64 Metadata..."u8)) + _metaDict = MetaApi.ConvertManips(_metaBase64, out var m, out _parsedVersion) ? m : new MetaDictionary(); - using var table = ImRaii.Table(string.Empty, 3, ImGuiTableFlags.SizingFixedFit); + using var table = Im.Table.Begin(StringU8.Empty, 3, TableFlags.SizingFixedFit); if (!table) return; - IpcTester.DrawIntro(GetPlayerMetaManipulations.Label, "Player Meta Manipulations"); - if (ImGui.Button("Copy to Clipboard##Player")) + IpcTester.DrawIntro(GetPlayerMetaManipulations.Label, "Player Meta Manipulations"u8); + if (Im.Button("Copy to Clipboard##Player"u8)) { var base64 = new GetPlayerMetaManipulations(pi).Invoke(); - ImGui.SetClipboardText(base64); + Im.Clipboard.Set(base64); } - IpcTester.DrawIntro(GetMetaManipulations.Label, "Game Object Manipulations"); - if (ImGui.Button("Copy to Clipboard##GameObject")) + IpcTester.DrawIntro(GetMetaManipulations.Label, "Game Object Manipulations"u8); + if (Im.Button("Copy to Clipboard##GameObject"u8)) { var base64 = new GetMetaManipulations(pi).Invoke(_gameObjectIndex); - ImGui.SetClipboardText(base64); + Im.Clipboard.Set(base64); } - IpcTester.DrawIntro(string.Empty, "Parsed Data"); - ImUtf8.Text($"Version: {_parsedVersion}, Count: {_metaDict.Count}"); + IpcTester.DrawIntro(string.Empty, "Parsed Data"u8); + Im.Text($"Version: {_parsedVersion}, Count: {_metaDict.Count}"); } } diff --git a/Penumbra/Api/IpcTester/ModSettingsIpcTester.cs b/Penumbra/Api/IpcTester/ModSettingsIpcTester.cs index 8847f2be..2d9a9cb2 100644 --- a/Penumbra/Api/IpcTester/ModSettingsIpcTester.cs +++ b/Penumbra/Api/IpcTester/ModSettingsIpcTester.cs @@ -1,18 +1,14 @@ -using Dalamud.Bindings.ImGui; using Dalamud.Plugin; -using OtterGui; -using OtterGui.Raii; -using OtterGui.Text; +using ImSharp; using Penumbra.Api.Enums; using Penumbra.Api.Helpers; using Penumbra.Api.IpcSubscribers; -using Penumbra.UI; namespace Penumbra.Api.IpcTester; public class ModSettingsIpcTester : Luna.IUiService, IDisposable { - private readonly IDalamudPluginInterface _pi; + private readonly IDalamudPluginInterface _pi; public readonly EventSubscriber SettingChanged; private PenumbraApiEc _lastSettingsError = PenumbraApiEc.Success; @@ -51,43 +47,43 @@ public class ModSettingsIpcTester : Luna.IUiService, IDisposable public void Draw() { - using var _ = ImRaii.TreeNode("Mod Settings"); + using var _ = Im.Tree.Node("Mod Settings"u8); if (!_) return; - ImGui.InputTextWithHint("##settingsDir", "Mod Directory Name...", ref _settingsModDirectory, 100); - ImGui.InputTextWithHint("##settingsName", "Mod Name...", ref _settingsModName, 100); - ImGuiUtil.GuidInput("##settingsCollection", "Collection...", string.Empty, ref _settingsCollection, ref _settingsCollectionName); - ImUtf8.Checkbox("Ignore Inheritance"u8, ref _settingsIgnoreInheritance); - ImUtf8.Checkbox("Ignore Temporary"u8, ref _settingsIgnoreTemporary); - ImUtf8.InputScalar("Key"u8, ref _settingsKey); + Im.Input.Text("##settingsDir"u8, ref _settingsModDirectory, "Mod Directory Name..."u8); + Im.Input.Text("##settingsName"u8, ref _settingsModName, "Mod Name..."u8); + ImEx.GuidInput("##settingsCollection"u8, ref _settingsCollection, "Collection..."u8); + Im.Checkbox("Ignore Inheritance"u8, ref _settingsIgnoreInheritance); + Im.Checkbox("Ignore Temporary"u8, ref _settingsIgnoreTemporary); + Im.Input.Scalar("Key"u8, ref _settingsKey); var collection = _settingsCollection.GetValueOrDefault(Guid.Empty); - using var table = ImRaii.Table(string.Empty, 3, ImGuiTableFlags.SizingFixedFit); + using var table = Im.Table.Begin(StringU8.Empty, 3, TableFlags.SizingFixedFit); if (!table) return; - IpcTester.DrawIntro("Last Error", _lastSettingsError.ToString()); + IpcTester.DrawIntro("Last Error"u8, $"{_lastSettingsError}"); - IpcTester.DrawIntro(ModSettingChanged.Label, "Last Mod Setting Changed"); - ImGui.TextUnformatted(_lastSettingChangeMod.Length > 0 + IpcTester.DrawIntro(ModSettingChanged.Label, "Last Mod Setting Changed"u8); + Im.Text(_lastSettingChangeMod.Length > 0 ? $"{_lastSettingChangeType} of {_lastSettingChangeMod} in {_lastSettingChangeCollection}{(_lastSettingChangeInherited ? " (Inherited)" : string.Empty)} at {_lastSettingChange}" - : "None"); + : "None"u8); - IpcTester.DrawIntro(GetAvailableModSettings.Label, "Get Available Settings"); - if (ImGui.Button("Get##Available")) + IpcTester.DrawIntro(GetAvailableModSettings.Label, "Get Available Settings"u8); + if (Im.Button("Get##Available"u8)) { _availableSettings = new GetAvailableModSettings(_pi).Invoke(_settingsModDirectory, _settingsModName); _lastSettingsError = _availableSettings == null ? PenumbraApiEc.ModMissing : PenumbraApiEc.Success; } - IpcTester.DrawIntro(GetCurrentModSettings.Label, "Get Current Settings"); - if (ImGui.Button("Get##Current")) + IpcTester.DrawIntro(GetCurrentModSettings.Label, "Get Current Settings"u8); + if (Im.Button("Get##Current"u8)) { var ret = new GetCurrentModSettings(_pi) .Invoke(collection, _settingsModDirectory, _settingsModName, _settingsIgnoreInheritance); _lastSettingsError = ret.Item1; - if (ret.Item1 == PenumbraApiEc.Success) + if (ret.Item1 is PenumbraApiEc.Success) { _settingsEnabled = ret.Item2?.Item1 ?? false; _settingsInherit = ret.Item2?.Item4 ?? true; @@ -101,13 +97,14 @@ public class ModSettingsIpcTester : Luna.IUiService, IDisposable } } - IpcTester.DrawIntro(GetCurrentModSettingsWithTemp.Label, "Get Current Settings With Temp"); - if (ImGui.Button("Get##CurrentTemp")) + IpcTester.DrawIntro(GetCurrentModSettingsWithTemp.Label, "Get Current Settings With Temp"u8); + if (Im.Button("Get##CurrentTemp"u8)) { var ret = new GetCurrentModSettingsWithTemp(_pi) - .Invoke(collection, _settingsModDirectory, _settingsModName, _settingsIgnoreInheritance, _settingsIgnoreTemporary, _settingsKey); + .Invoke(collection, _settingsModDirectory, _settingsModName, _settingsIgnoreInheritance, _settingsIgnoreTemporary, + _settingsKey); _lastSettingsError = ret.Item1; - if (ret.Item1 == PenumbraApiEc.Success) + if (ret.Item1 is PenumbraApiEc.Success) { _settingsEnabled = ret.Item2?.Item1 ?? false; _settingsInherit = ret.Item2?.Item4 ?? true; @@ -120,77 +117,76 @@ public class ModSettingsIpcTester : Luna.IUiService, IDisposable _currentSettings = null; } } - - IpcTester.DrawIntro(GetAllModSettings.Label, "Get All Mod Settings"); - if (ImGui.Button("Get##All")) + + IpcTester.DrawIntro(GetAllModSettings.Label, "Get All Mod Settings"u8); + if (Im.Button("Get##All"u8)) { var ret = new GetAllModSettings(_pi).Invoke(collection, _settingsIgnoreInheritance, _settingsIgnoreTemporary, _settingsKey); _lastSettingsError = ret.Item1; _allSettings = ret.Item2; } - if (_allSettings != null) + if (_allSettings is not null) { - ImGui.SameLine(); - ImUtf8.Text($"{_allSettings.Count} Mods"); + Im.Line.Same(); + Im.Text($"{_allSettings.Count} Mods"); } - IpcTester.DrawIntro(TryInheritMod.Label, "Inherit Mod"); - ImGui.Checkbox("##inherit", ref _settingsInherit); - ImGui.SameLine(); - if (ImGui.Button("Set##Inherit")) + IpcTester.DrawIntro(TryInheritMod.Label, "Inherit Mod"u8); + Im.Checkbox("##inherit"u8, ref _settingsInherit); + Im.Line.Same(); + if (Im.Button("Set##Inherit"u8)) _lastSettingsError = new TryInheritMod(_pi) .Invoke(collection, _settingsModDirectory, _settingsInherit, _settingsModName); - IpcTester.DrawIntro(TrySetMod.Label, "Set Enabled"); - ImGui.Checkbox("##enabled", ref _settingsEnabled); - ImGui.SameLine(); - if (ImGui.Button("Set##Enabled")) + IpcTester.DrawIntro(TrySetMod.Label, "Set Enabled"u8); + Im.Checkbox("##enabled"u8, ref _settingsEnabled); + Im.Line.Same(); + if (Im.Button("Set##Enabled"u8)) _lastSettingsError = new TrySetMod(_pi) .Invoke(collection, _settingsModDirectory, _settingsEnabled, _settingsModName); - IpcTester.DrawIntro(TrySetModPriority.Label, "Set Priority"); - ImGui.SetNextItemWidth(200 * UiHelpers.Scale); - ImGui.DragInt("##Priority", ref _settingsPriority); - ImGui.SameLine(); - if (ImGui.Button("Set##Priority")) + IpcTester.DrawIntro(TrySetModPriority.Label, "Set Priority"u8); + Im.Item.SetNextWidthScaled(200); + Im.Drag("##Priority"u8, ref _settingsPriority); + Im.Line.Same(); + if (Im.Button("Set##Priority"u8)) _lastSettingsError = new TrySetModPriority(_pi) .Invoke(collection, _settingsModDirectory, _settingsPriority, _settingsModName); - IpcTester.DrawIntro(CopyModSettings.Label, "Copy Mod Settings"); - if (ImGui.Button("Copy Settings")) + IpcTester.DrawIntro(CopyModSettings.Label, "Copy Mod Settings"u8); + if (Im.Button("Copy Settings"u8)) _lastSettingsError = new CopyModSettings(_pi) .Invoke(_settingsCollection, _settingsModDirectory, _settingsModName); - ImGuiUtil.HoverTooltip("Copy settings from Mod Directory Name to Mod Name (as directory) in collection."); + Im.Tooltip.OnHover("Copy settings from Mod Directory Name to Mod Name (as directory) in collection."u8); - IpcTester.DrawIntro(TrySetModSetting.Label, "Set Setting(s)"); + IpcTester.DrawIntro(TrySetModSetting.Label, "Set Setting(s)"u8); if (_availableSettings == null) return; foreach (var (group, (list, type)) in _availableSettings) { - using var id = ImRaii.PushId(group); + using var id = Im.Id.Push(group); var preview = list.Length > 0 ? list[0] : string.Empty; - if (_currentSettings != null && _currentSettings.TryGetValue(group, out var current) && current.Count > 0) + if (_currentSettings is not null && _currentSettings.TryGetValue(group, out var current) && current.Count > 0) { preview = current[0]; } else { - current = []; - if (_currentSettings != null) - _currentSettings[group] = current; + current = []; + _currentSettings?[group] = current; } - ImGui.SetNextItemWidth(200 * UiHelpers.Scale); - using (var c = ImRaii.Combo("##group", preview)) + Im.Item.SetNextWidthScaled(200); + using (var c = Im.Combo.Begin("##group"u8, preview)) { if (c) foreach (var s in list) { var contained = current.Contains(s); - if (ImGui.Checkbox(s, ref contained)) + if (Im.Checkbox(s, ref contained)) { if (contained) current.Add(s); @@ -200,15 +196,15 @@ public class ModSettingsIpcTester : Luna.IUiService, IDisposable } } - ImGui.SameLine(); - if (ImGui.Button("Set##setting")) - _lastSettingsError = type == GroupType.Single + Im.Line.Same(); + if (Im.Button("Set##setting"u8)) + _lastSettingsError = type is GroupType.Single ? new TrySetModSetting(_pi).Invoke(collection, _settingsModDirectory, group, current.Count > 0 ? current[0] : string.Empty, _settingsModName) : new TrySetModSettings(_pi).Invoke(collection, _settingsModDirectory, group, current.ToArray(), _settingsModName); - ImGui.SameLine(); - ImGui.TextUnformatted(group); + Im.Line.Same(); + Im.Text(group); } } diff --git a/Penumbra/Api/IpcTester/ModsIpcTester.cs b/Penumbra/Api/IpcTester/ModsIpcTester.cs index cb5e4747..3765d52a 100644 --- a/Penumbra/Api/IpcTester/ModsIpcTester.cs +++ b/Penumbra/Api/IpcTester/ModsIpcTester.cs @@ -1,8 +1,5 @@ -using Dalamud.Bindings.ImGui; -using Dalamud.Interface.Utility; using Dalamud.Plugin; -using OtterGui.Raii; -using OtterGui.Text; +using ImSharp; using Penumbra.Api.Enums; using Penumbra.Api.Helpers; using Penumbra.Api.IpcSubscribers; @@ -73,111 +70,111 @@ public class ModsIpcTester : Luna.IUiService, IDisposable public void Draw() { - using var _ = ImRaii.TreeNode("Mods"); + using var _ = Im.Tree.Node("Mods"u8); if (!_) return; - ImGui.InputTextWithHint("##install", "Install File Path...", ref _newInstallPath, 100); - ImGui.InputTextWithHint("##modDir", "Mod Directory Name...", ref _modDirectory, 100); - ImGui.InputTextWithHint("##modName", "Mod Name...", ref _modName, 100); - ImGui.InputTextWithHint("##path", "New Path...", ref _pathInput, 100); - using var table = ImRaii.Table(string.Empty, 3, ImGuiTableFlags.SizingFixedFit); + Im.Input.Text("##install"u8, ref _newInstallPath, "Install File Path..."u8); + Im.Input.Text("##modDir"u8, ref _modDirectory, "Mod Directory Name..."u8); + Im.Input.Text("##modName"u8, ref _modName, "Mod Name..."u8); + Im.Input.Text("##path"u8, ref _pathInput, "New Path..."u8); + using var table = Im.Table.Begin(StringU8.Empty, 3, TableFlags.SizingFixedFit); if (!table) return; - IpcTester.DrawIntro(GetModList.Label, "Mods"); + IpcTester.DrawIntro(GetModList.Label, "Mods"u8); DrawModsPopup(); - if (ImGui.Button("Get##Mods")) + if (Im.Button("Get##Mods"u8)) { _mods = new GetModList(_pi).Invoke(); - ImGui.OpenPopup("Mods"); + Im.Popup.Open("Mods"u8); } - IpcTester.DrawIntro(ReloadMod.Label, "Reload Mod"); - if (ImGui.Button("Reload")) + IpcTester.DrawIntro(ReloadMod.Label, "Reload Mod"u8); + if (Im.Button("Reload"u8)) _lastReloadEc = new ReloadMod(_pi).Invoke(_modDirectory, _modName); - ImGui.SameLine(); - ImGui.TextUnformatted(_lastReloadEc.ToString()); + Im.Line.Same(); + Im.Text($"{_lastReloadEc}"); - IpcTester.DrawIntro(InstallMod.Label, "Install Mod"); - if (ImGui.Button("Install")) + IpcTester.DrawIntro(InstallMod.Label, "Install Mod"u8); + if (Im.Button("Install"u8)) _lastInstallEc = new InstallMod(_pi).Invoke(_newInstallPath); - ImGui.SameLine(); - ImGui.TextUnformatted(_lastInstallEc.ToString()); + Im.Line.Same(); + Im.Text($"{_lastInstallEc}"); - IpcTester.DrawIntro(AddMod.Label, "Add Mod"); - if (ImGui.Button("Add")) + IpcTester.DrawIntro(AddMod.Label, "Add Mod"u8); + if (Im.Button("Add"u8)) _lastAddEc = new AddMod(_pi).Invoke(_modDirectory); - ImGui.SameLine(); - ImGui.TextUnformatted(_lastAddEc.ToString()); + Im.Line.Same(); + Im.Text($"{_lastAddEc}"); - IpcTester.DrawIntro(DeleteMod.Label, "Delete Mod"); - if (ImGui.Button("Delete")) + IpcTester.DrawIntro(DeleteMod.Label, "Delete Mod"u8); + if (Im.Button("Delete"u8)) _lastDeleteEc = new DeleteMod(_pi).Invoke(_modDirectory, _modName); - ImGui.SameLine(); - ImGui.TextUnformatted(_lastDeleteEc.ToString()); + Im.Line.Same(); + Im.Text(_lastDeleteEc.ToString()); - IpcTester.DrawIntro(GetChangedItems.Label, "Get Changed Items"); + IpcTester.DrawIntro(GetChangedItems.Label, "Get Changed Items"u8); DrawChangedItemsPopup(); - if (ImUtf8.Button("Get##ChangedItems"u8)) + if (Im.Button("Get##ChangedItems"u8)) { _changedItems = new GetChangedItems(_pi).Invoke(_modDirectory, _modName); - ImUtf8.OpenPopup("ChangedItems"u8); + Im.Popup.Open("ChangedItems"u8); } - IpcTester.DrawIntro(GetModPath.Label, "Current Path"); + IpcTester.DrawIntro(GetModPath.Label, "Current Path"u8); var (ec, path, def, nameDef) = new GetModPath(_pi).Invoke(_modDirectory, _modName); - ImGui.TextUnformatted($"{path} ({(def ? "Custom" : "Default")} Path, {(nameDef ? "Custom" : "Default")} Name) [{ec}]"); + Im.Text($"{path} ({(def ? "Custom" : "Default")} Path, {(nameDef ? "Custom" : "Default")} Name) [{ec}]"); - IpcTester.DrawIntro(SetModPath.Label, "Set Path"); - if (ImGui.Button("Set")) + IpcTester.DrawIntro(SetModPath.Label, "Set Path"u8); + if (Im.Button("Set"u8)) _lastSetPathEc = new SetModPath(_pi).Invoke(_modDirectory, _pathInput, _modName); - ImGui.SameLine(); - ImGui.TextUnformatted(_lastSetPathEc.ToString()); + Im.Line.Same(); + Im.Text($"{_lastSetPathEc}"); - IpcTester.DrawIntro(ModDeleted.Label, "Last Mod Deleted"); + IpcTester.DrawIntro(ModDeleted.Label, "Last Mod Deleted"u8); if (_lastDeletedModTime > DateTimeOffset.UnixEpoch) - ImGui.TextUnformatted($"{_lastDeletedMod} at {_lastDeletedModTime}"); + Im.Text($"{_lastDeletedMod} at {_lastDeletedModTime}"); - IpcTester.DrawIntro(ModAdded.Label, "Last Mod Added"); + IpcTester.DrawIntro(ModAdded.Label, "Last Mod Added"u8); if (_lastAddedModTime > DateTimeOffset.UnixEpoch) - ImGui.TextUnformatted($"{_lastAddedMod} at {_lastAddedModTime}"); + Im.Text($"{_lastAddedMod} at {_lastAddedModTime}"); IpcTester.DrawIntro(ModMoved.Label, "Last Mod Moved"); if (_lastMovedModTime > DateTimeOffset.UnixEpoch) - ImGui.TextUnformatted($"{_lastMovedModFrom} -> {_lastMovedModTo} at {_lastMovedModTime}"); + Im.Text($"{_lastMovedModFrom} -> {_lastMovedModTo} at {_lastMovedModTime}"); } private void DrawModsPopup() { - ImGui.SetNextWindowSize(ImGuiHelpers.ScaledVector2(500, 500)); - using var p = ImRaii.Popup("Mods"); + Im.Window.SetNextSize(ImEx.ScaledVector(500, 500)); + using var p = Im.Popup.Begin("Mods"u8); if (!p) return; foreach (var (modDir, modName) in _mods) - ImGui.TextUnformatted($"{modDir}: {modName}"); + Im.Text($"{modDir}: {modName}"); - if (ImGui.Button("Close", -Vector2.UnitX) || !ImGui.IsWindowFocused()) - ImGui.CloseCurrentPopup(); + if (Im.Button("Close"u8, -Vector2.UnitX) || !Im.Window.Focused()) + Im.Popup.CloseCurrent(); } private void DrawChangedItemsPopup() { - ImGui.SetNextWindowSize(ImGuiHelpers.ScaledVector2(500, 500)); - using var p = ImUtf8.Popup("ChangedItems"u8); + Im.Window.SetNextSize(ImEx.ScaledVector(500, 500)); + using var p = Im.Popup.Begin("ChangedItems"u8); if (!p) return; foreach (var (name, data) in _changedItems) - ImUtf8.Text($"{name}: {data}"); + Im.Text($"{name}: {data}"); - if (ImUtf8.Button("Close"u8, -Vector2.UnitX) || !ImGui.IsWindowFocused()) - ImGui.CloseCurrentPopup(); + if (Im.Button("Close"u8, -Vector2.UnitX) || !Im.Window.Focused()) + Im.Popup.CloseCurrent(); } } diff --git a/Penumbra/Api/IpcTester/PluginStateIpcTester.cs b/Penumbra/Api/IpcTester/PluginStateIpcTester.cs index 174a5dd2..86cb14b5 100644 --- a/Penumbra/Api/IpcTester/PluginStateIpcTester.cs +++ b/Penumbra/Api/IpcTester/PluginStateIpcTester.cs @@ -1,16 +1,12 @@ -using Dalamud.Interface; -using Dalamud.Interface.Utility; using Dalamud.Plugin; -using Dalamud.Bindings.ImGui; -using OtterGui; -using OtterGui.Raii; -using OtterGui.Text; +using ImSharp; +using Luna; using Penumbra.Api.Helpers; using Penumbra.Api.IpcSubscribers; namespace Penumbra.Api.IpcTester; -public class PluginStateIpcTester : Luna.IUiService, IDisposable +public class PluginStateIpcTester : IUiService, IDisposable { private readonly IDalamudPluginInterface _pi; public readonly EventSubscriber ModDirectoryChanged; @@ -54,82 +50,82 @@ public class PluginStateIpcTester : Luna.IUiService, IDisposable public void Draw() { - using var _ = ImRaii.TreeNode("Plugin State"); - if (!_) + using var tree = Im.Tree.Node("Plugin State"u8); + if (!tree) return; - if (ImUtf8.InputText("Required Features"u8, ref _requiredFeatureString)) + if (Im.Input.Text("Required Features"u8, ref _requiredFeatureString)) _requiredFeatures = _requiredFeatureString.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); - using var table = ImRaii.Table(string.Empty, 3, ImGuiTableFlags.SizingFixedFit); + using var table = Im.Table.Begin(StringU8.Empty, 3, TableFlags.SizingFixedFit); if (!table) return; - DrawList(IpcSubscribers.Initialized.Label, "Last Initialized", _initializedList); - DrawList(IpcSubscribers.Disposed.Label, "Last Disposed", _disposedList); + DrawList(IpcSubscribers.Initialized.Label, "Last Initialized"u8, _initializedList); + DrawList(IpcSubscribers.Disposed.Label, "Last Disposed"u8, _disposedList); - IpcTester.DrawIntro(ApiVersion.Label, "Current Version"); + IpcTester.DrawIntro(ApiVersion.Label, "Current Version"u8); var (breaking, features) = new ApiVersion(_pi).Invoke(); - ImGui.TextUnformatted($"{breaking}.{features:D4}"); + Im.Text($"{breaking}.{features:D4}"); - IpcTester.DrawIntro(GetEnabledState.Label, "Current State"); - ImGui.TextUnformatted($"{new GetEnabledState(_pi).Invoke()}"); + IpcTester.DrawIntro(GetEnabledState.Label, "Current State"u8); + Im.Text($"{new GetEnabledState(_pi).Invoke()}"); - IpcTester.DrawIntro(IpcSubscribers.EnabledChange.Label, "Last Change"); - ImGui.TextUnformatted(_lastEnabledValue is { } v ? $"{_lastEnabledChange} (to {v})" : "Never"); + IpcTester.DrawIntro(IpcSubscribers.EnabledChange.Label, "Last Change"u8); + Im.Text(_lastEnabledValue is { } v ? $"{_lastEnabledChange} (to {v})" : "Never"u8); - IpcTester.DrawIntro(SupportedFeatures.Label, "Supported Features"); - ImUtf8.Text(string.Join(", ", new SupportedFeatures(_pi).Invoke())); + IpcTester.DrawIntro(SupportedFeatures.Label, "Supported Features"u8); + Im.Text(StringU8.Join(", "u8, new SupportedFeatures(_pi).Invoke())); - IpcTester.DrawIntro(CheckSupportedFeatures.Label, "Missing Features"); - ImUtf8.Text(string.Join(", ", new CheckSupportedFeatures(_pi).Invoke(_requiredFeatures))); + IpcTester.DrawIntro(CheckSupportedFeatures.Label, "Missing Features"u8); + Im.Text(StringU8.Join(", "u8, new CheckSupportedFeatures(_pi).Invoke(_requiredFeatures))); DrawConfigPopup(); - IpcTester.DrawIntro(GetConfiguration.Label, "Configuration"); - if (ImGui.Button("Get")) + IpcTester.DrawIntro(GetConfiguration.Label, "Configuration"u8); + if (Im.Button("Get"u8)) { _currentConfiguration = new GetConfiguration(_pi).Invoke(); - ImGui.OpenPopup("Config Popup"); + Im.Popup.Open("Config Popup"u8); } - IpcTester.DrawIntro(GetModDirectory.Label, "Current Mod Directory"); - ImGui.TextUnformatted(new GetModDirectory(_pi).Invoke()); + IpcTester.DrawIntro(GetModDirectory.Label, "Current Mod Directory"u8); + Im.Text(new GetModDirectory(_pi).Invoke()); - IpcTester.DrawIntro(IpcSubscribers.ModDirectoryChanged.Label, "Last Mod Directory Change"); - ImGui.TextUnformatted(_lastModDirectoryTime > DateTimeOffset.MinValue + IpcTester.DrawIntro(IpcSubscribers.ModDirectoryChanged.Label, "Last Mod Directory Change"u8); + Im.Text(_lastModDirectoryTime > DateTimeOffset.MinValue ? $"{_lastModDirectory} ({(_lastModDirectoryValid ? "Valid" : "Invalid")}) at {_lastModDirectoryTime}" - : "None"); + : "None"u8); - void DrawList(string label, string text, List list) + void DrawList(string label, ReadOnlySpan text, List list) { IpcTester.DrawIntro(label, text); - if (list.Count == 0) + if (list.Count is 0) { - ImGui.TextUnformatted("Never"); + Im.Text("Never"u8); } else { - ImGui.TextUnformatted(list[^1].LocalDateTime.ToString(CultureInfo.CurrentCulture)); - if (list.Count > 1 && ImGui.IsItemHovered()) - ImGui.SetTooltip(string.Join("\n", - list.SkipLast(1).Select(t => t.LocalDateTime.ToString(CultureInfo.CurrentCulture)))); + Im.Text(list[^1].LocalDateTime.ToString(CultureInfo.CurrentCulture)); + if (list.Count > 1 && Im.Item.Hovered()) + Im.Tooltip.Set( + StringU8.Join((byte)'\n', list.SkipLast(1).Select(t => t.LocalDateTime.ToString(CultureInfo.CurrentCulture)))); } } } private void DrawConfigPopup() { - ImGui.SetNextWindowSize(ImGuiHelpers.ScaledVector2(500, 500)); - using var popup = ImRaii.Popup("Config Popup"); + Im.Window.SetNextSize(ImEx.ScaledVector(500, 500)); + using var popup = Im.Popup.Begin("Config Popup"u8); if (!popup) return; - using (ImRaii.PushFont(UiBuilder.MonoFont)) + using (Im.Font.PushMono()) { - ImGuiUtil.TextWrapped(_currentConfiguration); + Im.TextWrapped(_currentConfiguration); } - if (ImGui.Button("Close", -Vector2.UnitX) || !ImGui.IsWindowFocused()) - ImGui.CloseCurrentPopup(); + if (Im.Button("Close"u8, -Vector2.UnitX) || !Im.Window.Focused()) + Im.Popup.CloseCurrent(); } private void UpdateModDirectoryChanged(string path, bool valid) diff --git a/Penumbra/Api/IpcTester/RedrawingIpcTester.cs b/Penumbra/Api/IpcTester/RedrawingIpcTester.cs index a3d600c3..e3eb528b 100644 --- a/Penumbra/Api/IpcTester/RedrawingIpcTester.cs +++ b/Penumbra/Api/IpcTester/RedrawingIpcTester.cs @@ -1,21 +1,19 @@ using Dalamud.Plugin; -using Dalamud.Bindings.ImGui; -using OtterGui.Raii; +using ImSharp; using Penumbra.Api.Helpers; using Penumbra.Api.IpcSubscribers; using Penumbra.GameData.Interop; -using Penumbra.UI; namespace Penumbra.Api.IpcTester; public class RedrawingIpcTester : Luna.IUiService, IDisposable { - private readonly IDalamudPluginInterface _pi; + private readonly IDalamudPluginInterface _pi; private readonly ObjectManager _objects; public readonly EventSubscriber Redrawn; - private int _redrawIndex; - private string _lastRedrawnString = "None"; + private int _redrawIndex; + private StringU8 _lastRedrawnString = new("None"u8); public RedrawingIpcTester(IDalamudPluginInterface pi, ObjectManager objects) { @@ -32,29 +30,29 @@ public class RedrawingIpcTester : Luna.IUiService, IDisposable public void Draw() { - using var _ = ImRaii.TreeNode("Redrawing"); + using var _ = Im.Tree.Node("Redrawing"u8); if (!_) return; - using var table = ImRaii.Table(string.Empty, 3, ImGuiTableFlags.SizingFixedFit); + using var table = Im.Table.Begin(StringU8.Empty, 3, TableFlags.SizingFixedFit); if (!table) return; - IpcTester.DrawIntro(RedrawObject.Label, "Redraw by Index"); + IpcTester.DrawIntro(RedrawObject.Label, "Redraw by Index"u8); var tmp = _redrawIndex; - ImGui.SetNextItemWidth(100 * UiHelpers.Scale); - if (ImGui.DragInt("##redrawIndex", ref tmp, 0.1f, 0, _objects.TotalCount)) + Im.Item.SetNextWidthScaled(100); + if (Im.Drag("##redrawIndex"u8, ref tmp, 0, _objects.TotalCount, 0.1f)) _redrawIndex = Math.Clamp(tmp, 0, _objects.TotalCount); - ImGui.SameLine(); - if (ImGui.Button("Redraw##Index")) + Im.Line.Same(); + if (Im.Button("Redraw##Index"u8)) new RedrawObject(_pi).Invoke(_redrawIndex); - IpcTester.DrawIntro(RedrawAll.Label, "Redraw All"); - if (ImGui.Button("Redraw##All")) + IpcTester.DrawIntro(RedrawAll.Label, "Redraw All"u8); + if (Im.Button("Redraw##All"u8)) new RedrawAll(_pi).Invoke(); - IpcTester.DrawIntro(GameObjectRedrawn.Label, "Last Redrawn Object:"); - ImGui.TextUnformatted(_lastRedrawnString); + IpcTester.DrawIntro(GameObjectRedrawn.Label, "Last Redrawn Object:"u8); + Im.Text(_lastRedrawnString); } private void SetLastRedrawn(nint address, int index) @@ -63,8 +61,8 @@ public class RedrawingIpcTester : Luna.IUiService, IDisposable || index > _objects.TotalCount || address == nint.Zero || _objects[index].Address != address) - _lastRedrawnString = "Invalid"; + _lastRedrawnString = new StringU8("Invalid"u8); - _lastRedrawnString = $"{_objects[index].Utf8Name} (0x{address:X}, {index})"; + _lastRedrawnString = new StringU8($"{_objects[index].Utf8Name} (0x{address:X}, {index})"); } } diff --git a/Penumbra/Api/IpcTester/ResolveIpcTester.cs b/Penumbra/Api/IpcTester/ResolveIpcTester.cs index 012bbea8..734e02bd 100644 --- a/Penumbra/Api/IpcTester/ResolveIpcTester.cs +++ b/Penumbra/Api/IpcTester/ResolveIpcTester.cs @@ -1,8 +1,6 @@ using Dalamud.Plugin; -using Dalamud.Bindings.ImGui; -using OtterGui.Raii; +using ImSharp; using Penumbra.Api.IpcSubscribers; -using Penumbra.String.Classes; namespace Penumbra.Api.IpcTester; @@ -15,97 +13,86 @@ public class ResolveIpcTester(IDalamudPluginInterface pi) : Luna.IUiService public void Draw() { - using var tree = ImRaii.TreeNode("Resolving"); + using var tree = Im.Tree.Node("Resolving"u8); if (!tree) return; - ImGui.InputTextWithHint("##resolvePath", "Resolve this game path...", ref _currentResolvePath, Utf8GamePath.MaxGamePathLength); - ImGui.InputTextWithHint("##resolveInversePath", "Reverse-resolve this path...", ref _currentReversePath, - Utf8GamePath.MaxGamePathLength); - ImGui.InputInt("##resolveIdx", ref _currentReverseIdx, 0, 0); - using var table = ImRaii.Table(string.Empty, 3, ImGuiTableFlags.SizingFixedFit); + Im.Input.Text("##resolvePath"u8, ref _currentResolvePath, "Resolve this game path..."u8); + Im.Input.Text("##resolveInversePath"u8, ref _currentReversePath, "Reverse-resolve this path..."u8); + Im.Input.Scalar("##resolveIdx"u8, ref _currentReverseIdx); + using var table = Im.Table.Begin(StringU8.Empty, 3, TableFlags.SizingFixedFit); if (!table) return; - IpcTester.DrawIntro(ResolveDefaultPath.Label, "Default Collection Resolve"); - if (_currentResolvePath.Length != 0) - ImGui.TextUnformatted(new ResolveDefaultPath(pi).Invoke(_currentResolvePath)); + IpcTester.DrawIntro(ResolveDefaultPath.Label, "Default Collection Resolve"u8); + if (_currentResolvePath.Length is not 0) + Im.Text(new ResolveDefaultPath(pi).Invoke(_currentResolvePath)); - IpcTester.DrawIntro(ResolveInterfacePath.Label, "Interface Collection Resolve"); - if (_currentResolvePath.Length != 0) - ImGui.TextUnformatted(new ResolveInterfacePath(pi).Invoke(_currentResolvePath)); + IpcTester.DrawIntro(ResolveInterfacePath.Label, "Interface Collection Resolve"u8); + if (_currentResolvePath.Length is not 0) + Im.Text(new ResolveInterfacePath(pi).Invoke(_currentResolvePath)); - IpcTester.DrawIntro(ResolvePlayerPath.Label, "Player Collection Resolve"); - if (_currentResolvePath.Length != 0) - ImGui.TextUnformatted(new ResolvePlayerPath(pi).Invoke(_currentResolvePath)); + IpcTester.DrawIntro(ResolvePlayerPath.Label, "Player Collection Resolve"u8); + if (_currentResolvePath.Length is not 0) + Im.Text(new ResolvePlayerPath(pi).Invoke(_currentResolvePath)); - IpcTester.DrawIntro(ResolveGameObjectPath.Label, "Game Object Collection Resolve"); - if (_currentResolvePath.Length != 0) - ImGui.TextUnformatted(new ResolveGameObjectPath(pi).Invoke(_currentResolvePath, _currentReverseIdx)); + IpcTester.DrawIntro(ResolveGameObjectPath.Label, "Game Object Collection Resolve"u8); + if (_currentResolvePath.Length is not 0) + Im.Text(new ResolveGameObjectPath(pi).Invoke(_currentResolvePath, _currentReverseIdx)); - IpcTester.DrawIntro(ReverseResolvePlayerPath.Label, "Reversed Game Paths (Player)"); - if (_currentReversePath.Length > 0) + IpcTester.DrawIntro(ReverseResolvePlayerPath.Label, "Reversed Game Paths (Player)"u8); + if (_currentReversePath.Length is not 0) { var list = new ReverseResolvePlayerPath(pi).Invoke(_currentReversePath); if (list.Length > 0) { - ImGui.TextUnformatted(list[0]); - if (list.Length > 1 && ImGui.IsItemHovered()) - ImGui.SetTooltip(string.Join("\n", list.Skip(1))); + Im.Text(list[0]); + if (list.Length > 1 && Im.Item.Hovered()) + Im.Tooltip.Set(StringU8.Join((byte)'\n', list.Skip(1))); } } - IpcTester.DrawIntro(ReverseResolveGameObjectPath.Label, "Reversed Game Paths (Game Object)"); - if (_currentReversePath.Length > 0) + IpcTester.DrawIntro(ReverseResolveGameObjectPath.Label, "Reversed Game Paths (Game Object)"u8); + if (_currentReversePath.Length is not 0) { var list = new ReverseResolveGameObjectPath(pi).Invoke(_currentReversePath, _currentReverseIdx); if (list.Length > 0) { - ImGui.TextUnformatted(list[0]); - if (list.Length > 1 && ImGui.IsItemHovered()) - ImGui.SetTooltip(string.Join("\n", list.Skip(1))); + Im.Text(list[0]); + if (list.Length > 1 && Im.Item.Hovered()) + Im.Tooltip.Set(StringU8.Join((byte)'\n', list.Skip(1))); } } - var forwardArray = _currentResolvePath.Length > 0 - ? [_currentResolvePath] - : Array.Empty(); - var reverseArray = _currentReversePath.Length > 0 - ? [_currentReversePath] - : Array.Empty(); + string[] forwardArray = _currentResolvePath.Length > 0 ? [_currentResolvePath] : []; + string[] reverseArray = _currentReversePath.Length > 0 ? [_currentReversePath] : []; - IpcTester.DrawIntro(ResolvePlayerPaths.Label, "Resolved Paths (Player)"); + IpcTester.DrawIntro(ResolvePlayerPaths.Label, "Resolved Paths (Player)"u8); if (forwardArray.Length > 0 || reverseArray.Length > 0) { var ret = new ResolvePlayerPaths(pi).Invoke(forwardArray, reverseArray); - ImGui.TextUnformatted(ConvertText(ret)); + Im.Text(ConvertText(ret)); } - IpcTester.DrawIntro(ResolvePlayerPathsAsync.Label, "Resolved Paths Async (Player)"); - if (ImGui.Button("Start")) + IpcTester.DrawIntro(ResolvePlayerPathsAsync.Label, "Resolved Paths Async (Player)"u8); + if (Im.Button("Start"u8)) _task = new ResolvePlayerPathsAsync(pi).Invoke(forwardArray, reverseArray); - var hovered = ImGui.IsItemHovered(); - ImGui.SameLine(); - ImGui.AlignTextToFramePadding(); - ImGui.TextUnformatted(_task.Status.ToString()); - if ((hovered || ImGui.IsItemHovered()) && _task.IsCompletedSuccessfully) - ImGui.SetTooltip(ConvertText(_task.Result)); + var hovered = Im.Item.Hovered(); + Im.Line.Same(); + ImEx.TextFrameAligned($"{_task.Status}"); + if ((hovered || Im.Item.Hovered()) && _task.IsCompletedSuccessfully) + Im.Tooltip.Set(ConvertText(_task.Result)); return; - static string ConvertText((string[], string[][]) data) + static StringU8 ConvertText((string[], string[][]) data) { - var text = string.Empty; + var text = StringU8.Empty; if (data.Item1.Length > 0) - { - if (data.Item2.Length > 0) - text = $"Forward: {data.Item1[0]} | Reverse: {string.Join("; ", data.Item2[0])}."; - else - text = $"Forward: {data.Item1[0]}."; - } + text = data.Item2.Length > 0 + ? new StringU8($"Forward: {data.Item1[0]} | Reverse: {StringU8.Join("; "u8, data.Item2[0])}.") + : new StringU8($"Forward: {data.Item1[0]}."); else if (data.Item2.Length > 0) - { - text = $"Reverse: {string.Join("; ", data.Item2[0])}."; - } + text = new StringU8($"Reverse: {StringU8.Join("; "u8, data.Item2[0])}."); return text; } diff --git a/Penumbra/Api/IpcTester/ResourceTreeIpcTester.cs b/Penumbra/Api/IpcTester/ResourceTreeIpcTester.cs index cd417d46..dbad6500 100644 --- a/Penumbra/Api/IpcTester/ResourceTreeIpcTester.cs +++ b/Penumbra/Api/IpcTester/ResourceTreeIpcTester.cs @@ -1,11 +1,7 @@ -using Dalamud.Bindings.ImGui; using Dalamud.Game.ClientState.Objects.Enums; -using Dalamud.Interface; -using Dalamud.Interface.Utility; using Dalamud.Plugin; +using ImSharp; using Luna; -using OtterGui; -using OtterGui.Raii; using Penumbra.Api.Enums; using Penumbra.Api.Helpers; using Penumbra.Api.IpcSubscribers; @@ -15,7 +11,7 @@ using Penumbra.GameData.Structs; namespace Penumbra.Api.IpcTester; -public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager objects) : Luna.IUiService +public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager objects) : IUiService { private readonly Stopwatch _stopwatch = new(); @@ -23,30 +19,30 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj private ResourceType _type = ResourceType.Mtrl; private bool _withUiData; - private (string, Dictionary>?)[]? _lastGameObjectResourcePaths; - private (string, Dictionary>?)[]? _lastPlayerResourcePaths; - private (string, IReadOnlyDictionary?)[]? _lastGameObjectResourcesOfType; - private (string, IReadOnlyDictionary?)[]? _lastPlayerResourcesOfType; - private (string, ResourceTreeDto?)[]? _lastGameObjectResourceTrees; - private (string, ResourceTreeDto)[]? _lastPlayerResourceTrees; - private TimeSpan _lastCallDuration; + private (StringU8, Dictionary>?)[]? _lastGameObjectResourcePaths; + private (StringU8, Dictionary>?)[]? _lastPlayerResourcePaths; + private (StringU8, IReadOnlyDictionary?)[]? _lastGameObjectResourcesOfType; + private (StringU8, IReadOnlyDictionary?)[]? _lastPlayerResourcesOfType; + private (StringU8, ResourceTreeDto?)[]? _lastGameObjectResourceTrees; + private (StringU8, ResourceTreeDto)[]? _lastPlayerResourceTrees; + private TimeSpan _lastCallDuration; public void Draw() { - using var _ = ImRaii.TreeNode("Resource Tree"); + using var _ = Im.Tree.Node("Resource Tree"u8); if (!_) return; - ImGui.InputText("GameObject indices", ref _gameObjectIndices, 511); - ImGuiUtil.GenericEnumCombo("Resource type", ImGui.CalcItemWidth(), _type, out _type, Enum.GetValues()); - ImGui.Checkbox("Also get names and icons", ref _withUiData); + Im.Input.Text("GameObject indices"u8, ref _gameObjectIndices); + EnumCombo.Instance.Draw("Resource type"u8, ref _type, default, Im.Item.Size.X); + Im.Checkbox("Also get names and icons"u8, ref _withUiData); - using var table = ImRaii.Table(string.Empty, 3, ImGuiTableFlags.SizingFixedFit); + using var table = Im.Table.Begin(StringU8.Empty, 3, TableFlags.SizingFixedFit); if (!table) return; - IpcTester.DrawIntro(GetGameObjectResourcePaths.Label, "Get GameObject resource paths"); - if (ImGui.Button("Get##GameObjectResourcePaths")) + IpcTester.DrawIntro(GetGameObjectResourcePaths.Label, "Get GameObject resource paths"u8); + if (Im.Button("Get##GameObjectResourcePaths"u8)) { var gameObjects = GetSelectedGameObjects(); var subscriber = new GetGameObjectResourcePaths(pi); @@ -59,11 +55,11 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj .Zip(resourcePaths) .ToArray(); - ImGui.OpenPopup(nameof(GetGameObjectResourcePaths)); + Im.Popup.Open("GetGameObjectResourcePaths"u8); } - IpcTester.DrawIntro(GetPlayerResourcePaths.Label, "Get local player resource paths"); - if (ImGui.Button("Get##PlayerResourcePaths")) + IpcTester.DrawIntro(GetPlayerResourcePaths.Label, "Get local player resource paths"u8); + if (Im.Button("Get##PlayerResourcePaths"u8)) { var subscriber = new GetPlayerResourcePaths(pi); _stopwatch.Restart(); @@ -74,11 +70,11 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj .Select(pair => (GameObjectToString(pair.Key), pair.Value)) .ToArray()!; - ImGui.OpenPopup(nameof(GetPlayerResourcePaths)); + Im.Popup.Open("GetPlayerResourcePaths"u8); } - IpcTester.DrawIntro(GetGameObjectResourcesOfType.Label, "Get GameObject resources of type"); - if (ImGui.Button("Get##GameObjectResourcesOfType")) + IpcTester.DrawIntro(GetGameObjectResourcesOfType.Label, "Get GameObject resources of type"u8); + if (Im.Button("Get##GameObjectResourcesOfType"u8)) { var gameObjects = GetSelectedGameObjects(); var subscriber = new GetGameObjectResourcesOfType(pi); @@ -91,11 +87,11 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj .Zip(resourcesOfType) .ToArray(); - ImGui.OpenPopup(nameof(GetGameObjectResourcesOfType)); + Im.Popup.Open("GetGameObjectResourcesOfType"u8); } - IpcTester.DrawIntro(GetPlayerResourcesOfType.Label, "Get local player resources of type"); - if (ImGui.Button("Get##PlayerResourcesOfType")) + IpcTester.DrawIntro(GetPlayerResourcesOfType.Label, "Get local player resources of type"u8); + if (Im.Button("Get##PlayerResourcesOfType"u8)) { var subscriber = new GetPlayerResourcesOfType(pi); _stopwatch.Restart(); @@ -106,11 +102,11 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj .Select(pair => (GameObjectToString(pair.Key), (IReadOnlyDictionary?)pair.Value)) .ToArray(); - ImGui.OpenPopup(nameof(GetPlayerResourcesOfType)); + Im.Popup.Open("GetPlayerResourcesOfType"u8); } - IpcTester.DrawIntro(GetGameObjectResourceTrees.Label, "Get GameObject resource trees"); - if (ImGui.Button("Get##GameObjectResourceTrees")) + IpcTester.DrawIntro(GetGameObjectResourceTrees.Label, "Get GameObject resource trees"u8); + if (Im.Button("Get##GameObjectResourceTrees"u8)) { var gameObjects = GetSelectedGameObjects(); var subscriber = new GetGameObjectResourceTrees(pi); @@ -123,11 +119,11 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj .Zip(trees) .ToArray(); - ImGui.OpenPopup(nameof(GetGameObjectResourceTrees)); + Im.Popup.Open("GetGameObjectResourceTrees"u8); } - IpcTester.DrawIntro(GetPlayerResourceTrees.Label, "Get local player resource trees"); - if (ImGui.Button("Get##PlayerResourceTrees")) + IpcTester.DrawIntro(GetPlayerResourceTrees.Label, "Get local player resource trees"u8); + if (Im.Button("Get##PlayerResourceTrees"u8)) { var subscriber = new GetPlayerResourceTrees(pi); _stopwatch.Restart(); @@ -138,27 +134,27 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj .Select(pair => (GameObjectToString(pair.Key), pair.Value)) .ToArray(); - ImGui.OpenPopup(nameof(GetPlayerResourceTrees)); + Im.Popup.Open("GetPlayerResourceTrees"u8); } - DrawPopup(nameof(GetGameObjectResourcePaths), ref _lastGameObjectResourcePaths, DrawResourcePaths, + DrawPopup("GetGameObjectResourcePaths"u8, ref _lastGameObjectResourcePaths, DrawResourcePaths, _lastCallDuration); - DrawPopup(nameof(GetPlayerResourcePaths), ref _lastPlayerResourcePaths!, DrawResourcePaths, _lastCallDuration); + DrawPopup("GetPlayerResourcePaths"u8, ref _lastPlayerResourcePaths!, DrawResourcePaths, _lastCallDuration); - DrawPopup(nameof(GetGameObjectResourcesOfType), ref _lastGameObjectResourcesOfType, DrawResourcesOfType, + DrawPopup("GetGameObjectResourcesOfType"u8, ref _lastGameObjectResourcesOfType, DrawResourcesOfType, _lastCallDuration); - DrawPopup(nameof(GetPlayerResourcesOfType), ref _lastPlayerResourcesOfType, DrawResourcesOfType, + DrawPopup("GetPlayerResourcesOfType"u8, ref _lastPlayerResourcesOfType, DrawResourcesOfType, _lastCallDuration); - DrawPopup(nameof(GetGameObjectResourceTrees), ref _lastGameObjectResourceTrees, DrawResourceTrees, + DrawPopup("GetGameObjectResourceTrees"u8, ref _lastGameObjectResourceTrees, DrawResourceTrees, _lastCallDuration); - DrawPopup(nameof(GetPlayerResourceTrees), ref _lastPlayerResourceTrees, DrawResourceTrees!, _lastCallDuration); + DrawPopup("GetPlayerResourceTrees"u8, ref _lastPlayerResourceTrees, DrawResourceTrees!, _lastCallDuration); } - private static void DrawPopup(string popupId, ref T? result, Action drawResult, TimeSpan duration) where T : class + private static void DrawPopup(ReadOnlySpan popupId, ref T? result, Action drawResult, TimeSpan duration) where T : class { - ImGui.SetNextWindowSize(ImGuiHelpers.ScaledVector2(1000, 500)); - using var popup = ImRaii.Popup(popupId); + Im.Window.SetNextSize(ImEx.ScaledVector(1000, 500)); + using var popup = Im.Popup.Begin(popupId); if (!popup) { result = null; @@ -167,41 +163,41 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj if (result == null) { - ImGui.CloseCurrentPopup(); + Im.Popup.CloseCurrent(); return; } drawResult(result); - ImGui.TextUnformatted($"Invoked in {duration.TotalMilliseconds} ms"); + Im.Text($"Invoked in {duration.TotalMilliseconds} ms"); - if (ImGui.Button("Close", -Vector2.UnitX) || !ImGui.IsWindowFocused()) + if (Im.Button("Close"u8, -Vector2.UnitX) || !Im.Window.Focused()) { result = null; - ImGui.CloseCurrentPopup(); + Im.Popup.CloseCurrent(); } } - private static void DrawWithHeaders((string, T?)[] result, Action drawItem) where T : class + private static void DrawWithHeaders((StringU8, T?)[] result, Action drawItem) where T : class { - var firstSeen = new Dictionary(); + var firstSeen = new Dictionary(); foreach (var (label, item) in result) { if (item == null) { - ImRaii.TreeNode($"{label}: null", ImGuiTreeNodeFlags.Leaf).Dispose(); + Im.Tree.Node($"{label}: null", TreeNodeFlags.Leaf).Dispose(); continue; } if (firstSeen.TryGetValue(item, out var firstLabel)) { - ImRaii.TreeNode($"{label}: same as {firstLabel}", ImGuiTreeNodeFlags.Leaf).Dispose(); + Im.Tree.Node($"{label}: same as {firstLabel}", TreeNodeFlags.Leaf).Dispose(); continue; } firstSeen.Add(item, label); - using var header = ImRaii.TreeNode(label); + using var header = Im.Tree.Node(label); if (!header) continue; @@ -209,141 +205,130 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj } } - private static void DrawResourcePaths((string, Dictionary>?)[] result) + private static void DrawResourcePaths((StringU8, Dictionary>?)[] result) { DrawWithHeaders(result, paths => { - using var table = ImRaii.Table(string.Empty, 2, ImGuiTableFlags.SizingFixedFit); + using var table = Im.Table.Begin(StringU8.Empty, 2, TableFlags.SizingFixedFit); if (!table) return; - ImGui.TableSetupColumn("Actual Path", ImGuiTableColumnFlags.WidthStretch, 0.6f); - ImGui.TableSetupColumn("Game Paths", ImGuiTableColumnFlags.WidthStretch, 0.4f); - ImGui.TableHeadersRow(); + table.SetupColumn("Actual Path"u8, TableColumnFlags.WidthStretch, 0.6f); + table.SetupColumn("Game Paths"u8, TableColumnFlags.WidthStretch, 0.4f); + table.HeaderRow(); foreach (var (actualPath, gamePaths) in paths) { - ImGui.TableNextColumn(); - ImGui.TextUnformatted(actualPath); - ImGui.TableNextColumn(); + table.DrawColumn(actualPath); + table.NextColumn(); foreach (var gamePath in gamePaths) - ImGui.TextUnformatted(gamePath); + Im.Text(gamePath); } }); } - private void DrawResourcesOfType((string, IReadOnlyDictionary?)[] result) + private void DrawResourcesOfType((StringU8, IReadOnlyDictionary?)[] result) { DrawWithHeaders(result, resources => { - using var table = ImRaii.Table(string.Empty, _withUiData ? 3 : 2, ImGuiTableFlags.SizingFixedFit); + using var table = Im.Table.Begin(StringU8.Empty, _withUiData ? 3 : 2, TableFlags.SizingFixedFit); if (!table) return; - ImGui.TableSetupColumn("Resource Handle", ImGuiTableColumnFlags.WidthStretch, 0.15f); - ImGui.TableSetupColumn("Actual Path", ImGuiTableColumnFlags.WidthStretch, _withUiData ? 0.55f : 0.85f); + table.SetupColumn("Resource Handle"u8, TableColumnFlags.WidthStretch, 0.15f); + table.SetupColumn("Actual Path"u8, TableColumnFlags.WidthStretch, _withUiData ? 0.55f : 0.85f); if (_withUiData) - ImGui.TableSetupColumn("Icon & Name", ImGuiTableColumnFlags.WidthStretch, 0.3f); - ImGui.TableHeadersRow(); + table.SetupColumn("Icon & Name"u8, TableColumnFlags.WidthStretch, 0.3f); + table.HeaderRow(); foreach (var (resourceHandle, (actualPath, name, icon)) in resources) { - ImGui.TableNextColumn(); - TextUnformattedMono($"0x{resourceHandle:X}"); - ImGui.TableNextColumn(); - ImGui.TextUnformatted(actualPath); + table.NextColumn(); + Penumbra.Dynamis.DrawPointer(resourceHandle); + table.DrawColumn(actualPath); if (_withUiData) { - ImGui.TableNextColumn(); - TextUnformattedMono(icon.ToString()); - ImGui.SameLine(); - ImGui.TextUnformatted(name); + table.NextColumn(); + ImEx.MonoText($"{icon}"); + Im.Line.SameInner(); + Im.Text(name); } } }); } - private void DrawResourceTrees((string, ResourceTreeDto?)[] result) + private void DrawResourceTrees((StringU8, ResourceTreeDto?)[] result) { DrawWithHeaders(result, tree => { - ImGui.TextUnformatted($"Name: {tree.Name}\nRaceCode: {(GenderRace)tree.RaceCode}"); + Im.Text($"Name: {tree.Name}\nRaceCode: {(GenderRace)tree.RaceCode}"); - using var table = ImRaii.Table(string.Empty, _withUiData ? 7 : 5, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.Resizable); + using var table = Im.Table.Begin(StringU8.Empty, _withUiData ? 7 : 5, TableFlags.SizingFixedFit | TableFlags.Resizable); if (!table) return; if (_withUiData) { - ImGui.TableSetupColumn("Name", ImGuiTableColumnFlags.WidthStretch, 0.5f); - ImGui.TableSetupColumn("Type", ImGuiTableColumnFlags.WidthStretch, 0.1f); - ImGui.TableSetupColumn("Icon", ImGuiTableColumnFlags.WidthStretch, 0.15f); + table.SetupColumn("Name"u8, TableColumnFlags.WidthStretch, 0.5f); + table.SetupColumn("Type"u8, TableColumnFlags.WidthStretch, 0.1f); + table.SetupColumn("Icon"u8, TableColumnFlags.WidthStretch, 0.15f); } else { - ImGui.TableSetupColumn("Type", ImGuiTableColumnFlags.WidthStretch, 0.5f); + table.SetupColumn("Type"u8, TableColumnFlags.WidthStretch, 0.5f); } - ImGui.TableSetupColumn("Game Path", ImGuiTableColumnFlags.WidthStretch, 0.5f); - ImGui.TableSetupColumn("Actual Path", ImGuiTableColumnFlags.WidthStretch, 0.5f); - ImGui.TableSetupColumn("Object Address", ImGuiTableColumnFlags.WidthStretch, 0.2f); - ImGui.TableSetupColumn("Resource Handle", ImGuiTableColumnFlags.WidthStretch, 0.2f); - ImGui.TableHeadersRow(); + table.SetupColumn("Game Path"u8, TableColumnFlags.WidthStretch, 0.5f); + table.SetupColumn("Actual Path"u8, TableColumnFlags.WidthStretch, 0.5f); + table.SetupColumn("Object Address"u8, TableColumnFlags.WidthStretch, 0.2f); + table.SetupColumn("Resource Handle"u8, TableColumnFlags.WidthStretch, 0.2f); + table.HeaderRow(); - void DrawNode(ResourceNodeDto node) + foreach (var node in tree.Nodes) + DrawNode(table, node, _withUiData); + return; + + static void DrawNode(in Im.TableDisposable table, ResourceNodeDto node, bool uiData) { - ImGui.TableNextRow(); - ImGui.TableNextColumn(); - var hasChildren = node.Children.Any(); - using var treeNode = ImRaii.TreeNode( - $"{(_withUiData ? node.Name ?? "Unknown" : node.Type)}##{node.ObjectAddress:X8}", + table.NextRow(); + table.NextColumn(); + var hasChildren = node.Children.Count > 0; + using var treeNode = Im.Tree.Node($"{(uiData ? node.Name ?? "Unknown" : node.Type)}##{node.ObjectAddress:X8}", hasChildren - ? ImGuiTreeNodeFlags.SpanFullWidth - : ImGuiTreeNodeFlags.SpanFullWidth | ImGuiTreeNodeFlags.Leaf | ImGuiTreeNodeFlags.NoTreePushOnOpen); - if (_withUiData) + ? TreeNodeFlags.SpanFullWidth + : TreeNodeFlags.SpanFullWidth | TreeNodeFlags.Leaf | TreeNodeFlags.NoTreePushOnOpen); + if (uiData) { - ImGui.TableNextColumn(); - TextUnformattedMono(node.Type.ToString()); - ImGui.TableNextColumn(); - TextUnformattedMono(node.Icon.ToString()); + using var mono = Im.Font.PushMono(); + table.DrawColumn($"{node.Type}"); + table.DrawColumn($"{node.Icon}"); } - ImGui.TableNextColumn(); - ImGui.TextUnformatted(node.GamePath ?? "Unknown"); - ImGui.TableNextColumn(); - ImGui.TextUnformatted(node.ActualPath); - ImGui.TableNextColumn(); - TextUnformattedMono($"0x{node.ObjectAddress:X8}"); - ImGui.TableNextColumn(); - TextUnformattedMono($"0x{node.ResourceHandle:X8}"); + table.DrawColumn(node.GamePath ?? "Unknown"); + table.DrawColumn(node.ActualPath); + table.NextColumn(); + Penumbra.Dynamis.DrawPointer(node.ObjectAddress); + table.NextColumn(); + Penumbra.Dynamis.DrawPointer(node.ResourceHandle); if (treeNode) foreach (var child in node.Children) - DrawNode(child); + DrawNode(table, child, uiData); } - - foreach (var node in tree.Nodes) - DrawNode(node); }); } - private static void TextUnformattedMono(string text) - { - using var _ = ImRaii.PushFont(UiBuilder.MonoFont); - ImGui.TextUnformatted(text); - } - private ushort[] GetSelectedGameObjects() => _gameObjectIndices.Split(',') .SelectWhere(index => (ushort.TryParse(index.Trim(), out var i), i)) .ToArray(); - private unsafe string GameObjectToString(ObjectIndex gameObjectIndex) + private unsafe StringU8 GameObjectToString(ObjectIndex gameObjectIndex) { var gameObject = objects[gameObjectIndex]; return gameObject.Valid - ? $"[{gameObjectIndex}] {gameObject.Utf8Name} ({(ObjectKind)gameObject.AsObject->ObjectKind})" - : $"[{gameObjectIndex}] null"; + ? new StringU8($"[{gameObjectIndex}] {gameObject.Utf8Name} ({(ObjectKind)gameObject.AsObject->ObjectKind})") + : new StringU8($"[{gameObjectIndex}] null"); } } diff --git a/Penumbra/Api/IpcTester/TemporaryIpcTester.cs b/Penumbra/Api/IpcTester/TemporaryIpcTester.cs index 14c0aa14..1e665d06 100644 --- a/Penumbra/Api/IpcTester/TemporaryIpcTester.cs +++ b/Penumbra/Api/IpcTester/TemporaryIpcTester.cs @@ -1,9 +1,6 @@ -using Dalamud.Interface; using Dalamud.Plugin; -using Dalamud.Bindings.ImGui; -using OtterGui; -using OtterGui.Raii; -using OtterGui.Text; +using ImSharp; +using Luna; using Penumbra.Api.Api; using Penumbra.Api.Enums; using Penumbra.Api.IpcSubscribers; @@ -22,87 +19,79 @@ public class TemporaryIpcTester( TempCollectionManager tempCollections, SaveService saveService, Configuration config) - : Luna.IUiService + : IUiService { public Guid LastCreatedCollectionId = Guid.Empty; private readonly bool _debug = Assembly.GetAssembly(typeof(TemporaryIpcTester))?.GetName().Version?.Major >= 9; private Guid? _tempGuid; - private string _tempCollectionName = string.Empty; - private string _tempCollectionGuidName = string.Empty; - private string _tempModName = string.Empty; - private string _modDirectory = string.Empty; - private string _tempGamePath = "test/game/path.mtrl"; - private string _tempFilePath = "test/success.mtrl"; - private string _tempManipulation = string.Empty; - private string _identity = string.Empty; + private string _tempCollectionName = string.Empty; + private string _tempModName = string.Empty; + private string _modDirectory = string.Empty; + private string _tempGamePath = "test/game/path.mtrl"; + private string _tempFilePath = "test/success.mtrl"; + private string _tempManipulation = string.Empty; + private string _identity = string.Empty; private PenumbraApiEc _lastTempError; private int _tempActorIndex; private bool _forceOverwrite; public void Draw() { - using var _ = ImRaii.TreeNode("Temporary"); + using var _ = Im.Tree.Node("Temporary"u8); if (!_) return; - ImGui.InputTextWithHint("##identity", "Identity...", ref _identity, 128); - ImGui.InputTextWithHint("##tempCollection", "Collection Name...", ref _tempCollectionName, 128); - ImGuiUtil.GuidInput("##guid", "Collection GUID...", string.Empty, ref _tempGuid, ref _tempCollectionGuidName); - ImGui.InputInt("##tempActorIndex", ref _tempActorIndex, 0, 0); - ImGui.InputTextWithHint("##tempMod", "Temporary Mod Name...", ref _tempModName, 32); - ImGui.InputTextWithHint("##mod", "Existing Mod Name...", ref _modDirectory, 256); - ImGui.InputTextWithHint("##tempGame", "Game Path...", ref _tempGamePath, 256); - ImGui.InputTextWithHint("##tempFile", "File Path...", ref _tempFilePath, 256); - ImUtf8.InputText("##tempManip"u8, ref _tempManipulation, "Manipulation Base64 String..."u8); - ImGui.Checkbox("Force Character Collection Overwrite", ref _forceOverwrite); + Im.Input.Text("##identity"u8, ref _identity, "Identity..."u8); + Im.Input.Text("##tempCollection"u8, ref _tempCollectionName, "Collection Name..."u8); + ImEx.GuidInput("##guid"u8, ref _tempGuid, "Collection GUID..."u8); + Im.Input.Scalar("##tempActorIndex"u8, ref _tempActorIndex); + Im.Input.Text("##tempMod"u8, ref _tempModName, "Temporary Mod Name..."u8); + Im.Input.Text("##mod"u8, ref _modDirectory, "Existing Mod Name..."u8); + Im.Input.Text("##tempGame"u8, ref _tempGamePath, "Game Path..."u8); + Im.Input.Text("##tempFile"u8, ref _tempFilePath, "File Path..."u8); + Im.Input.Text("##tempManip"u8, ref _tempManipulation, "Manipulation Base64 String..."u8); + Im.Checkbox("Force Character Collection Overwrite"u8, ref _forceOverwrite); - using var table = ImRaii.Table(string.Empty, 3, ImGuiTableFlags.SizingFixedFit); + using var table = Im.Table.Begin(StringU8.Empty, 3, TableFlags.SizingFixedFit); if (!table) return; - IpcTester.DrawIntro("Last Error", _lastTempError.ToString()); - ImGuiUtil.DrawTableColumn("Last Created Collection"); - ImGui.TableNextColumn(); - using (ImRaii.PushFont(UiBuilder.MonoFont)) - { - ImGuiUtil.CopyOnClickSelectable(LastCreatedCollectionId.ToString()); - } + IpcTester.DrawIntro("Last Error", $"{_lastTempError}"); + table.DrawColumn("Last Created Collection"u8); + table.NextColumn(); + LunaStyle.DrawGuid(LastCreatedCollectionId); - IpcTester.DrawIntro(CreateTemporaryCollection.Label, "Create Temporary Collection"); - if (ImGui.Button("Create##Collection")) + IpcTester.DrawIntro(CreateTemporaryCollection.Label, "Create Temporary Collection"u8); + if (Im.Button("Create##Collection"u8)) { _lastTempError = new CreateTemporaryCollection(pi).Invoke(_identity, _tempCollectionName, out LastCreatedCollectionId); - if (_tempGuid == null) - { - _tempGuid = LastCreatedCollectionId; - _tempCollectionGuidName = LastCreatedCollectionId.ToString(); - } + if (_tempGuid is null) + _tempGuid = LastCreatedCollectionId; } var guid = _tempGuid.GetValueOrDefault(Guid.Empty); - IpcTester.DrawIntro(DeleteTemporaryCollection.Label, "Delete Temporary Collection"); - if (ImGui.Button("Delete##Collection")) + IpcTester.DrawIntro(DeleteTemporaryCollection.Label, "Delete Temporary Collection"u8); + if (Im.Button("Delete##Collection"u8)) _lastTempError = new DeleteTemporaryCollection(pi).Invoke(guid); - ImGui.SameLine(); - if (ImGui.Button("Delete Last##Collection")) + Im.Line.Same(); + if (Im.Button("Delete Last##Collection"u8)) _lastTempError = new DeleteTemporaryCollection(pi).Invoke(LastCreatedCollectionId); - IpcTester.DrawIntro(AssignTemporaryCollection.Label, "Assign Temporary Collection"); - if (ImGui.Button("Assign##NamedCollection")) + IpcTester.DrawIntro(AssignTemporaryCollection.Label, "Assign Temporary Collection"u8); + if (Im.Button("Assign##NamedCollection"u8)) _lastTempError = new AssignTemporaryCollection(pi).Invoke(guid, _tempActorIndex, _forceOverwrite); - IpcTester.DrawIntro(AddTemporaryMod.Label, "Add Temporary Mod to specific Collection"); - if (ImGui.Button("Add##Mod")) + IpcTester.DrawIntro(AddTemporaryMod.Label, "Add Temporary Mod to specific Collection"u8); + if (Im.Button("Add##Mod"u8)) _lastTempError = new AddTemporaryMod(pi).Invoke(_tempModName, guid, new Dictionary { { _tempGamePath, _tempFilePath } }, _tempManipulation.Length > 0 ? _tempManipulation : string.Empty, int.MaxValue); - IpcTester.DrawIntro(CreateTemporaryCollection.Label, "Copy Existing Collection"); - if (ImGuiUtil.DrawDisabledButton("Copy##Collection", Vector2.Zero, - "Copies the effective list from the collection named in Temporary Mod Name...", + IpcTester.DrawIntro(CreateTemporaryCollection.Label, "Copy Existing Collection"u8); + if (ImEx.Button("Copy##Collection"u8, Vector2.Zero, "Copies the effective list from the collection named in Temporary Mod Name..."u8, !collections.Storage.ByName(_tempModName, out var copyCollection)) && copyCollection is { HasCache: true }) { @@ -111,207 +100,199 @@ public class TemporaryIpcTester( _lastTempError = new AddTemporaryMod(pi).Invoke(_tempModName, guid, files, manips, 999); } - IpcTester.DrawIntro(AddTemporaryModAll.Label, "Add Temporary Mod to all Collections"); - if (ImGui.Button("Add##All")) + IpcTester.DrawIntro(AddTemporaryModAll.Label, "Add Temporary Mod to all Collections"u8); + if (Im.Button("Add##All"u8)) _lastTempError = new AddTemporaryModAll(pi).Invoke(_tempModName, new Dictionary { { _tempGamePath, _tempFilePath } }, _tempManipulation.Length > 0 ? _tempManipulation : string.Empty, int.MaxValue); - IpcTester.DrawIntro(RemoveTemporaryMod.Label, "Remove Temporary Mod from specific Collection"); - if (ImGui.Button("Remove##Mod")) + IpcTester.DrawIntro(RemoveTemporaryMod.Label, "Remove Temporary Mod from specific Collection"u8); + if (Im.Button("Remove##Mod"u8)) _lastTempError = new RemoveTemporaryMod(pi).Invoke(_tempModName, guid, int.MaxValue); - IpcTester.DrawIntro(RemoveTemporaryModAll.Label, "Remove Temporary Mod from all Collections"); - if (ImGui.Button("Remove##ModAll")) + IpcTester.DrawIntro(RemoveTemporaryModAll.Label, "Remove Temporary Mod from all Collections"u8); + if (Im.Button("Remove##ModAll"u8)) _lastTempError = new RemoveTemporaryModAll(pi).Invoke(_tempModName, int.MaxValue); - IpcTester.DrawIntro(SetTemporaryModSettings.Label, "Set Temporary Mod Settings (to default) in specific Collection"); - if (ImUtf8.Button("Set##SetTemporary"u8)) + IpcTester.DrawIntro(SetTemporaryModSettings.Label, "Set Temporary Mod Settings (to default) in specific Collection"u8); + if (Im.Button("Set##SetTemporary"u8)) _lastTempError = new SetTemporaryModSettings(pi).Invoke(guid, _modDirectory, false, true, 1337, new Dictionary>(), "IPC Tester", 1337); - IpcTester.DrawIntro(SetTemporaryModSettingsPlayer.Label, "Set Temporary Mod Settings (to default) in game object collection"); - if (ImUtf8.Button("Set##SetTemporaryPlayer"u8)) + IpcTester.DrawIntro(SetTemporaryModSettingsPlayer.Label, "Set Temporary Mod Settings (to default) in game object collection"u8); + if (Im.Button("Set##SetTemporaryPlayer"u8)) _lastTempError = new SetTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, _modDirectory, false, true, 1337, new Dictionary>(), "IPC Tester", 1337); - IpcTester.DrawIntro(RemoveTemporaryModSettings.Label, "Remove Temporary Mod Settings from specific Collection"); - if (ImUtf8.Button("Remove##RemoveTemporary"u8)) + IpcTester.DrawIntro(RemoveTemporaryModSettings.Label, "Remove Temporary Mod Settings from specific Collection"u8); + if (Im.Button("Remove##RemoveTemporary"u8)) _lastTempError = new RemoveTemporaryModSettings(pi).Invoke(guid, _modDirectory, 1337); - ImGui.SameLine(); - if (ImUtf8.Button("Remove (Wrong Key)##RemoveTemporary"u8)) + Im.Line.Same(); + if (Im.Button("Remove (Wrong Key)##RemoveTemporary"u8)) _lastTempError = new RemoveTemporaryModSettings(pi).Invoke(guid, _modDirectory, 1338); - IpcTester.DrawIntro(RemoveTemporaryModSettingsPlayer.Label, "Remove Temporary Mod Settings from game object Collection"); - if (ImUtf8.Button("Remove##RemoveTemporaryPlayer"u8)) + IpcTester.DrawIntro(RemoveTemporaryModSettingsPlayer.Label, "Remove Temporary Mod Settings from game object Collection"u8); + if (Im.Button("Remove##RemoveTemporaryPlayer"u8)) _lastTempError = new RemoveTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, _modDirectory, 1337); - ImGui.SameLine(); - if (ImUtf8.Button("Remove (Wrong Key)##RemoveTemporaryPlayer"u8)) + Im.Line.Same(); + if (Im.Button("Remove (Wrong Key)##RemoveTemporaryPlayer"u8)) _lastTempError = new RemoveTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, _modDirectory, 1338); - IpcTester.DrawIntro(RemoveAllTemporaryModSettings.Label, "Remove All Temporary Mod Settings from specific Collection"); - if (ImUtf8.Button("Remove##RemoveAllTemporary"u8)) + IpcTester.DrawIntro(RemoveAllTemporaryModSettings.Label, "Remove All Temporary Mod Settings from specific Collection"u8); + if (Im.Button("Remove##RemoveAllTemporary"u8)) _lastTempError = new RemoveAllTemporaryModSettings(pi).Invoke(guid, 1337); - ImGui.SameLine(); - if (ImUtf8.Button("Remove (Wrong Key)##RemoveAllTemporary"u8)) + Im.Line.Same(); + if (Im.Button("Remove (Wrong Key)##RemoveAllTemporary"u8)) _lastTempError = new RemoveAllTemporaryModSettings(pi).Invoke(guid, 1338); - IpcTester.DrawIntro(RemoveAllTemporaryModSettingsPlayer.Label, "Remove All Temporary Mod Settings from game object Collection"); - if (ImUtf8.Button("Remove##RemoveAllTemporaryPlayer"u8)) + IpcTester.DrawIntro(RemoveAllTemporaryModSettingsPlayer.Label, "Remove All Temporary Mod Settings from game object Collection"u8); + if (Im.Button("Remove##RemoveAllTemporaryPlayer"u8)) _lastTempError = new RemoveAllTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, 1337); - ImGui.SameLine(); - if (ImUtf8.Button("Remove (Wrong Key)##RemoveAllTemporaryPlayer"u8)) + Im.Line.Same(); + if (Im.Button("Remove (Wrong Key)##RemoveAllTemporaryPlayer"u8)) _lastTempError = new RemoveAllTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, 1338); - IpcTester.DrawIntro(QueryTemporaryModSettings.Label, "Query Temporary Mod Settings from specific Collection"); - ImUtf8.Button("Query##QueryTemporaryModSettings"u8); - if (ImGui.IsItemHovered()) + IpcTester.DrawIntro(QueryTemporaryModSettings.Label, "Query Temporary Mod Settings from specific Collection"u8); + Im.Button("Query##QueryTemporaryModSettings"u8); + if (Im.Item.Hovered()) { _lastTempError = new QueryTemporaryModSettings(pi).Invoke(guid, _modDirectory, out var settings, out var source, 1337); DrawTooltip(settings, source); } - ImGui.SameLine(); - ImUtf8.Button("Query (Wrong Key)##RemoveAllTemporary"u8); - if (ImGui.IsItemHovered()) + Im.Line.Same(); + Im.Button("Query (Wrong Key)##RemoveAllTemporary"u8); + if (Im.Item.Hovered()) { _lastTempError = new QueryTemporaryModSettings(pi).Invoke(guid, _modDirectory, out var settings, out var source, 1338); DrawTooltip(settings, source); } - IpcTester.DrawIntro(QueryTemporaryModSettingsPlayer.Label, "Query Temporary Mod Settings from game object Collection"); - ImUtf8.Button("Query##QueryTemporaryModSettingsPlayer"u8); - if (ImGui.IsItemHovered()) + IpcTester.DrawIntro(QueryTemporaryModSettingsPlayer.Label, "Query Temporary Mod Settings from game object Collection"u8); + Im.Button("Query##QueryTemporaryModSettingsPlayer"u8); + if (Im.Item.Hovered()) { _lastTempError = new QueryTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, _modDirectory, out var settings, out var source, 1337); DrawTooltip(settings, source); } - ImGui.SameLine(); - ImUtf8.Button("Query (Wrong Key)##RemoveAllTemporaryPlayer"u8); - if (ImGui.IsItemHovered()) + Im.Line.Same(); + Im.Button("Query (Wrong Key)##RemoveAllTemporaryPlayer"u8); + if (Im.Item.Hovered()) { _lastTempError = new QueryTemporaryModSettingsPlayer(pi).Invoke(_tempActorIndex, _modDirectory, out var settings, out var source, 1338); DrawTooltip(settings, source); } + return; + void DrawTooltip((bool ForceInherit, bool Enabled, int Priority, Dictionary> Settings)? settings, string source) { - using var tt = ImUtf8.Tooltip(); - ImUtf8.Text($"Query returned {_lastTempError}"); + using var tt = Im.Tooltip.Begin(); + Im.Text($"Query returned {_lastTempError}"); if (settings != null) - ImUtf8.Text($"Settings created by {(source.Length == 0 ? "Unknown Source" : source)}:"); + Im.Text($"Settings created by {(source.Length == 0 ? "Unknown Source" : source)}:"); else - ImUtf8.Text(source.Length > 0 ? $"Locked by {source}." : "No settings exist."); - ImGui.Separator(); + Im.Text(source.Length > 0 ? $"Locked by {source}." : "No settings exist."); + Im.Separator(); if (settings == null) - { - return; - } - using (ImUtf8.Group()) + using (Im.Group()) { - ImUtf8.Text("Force Inherit"u8); - ImUtf8.Text("Enabled"u8); - ImUtf8.Text("Priority"u8); + Im.Text("Force Inherit"u8); + Im.Text("Enabled"u8); + Im.Text("Priority"u8); foreach (var group in settings.Value.Settings.Keys) - ImUtf8.Text(group); + Im.Text(group); } - ImGui.SameLine(); - using (ImUtf8.Group()) + Im.Line.Same(); + using (Im.Group()) { - ImUtf8.Text($"{settings.Value.ForceInherit}"); - ImUtf8.Text($"{settings.Value.Enabled}"); - ImUtf8.Text($"{settings.Value.Priority}"); + Im.Text($"{settings.Value.ForceInherit}"); + Im.Text($"{settings.Value.Enabled}"); + Im.Text($"{settings.Value.Priority}"); foreach (var group in settings.Value.Settings.Values) - ImUtf8.Text(string.Join("; ", group)); + Im.Text(string.Join("; ", group)); } } } public void DrawCollections() { - using var collTree = ImUtf8.TreeNode("Temporary Collections##TempCollections"u8); + using var collTree = Im.Tree.Node("Temporary Collections##TempCollections"u8); if (!collTree) return; - using var table = ImUtf8.Table("##collTree"u8, 6, ImGuiTableFlags.SizingFixedFit); + using var table = Im.Table.Begin("##collTree"u8, 6, TableFlags.SizingFixedFit); if (!table) return; foreach (var (idx, collection) in tempCollections.Values.Index()) { - using var id = ImRaii.PushId(idx); - ImGui.TableNextColumn(); + using var id = Im.Id.Push(idx); + table.NextColumn(); var character = tempCollections.Collections.Where(p => p.Collection == collection).Select(p => p.DisplayName) .FirstOrDefault() ?? "Unknown"; - if (_debug && ImUtf8.Button("Save##Collection"u8)) + if (_debug && Im.Button("Save##Collection"u8)) TemporaryMod.SaveTempCollection(config, saveService, modManager, collection, character); - using (ImRaii.PushFont(UiBuilder.MonoFont)) - { - ImGui.TableNextColumn(); - ImGuiUtil.CopyOnClickSelectable(collection.Identity.Identifier); - } - - ImGuiUtil.DrawTableColumn(collection.Identity.Name); - ImGuiUtil.DrawTableColumn(collection.ResolvedFiles.Count.ToString()); - ImGuiUtil.DrawTableColumn(collection.MetaCache?.Count.ToString() ?? "0"); - ImGuiUtil.DrawTableColumn(string.Join(", ", + table.NextColumn(); + LunaStyle.DrawGuid(collection.Identity.Id); + table.DrawColumn(collection.Identity.Name); + table.DrawColumn($"{collection.ResolvedFiles.Count}"); + table.DrawColumn($"{collection.MetaCache?.Count ?? 0}"); + table.DrawColumn(string.Join(", ", tempCollections.Collections.Where(p => p.Collection == collection).Select(c => c.DisplayName))); } } public void DrawMods() { - using var modTree = ImRaii.TreeNode("Temporary Mods##TempMods"); + using var modTree = Im.Tree.Node("Temporary Mods##TempMods"u8); if (!modTree) return; - using var table = ImRaii.Table("##modTree", 5, ImGuiTableFlags.SizingFixedFit); + using var table = Im.Table.Begin("##modTree"u8, 5, TableFlags.SizingFixedFit); + if (!table) + return; - void PrintList(string collectionName, IReadOnlyList list) + PrintList(table, "All"u8, tempMods.ModsForAllCollections); + foreach (var (collection, list) in tempMods.Mods) + PrintList(table, collection.Identity.Name, list); + + return; + + static void PrintList(in Im.TableDisposable table, Utf8StringHandler collectionName, + IReadOnlyList list) { foreach (var mod in list) { - ImGui.TableNextColumn(); - ImGui.TextUnformatted(mod.Name); - ImGui.TableNextColumn(); - ImGui.TextUnformatted(mod.Priority.ToString()); - ImGui.TableNextColumn(); - ImGui.TextUnformatted(collectionName); - ImGui.TableNextColumn(); - ImGui.TextUnformatted(mod.Default.Files.Count.ToString()); - if (ImGui.IsItemHovered()) + table.DrawColumn(mod.Name); + table.DrawColumn($"{mod.Priority}"); + table.DrawColumn(ref collectionName); + table.DrawColumn($"{mod.Default.Files.Count}"); + if (Im.Item.Hovered()) { - using var tt = ImRaii.Tooltip(); + using var tt = Im.Tooltip.Begin(); foreach (var (path, file) in mod.Default.Files) - ImGui.TextUnformatted($"{path} -> {file}"); + Im.Text($"{path} -> {file}"); } - ImGui.TableNextColumn(); - ImGui.TextUnformatted(mod.TotalManipulations.ToString()); - if (ImGui.IsItemHovered()) + table.DrawColumn($"{mod.TotalManipulations}"); + if (Im.Item.Hovered()) { - using var tt = ImRaii.Tooltip(); + using var tt = Im.Tooltip.Begin(); foreach (var identifier in mod.Default.Manipulations.Identifiers) - ImGui.TextUnformatted(identifier.ToString()); + Im.Text($"{identifier}"); } } } - - if (table) - { - PrintList("All", tempMods.ModsForAllCollections); - foreach (var (collection, list) in tempMods.Mods) - PrintList(collection.Identity.Name, list); - } } } diff --git a/Penumbra/Api/IpcTester/UiIpcTester.cs b/Penumbra/Api/IpcTester/UiIpcTester.cs index 214edf27..c69eaa4e 100644 --- a/Penumbra/Api/IpcTester/UiIpcTester.cs +++ b/Penumbra/Api/IpcTester/UiIpcTester.cs @@ -1,15 +1,15 @@ using Dalamud.Plugin; -using Dalamud.Bindings.ImGui; -using OtterGui.Raii; +using ImSharp; using Penumbra.Api.Enums; using Penumbra.Api.Helpers; using Penumbra.Api.IpcSubscribers; +using MouseButton = Penumbra.Api.Enums.MouseButton; namespace Penumbra.Api.IpcTester; public class UiIpcTester : Luna.IUiService, IDisposable { - private readonly IDalamudPluginInterface _pi; + private readonly IDalamudPluginInterface _pi; public readonly EventSubscriber PreSettingsTabBar; public readonly EventSubscriber PreSettingsPanel; public readonly EventSubscriber PostEnabled; @@ -17,12 +17,12 @@ public class UiIpcTester : Luna.IUiService, IDisposable public readonly EventSubscriber ChangedItemTooltip; public readonly EventSubscriber ChangedItemClicked; - private string _lastDrawnMod = string.Empty; + private StringU8 _lastDrawnMod = StringU8.Empty; private DateTimeOffset _lastDrawnModTime = DateTimeOffset.MinValue; private bool _subscribedToTooltip; private bool _subscribedToClick; - private string _lastClicked = string.Empty; - private string _lastHovered = string.Empty; + private StringU8 _lastClicked = StringU8.Empty; + private StringU8 _lastHovered = StringU8.Empty; private TabType _selectTab = TabType.None; private string _modName = string.Empty; private PenumbraApiEc _ec = PenumbraApiEc.Success; @@ -30,10 +30,10 @@ public class UiIpcTester : Luna.IUiService, IDisposable public UiIpcTester(IDalamudPluginInterface pi) { _pi = pi; - PreSettingsTabBar = IpcSubscribers.PreSettingsTabBarDraw.Subscriber(pi, UpdateLastDrawnMod); - PreSettingsPanel = IpcSubscribers.PreSettingsDraw.Subscriber(pi, UpdateLastDrawnMod); - PostEnabled = IpcSubscribers.PostEnabledDraw.Subscriber(pi, UpdateLastDrawnMod); - PostSettingsPanelDraw = IpcSubscribers.PostSettingsDraw.Subscriber(pi, UpdateLastDrawnMod); + PreSettingsTabBar = PreSettingsTabBarDraw.Subscriber(pi, UpdateLastDrawnMod); + PreSettingsPanel = PreSettingsDraw.Subscriber(pi, UpdateLastDrawnMod); + PostEnabled = PostEnabledDraw.Subscriber(pi, UpdateLastDrawnMod); + PostSettingsPanelDraw = PostSettingsDraw.Subscriber(pi, UpdateLastDrawnMod); ChangedItemTooltip = IpcSubscribers.ChangedItemTooltip.Subscriber(pi, AddedTooltip); ChangedItemClicked = IpcSubscribers.ChangedItemClicked.Subscriber(pi, AddedClick); PreSettingsTabBar.Disable(); @@ -56,30 +56,21 @@ public class UiIpcTester : Luna.IUiService, IDisposable public void Draw() { - using var _ = ImRaii.TreeNode("UI"); + using var _ = Im.Tree.Node("UI"u8); if (!_) return; - using (var combo = ImRaii.Combo("Tab to Open at", _selectTab.ToString())) - { - if (combo) - foreach (var val in Enum.GetValues()) - { - if (ImGui.Selectable(val.ToString(), _selectTab == val)) - _selectTab = val; - } - } - - ImGui.InputTextWithHint("##openMod", "Mod to Open at...", ref _modName, 256); - using var table = ImRaii.Table(string.Empty, 3, ImGuiTableFlags.SizingFixedFit); + EnumCombo.Instance.Draw("Tab to Open at"u8, ref _selectTab, default, 0); + Im.Input.Text("##openMod"u8, ref _modName, "Mod to Open at..."u8); + using var table = Im.Table.Begin(StringU8.Empty, 3, TableFlags.SizingFixedFit); if (!table) return; - IpcTester.DrawIntro(IpcSubscribers.PostSettingsDraw.Label, "Last Drawn Mod"); - ImGui.TextUnformatted(_lastDrawnMod.Length > 0 ? $"{_lastDrawnMod} at {_lastDrawnModTime}" : "None"); + IpcTester.DrawIntro(PostSettingsDraw.Label, "Last Drawn Mod"u8); + Im.Text(_lastDrawnMod.Length > 0 ? $"{_lastDrawnMod} at {_lastDrawnModTime}" : "None"u8); - IpcTester.DrawIntro(IpcSubscribers.ChangedItemTooltip.Label, "Add Tooltip"); - if (ImGui.Checkbox("##tooltip", ref _subscribedToTooltip)) + IpcTester.DrawIntro(IpcSubscribers.ChangedItemTooltip.Label, "Add Tooltip"u8); + if (Im.Checkbox("##tooltip"u8, ref _subscribedToTooltip)) { if (_subscribedToTooltip) ChangedItemTooltip.Enable(); @@ -87,11 +78,11 @@ public class UiIpcTester : Luna.IUiService, IDisposable ChangedItemTooltip.Disable(); } - ImGui.SameLine(); - ImGui.TextUnformatted(_lastHovered); + Im.Line.Same(); + Im.Text(_lastHovered); - IpcTester.DrawIntro(IpcSubscribers.ChangedItemClicked.Label, "Subscribe Click"); - if (ImGui.Checkbox("##click", ref _subscribedToClick)) + IpcTester.DrawIntro(IpcSubscribers.ChangedItemClicked.Label, "Subscribe Click"u8); + if (Im.Checkbox("##click"u8, ref _subscribedToClick)) { if (_subscribedToClick) ChangedItemClicked.Enable(); @@ -99,34 +90,33 @@ public class UiIpcTester : Luna.IUiService, IDisposable ChangedItemClicked.Disable(); } - ImGui.SameLine(); - ImGui.TextUnformatted(_lastClicked); - IpcTester.DrawIntro(OpenMainWindow.Label, "Open Mod Window"); - if (ImGui.Button("Open##window")) + Im.Line.Same(); + Im.Text(_lastClicked); + IpcTester.DrawIntro(OpenMainWindow.Label, "Open Mod Window"u8); + if (Im.Button("Open##window"u8)) _ec = new OpenMainWindow(_pi).Invoke(_selectTab, _modName, _modName); - ImGui.SameLine(); - ImGui.TextUnformatted(_ec.ToString()); + Im.Line.Same(); + Im.Text($"{_ec}"); - IpcTester.DrawIntro(CloseMainWindow.Label, "Close Mod Window"); - if (ImGui.Button("Close##window")) + IpcTester.DrawIntro(CloseMainWindow.Label, "Close Mod Window"u8); + if (Im.Button("Close##window"u8)) new CloseMainWindow(_pi).Invoke(); } private void UpdateLastDrawnMod(string name) - => (_lastDrawnMod, _lastDrawnModTime) = (name, DateTimeOffset.Now); + => (_lastDrawnMod, _lastDrawnModTime) = (new StringU8(name), DateTimeOffset.Now); private void UpdateLastDrawnMod(string name, float _1, float _2) - => (_lastDrawnMod, _lastDrawnModTime) = (name, DateTimeOffset.Now); + => (_lastDrawnMod, _lastDrawnModTime) = (new StringU8(name), DateTimeOffset.Now); private void AddedTooltip(ChangedItemType type, uint id) { - _lastHovered = $"{type} {id} at {DateTime.UtcNow.ToLocalTime().ToString(CultureInfo.CurrentCulture)}"; - ImGui.TextUnformatted("IPC Test Successful"); + _lastHovered = new StringU8($"{type} {id} at {DateTime.UtcNow.ToLocalTime().ToString(CultureInfo.CurrentCulture)}"); + Im.Text("IPC Test Successful"u8); } private void AddedClick(MouseButton button, ChangedItemType type, uint id) - { - _lastClicked = $"{button}-click on {type} {id} at {DateTime.UtcNow.ToLocalTime().ToString(CultureInfo.CurrentCulture)}"; - } + => _lastClicked = + new StringU8($"{button}-click on {type} {id} at {DateTime.UtcNow.ToLocalTime().ToString(CultureInfo.CurrentCulture)}"); } diff --git a/Penumbra/ChangedItemMode.cs b/Penumbra/ChangedItemMode.cs index ddb79ee0..4a1d2b98 100644 --- a/Penumbra/ChangedItemMode.cs +++ b/Penumbra/ChangedItemMode.cs @@ -2,7 +2,7 @@ using Dalamud.Bindings.ImGui; using OtterGui.Text; namespace Penumbra; - + public enum ChangedItemMode { GroupedCollapsed, diff --git a/Penumbra/Import/Textures/CombinedTexture.Manipulation.cs b/Penumbra/Import/Textures/CombinedTexture.Manipulation.cs index 7a7e5888..21003104 100644 --- a/Penumbra/Import/Textures/CombinedTexture.Manipulation.cs +++ b/Penumbra/Import/Textures/CombinedTexture.Manipulation.cs @@ -1,9 +1,10 @@ using Dalamud.Bindings.ImGui; using OtterGui.Raii; using OtterGui; -using SixLabors.ImageSharp.PixelFormats; using Dalamud.Interface.Utility; +using ImSharp; using Penumbra.UI; +using Rgba32 = SixLabors.ImageSharp.PixelFormats.Rgba32; namespace Penumbra.Import.Textures; @@ -237,7 +238,7 @@ public partial class CombinedTexture ImGui.SetNextItemWidth(75.0f * UiHelpers.Scale); ImGui.DragInt("##XOffset", ref _offsetX, 0.5f); ret |= ImGui.IsItemDeactivatedAfterEdit(); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(75.0f * UiHelpers.Scale); ImGui.DragInt("Offsets##YOffset", ref _offsetY, 0.5f); ret |= ImGui.IsItemDeactivatedAfterEdit(); @@ -273,7 +274,7 @@ public partial class CombinedTexture ImGui.TextUnformatted("Copy"); foreach (var channel in Enum.GetValues()) { - ImGui.SameLine(); + Im.Line.Same(); var copy = (_copyChannels & channel) != 0; if (ImGui.Checkbox(channel.ToString(), ref copy)) { @@ -352,28 +353,28 @@ public partial class CombinedTexture private static bool DrawMatrixTools(ref Matrix4x4 multiplier, ref Vector4 constant) { var changes = PresetCombo(ref multiplier, ref constant); - ImGui.SameLine(); + Im.Line.Same(); ImGui.Dummy(ImGuiHelpers.ScaledVector2(20, 0)); - ImGui.SameLine(); + Im.Line.Same(); ImGui.TextUnformatted("Invert"); - ImGui.SameLine(); + Im.Line.Same(); Channels channels = 0; if (ImGui.Button("Colors")) channels |= Channels.Red | Channels.Green | Channels.Blue; - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("R")) channels |= Channels.Red; - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("G")) channels |= Channels.Green; - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("B")) channels |= Channels.Blue; - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("A")) channels |= Channels.Alpha; diff --git a/Penumbra/Import/Textures/CombinedTexture.cs b/Penumbra/Import/Textures/CombinedTexture.cs index f5f921be..b8684489 100644 --- a/Penumbra/Import/Textures/CombinedTexture.cs +++ b/Penumbra/Import/Textures/CombinedTexture.cs @@ -97,7 +97,7 @@ public partial class CombinedTexture : IDisposable break; case TextureType.Png: SaveAsPng(textures, path); - break; + break; case TextureType.Targa: SaveAsTarga(textures, path); break; diff --git a/Penumbra/Import/Textures/TextureDrawer.cs b/Penumbra/Import/Textures/TextureDrawer.cs index 14203dff..5520f391 100644 --- a/Penumbra/Import/Textures/TextureDrawer.cs +++ b/Penumbra/Import/Textures/TextureDrawer.cs @@ -1,5 +1,6 @@ using Dalamud.Bindings.ImGui; using Dalamud.Interface; +using ImSharp; using Lumina.Data.Files; using OtterGui; using OtterGui.Raii; @@ -9,6 +10,7 @@ using Penumbra.Mods.Editor; using Penumbra.String.Classes; using Penumbra.UI; using Penumbra.UI.Classes; +using MouseWheelType = OtterGui.Widgets.MouseWheelType; namespace Penumbra.Import.Textures; @@ -53,7 +55,7 @@ public static class TextureDrawer current.Load(textures, tmpPath); ImGuiUtil.HoverTooltip(tooltip); - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Folder.ToIconString(), new Vector2(ImGui.GetFrameHeight()), string.Empty, false, true)) { @@ -69,7 +71,7 @@ public static class TextureDrawer fileDialog.OpenFilePicker("Open Image...", "Textures{.png,.dds,.tex,.tga}", UpdatePath, 1, startPath, false); } - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Recycle.ToIconString(), new Vector2(ImGui.GetFrameHeight()), "Reload the currently selected path.", false, true)) diff --git a/Penumbra/Mods/FeatureChecker.cs b/Penumbra/Mods/FeatureChecker.cs index 5534d4e6..73d38e54 100644 --- a/Penumbra/Mods/FeatureChecker.cs +++ b/Penumbra/Mods/FeatureChecker.cs @@ -2,6 +2,7 @@ using System.Collections.Frozen; using Dalamud.Bindings.ImGui; using Dalamud.Interface.ImGuiNotification; using Dalamud.Interface.Utility.Raii; +using ImSharp; using OtterGui.Text; using Penumbra.Mods.Manager; using Penumbra.UI.Classes; @@ -78,18 +79,18 @@ public static class FeatureChecker editor.ChangeRequiredFeatures(mod, mod.RequiredFeatures | flag); } - ImGui.SameLine(); + Im.Line.Same(); } } if (ImUtf8.ButtonEx("Compute"u8, "Compute the required features automatically from the used features."u8, size)) editor.ChangeRequiredFeatures(mod, mod.ComputeRequiredFeatures()); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Clear"u8, "Clear all required features."u8, size)) editor.ChangeRequiredFeatures(mod, FeatureFlags.None); - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.Text("Required Features"u8); } } diff --git a/Penumbra/Services/StainService.cs b/Penumbra/Services/StainService.cs index 30605f50..f959ad4e 100644 --- a/Penumbra/Services/StainService.cs +++ b/Penumbra/Services/StainService.cs @@ -2,6 +2,7 @@ using Dalamud.Bindings.ImGui; using Dalamud.Interface; using Dalamud.Interface.Utility.Raii; using Dalamud.Plugin.Services; +using ImSharp; using OtterGui.Widgets; using Penumbra.GameData.DataContainers; using Penumbra.GameData.Files; @@ -9,6 +10,7 @@ using Penumbra.GameData.Files.StainMapStructs; using Penumbra.Interop.Services; using Penumbra.Interop.Structs; using Penumbra.UI.AdvancedWindow.Materials; +using MouseWheelType = OtterGui.Widgets.MouseWheelType; namespace Penumbra.Services; @@ -57,12 +59,12 @@ public class StainService : Luna.IService if (selection == 0 || !stmFile.TryGetValue(Items[globalIdx], selection, out var colors)) return ret; - ImGui.SameLine(); + Im.Line.Same(); var frame = new Vector2(ImGui.GetTextLineHeight()); ImGui.ColorButton("D", new Vector4(MtrlTab.PseudoSqrtRgb((Vector3)colors.DiffuseColor), 1), 0, frame); - ImGui.SameLine(); + Im.Line.Same(); ImGui.ColorButton("S", new Vector4(MtrlTab.PseudoSqrtRgb((Vector3)colors.SpecularColor), 1), 0, frame); - ImGui.SameLine(); + Im.Line.Same(); ImGui.ColorButton("E", new Vector4(MtrlTab.PseudoSqrtRgb((Vector3)colors.EmissiveColor), 1), 0, frame); return ret; } diff --git a/Penumbra/UI/AdvancedWindow/FileEditor.cs b/Penumbra/UI/AdvancedWindow/FileEditor.cs index cdbf27cf..62dbfb51 100644 --- a/Penumbra/UI/AdvancedWindow/FileEditor.cs +++ b/Penumbra/UI/AdvancedWindow/FileEditor.cs @@ -2,6 +2,7 @@ using Dalamud.Bindings.ImGui; using Dalamud.Interface; using Dalamud.Interface.ImGuiNotification; using Dalamud.Plugin.Services; +using ImSharp; using Luna; using OtterGui; using OtterGui.Classes; @@ -15,6 +16,7 @@ using Penumbra.Mods.Editor; using Penumbra.Services; using Penumbra.String.Classes; using Penumbra.UI.Classes; +using MouseWheelType = OtterGui.Widgets.MouseWheelType; namespace Penumbra.UI.AdvancedWindow; @@ -46,11 +48,11 @@ public class FileEditor( ImGui.NewLine(); DrawFileSelectCombo(); SaveButton(); - ImGui.SameLine(); + Im.Line.Same(); ResetButton(); - ImGui.SameLine(); + Im.Line.Same(); RedrawOnSaveBox(); - ImGui.SameLine(); + Im.Line.Same(); DefaultInput(); ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2)); @@ -127,7 +129,7 @@ public class FileEditor( } } - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Save.ToIconString(), new Vector2(ImGui.GetFrameHeight()), "Export this file.", _defaultFile == null, true)) fileDialog.OpenSavePicker($"Export {_defaultPath} to...", fileType, Path.GetFileNameWithoutExtension(_defaultPath), fileType, @@ -148,7 +150,7 @@ public class FileEditor( _quickImport ??= ModEditWindow.QuickImportAction.Prepare(owner, _isDefaultPathUtf8Valid ? _defaultPathUtf8 : Utf8GamePath.Empty, _defaultFile); - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.FileImport.ToIconString(), new Vector2(ImGui.GetFrameHeight()), $"Add a copy of this file to {_quickImport.OptionName}.", !_quickImport.CanExecute, true)) { @@ -318,7 +320,7 @@ public class FileEditor( if (file.SubModUsage.Count > 0) { - ImGui.SameLine(); + Im.Line.Same(); using var color = ImRaii.PushColor(ImGuiCol.Text, ColorId.ItemId.Value()); ImGuiUtil.RightAlign(file.SubModUsage[0].Item2.Path.ToString()); } diff --git a/Penumbra/UI/AdvancedWindow/ItemSwapTab.cs b/Penumbra/UI/AdvancedWindow/ItemSwapTab.cs index 0636c98a..57be786f 100644 --- a/Penumbra/UI/AdvancedWindow/ItemSwapTab.cs +++ b/Penumbra/UI/AdvancedWindow/ItemSwapTab.cs @@ -1,5 +1,6 @@ using Dalamud.Interface.ImGuiNotification; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui; using OtterGui.Raii; @@ -24,6 +25,7 @@ using Penumbra.Mods.SubMods; using Penumbra.Services; using Penumbra.UI.Classes; using Penumbra.UI.ModsTab; +using MouseWheelType = OtterGui.Widgets.MouseWheelType; namespace Penumbra.UI.AdvancedWindow; @@ -421,7 +423,7 @@ public class ItemSwapTab : IDisposable, ITab, IUiService if (ImGui.InputTextWithHint("##newModName", "New Mod Name...", ref _newModName, 64)) { } - ImGui.SameLine(); + Im.Line.Same(); var tt = !newModAvailable ? "No swap is currently loaded." : _newModName.Length == 0 @@ -430,7 +432,7 @@ public class ItemSwapTab : IDisposable, ITab, IUiService if (ImGuiUtil.DrawDisabledButton("Create New Mod", new Vector2(width / 2, 0), tt, !newModAvailable || _newModName.Length == 0)) CreateMod(); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetCursorPosX(ImGui.GetCursorPosX() + 20 * UiHelpers.Scale); ImGui.Checkbox("Use File Swaps", ref _useFileSwaps); ImGuiUtil.HoverTooltip("Instead of writing every single non-default file to the newly created mod or option,\n" @@ -440,12 +442,12 @@ public class ItemSwapTab : IDisposable, ITab, IUiService if (ImGui.InputTextWithHint("##groupName", "Group Name...", ref _newGroupName, 32)) UpdateOption(); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth((width - ImGui.GetStyle().ItemSpacing.X) / 2); if (ImGui.InputTextWithHint("##optionName", "New Option Name...", ref _newOptionName, 32)) UpdateOption(); - ImGui.SameLine(); + Im.Line.Same(); tt = !_subModValid ? "An option with that name already exists in that group, or no name is specified." : !newModAvailable @@ -454,7 +456,7 @@ public class ItemSwapTab : IDisposable, ITab, IUiService if (ImGuiUtil.DrawDisabledButton("Create New Option", new Vector2(width / 2, 0), tt, !newModAvailable || !_subModValid)) CreateOption(); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetCursorPosX(ImGui.GetCursorPosX() + 20 * UiHelpers.Scale); _dirty |= ImGui.Checkbox("Use Entire Collection", ref _useCurrentCollection); ImGuiUtil.HoverTooltip( @@ -561,7 +563,7 @@ public class ItemSwapTab : IDisposable, ITab, IUiService if (_affectedItems is not { Count: > 1 }) return; - ImGui.SameLine(); + Im.Line.Same(); ImGuiUtil.DrawTextButton($"which will also affect {_affectedItems.Count - 1} other Items.", Vector2.Zero, Colors.PressEnterWarningBg); if (ImGui.IsItemHovered()) @@ -603,7 +605,7 @@ public class ItemSwapTab : IDisposable, ITab, IUiService if (type == SwapType.Ring) { - ImGui.SameLine(); + Im.Line.Same(); _dirty |= ImGui.Checkbox("Swap Right Ring", ref _useRightRing); } @@ -615,14 +617,14 @@ public class ItemSwapTab : IDisposable, ITab, IUiService ImGui.GetTextLineHeightWithSpacing()); if (type == SwapType.Ring) { - ImGui.SameLine(); + Im.Line.Same(); _dirty |= ImGui.Checkbox("Swap Left Ring", ref _useLeftRing); } if (_affectedItems is not { Count: > 1 }) return; - ImGui.SameLine(); + Im.Line.Same(); ImGuiUtil.DrawTextButton($"which will also affect {_affectedItems.Count - 1} other Items.", Vector2.Zero, Colors.PressEnterWarningBg); if (ImGui.IsItemHovered()) @@ -707,12 +709,12 @@ public class ItemSwapTab : IDisposable, ITab, IUiService _dirty |= Combos.Gender("##Gender", _currentGender, out _currentGender); if (drawRace == 1) { - ImGui.SameLine(); + Im.Line.Same(); _dirty |= Combos.Race("##Race", _currentRace, out _currentRace, InputWidth); } else if (drawRace == 2) { - ImGui.SameLine(); + Im.Line.Same(); if (_currentRace is not ModelRace.Miqote and not ModelRace.AuRa and not ModelRace.Hrothgar) _currentRace = ModelRace.Miqote; diff --git a/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.ColorTable.cs b/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.ColorTable.cs index fad9adeb..e6940fff 100644 --- a/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.ColorTable.cs +++ b/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.ColorTable.cs @@ -1,5 +1,6 @@ using Dalamud.Interface; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Raii; using OtterGui.Text; @@ -70,7 +71,7 @@ public partial class MtrlTab ImGuiUtil.ColorConvertFloat3ToU32(PseudoSqrtRgb((Vector3)table[(pairIndex << 1) | 1].EmissiveColor)) ); if (j < 7) - ImGui.SameLine(); + Im.Line.Same(); var cursor = ImGui.GetCursorScreenPos(); ImGui.SetCursorScreenPos(rcMin with { Y = float.Lerp(rcMin.Y, rcMax.Y, 0.5f) - highlighterSize.Y * 0.5f }); @@ -244,7 +245,7 @@ public partial class MtrlTab ImUtf8.SameLineInner(); ColorTableRowHighlightButton(rowIdx, disabled); - ImGui.SameLine(); + Im.Line.Same(); CenteredTextInRest($"Row {(rowIdx >> 1) + 1}{"AB"[rowIdx & 1]}"); return ret; @@ -370,7 +371,7 @@ public partial class MtrlTab } ImGui.Dummy(new Vector2(64.0f, 0.0f)); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(scalarSize); ret |= CtDragScalar("Sphere Map Intensity"u8, default, (float)row.SphereMapMask * 100.0f, "%.0f%%"u8, HalfMinValue * 100.0f, HalfMaxValue * 100.0f, 1.0f, diff --git a/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.CommonColorTable.cs b/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.CommonColorTable.cs index 9ea9c2e0..b0e7cd63 100644 --- a/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.CommonColorTable.cs +++ b/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.CommonColorTable.cs @@ -1,6 +1,7 @@ using Dalamud.Bindings.ImGui; using Dalamud.Interface; using Dalamud.Interface.Utility; +using ImSharp; using Penumbra.GameData.Files.MaterialStructs; using Penumbra.GameData.Files; using OtterGui.Text; @@ -30,21 +31,21 @@ public partial class MtrlTab return false; ColorTableCopyAllClipboardButton(); - ImGui.SameLine(); + Im.Line.Same(); var ret = ColorTablePasteAllClipboardButton(disabled); if (!disabled) { - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.IconDummy(); - ImGui.SameLine(); + Im.Line.Same(); ret |= ColorTableDyeableCheckbox(); } if (Mtrl.DyeTable != null) { - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.IconDummy(); - ImGui.SameLine(); + Im.Line.Same(); ret |= DrawPreviewDye(disabled); } @@ -107,11 +108,11 @@ public partial class MtrlTab return ret; } - ImGui.SameLine(); + Im.Line.Same(); var label = dyeId1 == 0 ? "Preview Dye 1###previewDye1" : $"{name1} (Preview 1)###previewDye1"; if (_stainService.StainCombo1.Draw(label, dyeColor1, string.Empty, true, gloss1)) UpdateColorTablePreview(); - ImGui.SameLine(); + Im.Line.Same(); label = dyeId2 == 0 ? "Preview Dye 2###previewDye2" : $"{name2} (Preview 2)###previewDye2"; if (_stainService.StainCombo2.Draw(label, dyeColor2, string.Empty, true, gloss2)) UpdateColorTablePreview(); diff --git a/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.Constants.cs b/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.Constants.cs index 397c59b3..8b2e46bf 100644 --- a/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.Constants.cs +++ b/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.Constants.cs @@ -1,5 +1,6 @@ using Dalamud.Interface; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui; using OtterGui.Raii; @@ -198,7 +199,7 @@ public partial class MtrlTab SetMaterialParameter(constant.Id, slice.Start, buffer[slice]); } - ImGui.SameLine(); + Im.Line.Same(); using var font = ImRaii.PushFont(UiBuilder.MonoFont, monoFont); if (description.Length > 0) ImGuiUtil.LabeledHelpMarker(label, description); diff --git a/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.LegacyColorTable.cs b/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.LegacyColorTable.cs index e75cd633..c4ef8dd5 100644 --- a/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.LegacyColorTable.cs +++ b/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.LegacyColorTable.cs @@ -1,6 +1,7 @@ using Dalamud.Interface; using Dalamud.Interface.Utility.Raii; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Text; using Penumbra.GameData.Files.MaterialStructs; @@ -133,7 +134,7 @@ public partial class MtrlTab b => dyeTable[rowIdx].SpecularColor = b); } - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(pctSize); ret |= CtDragScalar("##SpecularMask"u8, "Specular Strength"u8, (float)row.SpecularMask * 100.0f, "%.0f%%"u8, 0f, HalfMaxValue * 100.0f, 1.0f, @@ -240,7 +241,7 @@ public partial class MtrlTab b => dyeTable[rowIdx].SpecularColor = b); } - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(pctSize); ret |= CtDragScalar("##SpecularMask"u8, "Specular Strength"u8, (float)row.Scalar7 * 100.0f, "%.0f%%"u8, 0f, HalfMaxValue * 100.0f, 1.0f, v => table[rowIdx].Scalar7 = (Half)(v * 0.01f)); @@ -325,7 +326,7 @@ public partial class MtrlTab ret = ret && Mtrl.ApplyDyeToRow(_stainService.LegacyStmFile, [stain], rowIdx); - ImGui.SameLine(); + Im.Line.Same(); DrawLegacyDyePreview(values, floatSize); return ret; @@ -348,7 +349,7 @@ public partial class MtrlTab _stainService.StainCombo2.CurrentSelection.Key, ], rowIdx); - ImGui.SameLine(); + Im.Line.Same(); DrawLegacyDyePreview(values, floatSize); return ret; diff --git a/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.LivePreview.cs b/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.LivePreview.cs index 6873f8ff..3257c840 100644 --- a/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.LivePreview.cs +++ b/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.LivePreview.cs @@ -1,4 +1,5 @@ using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Raii; using OtterGui.Text; using Penumbra.GameData.Files.MaterialStructs; @@ -29,7 +30,7 @@ public partial class MtrlTab if (_materialPreviewers.Count != 0 || _colorTablePreviewers.Count != 0) return; - ImGui.SameLine(); + Im.Line.Same(); using var c = ImRaii.PushColor(ImGuiCol.Text, Colors.RegexWarningBorder); ImUtf8.Text( "The current material has not been found on your character. Please check the Import from Screen tab for more information."u8); diff --git a/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.ShaderPackage.cs b/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.ShaderPackage.cs index 8c541a6f..9a15375e 100644 --- a/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.ShaderPackage.cs +++ b/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.ShaderPackage.cs @@ -1,6 +1,7 @@ using Dalamud.Interface; using Dalamud.Interface.ImGuiNotification; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using Newtonsoft.Json.Linq; using OtterGui; @@ -422,14 +423,14 @@ public partial class MtrlTab }, 1, _edit.Mod!.ModPath.FullName, false); var moddedPath = FindAssociatedShpk(out var defaultPath, out var gamePath); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Associate Default .shpk File"u8, moddedPath.ToPath(), Vector2.Zero, moddedPath.Equals(_loadedShpkPath))) LoadShpk(moddedPath); if (!gamePath.Path.Equals(moddedPath.InternalName)) { - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Associate Unmodded .shpk File", defaultPath, Vector2.Zero, gamePath.Path.Equals(_loadedShpkPath.InternalName))) LoadShpk(new FullPath(gamePath)); @@ -474,7 +475,7 @@ public partial class MtrlTab } } - ImGui.SameLine(); + Im.Line.Same(); if (description.Length > 0) ImGuiUtil.LabeledHelpMarker(label, description); else diff --git a/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.Textures.cs b/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.Textures.cs index da30d56f..e71ad943 100644 --- a/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.Textures.cs +++ b/Penumbra/UI/AdvancedWindow/Materials/MtrlTab.Textures.cs @@ -1,5 +1,6 @@ using Dalamud.Interface; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Raii; using OtterGui.Text; @@ -161,13 +162,13 @@ public partial class MtrlTab } ImGui.TableNextColumn(); - using (ImRaii.PushFont(UiBuilder.MonoFont, monoFont)) - { - ImGui.AlignTextToFramePadding(); - if (description.Length > 0) - ImGuiUtil.LabeledHelpMarker(label, description); - else - ImGui.TextUnformatted(label); + using (ImRaii.PushFont(UiBuilder.MonoFont, monoFont)) + { + ImGui.AlignTextToFramePadding(); + if (description.Length > 0) + ImGuiUtil.LabeledHelpMarker(label, description); + else + ImGui.TextUnformatted(label); } if (unfolded) @@ -229,7 +230,7 @@ public partial class MtrlTab SetSamplerFlags(sampler.SamplerId, sampler.Flags); } - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.LabeledHelpMarker("U Address Mode"u8, "Method to use for resolving a U texture coordinate that is outside the 0 to 1 range."); @@ -242,7 +243,7 @@ public partial class MtrlTab SetSamplerFlags(sampler.SamplerId, sampler.Flags); } - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.LabeledHelpMarker("V Address Mode"u8, "Method to use for resolving a V texture coordinate that is outside the 0 to 1 range."); @@ -255,7 +256,7 @@ public partial class MtrlTab SetSamplerFlags(sampler.SamplerId, sampler.Flags); } - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.LabeledHelpMarker("Level of Detail Bias"u8, "Offset from the calculated mipmap level.\n\nHigher means that the texture will start to lose detail nearer.\nLower means that the texture will keep its detail until farther."); @@ -268,7 +269,7 @@ public partial class MtrlTab SetSamplerFlags(sampler.SamplerId, sampler.Flags); } - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.LabeledHelpMarker("Minimum Level of Detail"u8, "Most detailed mipmap level to use.\n\n0 is the full-sized texture, 1 is the half-sized texture, 2 is the quarter-sized texture, and so on.\n15 will forcibly reduce the texture to its smallest mipmap."); } diff --git a/Penumbra/UI/AdvancedWindow/Meta/EqdpMetaDrawer.cs b/Penumbra/UI/AdvancedWindow/Meta/EqdpMetaDrawer.cs index 1a4b3316..04b44883 100644 --- a/Penumbra/UI/AdvancedWindow/Meta/EqdpMetaDrawer.cs +++ b/Penumbra/UI/AdvancedWindow/Meta/EqdpMetaDrawer.cs @@ -1,6 +1,7 @@ using Dalamud.Interface; using Dalamud.Interface.Utility.Raii; using Dalamud.Bindings.ImGui; +using ImSharp; using Newtonsoft.Json.Linq; using OtterGui.Text; using Penumbra.GameData.Enums; @@ -115,7 +116,7 @@ public sealed class EqdpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFil changes = true; } - ImGui.SameLine(); + Im.Line.Same(); if (Checkmark("Model##eqdp"u8, "\0"u8, entry.Model, defaultEntry.Model, out var newModel)) { entry = entry with { Model = newModel }; diff --git a/Penumbra/UI/AdvancedWindow/ModEditWindow.Deformers.cs b/Penumbra/UI/AdvancedWindow/ModEditWindow.Deformers.cs index fc1b9ef2..3c729157 100644 --- a/Penumbra/UI/AdvancedWindow/ModEditWindow.Deformers.cs +++ b/Penumbra/UI/AdvancedWindow/ModEditWindow.Deformers.cs @@ -2,6 +2,7 @@ using Dalamud.Interface; using Dalamud.Interface.ImGuiNotification; using Dalamud.Interface.Utility.Raii; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Text; using Penumbra.GameData.Data; @@ -20,9 +21,9 @@ public partial class ModEditWindow { _pbdData.Update(tab.File); DrawGenderRaceSelector(tab); - ImGui.SameLine(); + Im.Line.Same(); DrawBoneSelector(); - ImGui.SameLine(); + Im.Line.Same(); return DrawBoneData(tab, disabled); } @@ -59,7 +60,7 @@ public partial class ModEditWindow _pbdData.SelectedDeformer = deformer.RacialDeformer; } - ImGui.SameLine(); + Im.Line.Same(); color.Push(ImGuiCol.Text, metaColor); ImUtf8.TextRightAligned(raceCode); } @@ -205,7 +206,7 @@ public partial class ModEditWindow _pbdData.SelectedDeformer!.DeformMatrices[_pbdData.SelectedBone!] = matrix.ChangeValue(i, j, tmp); } - ImGui.SameLine(); + Im.Line.Same(); } ImGui.NewLine(); @@ -220,7 +221,7 @@ public partial class ModEditWindow if (ImUtf8.Button("Copy Values"u8, size)) _pbdData.CopiedMatrix = matrix; - ImGui.SameLine(); + Im.Line.Same(); var ret = false; if (ImUtf8.ButtonEx("Paste Values"u8, ""u8, size, disabled || !_pbdData.CopiedMatrix.HasValue)) @@ -230,7 +231,7 @@ public partial class ModEditWindow } var modifier = _config.DeleteModModifier.IsActive(); - ImGui.SameLine(); + Im.Line.Same(); if (modifier) { if (ImUtf8.ButtonEx("Delete"u8, "Delete this bone entry."u8, size, disabled)) @@ -263,11 +264,11 @@ public partial class ModEditWindow ImGui.SetNextItemWidth(width); ret |= ImUtf8.InputScalar("##ScaleX"u8, ref scale.X, "% 12.8f"u8); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(width); ret |= ImUtf8.InputScalar("##ScaleY"u8, ref scale.Y, "% 12.8f"u8); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(width); ret |= ImUtf8.InputScalar("##ScaleZ"u8, ref scale.Z, "% 12.8f"u8); @@ -275,11 +276,11 @@ public partial class ModEditWindow ImGui.SetNextItemWidth(width); ret |= ImUtf8.InputScalar("##TranslationX"u8, ref translation.X, "% 12.8f"u8); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(width); ret |= ImUtf8.InputScalar("##TranslationY"u8, ref translation.Y, "% 12.8f"u8); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(width); ret |= ImUtf8.InputScalar("##TranslationZ"u8, ref translation.Z, "% 12.8f"u8); @@ -287,19 +288,19 @@ public partial class ModEditWindow ImGui.SetNextItemWidth(width); ret |= ImUtf8.InputScalar("##RotationR"u8, ref rotation.W, "% 12.8f"u8); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(width); ret |= ImUtf8.InputScalar("##RotationI"u8, ref rotation.X, "% 12.8f"u8); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(width); ret |= ImUtf8.InputScalar("##RotationJ"u8, ref rotation.Y, "% 12.8f"u8); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(width); ret |= ImUtf8.InputScalar("##RotationK"u8, ref rotation.Z, "% 12.8f"u8); } - ImGui.SameLine(); + Im.Line.Same(); using (ImUtf8.Group()) { ImUtf8.TextFrameAligned("Scale"u8); diff --git a/Penumbra/UI/AdvancedWindow/ModEditWindow.Files.cs b/Penumbra/UI/AdvancedWindow/ModEditWindow.Files.cs index 66e51835..2d8dd366 100644 --- a/Penumbra/UI/AdvancedWindow/ModEditWindow.Files.cs +++ b/Penumbra/UI/AdvancedWindow/ModEditWindow.Files.cs @@ -197,7 +197,7 @@ public partial class ModEditWindow var rightText = DrawFileTooltip(registry, color); - ImGui.SameLine(); + Im.Line.Same(); ImGuiUtil.RightAlign(rightText); } @@ -281,14 +281,14 @@ public partial class ModEditWindow && (!Utf8GamePath.FromString(_gamePathEdit, out var path) || !path.IsEmpty && !path.Equals(gamePath) && !_editor.FileEditor.CanAddGamePath(path))) { - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetCursorPosX(pos); using var font = ImRaii.PushFont(UiBuilder.IconFont); ImGuiUtil.TextColored(0xFF0000FF, FontAwesomeIcon.TimesCircle.ToIconString()); } else if (tmp.Length > 0 && Path.GetExtension(tmp) != registry.File.Extension) { - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetCursorPosX(pos); using (ImRaii.PushFont(UiBuilder.IconFont)) { @@ -324,14 +324,14 @@ public partial class ModEditWindow && (!Utf8GamePath.FromString(_gamePathEdit, out var path) || !path.IsEmpty && !_editor.FileEditor.CanAddGamePath(path))) { - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetCursorPosX(pos); using var font = ImRaii.PushFont(UiBuilder.IconFont); ImGuiUtil.TextColored(0xFF0000FF, FontAwesomeIcon.TimesCircle.ToIconString()); } else if (tmp.Length > 0 && Path.GetExtension(tmp) != registry.File.Extension) { - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetCursorPosX(pos); using (ImRaii.PushFont(UiBuilder.IconFont)) { @@ -350,7 +350,7 @@ public partial class ModEditWindow ImGui.SetNextItemWidth(30 * UiHelpers.Scale); ImGui.DragInt("##skippedFolders", ref _folderSkip, 0.01f, 0, 10); ImGuiUtil.HoverTooltip("Skip the first N folders when automatically constructing the game path from the file path."); - ImGui.SameLine(); + Im.Line.Same(); spacing.Pop(); if (ImGui.Button("Add Paths")) _editor.FileEditor.AddPathsToSelected(_editor.Option!, _editor.Files.Available.Where(_selectedFiles.Contains), _folderSkip); @@ -359,14 +359,14 @@ public partial class ModEditWindow "Add the file path converted to a game path to all selected files for the current option, optionally skipping the first N folders."); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("Remove Paths")) _editor.FileEditor.RemovePathsFromSelected(_editor.Option!, _editor.Files.Available.Where(_selectedFiles.Contains)); ImGuiUtil.HoverTooltip("Remove all game paths associated with the selected files in the current option."); - ImGui.SameLine(); + Im.Line.Same(); var active = _config.DeleteModModifier.IsActive(); var tt = "Delete all selected files entirely from your filesystem, but not their file associations in the mod.\n!!!This can not be reverted!!!"; @@ -378,7 +378,7 @@ public partial class ModEditWindow if (ImGuiUtil.DrawDisabledButton("Delete Selected Files", Vector2.Zero, tt, _selectedFiles.Count == 0 || !active)) _editor.FileEditor.DeleteFiles(_editor.Mod!, _editor.Option!, _editor.Files.Available.Where(_selectedFiles.Contains)); - ImGui.SameLine(); + Im.Line.Same(); var changes = _editor.FileEditor.Changes; tt = changes ? "Apply the current file setup to the currently selected option." : "No changes made."; if (ImGuiUtil.DrawDisabledButton("Apply Changes", Vector2.Zero, tt, !changes)) @@ -389,7 +389,7 @@ public partial class ModEditWindow } - ImGui.SameLine(); + Im.Line.Same(); var label = changes ? "Revert Changes" : "Reload Files"; var length = new Vector2(ImGui.CalcTextSize("Revert Changes").X, 0); if (ImGui.Button(label, length)) @@ -397,7 +397,7 @@ public partial class ModEditWindow ImGuiUtil.HoverTooltip("Revert all revertible changes since the last file or option reload or data refresh."); - ImGui.SameLine(); + Im.Line.Same(); ImGui.Checkbox("Overview Mode", ref _overviewMode); } @@ -405,25 +405,25 @@ public partial class ModEditWindow { ImGui.SetNextItemWidth(250 * UiHelpers.Scale); Im.Input.Text("##filter"u8, ref _fileFilter, "Filter paths..."u8); - ImGui.SameLine(); + Im.Line.Same(); ImGui.Checkbox("Show Game Paths", ref _showGamePaths); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("Unselect All")) _selectedFiles.Clear(); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("Select Visible")) _selectedFiles.UnionWith(_editor.Files.Available.Where(CheckFilter)); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("Select Unused")) _selectedFiles.UnionWith(_editor.Files.Available.Where(f => f.SubModUsage.Count == 0)); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("Select Used Here")) _selectedFiles.UnionWith(_editor.Files.Available.Where(f => f.CurrentUsage > 0)); - ImGui.SameLine(); + Im.Line.Same(); ImGuiUtil.RightAlign($"{_selectedFiles.Count} / {_editor.Files.Available.Count} Files Selected"); } @@ -438,10 +438,10 @@ public partial class ModEditWindow ImGui.SetNextItemWidth(width * 3); Im.Input.Text("##fileFilter"u8, ref _fileOverviewFilter1, "Filter file..."u8); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(width * 3); Im.Input.Text("##pathFilter"u8, ref _fileOverviewFilter2, "Filter path..."u8); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(width * 2); Im.Input.Text("##optionFilter"u8, ref _fileOverviewFilter3, "Filter option..."u8); } diff --git a/Penumbra/UI/AdvancedWindow/ModEditWindow.Meta.cs b/Penumbra/UI/AdvancedWindow/ModEditWindow.Meta.cs index 06cd0763..59dc3579 100644 --- a/Penumbra/UI/AdvancedWindow/ModEditWindow.Meta.cs +++ b/Penumbra/UI/AdvancedWindow/ModEditWindow.Meta.cs @@ -1,5 +1,6 @@ using Dalamud.Interface; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Raii; using OtterGui.Text; @@ -30,24 +31,24 @@ public partial class ModEditWindow if (ImUtf8.ButtonEx("Apply Changes"u8, tt, Vector2.Zero, setsEqual)) _editor.MetaEditor.Apply(_editor.Option!); - ImGui.SameLine(); + Im.Line.Same(); tt = setsEqual ? "No changes staged."u8 : "Revert all currently staged changes."u8; if (ImUtf8.ButtonEx("Revert Changes"u8, tt, Vector2.Zero, setsEqual)) _editor.MetaEditor.Load(_editor.Mod!, _editor.Option!); - ImGui.SameLine(); + Im.Line.Same(); AddFromClipboardButton(); - ImGui.SameLine(); + Im.Line.Same(); SetFromClipboardButton(); - ImGui.SameLine(); + Im.Line.Same(); CopyToClipboardButton("Copy all current manipulations to clipboard.", _iconSize, _editor.MetaEditor); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.Button("Write as TexTools Files"u8)) _metaFileManager.WriteAllTexToolsMeta(Mod!); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Remove All Default-Values"u8, "Delete any entries from all lists that set the value to its default value."u8)) _editor.MetaEditor.DeleteDefaultValues(); - ImGui.SameLine(); + Im.Line.Same(); DrawAtchDragDrop(); using var child = ImRaii.Child("##meta", -Vector2.One, true); diff --git a/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs b/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs index 7189181d..55f749d8 100644 --- a/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs +++ b/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs @@ -1,5 +1,6 @@ using Dalamud.Bindings.ImGui; using Dalamud.Interface; +using ImSharp; using Lumina.Data.Parsing; using Luna; using OtterGui; @@ -105,7 +106,7 @@ public partial class ModEditWindow var childSize = new Vector2((ImGui.GetContentRegionAvail().X - ImGui.GetStyle().ItemSpacing.X) / 2, 0); DrawImport(tab, childSize, disabled); - ImGui.SameLine(); + Im.Line.Same(); DrawExport(tab, childSize, disabled); DrawIoExceptions(tab); @@ -139,7 +140,7 @@ public partial class ModEditWindow tab.Import(paths[0]); }, 1, Mod!.ModPath.FullName, false); - ImGui.SameLine(); + Im.Line.Same(); DrawDocumentationLink(MdlImportDocumentation); } @@ -162,7 +163,7 @@ public partial class ModEditWindow DrawGamePathCombo(tab); ImGui.Checkbox("##exportGeneratedMissingBones", ref tab.ExportConfig.GenerateMissingBones); - ImGui.SameLine(); + Im.Line.Same(); ImGuiUtil.LabeledHelpMarker("Generate missing bones", "WARNING: Enabling this option can result in unusable exported meshes.\n" + "It is primarily intended to allow exporting models weighted to bones that do not exist.\n" @@ -186,7 +187,7 @@ public partial class ModEditWindow false ); - ImGui.SameLine(); + Im.Line.Same(); DrawDocumentationLink(MdlExportDocumentation); } diff --git a/Penumbra/UI/AdvancedWindow/ModEditWindow.QuickImport.cs b/Penumbra/UI/AdvancedWindow/ModEditWindow.QuickImport.cs index f55ae576..26777830 100644 --- a/Penumbra/UI/AdvancedWindow/ModEditWindow.QuickImport.cs +++ b/Penumbra/UI/AdvancedWindow/ModEditWindow.QuickImport.cs @@ -1,5 +1,6 @@ using Dalamud.Interface; using Dalamud.Bindings.ImGui; +using ImSharp; using Lumina.Data; using OtterGui.Text; using Penumbra.Api.Enums; @@ -60,7 +61,7 @@ public partial class ModEditWindow private void DrawQuickImportActions(ResourceNode resourceNode, IWritable? writable, Vector2 buttonSize) { - ImGui.SameLine(); + Im.Line.Same(); if (!_quickImportActions!.TryGetValue((resourceNode.GamePath, writable), out var quickImport)) { quickImport = QuickImportAction.Prepare(this, resourceNode.GamePath, writable); diff --git a/Penumbra/UI/AdvancedWindow/ModEditWindow.ShaderPackages.cs b/Penumbra/UI/AdvancedWindow/ModEditWindow.ShaderPackages.cs index 01ddb7cc..e617969f 100644 --- a/Penumbra/UI/AdvancedWindow/ModEditWindow.ShaderPackages.cs +++ b/Penumbra/UI/AdvancedWindow/ModEditWindow.ShaderPackages.cs @@ -1,6 +1,7 @@ using Dalamud.Interface; using Dalamud.Interface.ImGuiNotification; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui.Raii; using OtterGui; @@ -265,7 +266,7 @@ public partial class ModEditWindow DrawShaderExportButton(tab, objectName, shader, idx); if (!disabled && tab.Shpk.Disassembled) { - ImGui.SameLine(); + Im.Line.Same(); DrawShaderImportButton(tab, objectName, shaders, idx); } @@ -503,7 +504,7 @@ public partial class ModEditWindow } } - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.Text("Start"u8); } @@ -529,7 +530,7 @@ public partial class ModEditWindow } } - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.Text("End"u8); } @@ -604,7 +605,7 @@ public partial class ModEditWindow return ret; } - private static void DrawKeyArray(ShpkTab tab, string arrayName, bool withId, IReadOnlyCollection keys) + private static void DrawKeyArray(ShpkTab tab, string arrayName, bool withId, IReadOnlyCollection keys) { if (keys.Count == 0) return; diff --git a/Penumbra/UI/AdvancedWindow/ModEditWindow.Textures.cs b/Penumbra/UI/AdvancedWindow/ModEditWindow.Textures.cs index 66b0c08b..ca2e0d3d 100644 --- a/Penumbra/UI/AdvancedWindow/ModEditWindow.Textures.cs +++ b/Penumbra/UI/AdvancedWindow/ModEditWindow.Textures.cs @@ -1,4 +1,5 @@ using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui; using OtterGui.Raii; @@ -51,20 +52,20 @@ public partial class ModEditWindow ImGuiUtil.DrawTextButton(label, new Vector2(-1, 0), ImGui.GetColorU32(ImGuiCol.FrameBg)); ImGui.NewLine(); - using (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); + using (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); } ImGui.NewLine(); @@ -125,9 +126,9 @@ public partial class ModEditWindow if (_center.IsLoaded) { RedrawOnSaveBox(); - ImGui.SameLine(); + Im.Line.Same(); SaveAsCombo(); - ImGui.SameLine(); + Im.Line.Same(); MipMapInput(); var canSaveInPlace = Path.IsPathRooted(_left.Path) && _left.Type is TextureType.Tex or TextureType.Dds or TextureType.Png; @@ -146,16 +147,16 @@ public partial class ModEditWindow AddReloadTask(_left.Path, false); } - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("Save as TEX", buttonSize2)) OpenSaveAsDialog(".tex"); if (ImGui.Button("Export as TGA", buttonSize3)) OpenSaveAsDialog(".tga"); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("Export as PNG", buttonSize3)) OpenSaveAsDialog(".png"); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("Export as DDS", buttonSize3)) OpenSaveAsDialog(".dds"); ImGui.NewLine(); @@ -171,7 +172,7 @@ public partial class ModEditWindow AddReloadTask(_left.Path, false); } - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton("Convert to BC3", buttonSize3, "This converts the texture to BC3 format in place. This is not revertible.", !canConvertInPlace || _left.Format is DXGIFormat.BC3Typeless or DXGIFormat.BC3UNorm or DXGIFormat.BC3UNormSRGB)) @@ -181,7 +182,7 @@ public partial class ModEditWindow AddReloadTask(_left.Path, false); } - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton("Convert to RGBA", buttonSize3, "This converts the texture to RGBA format in place. This is not revertible.", !canConvertInPlace @@ -312,15 +313,15 @@ public partial class ModEditWindow var childWidth = GetChildWidth(); var imageSize = new Vector2(childWidth.X - ImGui.GetStyle().FramePadding.X * 2); DrawInputChild("Input Texture", _left, childWidth, imageSize); - ImGui.SameLine(); + Im.Line.Same(); DrawOutputChild(childWidth, imageSize); if (!_overlayCollapsed) { - ImGui.SameLine(); + Im.Line.Same(); DrawInputChild("Overlay Texture", _right, childWidth, imageSize); } - ImGui.SameLine(); + Im.Line.Same(); DrawOverlayCollapseButton(); } catch (Exception e) diff --git a/Penumbra/UI/AdvancedWindow/ModEditWindow.cs b/Penumbra/UI/AdvancedWindow/ModEditWindow.cs index fea33e3e..c14443da 100644 --- a/Penumbra/UI/AdvancedWindow/ModEditWindow.cs +++ b/Penumbra/UI/AdvancedWindow/ModEditWindow.cs @@ -4,6 +4,7 @@ using Dalamud.Interface.DragDrop; using Dalamud.Interface.Windowing; using Dalamud.Plugin.Services; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Raii; using OtterGui.Text; @@ -268,13 +269,13 @@ public partial class ModEditWindow : Window, IDisposable, Luna.IUiService public static void Draw(ModEditor editor, Vector2 buttonSize) { DrawRaceCodeCombo(buttonSize); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(buttonSize.X); ImGui.InputTextWithHint("##suffixFrom", "From...", ref _materialSuffixFrom, 32); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(buttonSize.X); ImGui.InputTextWithHint("##suffixTo", "To...", ref _materialSuffixTo, 32); - ImGui.SameLine(); + Im.Line.Same(); var disabled = !MdlMaterialEditor.ValidString(_materialSuffixTo); var tt = _materialSuffixTo.Length == 0 ? "Please enter a target suffix." @@ -297,12 +298,12 @@ public partial class ModEditWindow : Window, IDisposable, Luna.IUiService anyChanges ? "Irreversibly rewrites all currently applied changes to model files." : "No changes made yet.", !anyChanges)) editor.MdlMaterialEditor.SaveAllModels(editor.Compactor); - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton("Revert All Changes", buttonSize, anyChanges ? "Revert all currently made and unsaved changes." : "No changes made yet.", !anyChanges)) editor.MdlMaterialEditor.RestoreAllModels(); - ImGui.SameLine(); + Im.Line.Same(); ImGuiComponents.HelpMarker( "Model files refer to the skin material they should use. This skin material is always the same, but modders have started using different suffices to differentiate between body types.\n" + "This option allows you to switch the suffix of all model files to another. This changes the files, so you do this on your own risk.\n" @@ -393,7 +394,7 @@ public partial class ModEditWindow : Window, IDisposable, Luna.IUiService if (_editor.Duplicates.SavedSpace > 0) { - ImGui.SameLine(); + Im.Line.Same(); ImGui.TextUnformatted($"Frees up {Functions.HumanReadableSize(_editor.Duplicates.SavedSpace)} from your hard drive."); } @@ -455,14 +456,14 @@ public partial class ModEditWindow : Window, IDisposable, Luna.IUiService ret = true; } - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Refresh Data"u8, "Refresh data for the current option.\nThis resets unsaved changes."u8, width)) { _editor.LoadMod(_editor.Mod!, _editor.GroupIdx, _editor.DataIdx).Wait(); ret = true; } - ImGui.SameLine(); + Im.Line.Same(); if (_optionSelect.Draw(width.X)) { var (groupIdx, dataIdx) = _optionSelect.CurrentSelection.Index; @@ -490,7 +491,7 @@ public partial class ModEditWindow : Window, IDisposable, Luna.IUiService if (ImGuiUtil.DrawDisabledButton("Apply Changes", Vector2.Zero, tt, setsEqual)) _editor.SwapEditor.Apply(_editor.Option!); - ImGui.SameLine(); + Im.Line.Same(); tt = setsEqual ? "No changes staged." : "Revert all currently staged changes."; if (ImGuiUtil.DrawDisabledButton("Revert Changes", Vector2.Zero, tt, setsEqual)) _editor.SwapEditor.Revert(_editor.Option!); @@ -498,7 +499,7 @@ public partial class ModEditWindow : Window, IDisposable, Luna.IUiService var otherSwaps = _editor.Mod!.TotalSwapCount - _editor.Option!.FileSwaps.Count; if (otherSwaps > 0) { - ImGui.SameLine(); + Im.Line.Same(); ImGuiUtil.DrawTextButton($"There are {otherSwaps} file swaps configured in other options.", Vector2.Zero, ColorId.RedundantAssignment.Value()); } diff --git a/Penumbra/UI/AdvancedWindow/ModMergeTab.cs b/Penumbra/UI/AdvancedWindow/ModMergeTab.cs index 332e9a10..72023e0c 100644 --- a/Penumbra/UI/AdvancedWindow/ModMergeTab.cs +++ b/Penumbra/UI/AdvancedWindow/ModMergeTab.cs @@ -1,5 +1,6 @@ using Dalamud.Interface.Utility; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Raii; using OtterGui.Text; @@ -27,7 +28,7 @@ public class ModMergeTab(ModMerger modMerger) : Luna.IUiService ImGui.Dummy(Vector2.One); var size = 550 * ImGuiHelpers.GlobalScale; DrawMergeInto(size); - ImGui.SameLine(); + Im.Line.Same(); DrawMergeIntoDesc(); ImGui.Dummy(Vector2.One); @@ -35,7 +36,7 @@ public class ModMergeTab(ModMerger modMerger) : Luna.IUiService ImGui.Dummy(Vector2.One); DrawSplitOff(size); - ImGui.SameLine(); + Im.Line.Same(); DrawSplitOffDesc(); @@ -69,7 +70,7 @@ public class ModMergeTab(ModMerger modMerger) : Luna.IUiService ImUtf8.Text(" into"u8); } - ImGui.SameLine(); + Im.Line.Same(); DrawCombo(size - ImGui.GetItemRectSize().X - ImGui.GetStyle().ItemSpacing.X); using (ImRaii.Group()) @@ -87,7 +88,7 @@ public class ModMergeTab(ModMerger modMerger) : Luna.IUiService ImGuiUtil.HoverTooltip( "The name of the new or existing option group to find or create the option in. Leave both group and option name blank for the default option.\n" + "A red border indicates an existing option group, a blue border indicates a new one."); - ImGui.SameLine(); + Im.Line.Same(); color = color == Colors.DiscordColor @@ -146,10 +147,10 @@ public class ModMergeTab(ModMerger modMerger) : Luna.IUiService var buttonSize = new Vector2((size - 2 * ImGui.GetStyle().ItemSpacing.X) / 3, 0); if (ImGui.Button("Select All", buttonSize)) modMerger.SelectedOptions.UnionWith(modMerger.MergeFromMod!.AllDataContainers); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("Unselect All", buttonSize)) modMerger.SelectedOptions.Clear(); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("Invert Selection", buttonSize)) modMerger.SelectedOptions.SymmetricExceptWith(modMerger.MergeFromMod!.AllDataContainers); DrawOptionTable(size); diff --git a/Penumbra/UI/AdvancedWindow/ResourceTreeViewer.cs b/Penumbra/UI/AdvancedWindow/ResourceTreeViewer.cs index 762bb5b6..2dc14086 100644 --- a/Penumbra/UI/AdvancedWindow/ResourceTreeViewer.cs +++ b/Penumbra/UI/AdvancedWindow/ResourceTreeViewer.cs @@ -4,6 +4,7 @@ using Dalamud.Interface.Colors; using Dalamud.Interface.ImGuiNotification; using Dalamud.Interface.Utility; using Dalamud.Plugin.Services; +using ImSharp; using Lumina.Data; using Luna; using OtterGui; @@ -99,7 +100,7 @@ public class ResourceTreeViewer( using var id = ImRaii.PushId(index); ImUtf8.TextFrameAligned($"Collection: {(incognito.IncognitoMode ? tree.AnonymizedCollectionName : tree.CollectionName)}"); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Export Character Pack"u8, "Note that this recomputes the current data of the actor if it still exists, and does not use the cached data."u8)) { @@ -340,7 +341,7 @@ public class ResourceTreeViewer( new Vector2(ImGui.GetContentRegionAvail().X, frameHeight)); } - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetCursorPosX(textPos); ImUtf8.Text(resourceNode.ModRelativePath); } diff --git a/Penumbra/UI/ChangedItemDrawer.cs b/Penumbra/UI/ChangedItemDrawer.cs index c006c909..5356b12b 100644 --- a/Penumbra/UI/ChangedItemDrawer.cs +++ b/Penumbra/UI/ChangedItemDrawer.cs @@ -4,15 +4,16 @@ using Dalamud.Interface.Textures.TextureWraps; using Dalamud.Plugin.Services; using Dalamud.Utility; using Dalamud.Bindings.ImGui; +using ImSharp; using Lumina.Data.Files; using OtterGui; using OtterGui.Raii; using OtterGui.Text; -using Penumbra.Api.Enums; using Penumbra.Communication; using Penumbra.GameData.Data; using Penumbra.Services; using Penumbra.UI.Classes; +using MouseButton = Penumbra.Api.Enums.MouseButton; namespace Penumbra.UI; @@ -111,7 +112,7 @@ public class ChangedItemDrawer : IDisposable, Luna.IUiService { using var tt = ImRaii.Tooltip(); ImGui.Image(icon.Handle, new Vector2(_smallestIconWidth)); - ImGui.SameLine(); + Im.Line.Same(); ImGuiUtil.DrawTextButton(iconFlagType.ToDescription(), new Vector2(0, _smallestIconWidth), 0); } } @@ -144,7 +145,7 @@ public class ChangedItemDrawer : IDisposable, Luna.IUiService if (additionalData.Length == 0) return; - ImGui.SameLine(); + Im.Line.Same(); using var color = ImRaii.PushColor(ImGuiCol.Text, ColorId.ItemId.Value()); ImGui.SetCursorPosY(ImGui.GetCursorPosY() + (height - ImGui.GetTextLineHeight()) / 2); ImUtf8.TextRightAligned(additionalData, ImGui.GetStyle().ItemInnerSpacing.X); @@ -156,7 +157,7 @@ public class ChangedItemDrawer : IDisposable, Luna.IUiService if (text.Length == 0) return; - ImGui.SameLine(); + Im.Line.Same(); using var color = ImRaii.PushColor(ImGuiCol.Text, ColorId.ItemId.Value()); ImGui.SetCursorPosY(ImGui.GetCursorPosY() + (height - ImGui.GetTextLineHeight()) / 2); ImUtf8.TextRightAligned(text, ImGui.GetStyle().ItemInnerSpacing.X); @@ -188,7 +189,7 @@ public class ChangedItemDrawer : IDisposable, Luna.IUiService foreach (var iconType in ChangedItemFlagExtensions.Order) { ret |= DrawIcon(iconType, ref typeFilter); - ImGui.SameLine(); + Im.Line.Same(); } ImGui.SetCursorPosX(ImGui.GetContentRegionMax().X - size.X); @@ -232,7 +233,7 @@ public class ChangedItemDrawer : IDisposable, Luna.IUiService { using var tt = ImRaii.Tooltip(); ImGui.Image(icon.Handle, new Vector2(_smallestIconWidth)); - ImGui.SameLine(); + Im.Line.Same(); ImGuiUtil.DrawTextButton(type.ToDescription(), new Vector2(0, _smallestIconWidth), 0); } diff --git a/Penumbra/UI/Classes/CollectionSelectHeader.cs b/Penumbra/UI/Classes/CollectionSelectHeader.cs index faef03c2..fb8a95be 100644 --- a/Penumbra/UI/Classes/CollectionSelectHeader.cs +++ b/Penumbra/UI/Classes/CollectionSelectHeader.cs @@ -29,7 +29,7 @@ public class CollectionSelectHeader( using var style = ImRaii.PushStyle(ImGuiStyleVar.FrameRounding, 0) .Push(ImGuiStyleVar.ItemSpacing, new Vector2(0, spacing ? ImGui.GetStyle().ItemSpacing.Y : 0)); DrawTemporaryCheckbox(); - ImGui.SameLine(); + Im.Line.Same(); var comboWidth = ImGui.GetContentRegionAvail().X / 4f; var buttonSize = new Vector2(comboWidth * 3f / 4f, 0f); using (var _ = ImRaii.Group()) @@ -155,6 +155,6 @@ public class CollectionSelectHeader( using var _ = ImRaii.PushId(id); if (ImGuiUtil.DrawDisabledButton(name, buttonWidth, tooltip, disabled)) _activeCollections.SetCollection(collection!, CollectionType.Current); - ImGui.SameLine(); + Im.Line.Same(); } } diff --git a/Penumbra/UI/Classes/MigrationSectionDrawer.cs b/Penumbra/UI/Classes/MigrationSectionDrawer.cs index 4c001a17..dc8b8cc0 100644 --- a/Penumbra/UI/Classes/MigrationSectionDrawer.cs +++ b/Penumbra/UI/Classes/MigrationSectionDrawer.cs @@ -1,4 +1,5 @@ using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Text; using Penumbra.Services; @@ -134,7 +135,7 @@ public class MigrationSectionDrawer(MigrationManager migrationManager, Configura if (!enabled) return; - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.Spinner("Spinner"u8, ImGui.GetTextLineHeight() / 2, 2, ImGui.GetColorU32(ImGuiCol.Text)); } diff --git a/Penumbra/UI/CollectionTab/CollectionPanel.cs b/Penumbra/UI/CollectionTab/CollectionPanel.cs index eae766bc..1b65fa0c 100644 --- a/Penumbra/UI/CollectionTab/CollectionPanel.cs +++ b/Penumbra/UI/CollectionTab/CollectionPanel.cs @@ -7,6 +7,7 @@ using Dalamud.Interface.ManagedFontAtlas; using Dalamud.Interface.Utility; using Dalamud.Plugin; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui; using OtterGui.Raii; @@ -55,16 +56,16 @@ public sealed class CollectionPanel( /// Draw the panel containing beginners information and simple assignments. public void DrawSimple() { - ImGuiUtil.TextWrapped("A collection is a set of mod configurations. You can have as many collections as you desire.\n" - + "The collection you are currently editing in the mod tab can be selected here and is highlighted.\n"); - ImGuiUtil.TextWrapped( - "There are functions you can assign these collections to, so different mod configurations apply for different things.\n" - + "You can assign an existing collection to such a function by clicking the function or dragging the collection over."); + Im.TextWrapped("A collection is a set of mod configurations. You can have as many collections as you desire.\n"u8 + + "The collection you are currently editing in the mod tab can be selected here and is highlighted.\n"u8); + Im.TextWrapped( + "There are functions you can assign these collections to, so different mod configurations apply for different things.\n"u8 + + "You can assign an existing collection to such a function by clicking the function or dragging the collection over."u8); ImGui.Separator(); - var buttonWidth = new Vector2(200 * ImGuiHelpers.GlobalScale, 2 * ImGui.GetTextLineHeightWithSpacing()); - using var style = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, Vector2.Zero) - .Push(ImGuiStyleVar.FrameBorderSize, 1 * ImGuiHelpers.GlobalScale); + var buttonWidth = new Vector2(200 * Im.Style.GlobalScale, 2 * Im.Style.FrameHeightWithSpacing); + using var style = Im.Style.Push(ImStyleDouble.ButtonTextAlign, Vector2.Zero) + .Push(ImStyleSingle.FrameBorderThickness, Im.Style.GlobalScale); DrawSimpleCollectionButton(CollectionType.Default, buttonWidth); DrawSimpleCollectionButton(CollectionType.Interface, buttonWidth); DrawSimpleCollectionButton(CollectionType.Yourself, buttonWidth); @@ -72,14 +73,14 @@ public sealed class CollectionPanel( DrawSimpleCollectionButton(CollectionType.FemalePlayerCharacter, buttonWidth); DrawSimpleCollectionButton(CollectionType.MaleNonPlayerCharacter, buttonWidth); DrawSimpleCollectionButton(CollectionType.FemaleNonPlayerCharacter, buttonWidth); - + ImGuiUtil.DrawColoredText(("Individual ", ColorId.NewMod.Value()), ("Assignments take precedence before anything else and only apply to one specific character or monster.", 0)); ImGui.Dummy(Vector2.UnitX); var specialWidth = buttonWidth with { X = 275 * ImGuiHelpers.GlobalScale }; DrawCurrentCharacter(specialWidth); - ImGui.SameLine(); + Im.Line.Same(); DrawCurrentTarget(specialWidth); DrawIndividualCollections(buttonWidth); @@ -112,7 +113,7 @@ public sealed class CollectionPanel( } DrawButton(name, type, buttonWidth, border, ActorIdentifier.Invalid, 's', collection); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.GetContentRegionAvail().X < buttonWidth.X + ImGui.GetStyle().ItemSpacing.X + ImGui.GetStyle().WindowPadding.X) ImGui.NewLine(); } @@ -127,19 +128,19 @@ public sealed class CollectionPanel( ImGui.Dummy(Vector2.One); DrawCurrentCharacter(width); - ImGui.SameLine(); + Im.Line.Same(); DrawCurrentTarget(width); ImGui.Separator(); ImGui.Dummy(Vector2.One); style.Pop(); _individualAssignmentUi.DrawWorldCombo(width.X / 2); - ImGui.SameLine(); + Im.Line.Same(); _individualAssignmentUi.DrawNewPlayerCollection(width.X); _individualAssignmentUi.DrawObjectKindCombo(width.X / 2); - ImGui.SameLine(); + Im.Line.Same(); _individualAssignmentUi.DrawNewNpcCollection(width.X); - ImGui.SameLine(); + Im.Line.Same(); ImGuiComponents.HelpMarker( "Battle- and Event NPCs may apply to more than one ID if they share the same name. This is language dependent. If you change your clients language, verify that your collections are still correctly assigned."); ImGui.Dummy(Vector2.One); @@ -147,22 +148,22 @@ public sealed class CollectionPanel( style.Push(ImGuiStyleVar.FrameBorderSize, 1 * ImGuiHelpers.GlobalScale); DrawNewPlayer(width); - ImGui.SameLine(); + Im.Line.Same(); ImGuiUtil.TextWrapped("Also check General Settings for UI characters and inheritance through ownership."); ImGui.Separator(); DrawNewRetainer(width); - ImGui.SameLine(); + Im.Line.Same(); ImGuiUtil.TextWrapped("Bell Retainers apply to Mannequins, but not to outdoor retainers, since those only carry their owners name."); ImGui.Separator(); DrawNewNpc(width); - ImGui.SameLine(); + Im.Line.Same(); ImGuiUtil.TextWrapped("Some NPCs are available as Battle - and Event NPCs and need to be setup for both if desired."); ImGui.Separator(); DrawNewOwned(width); - ImGui.SameLine(); + Im.Line.Same(); ImGuiUtil.TextWrapped("Owned NPCs take precedence before unowned NPCs of the same type."); ImGui.Separator(); @@ -219,7 +220,7 @@ public sealed class CollectionPanel( ImGui.AlignTextToFramePadding(); ImGui.TextUnformatted("Identifier"); ImGui.EndGroup(); - ImGui.SameLine(); + Im.Line.Same(); ImGui.BeginGroup(); var width = ImGui.GetContentRegionAvail().X; using (ImRaii.Disabled(_collections.DefaultNamed == collection)) @@ -373,7 +374,7 @@ public sealed class CollectionPanel( private void DrawSimpleCollectionButton(CollectionType type, Vector2 width) { DrawButton(type.ToName(), type, width, 0, ActorIdentifier.Invalid, 's'); - ImGui.SameLine(); + Im.Line.Same(); using (var group = ImRaii.Group()) { ImGuiUtil.TextWrapped(type.ToDescription()); @@ -470,7 +471,7 @@ public sealed class CollectionPanel( var (name, ids, coll) = _active.Individuals.Assignments[i]; DrawButton(Name(ids[0], name), CollectionType.Individual, width, 0, ids[0], 'i', coll); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.GetContentRegionAvail().X < width.X + ImGui.GetStyle().ItemSpacing.X + ImGui.GetStyle().WindowPadding.X && i < _active.Individuals.Count - 1) ImGui.NewLine(); @@ -550,7 +551,7 @@ public sealed class CollectionPanel( var name = type == CollectionType.Individual ? Name(id, null) : Buttons[type].Name; var color = Buttons.TryGetValue(type, out var p) ? p.Border : 0; DrawButton(name, type, buttonWidth, color, id, 's', collection); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.GetContentRegionAvail().X < buttonWidth.X + ImGui.GetStyle().ItemSpacing.X + ImGui.GetStyle().WindowPadding.X && idx != _inUseCache.Count - 1) ImGui.NewLine(); @@ -582,7 +583,7 @@ public sealed class CollectionPanel( { var name = Name(parent); var size = ImGui.CalcTextSize(name).X; - ImGui.SameLine(); + Im.Line.Same(); if (constOffset + size >= ImGui.GetContentRegionAvail().X) ImGui.NewLine(); ImGuiUtil.DrawTextButton(name, Vector2.Zero, 0); diff --git a/Penumbra/UI/CollectionTab/InheritanceUi.cs b/Penumbra/UI/CollectionTab/InheritanceUi.cs index cdb94a8a..ff90c806 100644 --- a/Penumbra/UI/CollectionTab/InheritanceUi.cs +++ b/Penumbra/UI/CollectionTab/InheritanceUi.cs @@ -1,5 +1,6 @@ using Dalamud.Interface; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui; using OtterGui.Raii; @@ -27,13 +28,13 @@ public class InheritanceUi(CollectionManager collectionManager, IncognitoService ImGui.Dummy(Vector2.One); DrawCurrentCollectionInheritance(); - ImGui.SameLine(); + Im.Line.Same(); DrawInheritanceTrashButton(); - ImGui.SameLine(); + Im.Line.Same(); DrawRightText(); DrawNewInheritanceSelection(); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("More Information about Inheritance", new Vector2(ImGui.GetContentRegionAvail().X, 0))) ImGui.OpenPopup("InheritanceHelp"); @@ -216,7 +217,7 @@ public class InheritanceUi(CollectionManager collectionManager, IncognitoService private void DrawNewInheritanceSelection() { DrawNewInheritanceCombo(); - ImGui.SameLine(); + Im.Line.Same(); var inheritance = InheritanceManager.CheckValidInheritance(_active.Current, _newInheritance); var tt = inheritance switch { diff --git a/Penumbra/UI/ConfigWindow.cs b/Penumbra/UI/ConfigWindow.cs index 72f6b129..a625b033 100644 --- a/Penumbra/UI/ConfigWindow.cs +++ b/Penumbra/UI/ConfigWindow.cs @@ -1,5 +1,6 @@ using Dalamud.Plugin; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui; using OtterGui.Raii; @@ -148,7 +149,7 @@ public sealed class ConfigWindow : Window, Luna.IUiService ImGui.NewLine(); ImGui.NewLine(); SupportButton.Discord(Penumbra.Messager, 0); - ImGui.SameLine(); + Im.Line.Same(); UiHelpers.DrawSupportButton(_penumbra!); ImGui.NewLine(); ImGui.NewLine(); diff --git a/Penumbra/UI/Knowledge/RaceCodeTab.cs b/Penumbra/UI/Knowledge/RaceCodeTab.cs index 44b544eb..3dbb9e27 100644 --- a/Penumbra/UI/Knowledge/RaceCodeTab.cs +++ b/Penumbra/UI/Knowledge/RaceCodeTab.cs @@ -1,4 +1,5 @@ using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Text; using Penumbra.GameData.Enums; @@ -31,7 +32,7 @@ public sealed class RaceCodeTab() : IKnowledgeTab } } - ImGui.SameLine(); + Im.Line.Same(); using (var table = ImUtf8.Table("children"u8, 4, ImGuiTableFlags.BordersOuter, size)) { diff --git a/Penumbra/UI/ModsTab/DescriptionEditPopup.cs b/Penumbra/UI/ModsTab/DescriptionEditPopup.cs index 8138a08a..b03dd72e 100644 --- a/Penumbra/UI/ModsTab/DescriptionEditPopup.cs +++ b/Penumbra/UI/ModsTab/DescriptionEditPopup.cs @@ -1,5 +1,6 @@ using Dalamud.Interface.Utility; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Text; using Penumbra.Mods; using Penumbra.Mods.Groups; @@ -74,7 +75,7 @@ public class DescriptionEditPopup(ModManager modManager) : Luna.IUiService ImGui.SetCursorPosX((inputSize.X - width) / 2); DrawSaveButton(buttonSize); - ImGui.SameLine(); + Im.Line.Same(); DrawCancelButton(buttonSize); } diff --git a/Penumbra/UI/ModsTab/Groups/ImcModGroupEditDrawer.cs b/Penumbra/UI/ModsTab/Groups/ImcModGroupEditDrawer.cs index e9c3bc23..70165996 100644 --- a/Penumbra/UI/ModsTab/Groups/ImcModGroupEditDrawer.cs +++ b/Penumbra/UI/ModsTab/Groups/ImcModGroupEditDrawer.cs @@ -1,8 +1,8 @@ using Dalamud.Interface; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Raii; using OtterGui.Text; -using OtterGui.Text.Widget; using OtterGuiInternal.Utility; using Penumbra.GameData.Structs; using Penumbra.Meta; @@ -31,7 +31,7 @@ public readonly struct ImcModGroupEditDrawer(ModGroupEditDrawer editor, ImcModGr editor.ModManager.OptionEditor.ImcEditor.ChangeAllVariants(group, allVariants); ImUtf8.HoverTooltip("Make this group overwrite all corresponding variants for this identifier, not just the one specified."u8); - ImGui.SameLine(); + Im.Line.Same(); var onlyAttributes = group.OnlyAttributes; if (ImUtf8.Checkbox("Only Attributes"u8, ref onlyAttributes)) editor.ModManager.OptionEditor.ImcEditor.ChangeOnlyAttributes(group, onlyAttributes); @@ -44,7 +44,7 @@ public readonly struct ImcModGroupEditDrawer(ModGroupEditDrawer editor, ImcModGr ImUtf8.TextFrameAligned("Decal ID"u8); } - ImGui.SameLine(); + Im.Line.Same(); using (ImUtf8.Group()) { changes |= ImcMetaDrawer.DrawMaterialId(defaultEntry, ref entry, true); @@ -60,7 +60,7 @@ public readonly struct ImcModGroupEditDrawer(ModGroupEditDrawer editor, ImcModGr ImUtf8.TextFrameAligned("Can Be Disabled"u8); } - ImGui.SameLine(); + Im.Line.Same(); using (ImUtf8.Group()) { @@ -168,7 +168,7 @@ public readonly struct ImcModGroupEditDrawer(ModGroupEditDrawer editor, ImcModGr } } - private sealed class NegativeCheckbox : MultiStateCheckbox + private sealed class NegativeCheckbox : OtterGui.Text.Widget.MultiStateCheckbox { public static readonly NegativeCheckbox Instance = new(); diff --git a/Penumbra/UI/ModsTab/Groups/ModGroupDrawer.cs b/Penumbra/UI/ModsTab/Groups/ModGroupDrawer.cs index 4411a3b3..a09e4fb9 100644 --- a/Penumbra/UI/ModsTab/Groups/ModGroupDrawer.cs +++ b/Penumbra/UI/ModsTab/Groups/ModGroupDrawer.cs @@ -1,5 +1,6 @@ using Dalamud.Interface.Components; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Raii; using OtterGui.Text; @@ -10,6 +11,7 @@ using Penumbra.Mods; using Penumbra.Mods.Groups; using Penumbra.Mods.Settings; using Penumbra.Mods.SubMods; +using MouseWheelType = OtterGui.Widgets.MouseWheelType; namespace Penumbra.UI.ModsTab.Groups; @@ -117,7 +119,7 @@ public sealed class ModGroupDrawer : Luna.IUiService var selectedOption = setting.AsIndex; using var disabled = ImRaii.Disabled(_locked); _combo.Draw(group, groupIdx, selectedOption); - ImGui.SameLine(); + Im.Line.Same(); if (group.Description.Length > 0) ImUtf8.LabeledHelpMarker(group.Name, group.Description); else @@ -152,7 +154,7 @@ public sealed class ModGroupDrawer : Luna.IUiService if (option.Description.Length <= 0) continue; - ImGui.SameLine(); + Im.Line.Same(); ImGuiComponents.HelpMarker(option.Description); } } @@ -191,7 +193,7 @@ public sealed class ModGroupDrawer : Luna.IUiService if (option.Description.Length > 0) { - ImGui.SameLine(); + Im.Line.Same(); ImGuiComponents.HelpMarker(option.Description); } } diff --git a/Penumbra/UI/ModsTab/ModPanelConflictsTab.cs b/Penumbra/UI/ModsTab/ModPanelConflictsTab.cs index 358ba438..b6f8f56c 100644 --- a/Penumbra/UI/ModsTab/ModPanelConflictsTab.cs +++ b/Penumbra/UI/ModsTab/ModPanelConflictsTab.cs @@ -1,6 +1,7 @@ using Dalamud.Interface; using Dalamud.Interface.Utility; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Raii; using OtterGui.Text; @@ -141,7 +142,7 @@ public class ModPanelConflictsTab(CollectionManager collectionManager, ModFileSy var expanded = DrawExpandedFiles(conflict); ImGui.TableNextColumn(); var conflictPriority = DrawPriorityInput(conflict, priorityWidth); - ImGui.SameLine(); + Im.Line.Same(); var selectedPriority = collectionManager.Active.Current.GetActualSettings(selector.Selected!.Index).Settings!.Priority.Value; DrawPriorityButtons(conflict.Mod2 as Mod, conflictPriority, selectedPriority, buttonSize); ImGui.TableNextColumn(); @@ -196,7 +197,7 @@ public class ModPanelConflictsTab(CollectionManager collectionManager, ModFileSy selectedPriority > conflictPriority, true)) collectionManager.Editor.SetModPriority(collectionManager.Active.Current, selector.Selected!, new ModPriority(conflictPriority + 1)); - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.SortNumericDownAlt.ToIconString(), buttonSize, $"Set the priority of this mod to the currently selected mods priority minus one. ({conflictPriority} -> {selectedPriority - 1})", selectedPriority > conflictPriority || conflict == null, true)) diff --git a/Penumbra/UI/ModsTab/ModPanelEditTab.cs b/Penumbra/UI/ModsTab/ModPanelEditTab.cs index 9b99fd2a..82960361 100644 --- a/Penumbra/UI/ModsTab/ModPanelEditTab.cs +++ b/Penumbra/UI/ModsTab/ModPanelEditTab.cs @@ -2,6 +2,7 @@ using Dalamud.Interface; using Dalamud.Interface.Components; using Dalamud.Interface.ImGuiNotification; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui; using OtterGui.Raii; @@ -105,7 +106,7 @@ public class ModPanelEditTab( if (ImGuiUtil.DrawDisabledButton("Open Mod Directory", buttonSize, tt, !folderExists)) Process.Start(new ProcessStartInfo(_mod.ModPath.FullName) { UseShellExecute = true }); - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton("Reload Mod", buttonSize, "Reload the current mod from its files.\n" + "If the mod directory or meta file do not exist anymore or if the new mod name is empty, the mod is deleted instead.", false)) @@ -131,7 +132,7 @@ public class ModPanelEditTab( if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) ImUtf8.OpenPopup("context"u8); - ImGui.SameLine(); + Im.Line.Same(); tt = backup.Exists ? $"Delete existing mod export \"{backup.Name}\" (hold {config.DeleteModModifier} while clicking)." : $"Exported mod \"{backup.Name}\" does not exist."; @@ -141,12 +142,12 @@ public class ModPanelEditTab( tt = backup.Exists ? $"Restore mod from exported file \"{backup.Name}\" (hold {config.DeleteModModifier} while clicking)." : $"Exported mod \"{backup.Name}\" does not exist."; - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Restore From Export"u8, tt, buttonSize, !backup.Exists || !config.DeleteModModifier.IsActive())) backup.Restore(modManager); if (backup.Exists) { - ImGui.SameLine(); + Im.Line.Same(); using (ImRaii.PushFont(UiBuilder.IconFont)) { ImUtf8.Text(FontAwesomeIcon.CheckCircle.ToIconString()); @@ -187,7 +188,7 @@ public class ModPanelEditTab( descriptionPopup.Open(_mod); - ImGui.SameLine(); + Im.Line.Same(); var fileExists = File.Exists(filenames.ModMetaPath(_mod)); var tt = fileExists ? "Open the metadata json file in the text editor of your choice." @@ -279,14 +280,14 @@ public class ModPanelEditTab( $"{_currentModDirectory} contains invalid symbols for FFXIV."), _ => (true, "Unknown error."), }; - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton("Rename Mod Directory", buttonSize, tt, disabled) && _currentModDirectory != null) { modManager.MoveModDirectory(mod, _currentModDirectory); Reset(); } - ImGui.SameLine(); + Im.Line.Same(); ImGuiComponents.HelpMarker( "The mod directory name is used to correspond stored settings and sort orders, otherwise it has no influence on anything that is displayed.\n" + "This can currently not be used on pre-existing folders and does not support merges or overwriting."); diff --git a/Penumbra/UI/ModsTab/ModPanelHeader.cs b/Penumbra/UI/ModsTab/ModPanelHeader.cs index 96288df4..45a14178 100644 --- a/Penumbra/UI/ModsTab/ModPanelHeader.cs +++ b/Penumbra/UI/ModsTab/ModPanelHeader.cs @@ -2,6 +2,7 @@ using Dalamud.Bindings.ImGui; using Dalamud.Interface.GameFonts; using Dalamud.Interface.ManagedFontAtlas; using Dalamud.Plugin; +using ImSharp; using OtterGui; using OtterGui.Raii; using Penumbra.Communication; @@ -208,7 +209,7 @@ public class ModPanelHeader : IDisposable } DrawAuthor(); - ImGui.SameLine(); + Im.Line.Same(); DrawWebsite(); } } @@ -218,7 +219,7 @@ public class ModPanelHeader : IDisposable { using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero); ImGuiUtil.TextColored(Colors.MetaInfoText, "by "); - ImGui.SameLine(); + Im.Line.Same(); style.Pop(); ImGui.TextUnformatted(_modAuthor); } @@ -253,7 +254,7 @@ public class ModPanelHeader : IDisposable { using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero); ImGuiUtil.TextColored(Colors.MetaInfoText, "from "); - ImGui.SameLine(); + Im.Line.Same(); style.Pop(); ImGui.TextUnformatted(_modWebsite); } diff --git a/Penumbra/UI/ModsTab/ModPanelSettingsTab.cs b/Penumbra/UI/ModsTab/ModPanelSettingsTab.cs index 20ac87f0..f2dbd1c4 100644 --- a/Penumbra/UI/ModsTab/ModPanelSettingsTab.cs +++ b/Penumbra/UI/ModsTab/ModPanelSettingsTab.cs @@ -1,4 +1,5 @@ using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Raii; using OtterGui.Text; using OtterGui.Widgets; @@ -55,7 +56,7 @@ public class ModPanelSettingsTab( communicator.PreSettingsPanelDraw.Invoke(new PreSettingsPanelDraw.Arguments(selection.Mod!)); DrawEnabledInput(); tutorial.OpenTutorial(BasicTutorialSteps.EnablingMods); - ImGui.SameLine(); + Im.Line.Same(); DrawPriorityInput(); tutorial.OpenTutorial(BasicTutorialSteps.Priority); DrawRemoveSettings(); @@ -219,7 +220,7 @@ public class ModPanelSettingsTab( } } - ImGui.SameLine(); + Im.Line.Same(); } if (_temporary) diff --git a/Penumbra/UI/ModsTab/MultiModPanel.cs b/Penumbra/UI/ModsTab/MultiModPanel.cs index 63c9116d..cea228ba 100644 --- a/Penumbra/UI/ModsTab/MultiModPanel.cs +++ b/Penumbra/UI/ModsTab/MultiModPanel.cs @@ -1,6 +1,7 @@ using Dalamud.Bindings.ImGui; using Dalamud.Interface; using Dalamud.Interface.Utility; +using ImSharp; using Luna; using OtterGui.Raii; using OtterGui.Text; @@ -95,7 +96,7 @@ public class MultiModPanel(ModFileSystemSelector selector, ModDataEditor editor, { var width = ImGuiHelpers.ScaledVector2(150, 0); ImUtf8.TextFrameAligned("Multi Tagger:"u8); - ImGui.SameLine(); + Im.Line.Same(); var predefinedTagsEnabled = tagManager.Enabled; var inputWidth = predefinedTagsEnabled diff --git a/Penumbra/UI/PredefinedTagManager.cs b/Penumbra/UI/PredefinedTagManager.cs index 33e52424..c041a590 100644 --- a/Penumbra/UI/PredefinedTagManager.cs +++ b/Penumbra/UI/PredefinedTagManager.cs @@ -1,6 +1,7 @@ using Dalamud.Bindings.ImGui; using Dalamud.Interface; using Dalamud.Interface.ImGuiNotification; +using ImSharp; using Luna; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -155,7 +156,7 @@ public sealed class PredefinedTagManager : ISavable, IReadOnlyList, ISer ret = true; } - ImGui.SameLine(); + Im.Line.Same(); } ImGui.NewLine(); @@ -250,7 +251,7 @@ public sealed class PredefinedTagManager : ISavable, IReadOnlyList, ISer _modManager.DataEditor.ChangeLocalTag(mod, localIdx, string.Empty); } } - ImGui.SameLine(); + Im.Line.Same(); color.Pop(); } diff --git a/Penumbra/UI/ResourceWatcher/ResourceWatcher.cs b/Penumbra/UI/ResourceWatcher/ResourceWatcher.cs index a52b2957..e09a1888 100644 --- a/Penumbra/UI/ResourceWatcher/ResourceWatcher.cs +++ b/Penumbra/UI/ResourceWatcher/ResourceWatcher.cs @@ -115,7 +115,7 @@ public sealed class ResourceWatcher : IDisposable, ITab, Luna.IUiService if (Im.Button("Clear"u8)) Clear(); - ImGui.SameLine(); + Im.Line.Same(); var onlyMatching = _ephemeral.OnlyAddMatchingResources; if (Im.Checkbox("Store Only Matching"u8, ref onlyMatching)) { @@ -181,7 +181,7 @@ public sealed class ResourceWatcher : IDisposable, ITab, Luna.IUiService private void DrawMaxEntries() { - Im.Item.SetNextWidth(80 * Im.Style.GlobalScale); + Im.Item.SetNextWidthScaled(80); Im.Input.Scalar("Max. Entries"u8, ref _newMaxEntries); var change = ImGui.IsItemDeactivatedAfterEdit(); if (ImGui.IsItemClicked(ImGuiMouseButton.Right) && ImGui.GetIO().KeyCtrl) diff --git a/Penumbra/UI/Tabs/ChangedItemsTab.cs b/Penumbra/UI/Tabs/ChangedItemsTab.cs index 8959c8a3..43aaf6c2 100644 --- a/Penumbra/UI/Tabs/ChangedItemsTab.cs +++ b/Penumbra/UI/Tabs/ChangedItemsTab.cs @@ -67,7 +67,7 @@ public class ChangedItemsTab( - ImGui.GetStyle().ItemSpacing.X; ImGui.SetNextItemWidth(450 * UiHelpers.Scale); Im.Input.Text("##changedItemsFilter"u8, ref _changedItemFilter, "Filter Item..."u8); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(varWidth); Im.Input.Text("##changedItemsModFilter"u8, ref _changedItemModFilter, "Filter Mods..."u8); return varWidth; diff --git a/Penumbra/UI/Tabs/CollectionsTab.cs b/Penumbra/UI/Tabs/CollectionsTab.cs index 286e34c1..029e3be6 100644 --- a/Penumbra/UI/Tabs/CollectionsTab.cs +++ b/Penumbra/UI/Tabs/CollectionsTab.cs @@ -1,6 +1,7 @@ using Dalamud.Bindings.ImGui; using Dalamud.Game.ClientState.Objects; using Dalamud.Plugin; +using ImSharp; using OtterGui.Raii; using OtterGui.Widgets; using Penumbra.Collections.Manager; @@ -66,7 +67,7 @@ public sealed class CollectionsTab : IDisposable, ITab, Luna.IUiService _tutorial.OpenTutorial(BasicTutorialSteps.EditingCollections); - ImGui.SameLine(); + Im.Line.Same(); using (var group = ImRaii.Group()) { DrawHeaderLine(); @@ -91,28 +92,28 @@ public sealed class CollectionsTab : IDisposable, ITab, Luna.IUiService Mode = PanelMode.SimpleAssignment; color.Pop(); _tutorial.OpenTutorial(BasicTutorialSteps.SimpleAssignments); - ImGui.SameLine(); + Im.Line.Same(); color.Push(ImGuiCol.Button, ImGui.GetColorU32(ImGuiCol.TabActive), Mode is PanelMode.IndividualAssignment); if (ImGui.Button("Individual Assignments", buttonSize)) Mode = PanelMode.IndividualAssignment; color.Pop(); _tutorial.OpenTutorial(BasicTutorialSteps.IndividualAssignments); - ImGui.SameLine(); + Im.Line.Same(); color.Push(ImGuiCol.Button, ImGui.GetColorU32(ImGuiCol.TabActive), Mode is PanelMode.GroupAssignment); if (ImGui.Button("Group Assignments", buttonSize)) Mode = PanelMode.GroupAssignment; color.Pop(); _tutorial.OpenTutorial(BasicTutorialSteps.GroupAssignments); - ImGui.SameLine(); + Im.Line.Same(); color.Push(ImGuiCol.Button, ImGui.GetColorU32(ImGuiCol.TabActive), Mode is PanelMode.Details); if (ImGui.Button("Collection Details", buttonSize)) Mode = PanelMode.Details; color.Pop(); _tutorial.OpenTutorial(BasicTutorialSteps.CollectionDetails); - ImGui.SameLine(); + Im.Line.Same(); _incognito.DrawToggle(withSpacing); } diff --git a/Penumbra/UI/Tabs/Debug/AtchDrawer.cs b/Penumbra/UI/Tabs/Debug/AtchDrawer.cs index 911e4c5e..759795f5 100644 --- a/Penumbra/UI/Tabs/Debug/AtchDrawer.cs +++ b/Penumbra/UI/Tabs/Debug/AtchDrawer.cs @@ -1,6 +1,7 @@ using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Text; -using Penumbra.GameData.Files; +using Penumbra.GameData.Files; using Penumbra.GameData.Files.AtchStructs; namespace Penumbra.UI.Tabs.Debug; @@ -15,7 +16,7 @@ public static class AtchDrawer ImUtf8.Text("States: "u8); } - ImGui.SameLine(); + Im.Line.Same(); using (ImUtf8.Group()) { ImUtf8.Text($"{file.Points.Count}"); @@ -53,4 +54,4 @@ public static class AtchDrawer } } } -} +} diff --git a/Penumbra/UI/Tabs/Debug/CrashDataExtensions.cs b/Penumbra/UI/Tabs/Debug/CrashDataExtensions.cs index 471d770a..b383a96c 100644 --- a/Penumbra/UI/Tabs/Debug/CrashDataExtensions.cs +++ b/Penumbra/UI/Tabs/Debug/CrashDataExtensions.cs @@ -1,4 +1,5 @@ using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Raii; using Penumbra.CrashHandler; @@ -23,7 +24,7 @@ public static class CrashDataExtensions ImGui.TextUnformatted(nameof(data.TotalVFXFuncsInvoked)); } - ImGui.SameLine(); + Im.Line.Same(); using (ImRaii.Group()) { ImGui.TextUnformatted(data.Mode); diff --git a/Penumbra/UI/Tabs/Debug/CrashHandlerPanel.cs b/Penumbra/UI/Tabs/Debug/CrashHandlerPanel.cs index 2b11fb20..ea5c008e 100644 --- a/Penumbra/UI/Tabs/Debug/CrashHandlerPanel.cs +++ b/Penumbra/UI/Tabs/Debug/CrashHandlerPanel.cs @@ -1,6 +1,7 @@ using System.Text.Json; using Dalamud.Bindings.ImGui; using Dalamud.Interface.DragDrop; +using ImSharp; using OtterGui; using OtterGui.Raii; using Penumbra.CrashHandler; @@ -60,13 +61,13 @@ public class CrashHandlerPanel(CrashHandlerService service, Configuration config if (ImGui.Button("Enable")) service.Enable(); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("Disable")) service.Disable(); if (ImGui.Button("Shutdown Crash Handler")) service.CloseCrashHandler(); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("Relaunch Crash Handler")) service.LaunchCrashHandler(); } diff --git a/Penumbra/UI/Tabs/Debug/DebugTab.cs b/Penumbra/UI/Tabs/Debug/DebugTab.cs index 4fce8866..51d67fb2 100644 --- a/Penumbra/UI/Tabs/Debug/DebugTab.cs +++ b/Penumbra/UI/Tabs/Debug/DebugTab.cs @@ -475,7 +475,7 @@ public class DebugTab : Window, ITab, IUiService ImUtf8.Text("Free'd Allocated Bytes"u8); } - ImGui.SameLine(); + Im.Line.Same(); using (ImUtf8.Group()) { ImUtf8.Text($"{PenumbraStringMemory.CurrentStrings}"); @@ -948,7 +948,7 @@ public class DebugTab : Window, ITab, IUiService ImGui.TableNextColumn(); var frame = new Vector2(ImGui.GetTextLineHeight()); ImGui.ColorButton("###color", new Vector4(MtrlTab.PseudoSqrtRgb((Vector3)color), 1), 0, frame); - ImGui.SameLine(); + Im.Line.Same(); ImGui.TextUnformatted($"{color.Red:F6} | {color.Green:F6} | {color.Blue:F6}"); } diff --git a/Penumbra/UI/Tabs/Debug/GlobalVariablesDrawer.cs b/Penumbra/UI/Tabs/Debug/GlobalVariablesDrawer.cs index 49ba2d7a..a1958c02 100644 --- a/Penumbra/UI/Tabs/Debug/GlobalVariablesDrawer.cs +++ b/Penumbra/UI/Tabs/Debug/GlobalVariablesDrawer.cs @@ -2,8 +2,8 @@ using Dalamud.Bindings.ImGui; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; using FFXIVClientStructs.FFXIV.Client.System.Scheduler; using FFXIVClientStructs.FFXIV.Client.System.Scheduler.Resource; -using FFXIVClientStructs.Interop; using FFXIVClientStructs.STD; +using ImSharp; using OtterGui.Text; using Penumbra.Interop.Services; using Penumbra.Interop.Structs; @@ -38,7 +38,7 @@ public unsafe class GlobalVariablesDrawer( Penumbra.Dynamis.DrawPointer(Device.Instance()); } - ImGui.SameLine(); + Im.Line.Same(); using (ImUtf8.Group()) { ImUtf8.Text("CharacterUtility"u8); @@ -168,7 +168,7 @@ public unsafe class GlobalVariablesDrawer( return; // TODO Remove cast when it'll have the right type in CS. - var map = (StdMap>*)&scheduler.Scheduler->Resources; + var map = (StdMap>*)&scheduler.Scheduler->Resources; var total = 0; _shownResourcesMap = 0; foreach (var (key, resourcePtr) in *map) diff --git a/Penumbra/UI/Tabs/Debug/HookOverrideDrawer.cs b/Penumbra/UI/Tabs/Debug/HookOverrideDrawer.cs index 1ef37279..fb290fda 100644 --- a/Penumbra/UI/Tabs/Debug/HookOverrideDrawer.cs +++ b/Penumbra/UI/Tabs/Debug/HookOverrideDrawer.cs @@ -1,5 +1,6 @@ using Dalamud.Bindings.ImGui; using Dalamud.Plugin; +using ImSharp; using OtterGui.Text; using Penumbra.Interop.Hooks; @@ -20,7 +21,7 @@ public class HookOverrideDrawer(IDalamudPluginInterface pluginInterface) : Luna. if (ImUtf8.Button("Save"u8)) _overrides.Write(pluginInterface); - ImGui.SameLine(); + Im.Line.Same(); var path = Path.Combine(pluginInterface.GetPluginConfigDirectory(), HookOverrides.FileName); var exists = File.Exists(path); if (ImUtf8.ButtonEx("Delete"u8, disabled: !exists, tooltip: exists ? ""u8 : "File does not exist."u8)) @@ -34,18 +35,18 @@ public class HookOverrideDrawer(IDalamudPluginInterface pluginInterface) : Luna. } bool? allVisible = null; - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.Button("Disable All Visible Hooks"u8)) allVisible = true; - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.Button("Enable All VisibleHooks"u8)) allVisible = false; bool? all = null; - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.Button("Disable All Hooks")) all = true; - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.Button("Enable All Hooks")) all = false; diff --git a/Penumbra/UI/Tabs/Debug/ModMigratorDebug.cs b/Penumbra/UI/Tabs/Debug/ModMigratorDebug.cs index f76b04fc..7e985a93 100644 --- a/Penumbra/UI/Tabs/Debug/ModMigratorDebug.cs +++ b/Penumbra/UI/Tabs/Debug/ModMigratorDebug.cs @@ -1,4 +1,5 @@ using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Text; using Penumbra.Services; @@ -29,7 +30,7 @@ public class ModMigratorDebug(ModMigrator migrator) : Luna.IUiService if (_indexTask is not null) { - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.TextFrameAligned($"{_indexTask.Status}"); } @@ -47,7 +48,7 @@ public class ModMigratorDebug(ModMigrator migrator) : Luna.IUiService if (_mdlTask is not null) { - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.TextFrameAligned($"{_mdlTask.Status}"); } } diff --git a/Penumbra/UI/Tabs/Debug/RenderTargetDrawer.cs b/Penumbra/UI/Tabs/Debug/RenderTargetDrawer.cs index 54baffa1..bb0431e3 100644 --- a/Penumbra/UI/Tabs/Debug/RenderTargetDrawer.cs +++ b/Penumbra/UI/Tabs/Debug/RenderTargetDrawer.cs @@ -1,6 +1,7 @@ using Dalamud.Bindings.ImGui; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; using FFXIVClientStructs.FFXIV.Client.Graphics.Render; +using ImSharp; using OtterGui; using OtterGui.Text; using Penumbra.Interop.Hooks; @@ -27,7 +28,7 @@ public class RenderTargetDrawer(RenderTargetHdrEnabler renderTargetHdrEnabler, D ImUtf8.Text("HDR Detour Called"); ImUtf8.Text("Penumbra Reload Count"); } - ImGui.SameLine(); + Im.Line.Same(); using (ImUtf8.Group()) { ImUtf8.Text($"{(dalamudConfig.GetDalamudConfig(DalamudConfigService.WaitingForPluginsOption, out bool w) ? w.ToString() : "Unknown")}"); diff --git a/Penumbra/UI/Tabs/ModsTab.cs b/Penumbra/UI/Tabs/ModsTab.cs index 01a49fe1..f1980d6a 100644 --- a/Penumbra/UI/Tabs/ModsTab.cs +++ b/Penumbra/UI/Tabs/ModsTab.cs @@ -6,6 +6,7 @@ using Penumbra.UI.Classes; using Dalamud.Interface; using Dalamud.Plugin.Services; using FFXIVClientStructs.FFXIV.Client.Game; +using ImSharp; using OtterGui.Widgets; using Penumbra.Api.Enums; using Penumbra.Interop.Services; @@ -53,7 +54,7 @@ public class ModsTab( try { selector.Draw(); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetCursorPosX(MathF.Round(ImGui.GetCursorPosX())); using var group = ImRaii.Group(); collectionHeader.Draw(false); @@ -100,7 +101,7 @@ public class ModsTab( using (ImRaii.PushFont(UiBuilder.IconFont)) { ImGuiUtil.DrawTextButton(FontAwesomeIcon.InfoCircle.ToIconString(), frameHeight, frameColor); - ImGui.SameLine(); + Im.Line.Same(); } ImGuiUtil.DrawTextButton("Redraw: ", frameHeight, frameColor); @@ -113,27 +114,27 @@ public class ModsTab( using var id = ImRaii.PushId("Redraw"); using var disabled = ImRaii.Disabled(clientState.LocalPlayer == null); - ImGui.SameLine(); + Im.Line.Same(); var buttonWidth = frameHeight with { X = ImGui.GetContentRegionAvail().X / 5 }; var tt = !objects[0].Valid ? "\nCan only be used when you are logged in and your character is available." : string.Empty; DrawButton(buttonWidth, "All", string.Empty, tt); - ImGui.SameLine(); + Im.Line.Same(); DrawButton(buttonWidth, "Self", "self", tt); - ImGui.SameLine(); + Im.Line.Same(); tt = targets.Target == null && targets.GPoseTarget == null ? "\nCan only be used when you have a target." : string.Empty; DrawButton(buttonWidth, "Target", "target", tt); - ImGui.SameLine(); + Im.Line.Same(); tt = targets.FocusTarget == null ? "\nCan only be used when you have a focus target." : string.Empty; DrawButton(buttonWidth, "Focus", "focus", tt); - ImGui.SameLine(); + Im.Line.Same(); tt = !IsIndoors() ? "\nCan currently only be used for indoor furniture." diff --git a/Penumbra/UI/Tabs/SettingsTab.cs b/Penumbra/UI/Tabs/SettingsTab.cs index f8fd17ac..0e2c66df 100644 --- a/Penumbra/UI/Tabs/SettingsTab.cs +++ b/Penumbra/UI/Tabs/SettingsTab.cs @@ -215,7 +215,7 @@ public class SettingsTab : ITab, IUiService _config.Save(); } - ImGui.SameLine(); + Im.Line.Same(); ImGuiUtil.LabeledHelpMarker(label, tooltip); } @@ -230,7 +230,7 @@ public class SettingsTab : ITab, IUiService _config.Ephemeral.Save(); } - ImGui.SameLine(); + Im.Line.Same(); ImGuiUtil.LabeledHelpMarker(label, tooltip); } @@ -349,10 +349,10 @@ public class SettingsTab : ITab, IUiService selected = ImGui.IsItemActive(); using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(UiHelpers.ScaleX3, 0)); - ImGui.SameLine(); + Im.Line.Same(); DrawDirectoryPickerButton(); style.Pop(); - ImGui.SameLine(); + Im.Line.Same(); const string tt = "This is where Penumbra will store your extracted mod files.\n" + "TTMP files are not copied, just extracted.\n" @@ -362,13 +362,13 @@ public class SettingsTab : ITab, IUiService + "Definitely do not place it in your Dalamud directory or any sub-directory thereof."; ImGuiComponents.HelpMarker(tt); _tutorial.OpenTutorial(BasicTutorialSteps.GeneralTooltips); - ImGui.SameLine(); + Im.Line.Same(); ImGui.TextUnformatted("Root Directory"); ImGuiUtil.HoverTooltip(tt); } _tutorial.OpenTutorial(BasicTutorialSteps.ModDirectory); - ImGui.SameLine(); + Im.Line.Same(); var pos = ImGui.GetCursorPosX(); ImGui.NewLine(); @@ -382,7 +382,7 @@ public class SettingsTab : ITab, IUiService private void DrawDirectoryButtons() { UiHelpers.DrawOpenDirectoryButton(0, _modManager.BasePath, _modManager.Valid); - ImGui.SameLine(); + Im.Line.Same(); var tt = _modManager.Valid ? "Force Penumbra to completely re-scan your root directory as if it was restarted." : "The currently selected folder is not valid. Please select a different folder."; @@ -636,11 +636,11 @@ public class SettingsTab : ITab, IUiService } } - ImGui.SameLine(); + Im.Line.Same(); const string tt = "Select which of the two renaming input fields are visible when opening the right-click context menu of a mod in the mod selector."; ImGuiComponents.HelpMarker(tt); - ImGui.SameLine(); + Im.Line.Same(); ImGui.TextUnformatted("Rename Fields in Mod Context Menu"); ImGuiUtil.HoverTooltip(tt); } @@ -693,13 +693,13 @@ public class SettingsTab : ITab, IUiService !_config.PcpSettings.DisableHandling, v => _config.PcpSettings.DisableHandling = !v); var active = _config.DeleteModModifier.IsActive(); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Delete all PCP Mods"u8, "Deletes all mods tagged with 'PCP' from the mod list."u8, disabled: !active)) _pcpService.CleanPcpMods(); if (!active) ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"Hold {_config.DeleteModModifier} while clicking."); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Delete all PCP Collections"u8, "Deletes all collections whose name starts with 'PCP/' from the collection list."u8, disabled: !active)) _pcpService.CleanPcpCollections(); @@ -740,7 +740,7 @@ public class SettingsTab : ITab, IUiService if (ImGui.IsItemDeactivatedAfterEdit()) _config.Save(); - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton($"{FontAwesomeIcon.Folder.ToIconString()}##import", UiHelpers.IconButtonSize, "Select a directory via dialog.", false, true)) { @@ -780,7 +780,7 @@ public class SettingsTab : ITab, IUiService if (ImGui.IsItemDeactivatedAfterEdit()) _modExportManager.UpdateExportDirectory(_tempExportDirectory); - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton($"{FontAwesomeIcon.Folder.ToIconString()}##export", UiHelpers.IconButtonSize, "Select a directory via dialog.", false, true)) { @@ -961,14 +961,14 @@ public class SettingsTab : ITab, IUiService _config.UseFileSystemCompression = v; _compactor.Enabled = v; }); - ImGui.SameLine(); + Im.Line.Same(); 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); - ImGui.SameLine(); + Im.Line.Same(); 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)) @@ -981,7 +981,7 @@ public class SettingsTab : ITab, IUiService new Vector2(ImGui.GetContentRegionAvail().X - ImGui.GetStyle().ItemSpacing.X - UiHelpers.IconButtonSize.X, ImGui.GetFrameHeight()), _compactor.CurrentFile?.FullName[(_modManager.BasePath.FullName.Length + 1)..] ?? "Gathering Files..."); - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Ban.ToIconString(), UiHelpers.IconButtonSize, "Cancel the mass action.", !_compactor.MassCompactRunning, true)) _compactor.CancelMassCompact(); @@ -1011,13 +1011,13 @@ public class SettingsTab : ITab, IUiService _minimumX = x; var edited = ImGui.IsItemDeactivatedAfterEdit(); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetNextItemWidth(buttonWidth); if (ImGui.DragInt("##yMinSize", ref y, 0.1f, 300, 1500)) _minimumY = y; edited |= ImGui.IsItemDeactivatedAfterEdit(); - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton("Reset##resetMinSize", new Vector2(buttonWidth / 2 - ImGui.GetStyle().ItemSpacing.X * 2, 0), $"Reset minimum dimensions to ({Configuration.Constants.MinimumSizeX}, {Configuration.Constants.MinimumSizeY}).", x == Configuration.Constants.MinimumSizeX && y == Configuration.Constants.MinimumSizeY)) @@ -1065,7 +1065,7 @@ public class SettingsTab : ITab, IUiService } } - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.LabeledHelpMarker("Diffuse Dynamic Range"u8, "Set the dynamic range that can be used for diffuse colors in materials without causing visual artifacts.\n"u8 + "Changing this setting requires a game restart. It also only works if Wait for Plugins on Startup is enabled."u8); @@ -1086,7 +1086,7 @@ public class SettingsTab : ITab, IUiService _config.Save(); } - ImGui.SameLine(); + Im.Line.Same(); ImGuiUtil.LabeledHelpMarker("Enable HTTP API", "Enables other applications, e.g. Anamnesis, to use some Penumbra functions, like requesting redraws."); } @@ -1101,7 +1101,7 @@ public class SettingsTab : ITab, IUiService _config.Save(); } - ImGui.SameLine(); + Im.Line.Same(); ImGuiUtil.LabeledHelpMarker("Enable Debug Mode", "[DEBUG] Enable the Debug Tab and Resource Manager Tab as well as some additional data collection. Also open the config window on plugin load."); } @@ -1129,7 +1129,7 @@ public class SettingsTab : ITab, IUiService { ImUtf8.ProgressBar((float)_cleanupService.Progress, new Vector2(200 * ImUtf8.GlobalScale, ImGui.GetFrameHeight()), $"{_cleanupService.Progress * 100}%"); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.Button("Cancel##FileCleanup"u8)) _cleanupService.Cancel(); }