diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index 0190dce6..68018288 100644 Binary files a/.vs/Switch_Toolbox/v15/.suo and b/.vs/Switch_Toolbox/v15/.suo differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide index b8cb3963..30e36db5 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal index cacb53b1..3bede88e 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal differ diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index aafe157e..89f710b5 100644 Binary files a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache and b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache index 489c1f40..a22eeafb 100644 Binary files a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache and b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache differ diff --git a/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.cs b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.cs index cde89d93..5d4565ce 100644 --- a/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.cs +++ b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.cs @@ -355,7 +355,7 @@ namespace Switch_Toolbox.Library.Forms { var message = MessageBox.Show("This texture has been edited! Would you like to apply the changes made?", "Texture Editor", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (message == DialogResult.Yes) - ApplyEdit(); + ApplyEdit(pictureBoxCustom1.Image); HasBeenEdited = false; } @@ -574,7 +574,7 @@ namespace Switch_Toolbox.Library.Forms HasBeenEdited = true; } - private void ApplyEdit() + private void ApplyEdit(Image Image) { STProgressBar progressBar = new STProgressBar(); progressBar.Task = "Applying Edits"; @@ -584,17 +584,13 @@ namespace Switch_Toolbox.Library.Forms progressBar.Show(); progressBar.Refresh(); - Image Image = pictureBoxCustom1.Image; - if (Image != null) - { - ActiveTexture.Width = (uint)Image.Width; - ActiveTexture.Height = (uint)Image.Height; + ActiveTexture.Width = (uint)Image.Width; + ActiveTexture.Height = (uint)Image.Height; - ActiveTexture.SetImageData(new Bitmap(Image), CurArrayDisplayLevel); + ActiveTexture.SetImageData(new Bitmap(Image), CurArrayDisplayLevel); - CurMipDisplayLevel = 0; - HasBeenEdited = false; - } + CurMipDisplayLevel = 0; + HasBeenEdited = false; if (ActiveTexture.EditedImages != null && ActiveTexture.EditedImages[CurArrayDisplayLevel] != null) { ActiveTexture.EditedImages[CurArrayDisplayLevel].bitmap.Dispose(); @@ -606,7 +602,8 @@ namespace Switch_Toolbox.Library.Forms private void saveBtn_Click(object sender, EventArgs e) { - ApplyEdit(); + if (pictureBoxCustom1.Image != null) + ApplyEdit(pictureBoxCustom1.Image); } private void ChannelBtn_Click(object sender, EventArgs e) @@ -912,14 +909,22 @@ namespace Switch_Toolbox.Library.Forms delegate () { UpdateEdit(image); - ApplyEdit(); + ApplyEdit(image); + + //Update the image with decoding as format could change + UpdateImage(ActiveTexture); })); } else { UpdateEdit(image); - ApplyEdit(); + ApplyEdit(image); + + //Update the image with decoding as format could change + UpdateImage(ActiveTexture); } + + propertiesEditor.UpdateProperties(); } private void generateMipmapsToolStripMenuItem_Click(object sender, EventArgs e) @@ -928,8 +933,9 @@ namespace Switch_Toolbox.Library.Forms if (Image != null) { HasBeenEdited = true; - //Applying edits will generate mip maps - ApplyEdit(); + + //Apply edits first to update mip map data + ApplyEdit(Image); UpdateEdit(Image); } }