Update Changelog and improve metamanipulation display in advanced editing.

This commit is contained in:
Ottermandias 2024-05-31 19:37:24 +02:00
parent 67bb95f6e6
commit f61bd8bb8a
3 changed files with 64 additions and 71 deletions

View file

@ -1,3 +1,4 @@
using System.Collections.Frozen;
using Penumbra.Meta.Manipulations; using Penumbra.Meta.Manipulations;
using Penumbra.Mods.Manager; using Penumbra.Mods.Manager;
using Penumbra.Mods.SubMods; using Penumbra.Mods.SubMods;
@ -14,13 +15,19 @@ public class ModMetaEditor(ModManager modManager)
private readonly HashSet<RspManipulation> _rsp = []; private readonly HashSet<RspManipulation> _rsp = [];
private readonly HashSet<GlobalEqpManipulation> _globalEqp = []; private readonly HashSet<GlobalEqpManipulation> _globalEqp = [];
public int OtherImcCount { get; private set; } public sealed class OtherOptionData : List<string>
public int OtherEqpCount { get; private set; } {
public int OtherEqdpCount { get; private set; } public int TotalCount;
public int OtherGmpCount { get; private set; }
public int OtherEstCount { get; private set; } public new void Clear()
public int OtherRspCount { get; private set; } {
public int OtherGlobalEqpCount { get; private set; } TotalCount = 0;
base.Clear();
}
}
public readonly FrozenDictionary<MetaManipulation.Type, OtherOptionData> OtherData =
Enum.GetValues<MetaManipulation.Type>().ToFrozenDictionary(t => t, _ => new OtherOptionData());
public bool Changes { get; private set; } public bool Changes { get; private set; }
@ -114,13 +121,9 @@ public class ModMetaEditor(ModManager modManager)
public void Load(Mod mod, IModDataContainer currentOption) public void Load(Mod mod, IModDataContainer currentOption)
{ {
OtherImcCount = 0; foreach (var type in Enum.GetValues<MetaManipulation.Type>())
OtherEqpCount = 0; OtherData[type].Clear();
OtherEqdpCount = 0;
OtherGmpCount = 0;
OtherEstCount = 0;
OtherRspCount = 0;
OtherGlobalEqpCount = 0;
foreach (var option in mod.AllDataContainers) foreach (var option in mod.AllDataContainers)
{ {
if (option == currentOption) if (option == currentOption)
@ -128,30 +131,9 @@ public class ModMetaEditor(ModManager modManager)
foreach (var manip in option.Manipulations) foreach (var manip in option.Manipulations)
{ {
switch (manip.ManipulationType) var data = OtherData[manip.ManipulationType];
{ ++data.TotalCount;
case MetaManipulation.Type.Imc: data.Add(option.GetFullName());
++OtherImcCount;
break;
case MetaManipulation.Type.Eqdp:
++OtherEqdpCount;
break;
case MetaManipulation.Type.Eqp:
++OtherEqpCount;
break;
case MetaManipulation.Type.Est:
++OtherEstCount;
break;
case MetaManipulation.Type.Gmp:
++OtherGmpCount;
break;
case MetaManipulation.Type.Rsp:
++OtherRspCount;
break;
case MetaManipulation.Type.GlobalEqp:
++OtherGlobalEqpCount;
break;
}
} }
} }

View file

@ -66,37 +66,45 @@ public partial class ModEditWindow
return; return;
DrawEditHeader(_editor.MetaEditor.Eqp, "Equipment Parameter Edits (EQP)###EQP", 5, EqpRow.Draw, EqpRow.DrawNew, DrawEditHeader(_editor.MetaEditor.Eqp, "Equipment Parameter Edits (EQP)###EQP", 5, EqpRow.Draw, EqpRow.DrawNew,
_editor.MetaEditor.OtherEqpCount); _editor.MetaEditor.OtherData[MetaManipulation.Type.Eqp]);
DrawEditHeader(_editor.MetaEditor.Eqdp, "Racial Model Edits (EQDP)###EQDP", 7, EqdpRow.Draw, EqdpRow.DrawNew, DrawEditHeader(_editor.MetaEditor.Eqdp, "Racial Model Edits (EQDP)###EQDP", 7, EqdpRow.Draw, EqdpRow.DrawNew,
_editor.MetaEditor.OtherEqdpCount); _editor.MetaEditor.OtherData[MetaManipulation.Type.Eqdp]);
DrawEditHeader(_editor.MetaEditor.Imc, "Variant Edits (IMC)###IMC", 10, ImcRow.Draw, ImcRow.DrawNew, _editor.MetaEditor.OtherImcCount); DrawEditHeader(_editor.MetaEditor.Imc, "Variant Edits (IMC)###IMC", 10, ImcRow.Draw, ImcRow.DrawNew,
_editor.MetaEditor.OtherData[MetaManipulation.Type.Imc]);
DrawEditHeader(_editor.MetaEditor.Est, "Extra Skeleton Parameters (EST)###EST", 7, EstRow.Draw, EstRow.DrawNew, DrawEditHeader(_editor.MetaEditor.Est, "Extra Skeleton Parameters (EST)###EST", 7, EstRow.Draw, EstRow.DrawNew,
_editor.MetaEditor.OtherEstCount); _editor.MetaEditor.OtherData[MetaManipulation.Type.Est]);
DrawEditHeader(_editor.MetaEditor.Gmp, "Visor/Gimmick Edits (GMP)###GMP", 7, GmpRow.Draw, GmpRow.DrawNew, DrawEditHeader(_editor.MetaEditor.Gmp, "Visor/Gimmick Edits (GMP)###GMP", 7, GmpRow.Draw, GmpRow.DrawNew,
_editor.MetaEditor.OtherGmpCount); _editor.MetaEditor.OtherData[MetaManipulation.Type.Gmp]);
DrawEditHeader(_editor.MetaEditor.Rsp, "Racial Scaling Edits (RSP)###RSP", 5, RspRow.Draw, RspRow.DrawNew, DrawEditHeader(_editor.MetaEditor.Rsp, "Racial Scaling Edits (RSP)###RSP", 5, RspRow.Draw, RspRow.DrawNew,
_editor.MetaEditor.OtherRspCount); _editor.MetaEditor.OtherData[MetaManipulation.Type.Rsp]);
DrawEditHeader(_editor.MetaEditor.GlobalEqp, "Global Equipment Parameter Edits (Global EQP)###GEQP", 4, GlobalEqpRow.Draw, DrawEditHeader(_editor.MetaEditor.GlobalEqp, "Global Equipment Parameter Edits (Global EQP)###GEQP", 4, GlobalEqpRow.Draw,
GlobalEqpRow.DrawNew, _editor.MetaEditor.OtherGlobalEqpCount); GlobalEqpRow.DrawNew, _editor.MetaEditor.OtherData[MetaManipulation.Type.GlobalEqp]);
} }
/// <summary> The headers for the different meta changes all have basically the same structure for different types.</summary> /// <summary> The headers for the different meta changes all have basically the same structure for different types.</summary>
private void DrawEditHeader<T>(IReadOnlyCollection<T> items, string label, int numColumns, private void DrawEditHeader<T>(IReadOnlyCollection<T> items, string label, int numColumns,
Action<MetaFileManager, T, ModEditor, Vector2> draw, Action<MetaFileManager, T, ModEditor, Vector2> draw, Action<MetaFileManager, ModEditor, Vector2> drawNew,
Action<MetaFileManager, ModEditor, Vector2> drawNew, int otherCount) ModMetaEditor.OtherOptionData otherOptionData)
{ {
const ImGuiTableFlags flags = ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.BordersInnerV; const ImGuiTableFlags flags = ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.BordersInnerV;
var oldPos = ImGui.GetCursorPosY(); var oldPos = ImGui.GetCursorPosY();
var header = ImGui.CollapsingHeader($"{items.Count} {label}"); var header = ImGui.CollapsingHeader($"{items.Count} {label}");
var newPos = ImGui.GetCursorPos(); var newPos = ImGui.GetCursorPos();
if (otherCount > 0) if (otherOptionData.TotalCount > 0)
{ {
var text = $"{otherCount} Edits in other Options"; var text = $"{otherOptionData.TotalCount} Edits in other Options";
var size = ImGui.CalcTextSize(text).X; var size = ImGui.CalcTextSize(text).X;
ImGui.SetCursorPos(new Vector2(ImGui.GetContentRegionAvail().X - size, oldPos + ImGui.GetStyle().FramePadding.Y)); ImGui.SetCursorPos(new Vector2(ImGui.GetContentRegionAvail().X - size, oldPos + ImGui.GetStyle().FramePadding.Y));
ImGuiUtil.TextColored(ColorId.RedundantAssignment.Value() | 0xFF000000, text); ImGuiUtil.TextColored(ColorId.RedundantAssignment.Value() | 0xFF000000, text);
if (ImGui.IsItemHovered())
{
using var tt = ImUtf8.Tooltip();
foreach (var name in otherOptionData)
ImUtf8.Text(name);
}
ImGui.SetCursorPos(newPos); ImGui.SetCursorPos(newPos);
} }

View file

@ -47,19 +47,26 @@ public class PenumbraChangelog
Add8_2_0(Changelog); Add8_2_0(Changelog);
Add8_3_0(Changelog); Add8_3_0(Changelog);
Add1_0_0_0(Changelog); Add1_0_0_0(Changelog);
Add1_0_2_0(Changelog); AddDummy(Changelog);
Add1_0_3_0(Changelog); AddDummy(Changelog);
Add1_1_0_0(Changelog);
} }
#region Changelogs #region Changelogs
private static void Add1_0_3_0(Changelog log) private static void Add1_1_0_0(Changelog log)
=> log.NextVersion("Version 1.0.3.0") => log.NextVersion("Version 1.1.0.0")
.RegisterImportant( .RegisterImportant(
"This update comes, again, with a lot of very heavy backend changes (collections and groups) and thus may introduce new issues.") "This update comes, again, with a lot of very heavy backend changes (collections and groups) and thus may introduce new issues.")
.RegisterEntry("Updated to .net8 and XIV 6.58, using some new framework facilities to improve performance and stability.")
.RegisterHighlight(
"Added an experimental crash handler that is supposed to write a Penumbra.log file when the game crashes, containing Penumbra-specific information.")
.RegisterEntry("This is disabled by default. It can be enabled in Advanced Settings.", 1)
.RegisterHighlight("Collections now have associated GUIDs as identifiers instead of their names, so they can now be renamed.") .RegisterHighlight("Collections now have associated GUIDs as identifiers instead of their names, so they can now be renamed.")
.RegisterEntry("Migrating those collections may introduce issues, please let me know as soon as possible if you encounter any.", 1) .RegisterEntry("Migrating those collections may introduce issues, please let me know as soon as possible if you encounter any.", 1)
.RegisterEntry("A permanent (non-rolling) backup should be created before the migration in case of any issues.", 1) .RegisterEntry("A permanent (non-rolling) backup should be created before the migration in case of any issues.", 1)
.RegisterHighlight(
"Added predefined tags that can be setup in the Settings tab and can be more easily applied or removed from mods. (by DZD)")
.RegisterHighlight( .RegisterHighlight(
"A total rework of how options and groups are handled internally, and introduction of the first new group type, the IMC Group.") "A total rework of how options and groups are handled internally, and introduction of the first new group type, the IMC Group.")
.RegisterEntry( .RegisterEntry(
@ -75,9 +82,14 @@ public class PenumbraChangelog
.RegisterEntry( .RegisterEntry(
"This can be used if something like a jacket or a stole is put onto an accessory to prevent it from being hidden in general.", "This can be used if something like a jacket or a stole is put onto an accessory to prevent it from being hidden in general.",
1) 1)
.RegisterEntry(
"The first empty option in a single-select option group imported from a TTMP will now keep its location instead of being moved to the first option.")
.RegisterEntry("Further empty options are still removed.", 1)
.RegisterHighlight( .RegisterHighlight(
"Added a field to rename mods directly from the mod selector context menu, instead of moving them in the filesystem.") "Added a field to rename mods directly from the mod selector context menu, instead of moving them in the filesystem.")
.RegisterEntry("You can choose which rename field (none, either one or both) to display in the settings.", 1) .RegisterEntry("You can choose which rename field (none, either one or both) to display in the settings.", 1)
.RegisterEntry("Added the characterglass.shpk shader file to special shader treatment to fix issues when replacing it. (By Ny)")
.RegisterEntry("Made it more obvious if a user has not set their root directory yet.")
.RegisterEntry( .RegisterEntry(
"You can now paste your current clipboard text into the mod selector filter with a simple right-click as long as it is not focused.") "You can now paste your current clipboard text into the mod selector filter with a simple right-click as long as it is not focused.")
.RegisterHighlight( .RegisterHighlight(
@ -88,29 +100,17 @@ public class PenumbraChangelog
.RegisterEntry("Removed the auto-generated descriptions for newly created groups in Penumbra.") .RegisterEntry("Removed the auto-generated descriptions for newly created groups in Penumbra.")
.RegisterEntry( .RegisterEntry(
"Made some improvements to the Advanced Editing window, for example a much better and more performant Hex Viewer for unstructured data was added.") "Made some improvements to the Advanced Editing window, for example a much better and more performant Hex Viewer for unstructured data was added.")
.RegisterEntry("Made a lot of further improvements on Model import/export (by ackwell).") .RegisterEntry("Various improvements to model import/export by ackwell (throughout all patches).")
.RegisterEntry("Hovering over meta manipulations in other options in the advanced editing window now shows a list of those options.")
.RegisterEntry("Reworked the API and IPC structure heavily.") .RegisterEntry("Reworked the API and IPC structure heavily.")
.RegisterImportant("This means some plugins interacting with Penumbra may not work correctly until they update.", 1)
.RegisterEntry("Worked around the UI IPC possibly displacing all settings when the drawn additions became too big.") .RegisterEntry("Worked around the UI IPC possibly displacing all settings when the drawn additions became too big.")
.RegisterEntry("Fixed an issue where reloading a mod did not ensure settings for that mod being correct afterwards.")
.RegisterEntry("Fixed some issues with the file sizes of compressed files.")
.RegisterEntry("Fixed an issue with merging and deduplicating mods.") .RegisterEntry("Fixed an issue with merging and deduplicating mods.")
.RegisterEntry("Fixed a crash when scanning for mods without access rights to the folder.") .RegisterEntry("Fixed a crash when scanning for mods without access rights to the folder.")
.RegisterEntry( .RegisterEntry(
"Made plugin conform to Dalamud requirements by adding a punchline and another button to open the menu from the installer."); "Made plugin conform to Dalamud requirements by adding a punchline and another button to open the menu from the installer.")
private static void Add1_0_2_0(Changelog log)
=> log.NextVersion("Version 1.0.2.0")
.RegisterEntry("Updated to .net8 and XIV 6.58, using some new framework facilities to improve performance and stability.")
.RegisterHighlight(
"Added an experimental crash handler that is supposed to write a Penumbra.log file when the game crashes, containing Penumbra-specific information.")
.RegisterEntry("Various improvements to model import/export by ackwell (throughout all patches).")
.RegisterHighlight(
"Added predefined tags that can be setup in the Settings tab and can be more easily applied or removed from mods. (by DZD)")
.RegisterEntry(
"The first empty option in a single-select option group imported from a TTMP will now keep its location instead of being moved to the first option.")
.RegisterEntry("Further empty options are still removed.", 1)
.RegisterEntry("Made it more obvious if a user has not set their root directory yet.")
.RegisterEntry("Added the characterglass.shpk shader file to special shader treatment to fix issues when replacing it. (By Ny)")
.RegisterEntry("Fixed some issues with the file sizes of compressed files.")
.RegisterEntry("Fixed an issue where reloading a mod did not ensure settings for that mod being correct afterwards.")
.RegisterEntry("Added an option to automatically redraw the player character when saving files. (1.0.0.8)") .RegisterEntry("Added an option to automatically redraw the player character when saving files. (1.0.0.8)")
.RegisterEntry("Fixed issue with manipulating mods not triggering some events. (1.0.0.7)") .RegisterEntry("Fixed issue with manipulating mods not triggering some events. (1.0.0.7)")
.RegisterEntry("Fixed issue with temporary mods not triggering some events. (1.0.0.6)") .RegisterEntry("Fixed issue with temporary mods not triggering some events. (1.0.0.6)")
@ -762,6 +762,9 @@ public class PenumbraChangelog
#endregion #endregion
private static void AddDummy(Changelog log)
=> log.NextVersion(string.Empty);
private (int, ChangeLogDisplayType) ConfigData() private (int, ChangeLogDisplayType) ConfigData()
=> (_config.Ephemeral.LastSeenVersion, _config.ChangeLogDisplayType); => (_config.Ephemeral.LastSeenVersion, _config.ChangeLogDisplayType);