Skip to content

Commit 4644ef3

Browse files
Restore option for material keys
1 parent 48ea5ec commit 4644ef3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Meddle/Meddle.Plugin/UI/Windows/MdlMaterialWindow.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ public unsafe void DrawMtrl(Pointer<MaterialResourceHandle> mtrlPtr)
362362
}
363363

364364
materialKeys = keyColl.ToArray();
365+
materialKeysCache[(nint)mtrlPtr.Value] = materialKeys;
365366
}
366367

367368
for (int i = 0; i < shpk.MaterialKeys.Length; i++)
@@ -407,6 +408,21 @@ public unsafe void DrawMtrl(Pointer<MaterialResourceHandle> mtrlPtr)
407408
ImGui.TextColored(new Vector4(1, 0, 0, 1), "Invalid value format.");
408409
}
409410
}
411+
412+
ImGui.SameLine();
413+
if (ImGui.Button($"Restore##{key.Id}"))
414+
{
415+
var cacheValue = materialKeys.FirstOrDefault(x => x.Key == key.Id);
416+
if (cacheValue.Key != 0)
417+
{
418+
shaderValues[i] = cacheValue.Value;
419+
keyEditor[key.Id] = $"{cacheValue.Value:X8}";
420+
}
421+
else
422+
{
423+
ImGui.TextColored(new Vector4(1, 0, 0, 1), "No cached value found.");
424+
}
425+
}
410426
}
411427
}
412428
}

0 commit comments

Comments
 (0)