diff --git a/PCK-Studio/Forms/Editor/MaterialsEditor.cs b/PCK-Studio/Forms/Editor/MaterialsEditor.cs
index ffed1d47..1ae8ffac 100644
--- a/PCK-Studio/Forms/Editor/MaterialsEditor.cs
+++ b/PCK-Studio/Forms/Editor/MaterialsEditor.cs
@@ -65,6 +65,17 @@ namespace PckStudio.Forms.Editor
SetUpTree();
}
+ public MaterialsEditor()
+ {
+ InitializeComponent();
+
+ treeView1.ImageList = new ImageList();
+ ApplicationScope.EntityImages.ToList().ForEach(treeView1.ImageList.Images.Add);
+ treeView1.ImageList.ColorDepth = ColorDepth.Depth32Bit;
+
+ openToolStripMenuItem_Click(null, null);
+ }
+
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
if (e.Node == null) return;
@@ -125,9 +136,32 @@ namespace PckStudio.Forms.Editor
}
}
- var writer = new MaterialFileWriter(materialFile);
- writer.WriteToStream(stream);
- _file.SetData(stream.ToArray());
+ if (_file is null) // if external file is being edited
+ {
+ using (var sfd = new SaveFileDialog())
+ {
+ sfd.Filter = "behaviours.bin (Minecraft Behaviour File)|*.bin";
+ if (sfd.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ var writer = new MaterialFileWriter(materialFile);
+ writer.WriteToFile(sfd.FileName);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(this, $"Failed to save the selected file\nError: {ex.Message}", "Failed to save materials file");
+ }
+ }
+ else return;
+ }
+ }
+ else
+ {
+ var writer = new MaterialFileWriter(materialFile);
+ writer.WriteToStream(stream);
+ _file.SetData(stream.ToArray());
+ }
}
DialogResult = DialogResult.OK;
}
diff --git a/PCK-Studio/MainForm.Designer.cs b/PCK-Studio/MainForm.Designer.cs
index 7f4a8c98..6d6774aa 100644
--- a/PCK-Studio/MainForm.Designer.cs
+++ b/PCK-Studio/MainForm.Designer.cs
@@ -147,9 +147,10 @@
this.label11 = new MetroFramework.Controls.MetroLabel();
this.treeViewMain = new System.Windows.Forms.TreeView();
this.imageList = new System.Windows.Forms.ImageList(this.components);
- this.pictureBoxImagePreview = new PckStudio.PictureBoxWithInterpolationMode();
this.LittleEndianCheckBox = new MetroFramework.Controls.MetroCheckBox();
this.behavioursEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.pictureBoxImagePreview = new PckStudio.PictureBoxWithInterpolationMode();
+ this.entityMaterialsEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuPCKEntries.SuspendLayout();
this.menuStrip.SuspendLayout();
this.contextMenuMetaTree.SuspendLayout();
@@ -597,7 +598,8 @@
//
this.fileEditorsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.behavioursEditorToolStripMenuItem,
- this.cOLEditorToolStripMenuItem});
+ this.cOLEditorToolStripMenuItem,
+ this.entityMaterialsEditorToolStripMenuItem});
this.fileEditorsToolStripMenuItem.Name = "fileEditorsToolStripMenuItem";
resources.ApplyResources(this.fileEditorsToolStripMenuItem, "fileEditorsToolStripMenuItem");
//
@@ -1101,14 +1103,6 @@
resources.ApplyResources(this.imageList, "imageList");
this.imageList.TransparentColor = System.Drawing.Color.Transparent;
//
- // pictureBoxImagePreview
- //
- resources.ApplyResources(this.pictureBoxImagePreview, "pictureBoxImagePreview");
- this.pictureBoxImagePreview.BackColor = System.Drawing.Color.Transparent;
- this.pictureBoxImagePreview.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
- this.pictureBoxImagePreview.Name = "pictureBoxImagePreview";
- this.pictureBoxImagePreview.TabStop = false;
- //
// LittleEndianCheckBox
//
resources.ApplyResources(this.LittleEndianCheckBox, "LittleEndianCheckBox");
@@ -1124,6 +1118,20 @@
resources.ApplyResources(this.behavioursEditorToolStripMenuItem, "behavioursEditorToolStripMenuItem");
this.behavioursEditorToolStripMenuItem.Click += new System.EventHandler(this.behavioursEditorToolStripMenuItem_Click);
//
+ // pictureBoxImagePreview
+ //
+ resources.ApplyResources(this.pictureBoxImagePreview, "pictureBoxImagePreview");
+ this.pictureBoxImagePreview.BackColor = System.Drawing.Color.Transparent;
+ this.pictureBoxImagePreview.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
+ this.pictureBoxImagePreview.Name = "pictureBoxImagePreview";
+ this.pictureBoxImagePreview.TabStop = false;
+ //
+ // entityMaterialsEditorToolStripMenuItem
+ //
+ this.entityMaterialsEditorToolStripMenuItem.Name = "entityMaterialsEditorToolStripMenuItem";
+ resources.ApplyResources(this.entityMaterialsEditorToolStripMenuItem, "entityMaterialsEditorToolStripMenuItem");
+ this.entityMaterialsEditorToolStripMenuItem.Click += new System.EventHandler(this.entityMaterialsEditorToolStripMenuItem_Click);
+ //
// MainForm
//
this.ApplyImageInvert = true;
@@ -1282,6 +1290,7 @@
private System.Windows.Forms.ToolStripMenuItem fileEditorsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem cOLEditorToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem behavioursEditorToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem entityMaterialsEditorToolStripMenuItem;
}
}
diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs
index 6cb6c755..eabec810 100644
--- a/PCK-Studio/MainForm.cs
+++ b/PCK-Studio/MainForm.cs
@@ -2404,5 +2404,10 @@ namespace PckStudio
{
new BehaviourEditor().ShowDialog(this);
}
+
+ private void entityMaterialsEditorToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ new MaterialsEditor().ShowDialog(this);
+ }
}
}
\ No newline at end of file
diff --git a/PCK-Studio/MainForm.resx b/PCK-Studio/MainForm.resx
index 83d81a7e..2253326b 100644
--- a/PCK-Studio/MainForm.resx
+++ b/PCK-Studio/MainForm.resx
@@ -686,13 +686,13 @@
Open Pck Manager
- 180, 22
+ 145, 22
Wav -> Binka
- 180, 22
+ 145, 22
Binka -> Wav
@@ -704,17 +704,23 @@
Convert Music Files
- 180, 22
+ 189, 22
Behaviours Editor
- 180, 22
+ 189, 22
Colours Editor
+
+ 189, 22
+
+
+ Entity Materials Editor
+
195, 22
@@ -29689,6 +29695,12 @@
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ entityMaterialsEditorToolStripMenuItem
+
+
+ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
MainForm