Update row type names.

This commit is contained in:
Ottermandias 2024-08-04 15:35:27 +02:00
parent a6ee4c96ea
commit d90c3dd1af
3 changed files with 12 additions and 12 deletions

@ -1 +1 @@
Subproject commit 44427ad0149059ab5ccb4e4a2f42a1a43423e4c5 Subproject commit f2734d543d9b2debecb8feb6d6fa928801eb2bcb

View file

@ -171,7 +171,7 @@ public partial class ModEditWindow
} }
[SkipLocalsInit] [SkipLocalsInit]
private static unsafe void ColorTableCopyClipboardButton(ColorTable.Row row, ColorDyeTable.Row dye) private static unsafe void ColorTableCopyClipboardButton(ColorTableRow row, ColorDyeTableRow dye)
{ {
if (!ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Clipboard.ToIconString(), ImGui.GetFrameHeight() * Vector2.One, if (!ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Clipboard.ToIconString(), ImGui.GetFrameHeight() * Vector2.One,
"Export this row to your clipboard.", false, true)) "Export this row to your clipboard.", false, true))
@ -179,11 +179,11 @@ public partial class ModEditWindow
try try
{ {
Span<byte> data = stackalloc byte[ColorTable.Row.Size + ColorDyeTable.Row.Size]; Span<byte> data = stackalloc byte[ColorTableRow.Size + ColorDyeTableRow.Size];
fixed (byte* ptr = data) fixed (byte* ptr = data)
{ {
MemoryUtility.MemCpyUnchecked(ptr, &row, ColorTable.Row.Size); MemoryUtility.MemCpyUnchecked(ptr, &row, ColorTableRow.Size);
MemoryUtility.MemCpyUnchecked(ptr + ColorTable.Row.Size, &dye, ColorDyeTable.Row.Size); MemoryUtility.MemCpyUnchecked(ptr + ColorTableRow.Size, &dye, ColorDyeTableRow.Size);
} }
var text = Convert.ToBase64String(data); var text = Convert.ToBase64String(data);
@ -219,15 +219,15 @@ public partial class ModEditWindow
{ {
var text = ImGui.GetClipboardText(); var text = ImGui.GetClipboardText();
var data = Convert.FromBase64String(text); var data = Convert.FromBase64String(text);
if (data.Length != ColorTable.Row.Size + ColorDyeTable.Row.Size if (data.Length != ColorTableRow.Size + ColorDyeTableRow.Size
|| !tab.Mtrl.HasTable) || !tab.Mtrl.HasTable)
return false; return false;
fixed (byte* ptr = data) fixed (byte* ptr = data)
{ {
tab.Mtrl.Table[rowIdx] = *(ColorTable.Row*)ptr; tab.Mtrl.Table[rowIdx] = *(ColorTableRow*)ptr;
if (tab.Mtrl.HasDyeTable) if (tab.Mtrl.HasDyeTable)
tab.Mtrl.DyeTable[rowIdx] = *(ColorDyeTable.Row*)(ptr + ColorTable.Row.Size); tab.Mtrl.DyeTable[rowIdx] = *(ColorDyeTableRow*)(ptr + ColorTableRow.Size);
} }
tab.UpdateColorTableRowPreview(rowIdx); tab.UpdateColorTableRowPreview(rowIdx);
@ -453,7 +453,7 @@ public partial class ModEditWindow
return ret; return ret;
} }
private bool DrawDyePreview(MtrlTab tab, int rowIdx, bool disabled, ColorDyeTable.Row dye, float floatSize) private bool DrawDyePreview(MtrlTab tab, int rowIdx, bool disabled, ColorDyeTableRow dye, float floatSize)
{ {
var stain = _stainService.StainCombo.CurrentSelection.Key; var stain = _stainService.StainCombo.CurrentSelection.Key;
if (stain == 0 || !_stainService.StmFile.Entries.TryGetValue(dye.Template, out var entry)) if (stain == 0 || !_stainService.StmFile.Entries.TryGetValue(dye.Template, out var entry))

View file

@ -597,11 +597,11 @@ public partial class ModEditWindow
if (!Mtrl.HasTable) if (!Mtrl.HasTable)
return; return;
var row = new LegacyColorTable.Row(Mtrl.Table[rowIdx]); var row = new LegacyColorTableRow(Mtrl.Table[rowIdx]);
if (Mtrl.HasDyeTable) if (Mtrl.HasDyeTable)
{ {
var stm = _edit._stainService.StmFile; var stm = _edit._stainService.StmFile;
var dye = new LegacyColorDyeTable.Row(Mtrl.DyeTable[rowIdx]); var dye = new LegacyColorDyeTableRow(Mtrl.DyeTable[rowIdx]);
if (stm.TryGetValue(dye.Template, _edit._stainService.StainCombo.CurrentSelection.Key, out var dyes)) if (stm.TryGetValue(dye.Template, _edit._stainService.StainCombo.CurrentSelection.Key, out var dyes))
row.ApplyDyeTemplate(dye, dyes); row.ApplyDyeTemplate(dye, dyes);
} }
@ -651,7 +651,7 @@ public partial class ModEditWindow
} }
} }
private static void ApplyHighlight(ref LegacyColorTable.Row row, float time) private static void ApplyHighlight(ref LegacyColorTableRow row, float time)
{ {
var level = (MathF.Sin(time * 2.0f * MathF.PI) + 2.0f) / 3.0f / 255.0f; var level = (MathF.Sin(time * 2.0f * MathF.PI) + 2.0f) / 3.0f / 255.0f;
var baseColor = ColorId.InGameHighlight.Value(); var baseColor = ColorId.InGameHighlight.Value();