Skip to content

Commit bd00a3f

Browse files
authored
Merge pull request #43 from SilverEzredes/master
MDF Editor clean up
2 parents 4f6977e + 05bf345 commit bd00a3f

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

ContentEditor.App/Imgui/App/PakBrowser.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using ContentEditor.App.Graphics;
22
using ContentEditor.App.Windowing;
3+
using ContentEditor.App.ImguiHandling;
34
using ContentEditor.Core;
45
using ContentPatcher;
56
using ReeLib;
@@ -785,6 +786,14 @@ private void ShowFileContextMenu(string file, bool isBookmarked, bool showSort =
785786
_bookmarkManager.AddBookmark(Workspace.Config.Game.name, file);
786787
}
787788
}
789+
if (Path.HasExtension(file) && contentWorkspace.CurrentBundle != null) {
790+
var handle = contentWorkspace.ResourceManager.GetFileHandle(file);
791+
if (ImguiHelpers.ContextMenuItem("##SaveToBundle", AppIcons.SIC_BundleSaveTo, "Save to Bundle", new[] { Colors.IconPrimary, Colors.IconPrimary, Colors.IconPrimary, Colors.IconSecondary, Colors.IconPrimary })) {
792+
if (handle != null) {
793+
ResourcePathPicker.SaveFileToBundle(contentWorkspace, handle, (savePath, localPath, nativePath) => handle.Save(contentWorkspace, savePath));
794+
}
795+
}
796+
}
788797
if (Path.HasExtension(file)) {
789798
if (ImguiHelpers.ContextMenuItem("##JumpToContainingFolder", AppIcons.SIC_FolderContain, "Jump to Containing Folder", new[] { Colors.IconPrimary, Colors.IconSecondary })) {
790799
string currFolder = Path.GetDirectoryName(file)!;

ContentEditor.App/Imgui/Editors/MdfEditor.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -180,30 +180,13 @@ private static void ShowMaterialDataTabContent(UIContext context, string label,
180180
if (context.children.Count == 0 || context.children[0].label != label) {
181181
context.children.Clear();
182182
child = context.AddChild(label, data);
183-
AssignHandler(child, data);
183+
child.AddDefaultHandler();
184184
} else {
185185
child = context.children[0];
186186
}
187187
ImGui.SetNextItemOpen(true, ImGuiCond.Always);
188188
child.ShowUI();
189189
}
190-
private static void AssignHandler(UIContext context, object data)
191-
{
192-
switch (data) {
193-
case MaterialHeader:
194-
context.uiHandler = new MatHeaderImguiHandler();
195-
break;
196-
case List<TexHeader>:
197-
context.uiHandler = new TexHeaderListImguiHandler();
198-
break;
199-
case List<ParamHeader>:
200-
context.uiHandler = new ParamHeaderListImguiHandler();
201-
break;
202-
case List<GpuBufferEntry>: context.AddDefaultHandler<List<GpuBufferEntry>>();
203-
break;
204-
}
205-
}
206-
207190
private static void ShowMaterialContextMenu(UIContext context, List<MaterialData> list, MaterialData mat, Action<int>? onSelectIndexChanged = null)
208191
{
209192
if (ImGui.MenuItem("Duplicate")) {

0 commit comments

Comments
 (0)