Skip to content

Commit

Permalink
Update config defaults and add debug view
Browse files Browse the repository at this point in the history
  • Loading branch information
PassiveModding committed Oct 6, 2024
1 parent 416d21c commit 3dcecf4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Meddle/Meddle.Plugin/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -120,7 +141,7 @@ public class Configuration : IPluginConfiguration
/// </summary>
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();

Expand Down
12 changes: 12 additions & 0 deletions Meddle/Meddle.Plugin/UI/DebugTab.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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()
{
Expand All @@ -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();
Expand Down

0 comments on commit 3dcecf4

Please sign in to comment.