Clip meta changes.

This commit is contained in:
Ottermandias 2024-08-28 18:29:47 +02:00
parent 4970e57131
commit 6d408ba695
8 changed files with 31 additions and 7 deletions

View file

@ -66,6 +66,9 @@ public sealed class EqdpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFil
.ThenBy(kvp => kvp.Key.Slot) .ThenBy(kvp => kvp.Key.Slot)
.Select(kvp => (kvp.Key, kvp.Value)); .Select(kvp => (kvp.Key, kvp.Value));
protected override int Count
=> Editor.Eqdp.Count;
private static bool DrawIdentifierInput(ref EqdpIdentifier identifier) private static bool DrawIdentifierInput(ref EqdpIdentifier identifier)
{ {
ImGui.TableNextColumn(); ImGui.TableNextColumn();

View file

@ -64,6 +64,9 @@ public sealed class EqpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
.ThenBy(kvp => kvp.Key.Slot) .ThenBy(kvp => kvp.Key.Slot)
.Select(kvp => (kvp.Key, kvp.Value)); .Select(kvp => (kvp.Key, kvp.Value));
protected override int Count
=> Editor.Eqp.Count;
private static bool DrawIdentifierInput(ref EqpIdentifier identifier) private static bool DrawIdentifierInput(ref EqpIdentifier identifier)
{ {
ImGui.TableNextColumn(); ImGui.TableNextColumn();

View file

@ -64,6 +64,9 @@ public sealed class EstMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
.ThenBy(kvp => kvp.Key.Slot) .ThenBy(kvp => kvp.Key.Slot)
.Select(kvp => (kvp.Key, kvp.Value)); .Select(kvp => (kvp.Key, kvp.Value));
protected override int Count
=> Editor.Est.Count;
private static bool DrawIdentifierInput(ref EstIdentifier identifier) private static bool DrawIdentifierInput(ref EstIdentifier identifier)
{ {
ImGui.TableNextColumn(); ImGui.TableNextColumn();

View file

@ -52,6 +52,9 @@ public sealed class GlobalEqpMetaDrawer(ModMetaEditor editor, MetaFileManager me
.ThenBy(identifier => identifier.Condition.Id) .ThenBy(identifier => identifier.Condition.Id)
.Select(identifier => (identifier, (byte)0)); .Select(identifier => (identifier, (byte)0));
protected override int Count
=> Editor.GlobalEqp.Count;
private static void DrawIdentifierInput(ref GlobalEqpManipulation identifier) private static void DrawIdentifierInput(ref GlobalEqpManipulation identifier)
{ {
ImGui.TableNextColumn(); ImGui.TableNextColumn();

View file

@ -59,7 +59,10 @@ public sealed class GmpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
protected override IEnumerable<(GmpIdentifier, GmpEntry)> Enumerate() protected override IEnumerable<(GmpIdentifier, GmpEntry)> Enumerate()
=> Editor.Gmp => Editor.Gmp
.OrderBy(kvp => kvp.Key.SetId.Id) .OrderBy(kvp => kvp.Key.SetId.Id)
.Select(kvp => (kvp.Key, kvp.Value)); .Select(kvp => (kvp.Key, kvp.Value));
protected override int Count
=> Editor.Gmp.Count;
private static bool DrawIdentifierInput(ref GmpIdentifier identifier) private static bool DrawIdentifierInput(ref GmpIdentifier identifier)
{ {

View file

@ -149,6 +149,9 @@ public sealed class ImcMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
.ThenBy(kvp => kvp.Key.Variant.Id) .ThenBy(kvp => kvp.Key.Variant.Id)
.Select(kvp => (kvp.Key, kvp.Value)); .Select(kvp => (kvp.Key, kvp.Value));
protected override int Count
=> Editor.Imc.Count;
public static bool DrawObjectType(ref ImcIdentifier identifier, float width = 110) public static bool DrawObjectType(ref ImcIdentifier identifier, float width = 110)
{ {
var ret = Combos.ImcType("##imcType", identifier.ObjectType, out var type, width); var ret = Combos.ImcType("##imcType", identifier.ObjectType, out var type, width);

View file

@ -41,12 +41,14 @@ public abstract class MetaDrawer<TIdentifier, TEntry>(ModMetaEditor editor, Meta
using var id = ImUtf8.PushId((int)Identifier.Type); using var id = ImUtf8.PushId((int)Identifier.Type);
DrawNew(); DrawNew();
foreach (var ((identifier, entry), idx) in Enumerate().WithIndex())
{ var height = ImUtf8.FrameHeightSpacing;
id.Push(idx); var skips = ImGuiClip.GetNecessarySkipsAtPos(height, ImGui.GetCursorPosY());
DrawEntry(identifier, entry); var remainder = ImGuiClip.ClippedTableDraw(Enumerate(), skips, DrawLine, Count);
id.Pop(); ImGuiClip.DrawEndDummy(remainder, height);
}
void DrawLine((TIdentifier Identifier, TEntry Value) pair)
=> DrawEntry(pair.Identifier, pair.Value);
} }
public abstract ReadOnlySpan<byte> Label { get; } public abstract ReadOnlySpan<byte> Label { get; }
@ -57,6 +59,7 @@ public abstract class MetaDrawer<TIdentifier, TEntry>(ModMetaEditor editor, Meta
protected abstract void DrawEntry(TIdentifier identifier, TEntry entry); protected abstract void DrawEntry(TIdentifier identifier, TEntry entry);
protected abstract IEnumerable<(TIdentifier, TEntry)> Enumerate(); protected abstract IEnumerable<(TIdentifier, TEntry)> Enumerate();
protected abstract int Count { get; }
/// <summary> /// <summary>

View file

@ -63,6 +63,9 @@ public sealed class RspMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
.ThenBy(kvp => kvp.Key.Attribute) .ThenBy(kvp => kvp.Key.Attribute)
.Select(kvp => (kvp.Key, kvp.Value)); .Select(kvp => (kvp.Key, kvp.Value));
protected override int Count
=> Editor.Rsp.Count;
private static bool DrawIdentifierInput(ref RspIdentifier identifier) private static bool DrawIdentifierInput(ref RspIdentifier identifier)
{ {
ImGui.TableNextColumn(); ImGui.TableNextColumn();