diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index ca8dea72..5a870809 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 411ed153..ae8dc469 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-shm b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm index ae7080bd..a7a6aa4c 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal index 2e8f8f55..64740a4d 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/FileFormats/BFRES/Bfres Structs/SubFiles/FTEX.cs b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FTEX.cs index 5eee43ac..bfc608f8 100644 --- a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FTEX.cs +++ b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FTEX.cs @@ -690,7 +690,7 @@ namespace Bfres.Structs LibraryGUI.Instance.LoadEditor(editor); } editor.Text = Text; - editor.LoadProperties(this.texture, OnPropertyChanged); + editor.LoadProperties(this.texture); editor.LoadImage(this); if (texture.UserData != null) diff --git a/Switch_FileFormatsMain/FileFormats/Texture/BNTX.cs b/Switch_FileFormatsMain/FileFormats/Texture/BNTX.cs index a277e2ad..9adb1d17 100644 --- a/Switch_FileFormatsMain/FileFormats/Texture/BNTX.cs +++ b/Switch_FileFormatsMain/FileFormats/Texture/BNTX.cs @@ -967,8 +967,6 @@ namespace FirstPlugin public void UpdateEditor() { - OnPropertyChanged(); - if (Parent != null && Parent.Parent != null && Parent.Parent is BFRES) { ((BFRES)Parent.Parent).LoadEditors(this); @@ -996,7 +994,7 @@ namespace FirstPlugin editor.Text = Text; - editor.LoadProperties(Texture, OnPropertyChanged); + editor.LoadProperties(Texture); editor.LoadImage(this); } diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index 4f092cf0..7c7e57ef 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 374d66be..eb79d33a 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 42d74a96..2496497a 100644 --- a/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.cs +++ b/Switch_Toolbox_Library/Forms/Editors/ImageEditor/ImageEditorBase.cs @@ -84,7 +84,7 @@ namespace Switch_Toolbox.Library.Forms public bool CanModify = true; //Instead of disabling/enabling channels, this will only show the selected channel - public bool UseChannelToggle = false; + public bool UseChannelToggle = false; private bool hasBeenEdited = false; public bool HasBeenEdited @@ -191,9 +191,6 @@ namespace Switch_Toolbox.Library.Forms else HidePropertyGrid(false); - if (ShowChannelEditor) - LoadChannelEditor(null); - OnDataAcquiredEvent += new DataAcquired(ThreadReportsDataAquiredEvent); SetUpFileSystemWatcher(); @@ -338,11 +335,22 @@ namespace Switch_Toolbox.Library.Forms var image = ActiveTexture.GetBitmap(CurArrayDisplayLevel, CurMipDisplayLevel); + if (propertiesEditor.InvokeRequired) + { + propertiesEditor.Invoke(new MethodInvoker( + delegate () + { + LoadChannelEditor(image); + })); + } + else + { + LoadChannelEditor(image); + } + + if (image != null) { - if (ShowChannelEditor) - LoadChannelEditor(image); - if (ChannelIndex == 1) BitmapExtension.SetChannel(image, STChannelType.Red, STChannelType.Red, STChannelType.Red, STChannelType.One); else if (ChannelIndex == 2) @@ -362,9 +370,7 @@ namespace Switch_Toolbox.Library.Forms } else { - if (Runtime.ImageEditor.DisplayAlpha) - BitmapExtension.SetChannel(image, STChannelType.Red, STChannelType.Green, STChannelType.Blue, STChannelType.Alpha); - else + if (!Runtime.ImageEditor.DisplayAlpha) BitmapExtension.SetChannel(image, STChannelType.Red, STChannelType.Green, STChannelType.Blue, STChannelType.One); } } @@ -627,8 +633,8 @@ namespace Switch_Toolbox.Library.Forms private void UpdateEditCached(Image image) { - // ImageCache.Add(new Bitmap(image)); - UpdateEdit(image); + if (IsFinished) + UpdateEdit(image); } private void UpdateEdit(Image image) @@ -672,9 +678,10 @@ namespace Switch_Toolbox.Library.Forms CurMipDisplayLevel = 0; HasBeenEdited = false; - if (ActiveTexture.EditedImages != null && ActiveTexture.EditedImages[CurArrayDisplayLevel] != null) { - ActiveTexture.EditedImages[CurArrayDisplayLevel].bitmap.Dispose(); - ActiveTexture.EditedImages[CurArrayDisplayLevel] = null; + if (ActiveTexture.EditedImages != null && ActiveTexture.EditedImages[CurArrayDisplayLevel] != null) + { + ActiveTexture.EditedImages[CurArrayDisplayLevel].bitmap.Dispose(); + ActiveTexture.EditedImages[CurArrayDisplayLevel] = null; } progressBar.Value = 100; @@ -698,6 +705,8 @@ namespace Switch_Toolbox.Library.Forms private void reEncodeToolStripMenuItem_Click(object sender, EventArgs e) { + if (!IsFinished) + return; ImageReEncodeDialog encodingEditor = new ImageReEncodeDialog(); encodingEditor.LoadImage(pictureBoxCustom1.Image, ActiveTexture); @@ -712,6 +721,9 @@ namespace Switch_Toolbox.Library.Forms private void hueToolStripMenuItem_Click(object sender, EventArgs e) { + if (!IsFinished) + return; + HueSaturationAdjuster hsvEditor = new HueSaturationAdjuster(); hsvEditor.LoadBitmap(pictureBoxCustom1); @@ -722,6 +734,9 @@ namespace Switch_Toolbox.Library.Forms private void toggleAlphaChk_CheckedChanged(object sender, EventArgs e) { + if (!IsFinished) + return; + UpdatePictureBox(); } @@ -767,22 +782,26 @@ namespace Switch_Toolbox.Library.Forms { if (Hide) { - if (splitContainer1.Panel1.Controls.Contains(propertiesEditor)) { + if (splitContainer1.Panel1.Controls.Contains(propertiesEditor)) + { splitContainer1.Panel1Collapsed = true; splitContainer1.Panel1.Hide(); } - if (splitContainer1.Panel2.Controls.Contains(propertiesEditor)) { + if (splitContainer1.Panel2.Controls.Contains(propertiesEditor)) + { splitContainer1.Panel2Collapsed = true; splitContainer1.Panel2.Hide(); } } else { - if (splitContainer1.Panel1.Controls.Contains(propertiesEditor)) { + if (splitContainer1.Panel1.Controls.Contains(propertiesEditor)) + { splitContainer1.Panel1Collapsed = false; splitContainer1.Panel1.Show(); } - if (splitContainer1.Panel2.Controls.Contains(propertiesEditor)) { + if (splitContainer1.Panel2.Controls.Contains(propertiesEditor)) + { splitContainer1.Panel2Collapsed = false; splitContainer1.Panel2.Show(); } @@ -832,14 +851,15 @@ namespace Switch_Toolbox.Library.Forms } - private void editBtn_Click(object sender, EventArgs e) { + private void editBtn_Click(object sender, EventArgs e) + { EditInExternalProgram(); } private TEX_FORMAT FormatToChange = TEX_FORMAT.UNKNOWN; private void EditInExternalProgram(bool UseDefaultEditor = true) { - if (!ActiveTexture.CanEdit) + if (!ActiveTexture.CanEdit || !IsFinished) return; ImageProgramSettings settings = new ImageProgramSettings(); @@ -907,7 +927,7 @@ namespace Switch_Toolbox.Library.Forms } if (FileName.EndsWith(".dds")) - { + { DDS dds = new DDS(FileName); if (dds.Format != ActiveTexture.Format) DecodeTextureBack = true; @@ -967,15 +987,18 @@ namespace Switch_Toolbox.Library.Forms } } - private void copyImageToolStripMenuItem_Click(object sender, EventArgs e) { + private void copyImageToolStripMenuItem_Click(object sender, EventArgs e) + { Clipboard.SetImage(pictureBoxCustom1.Image); } - private void copyToolStripMenuItem_Click(object sender, EventArgs e) { + private void copyToolStripMenuItem_Click(object sender, EventArgs e) + { Clipboard.SetImage(pictureBoxCustom1.Image); } - private void editInExternalProgramToolStripMenuItem_Click(object sender, EventArgs e) { + private void editInExternalProgramToolStripMenuItem_Click(object sender, EventArgs e) + { EditInExternalProgram(); } @@ -1033,7 +1056,7 @@ namespace Switch_Toolbox.Library.Forms else displayAlphaToolStripMenuItem.Checked = true; - SetAlphaEnableUI(displayAlphaToolStripMenuItem.Checked ); + SetAlphaEnableUI(displayAlphaToolStripMenuItem.Checked); Runtime.ImageEditor.DisplayAlpha = displayAlphaToolStripMenuItem.Checked; UpdateMipDisplay(); @@ -1047,11 +1070,13 @@ namespace Switch_Toolbox.Library.Forms alphaBtn.BackgroundImage = Properties.Resources.AlphaIconDisabled; } - private void displayAlphaToolStripMenuItem_Click(object sender, EventArgs e) { + private void displayAlphaToolStripMenuItem_Click(object sender, EventArgs e) + { UpdateAlphaEnable(); } - private void alphaBtn_Click(object sender, EventArgs e) { + private void alphaBtn_Click(object sender, EventArgs e) + { UpdateAlphaEnable(); } } diff --git a/Switch_Toolbox_Library/Forms/Editors/ObjectEditor.cs b/Switch_Toolbox_Library/Forms/Editors/ObjectEditor.cs index a548d2aa..fcfde79e 100644 --- a/Switch_Toolbox_Library/Forms/Editors/ObjectEditor.cs +++ b/Switch_Toolbox_Library/Forms/Editors/ObjectEditor.cs @@ -186,7 +186,7 @@ namespace Switch_Toolbox.Library.Forms { //Check if the object was previously selected //This will disable selection view and other things - if (RenderedObjectWasSelected == true) + if (RenderedObjectWasSelected) { LibraryGUI.Instance.UpdateViewport(); RenderedObjectWasSelected = false;