mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-02 05:26:47 +00:00
Merge branch 'main' into 3dSkinRenderer
This commit is contained in:
@@ -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
|
||||
|
||||
27
PCK-Studio/Extensions/PictureBoxExtensions.cs
Normal file
27
PCK-Studio/Extensions/PictureBoxExtensions.cs
Normal file
@@ -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 });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
26
PCK-Studio/Extensions/TreeViewExtensions.cs
Normal file
26
PCK-Studio/Extensions/TreeViewExtensions.cs
Normal file
@@ -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<TreeNode>();
|
||||
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<TreeNode>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,12 +108,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)
|
||||
@@ -134,8 +134,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;
|
||||
}
|
||||
@@ -172,8 +172,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;
|
||||
}
|
||||
|
||||
1
PCK-Studio/MainForm.Designer.cs
generated
1
PCK-Studio/MainForm.Designer.cs
generated
@@ -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
|
||||
//
|
||||
|
||||
@@ -424,7 +424,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();
|
||||
@@ -441,9 +441,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];
|
||||
}
|
||||
@@ -2505,6 +2504,7 @@ namespace PckStudio
|
||||
|
||||
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
PckManager?.Close();
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
@@ -2644,5 +2644,11 @@ namespace PckStudio
|
||||
setFileTypeToolStripMenuItem.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void treeViewMain_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
|
||||
{
|
||||
if (e.Node is not null)
|
||||
treeViewMain.SelectedNode = e.Node;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,6 +135,8 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Extensions\MaterialContainerExtensions.cs" />
|
||||
<Compile Include="Extensions\PictureBoxExtensions.cs" />
|
||||
<Compile Include="Extensions\TreeViewExtensions.cs" />
|
||||
<Compile Include="Forms\Additional-Popups\FilterPrompt.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -777,14 +779,14 @@
|
||||
-->
|
||||
<Target Name="GetGitInfo" BeforeTargets="WriteGitInfo" Condition="'$(BuildHash)' == ''">
|
||||
<!-- write hash and branch to console.-->
|
||||
<Exec Condition="'$(Configuration)' == 'Debug'" Command="git -C $(ProjectDir) describe --always" ConsoleToMsBuild="true">
|
||||
<Exec Command="git -C $(ProjectDir) describe --always" ConsoleToMsBuild="true">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="GitHash" />
|
||||
</Exec>
|
||||
<Exec Command="git -C $(ProjectDir) branch --show-current" ConsoleToMsBuild="true">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="GitBranch" />
|
||||
</Exec>
|
||||
<PropertyGroup>
|
||||
<BuildHash Condition="'$(Configuration)' == 'Debug'">$(GitHash)</BuildHash>
|
||||
<BuildHash>$(GitHash)</BuildHash>
|
||||
<BuildBranch>$(GitBranch)</BuildBranch>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
@@ -799,7 +801,7 @@
|
||||
</ItemGroup>
|
||||
<!-- defines the AssemblyMetadata attribute that will be written -->
|
||||
<ItemGroup>
|
||||
<AssemblyAttributes Include="AssemblyMetadata" Condition="'$(Configuration)' == 'Debug'">
|
||||
<AssemblyAttributes Include="AssemblyMetadata">
|
||||
<_Parameter1>GitHash</_Parameter1>
|
||||
<_Parameter2>$(BuildHash)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user