diff --git a/Meddle/Meddle.Plugin/Plugin.cs b/Meddle/Meddle.Plugin/Plugin.cs index 54e7a24..2be3059 100644 --- a/Meddle/Meddle.Plugin/Plugin.cs +++ b/Meddle/Meddle.Plugin/Plugin.cs @@ -28,6 +28,8 @@ public Plugin(IDalamudPluginInterface pluginInterface) { var config = pluginInterface.GetPluginConfig() as Configuration ?? new Configuration(); pluginInterface.Inject(config); + config.Migrate(); + Alloc.Init(); var host = Host.CreateDefaultBuilder(); @@ -80,6 +82,25 @@ public class Configuration : IPluginConfiguration { public const ExportType DefaultExportType = ExportType.GLTF; public const SkeletonUtils.PoseMode DefaultPoseMode = SkeletonUtils.PoseMode.Model; + + public void Migrate() + { + if (Version == 1) + { + if (DisableAutomaticUiHide == false) + { + DisableAutomaticUiHide = true; + } + + if (DisableCutsceneUiHide == false) + { + DisableCutsceneUiHide = true; + } + + Version = 2; + Save(); + } + } [PluginService] [JsonIgnore] @@ -120,7 +141,7 @@ public class Configuration : IPluginConfiguration /// public ExportType ExportType { get; set; } = DefaultExportType; - public int Version { get; set; } = 1; + public int Version { get; set; } = 2; public LayoutWindow.LayoutConfig LayoutConfig { get; set; } = new(); diff --git a/Meddle/Meddle.Plugin/UI/DebugTab.cs b/Meddle/Meddle.Plugin/UI/DebugTab.cs index 538285b..fc2613f 100644 --- a/Meddle/Meddle.Plugin/UI/DebugTab.cs +++ b/Meddle/Meddle.Plugin/UI/DebugTab.cs @@ -1,4 +1,5 @@ using System.Numerics; +using System.Text.Json; using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Interface.Utility.Raii; using Dalamud.Plugin.Services; @@ -61,6 +62,11 @@ public void Dispose() public string Name => "Debug"; public int Order => int.MaxValue - 10; + private JsonSerializerOptions jsonOptions = new() + { + WriteIndented = true, + IncludeFields = true + }; public void Draw() { @@ -69,6 +75,12 @@ public void Draw() DrawSelectedCharacter(); } + if (ImGui.CollapsingHeader("Config Json")) + { + var cofigJson = JsonSerializer.Serialize(config, jsonOptions); + ImGui.TextWrapped(cofigJson); + } + if (ImGui.CollapsingHeader("Object Table")) { DrawObjectTable();