From 2be8627ad1417682252223dd543bcf2a0b3d06be Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Sun, 23 Jun 2024 12:54:59 +0200 Subject: [PATCH 1/7] MainForm - Fix error when closing via file menu --- PCK-Studio/MainForm.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index f8810bbc..dc877551 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -2491,6 +2491,7 @@ namespace PckStudio private void exitToolStripMenuItem_Click(object sender, EventArgs e) { + PckManager?.Close(); Application.Exit(); } From 4ce300d7bee84afa7830c0a9f43bca342f7347c8 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:08:46 +0200 Subject: [PATCH 2/7] Fix Branch information not showing in release(#35) --- PCK-Studio/PckStudio.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj index b8f65959..5c6c2dc5 100644 --- a/PCK-Studio/PckStudio.csproj +++ b/PCK-Studio/PckStudio.csproj @@ -738,14 +738,14 @@ --> - + - $(GitHash) + $(GitHash) $(GitBranch) @@ -760,7 +760,7 @@ - + <_Parameter1>GitHash <_Parameter2>$(BuildHash) From 3b884901a1d6c8141e6e3781a30b364e94d170d4 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:25:57 +0200 Subject: [PATCH 3/7] AddNEwSkin - Fix context menu location(#33) --- PCK-Studio/Forms/Skins-And-Textures/AddNewSkin.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PCK-Studio/Forms/Skins-And-Textures/AddNewSkin.cs b/PCK-Studio/Forms/Skins-And-Textures/AddNewSkin.cs index 4dc93f1e..def7994e 100644 --- a/PCK-Studio/Forms/Skins-And-Textures/AddNewSkin.cs +++ b/PCK-Studio/Forms/Skins-And-Textures/AddNewSkin.cs @@ -145,12 +145,12 @@ namespace PckStudio.Popups private void buttonSkin_Click(object sender, EventArgs e) { - contextMenuSkin.Show(this, Location.X + buttonSkin.Location.X + 2, Location.Y + buttonSkin.Location.Y + buttonSkin.Size.Height); + contextMenuSkin.Show(this, buttonSkin.Location.X + 2, buttonSkin.Location.Y + buttonSkin.Size.Height); } private void buttonCape_Click(object sender, EventArgs e) { - contextMenuCape.Show(this, Location.X + buttonCape.Location.X + 2, Location.Y + buttonCape.Location.Y + buttonCape.Size.Height); + contextMenuCape.Show(this, buttonCape.Location.X + 2, buttonCape.Location.Y + buttonCape.Size.Height); } private void replaceToolStripMenuItem_Click(object sender, EventArgs e) @@ -171,8 +171,8 @@ namespace PckStudio.Popups { contextMenuSkin.Show( this, - x: Location.X + skinPictureBox.Location.X, - y: Location.Y + skinPictureBox.Location.Y + skinPictureBox.Size.Height + x: skinPictureBox.Location.X, + y: skinPictureBox.Location.Y + skinPictureBox.Size.Height ); return; } @@ -207,8 +207,8 @@ namespace PckStudio.Popups { contextMenuCape.Show( this, - x: Location.X + capePictureBox.Location.X, - y: Location.Y + capePictureBox.Location.Y + capePictureBox.Size.Height + x: capePictureBox.Location.X, + y: capePictureBox.Location.Y + capePictureBox.Size.Height ); return; } From 795ad9f9d129a6dc99f1d66c8e3ff5a9f99e2336 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Mon, 24 Jun 2024 18:44:37 +0200 Subject: [PATCH 4/7] Update Changelog(#37) --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 479a737d..bff7e3c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,5 @@ -7.0 (IN DEVELOPMENT) +7.0.0.0 ==================== -Some features may be completely missing or incomplete at this point in time! -Added .3dst (3DS Texture) support -Semi-added Sub-Pck editing From d620759de8d1094710f3fea9f152f2ca6e752770 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Mon, 24 Jun 2024 19:10:35 +0200 Subject: [PATCH 5/7] Fix main treeview selecting wrong asset after rebuild(#36) --- PCK-Studio/Extensions/TreeViewExtensions.cs | 26 +++++++++++++++++++++ PCK-Studio/MainForm.cs | 7 +++--- PCK-Studio/PckStudio.csproj | 1 + 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 PCK-Studio/Extensions/TreeViewExtensions.cs diff --git a/PCK-Studio/Extensions/TreeViewExtensions.cs b/PCK-Studio/Extensions/TreeViewExtensions.cs new file mode 100644 index 00000000..61583041 --- /dev/null +++ b/PCK-Studio/Extensions/TreeViewExtensions.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using PckStudio.Internal.App; + +namespace PckStudio.Extensions +{ + internal static class TreeViewExtensions + { + public static TreeNode[] FindPath(this TreeView treeView, string path) + { + if (string.IsNullOrWhiteSpace(path)) + return Array.Empty(); + string segment = path.Substring(0, path.IndexOf(treeView.PathSeparator)); + if (treeView.Nodes.ContainsKey(segment)) + { + var res = treeView.Nodes[segment].GetChildNodes().Where(node => node.FullPath == path).ToArray(); + return res; + } + return Array.Empty(); + } + } +} diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index dc877551..cd201ba7 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -423,7 +423,7 @@ namespace PckStudio private void BuildMainTreeView() { // In case the Rename function was just used and the selected node name no longer matches the file name - string selectedNodeText = treeViewMain.SelectedNode is TreeNode node ? node.Text : string.Empty; + string selectedNodeText = treeViewMain.SelectedNode is TreeNode node ? node.FullPath : string.Empty; previewPictureBox.Image = Resources.NoImageFound; treeMeta.Nodes.Clear(); treeViewMain.Nodes.Clear(); @@ -440,9 +440,8 @@ namespace PckStudio } treeViewMain.Sort(); - TreeNode[] selectedNodes; - if (!string.IsNullOrEmpty(selectedNodeText) && - (selectedNodes = treeViewMain.Nodes.Find(selectedNodeText, true)).Length > 0) + TreeNode[] selectedNodes = treeViewMain.FindPath(selectedNodeText); + if (selectedNodes.Length > 0) { treeViewMain.SelectedNode = selectedNodes[0]; } diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj index 5c6c2dc5..49985dfc 100644 --- a/PCK-Studio/PckStudio.csproj +++ b/PCK-Studio/PckStudio.csproj @@ -134,6 +134,7 @@ + Form From 4c41504a0b76113ba26b84c982993b78a6b05bad Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Mon, 24 Jun 2024 19:26:59 +0200 Subject: [PATCH 6/7] Fix right click issue on main treeview(#34) --- PCK-Studio/MainForm.Designer.cs | 1 + PCK-Studio/MainForm.cs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/PCK-Studio/MainForm.Designer.cs b/PCK-Studio/MainForm.Designer.cs index eb75cbbe..8c9e1cd4 100644 --- a/PCK-Studio/MainForm.Designer.cs +++ b/PCK-Studio/MainForm.Designer.cs @@ -1122,6 +1122,7 @@ this.treeViewMain.DragOver += new System.Windows.Forms.DragEventHandler(this.treeViewMain_DragOver); this.treeViewMain.DoubleClick += new System.EventHandler(this.treeViewMain_DoubleClick); this.treeViewMain.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeViewMain_KeyDown); + this.treeViewMain.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeViewMain_NodeMouseClick); // // imageList // diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index cd201ba7..b376b921 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -2630,5 +2630,11 @@ namespace PckStudio setFileTypeToolStripMenuItem.Visible = false; } } + + private void treeViewMain_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + if (e.Node is not null) + treeViewMain.SelectedNode = e.Node; + } } } \ No newline at end of file From d5ba7e1fdb9ef3c1a844d7d34bbeda9a74a05064 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Tue, 25 Jun 2024 17:37:22 +0200 Subject: [PATCH 7/7] AnimationPictureBox - Fix animation starting when resizong --- PCK-Studio/Extensions/PictureBoxExtensions.cs | 27 +++++++++++++++++++ PCK-Studio/PckStudio.csproj | 1 + .../ToolboxItems/AnimationPictureBox.cs | 23 ++++++++-------- 3 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 PCK-Studio/Extensions/PictureBoxExtensions.cs diff --git a/PCK-Studio/Extensions/PictureBoxExtensions.cs b/PCK-Studio/Extensions/PictureBoxExtensions.cs new file mode 100644 index 00000000..e26446da --- /dev/null +++ b/PCK-Studio/Extensions/PictureBoxExtensions.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace PckStudio.Extensions +{ + internal static class PictureBoxExtensions + { + public static bool IsAnimating(this PictureBox pictureBox) + { + var fi = typeof(PictureBox).GetField("currentlyAnimating", BindingFlags.NonPublic | BindingFlags.Instance); + return (bool)fi.GetValue(pictureBox); + } + + public static void Animate(this PictureBox pictureBox, bool animate) + { + var animateMethod = typeof(PictureBox).GetMethod("Animate", BindingFlags.NonPublic | BindingFlags.Instance, + null, new Type[] { typeof(bool) }, null); + animateMethod.Invoke(pictureBox, new object[] { animate }); + } + + } +} diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj index 49985dfc..3e9d2105 100644 --- a/PCK-Studio/PckStudio.csproj +++ b/PCK-Studio/PckStudio.csproj @@ -134,6 +134,7 @@ + Form diff --git a/PCK-Studio/ToolboxItems/AnimationPictureBox.cs b/PCK-Studio/ToolboxItems/AnimationPictureBox.cs index 580cd49f..196b19e1 100644 --- a/PCK-Studio/ToolboxItems/AnimationPictureBox.cs +++ b/PCK-Studio/ToolboxItems/AnimationPictureBox.cs @@ -34,37 +34,38 @@ namespace PckStudio.ToolboxItems private bool _isPlaying; - private void PictureBox_Internal_Animate(PictureBox pictureBox, bool animate) - { - var animateMethod = typeof(PictureBox).GetMethod("Animate", - System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, - null, new Type[] { typeof(bool) }, null); - animateMethod.Invoke(pictureBox, new object[] { animate }); - } - public new Image Image { get => base.Image; set { base.Image = value; - PictureBox_Internal_Animate(this, false); + this.Animate(false); if (value is null) return; value.SelectActiveFrame(new FrameDimension(value.FrameDimensionsList[0]), 0); } } + protected override void OnPaint(PaintEventArgs paintEventArgs) + { + base.OnPaint(paintEventArgs); + if (!_isPlaying && this.IsAnimating()) + { + Stop(); + } + } + public void Start() { _isPlaying = true; - PictureBox_Internal_Animate(this, _isPlaying); + this.Animate(_isPlaying); } public void Stop() { _isPlaying = false; - PictureBox_Internal_Animate(this, _isPlaying); + this.Animate(_isPlaying); } protected override void Dispose(bool disposing)