Files
PCK-Studio/MinecraftUSkinEditor/Forms/Utilities/Animation/SetBulkSpeed.cs
MattNL 9e31eb847c Animation Editor and small adjustments
-Added an Animation Editor for textures in the "textures/blocks" and "textures/items" folders (besides the clock and compass) and an "EDIT TEXTURE ANIMATION" button.
-Within the animation editor, there is a "Set Bulk Animation Speed" function that sets the entire animation to a set frame speed.
-Improved the drag and drop function.
-Changed some pop up dialogs to child dialogs to prevent multiple extra windows.
-Changed the "EDIT AUDIO" button text to "EDIT MUSIC CUES" to describe the Audio.pck functions more accurately.
-Changed the main tree's double click event to a NodeMouseDoubleClick event to prevent a rare crash and optimize that event's code.
-Adjusted the max display size for large images so that the meta tree would no longer be blocked.
2022-04-19 18:05:55 -04:00

61 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MetroFramework.Forms;
using System.Windows.Forms;
namespace PckStudio.Forms.Utilities.AnimationEditor
{
public partial class SetBulkSpeed : MetroForm
{
TreeView tv;
public SetBulkSpeed(TreeView treeView)
{
tv = treeView;
InitializeComponent();
label3.Text = "Frame Time must be greater than 0.";
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
{
e.Handled = true;
}
}
private void button1_Click(object sender, EventArgs e)
{
if(metroTextBox2.Text == "") {}
else if(Int16.Parse(metroTextBox2.Text) < 0) {}
else
{
int i = 0;
foreach (TreeNode nodes in tv.Nodes)
{
Tuple<string, string> frameData = nodes.Tag as Tuple<string, string>;
tv.Nodes.RemoveAt(i);
TreeNode frameNode = new TreeNode();
Tuple<string, string> finalFrameData = new Tuple<string, string>(frameData.Item1, metroTextBox2.Text);
frameNode.Tag = finalFrameData;
frameNode.Text = "Frame: " + frameData.Item1 + ", Frame Time: " + metroTextBox2.Text;
tv.Nodes.Insert(i, frameNode);
i++;
}
this.Close();
}
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
}
}