Animation - Removed implicit frame to image operator

This commit is contained in:
miku-666
2023-03-29 19:40:53 +02:00
parent f0de26fc97
commit cc788d35cb
3 changed files with 4 additions and 11 deletions

View File

@@ -41,8 +41,6 @@ namespace PckStudio.Forms.Editor
public readonly Image Texture;
public int Ticks;
public static implicit operator Image(Frame f) => f.Texture;
public Frame(Image texture) : this(texture, MinimumFrameTime)
{ }
@@ -131,7 +129,7 @@ namespace PckStudio.Forms.Editor
{
StringBuilder stringBuilder = new StringBuilder(Interpolate ? "#" : string.Empty);
foreach (var frame in frames)
stringBuilder.Append($"{GetTextureIndex(frame)}*{frame.Ticks},");
stringBuilder.Append($"{GetTextureIndex(frame.Texture)}*{frame.Ticks},");
return stringBuilder.ToString(0, stringBuilder.Length - 1);
}

View File

@@ -265,14 +265,9 @@ namespace PckStudio.Forms.Editor
private void bulkAnimationSpeedToolStripMenuItem_Click(object sender, EventArgs e)
{
SetBulkSpeed diag = new SetBulkSpeed(frameTreeView);
if(diag.ShowDialog(this) == DialogResult.OK)
if (diag.ShowDialog(this) == DialogResult.OK)
{
var list = currentAnimation.GetFrames();
for (int i = 0; i < list.Count; i++)
{
Animation.Frame f = list[i];
currentAnimation.SetFrame(f, currentAnimation.GetTextureIndex(f), diag.time);
}
currentAnimation.GetFrames().ForEach(frame => frame.Ticks = diag.time);
LoadAnimationTreeView();
}
diag.Dispose();

View File

@@ -68,7 +68,7 @@ namespace PckStudio.Forms.Editor
{
Monitor.Enter(_animation);
Animation.Frame frame = _animation[frameIndex];
display.Image = frame;
display.Image = frame.Texture;
Monitor.Exit(_animation);
return frame;
}