Fix layout animation saving
This commit is contained in:
parent
7298c0e6a8
commit
12558f5ba0
@ -181,9 +181,11 @@ namespace LayoutBXLYT.Cafe
|
||||
{
|
||||
foreach (var file in IFileInfo.ArchiveParent.Files)
|
||||
{
|
||||
if (Utils.GetExtension(file.FileName) == ".bflan")
|
||||
if (Utils.GetExtension(file.FileName) == ".bflan" && file.FileFormat == null)
|
||||
{
|
||||
BFLAN bflan = (BFLAN)file.OpenFile();
|
||||
file.FileFormat = bflan;
|
||||
bflan.IFileInfo.ArchiveParent = IFileInfo.ArchiveParent;
|
||||
|
||||
//Disable saving unless the file gets edited
|
||||
//Prevents broken files if version is unsupported
|
||||
|
@ -75,6 +75,7 @@
|
||||
this.stLabel2 = new Toolbox.Library.Forms.STLabel();
|
||||
this.editorModeCB = new Toolbox.Library.Forms.STComboBox();
|
||||
this.chkAutoKey = new Toolbox.Library.Forms.STCheckBox();
|
||||
this.saveWorkspaceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.backColorDisplay)).BeginInit();
|
||||
this.stToolStrip1.SuspendLayout();
|
||||
this.stMenuStrip1.SuspendLayout();
|
||||
@ -190,43 +191,45 @@
|
||||
this.clearWorkspaceToolStripMenuItem,
|
||||
this.saveToolStripMenuItem1,
|
||||
this.saveAnimationToolStripMenuItem,
|
||||
this.saveToolStripMenuItem});
|
||||
this.saveToolStripMenuItem,
|
||||
this.saveWorkspaceToolStripMenuItem});
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||
this.fileToolStripMenuItem.Text = "File";
|
||||
this.fileToolStripMenuItem.Click += new System.EventHandler(this.fileToolStripMenuItem_Click);
|
||||
//
|
||||
// openToolStripMenuItem
|
||||
//
|
||||
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
|
||||
this.openToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
|
||||
this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.openToolStripMenuItem.Text = "Open";
|
||||
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
|
||||
//
|
||||
// clearWorkspaceToolStripMenuItem
|
||||
//
|
||||
this.clearWorkspaceToolStripMenuItem.Name = "clearWorkspaceToolStripMenuItem";
|
||||
this.clearWorkspaceToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
|
||||
this.clearWorkspaceToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.clearWorkspaceToolStripMenuItem.Text = "Clear Files";
|
||||
this.clearWorkspaceToolStripMenuItem.Click += new System.EventHandler(this.clearWorkspaceToolStripMenuItem_Click);
|
||||
//
|
||||
// saveToolStripMenuItem1
|
||||
//
|
||||
this.saveToolStripMenuItem1.Name = "saveToolStripMenuItem1";
|
||||
this.saveToolStripMenuItem1.Size = new System.Drawing.Size(157, 22);
|
||||
this.saveToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
|
||||
this.saveToolStripMenuItem1.Text = "Save Layout";
|
||||
this.saveToolStripMenuItem1.Click += new System.EventHandler(this.saveToolStripMenuItem1_Click);
|
||||
//
|
||||
// saveAnimationToolStripMenuItem
|
||||
//
|
||||
this.saveAnimationToolStripMenuItem.Name = "saveAnimationToolStripMenuItem";
|
||||
this.saveAnimationToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
|
||||
this.saveAnimationToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.saveAnimationToolStripMenuItem.Text = "Save Animation";
|
||||
this.saveAnimationToolStripMenuItem.Click += new System.EventHandler(this.saveAnimationToolStripMenuItem_Click);
|
||||
//
|
||||
// saveToolStripMenuItem
|
||||
//
|
||||
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||
this.saveToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
|
||||
this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.saveToolStripMenuItem.Text = "Save As";
|
||||
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
|
||||
//
|
||||
@ -510,6 +513,13 @@
|
||||
this.chkAutoKey.Text = "Auto Key";
|
||||
this.chkAutoKey.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// saveWorkspaceToolStripMenuItem
|
||||
//
|
||||
this.saveWorkspaceToolStripMenuItem.Name = "saveWorkspaceToolStripMenuItem";
|
||||
this.saveWorkspaceToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.saveWorkspaceToolStripMenuItem.Text = "Save Workspace";
|
||||
this.saveWorkspaceToolStripMenuItem.Click += new System.EventHandler(this.saveWorkspaceToolStripMenuItem_Click);
|
||||
//
|
||||
// LayoutEditor
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
@ -592,5 +602,6 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem showTextureListToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem showAnimationListToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem showPanelHiearchyToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem saveWorkspaceToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
@ -408,6 +408,10 @@ namespace LayoutBXLYT
|
||||
{
|
||||
var archiveNode = node.Tag as ArchiveFileInfo;
|
||||
var fileFormat = archiveNode.OpenFile();
|
||||
if (archiveNode.FileWrapper != null)
|
||||
fileFormat.IFileInfo.ArchiveParent = archiveNode.FileWrapper.ArchiveFile;
|
||||
|
||||
archiveNode.FileFormat = fileFormat;
|
||||
|
||||
//Update the tag so this doesn't run again
|
||||
node.Tag = "Expanded";
|
||||
@ -880,8 +884,8 @@ namespace LayoutBXLYT
|
||||
}
|
||||
|
||||
private void saveAnimationToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
if (ActiveAnimation != null)
|
||||
SaveActiveFile(ActiveAnimation.FileInfo);
|
||||
foreach (var anim in AnimationFiles)
|
||||
SaveActiveFile(anim.FileInfo);
|
||||
}
|
||||
|
||||
private void SaveActiveFile(IFileFormat fileFormat, bool ForceDialog = false)
|
||||
@ -1299,5 +1303,15 @@ namespace LayoutBXLYT
|
||||
private void dockPanel1_ContentRemoved(object sender, DockContentEventArgs e) {
|
||||
UpdateMenuBar();
|
||||
}
|
||||
|
||||
private void fileToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void saveWorkspaceToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,12 +23,22 @@ namespace Toolbox.Library.Animations
|
||||
return Result;
|
||||
}
|
||||
|
||||
public static float HermiteInterpolate(float frame, float frame1, float frame2,
|
||||
public static float BezierInterpolate(float frame, float frame1, float frame2,
|
||||
float inSlope, float outSlope, float p0, float p1)
|
||||
{
|
||||
if (frame == frame1) return p0;
|
||||
if (frame == frame2) return p1;
|
||||
|
||||
float t = (frame - frame1) / (frame2 - frame1);
|
||||
return GetPointBezier(p0, p1, outSlope, inSlope, t);
|
||||
}
|
||||
|
||||
public static float HermiteInterpolate(float frame, float frame1, float frame2,
|
||||
float inSlope, float outSlope, float p0, float p1)
|
||||
{
|
||||
if (frame == frame1) return p0;
|
||||
if (frame == frame2) return p1;
|
||||
|
||||
float t = (frame - frame1) / (frame2 - frame1);
|
||||
return GetPointHermite(p0, p1, outSlope, inSlope, t);
|
||||
}
|
||||
@ -41,6 +51,14 @@ namespace Toolbox.Library.Animations
|
||||
return GetPointCubic(cf0, cf1, cf2, cf3, t);
|
||||
}
|
||||
|
||||
private static float GetPointBezier(float p0, float p1, float p2, float p3, float t) {
|
||||
float cf0 = (p0 * -1) + (p1 * 3) + (p2 * -3) + (p3 * 1);
|
||||
float cf1 = (p0 * 3) + (p1 * -6) + (p2 * 3) + (p3 * 0);
|
||||
float cf2 = (p0 * -3) + (p1 * 3) + (p2 * 0) + (p3 * 0);
|
||||
float cf3 = (p0 * 1) + (p1 * 0) + (p2 * 0) + (p3 * 0);
|
||||
return GetPointCubic(cf0, cf1, cf2, cf3, t);
|
||||
}
|
||||
|
||||
private static float GetPointCubic(float cf0, float cf1, float cf2, float cf3, float t) {
|
||||
return (((cf0 * t + cf1) * t + cf2) * t + cf3);
|
||||
}
|
||||
|
@ -12,6 +12,8 @@ namespace Toolbox.Library.Animations
|
||||
Step,
|
||||
Linear,
|
||||
Hermite,
|
||||
Bezier,
|
||||
Bitmap,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -26,6 +26,12 @@ namespace Toolbox.Library.Animations
|
||||
}
|
||||
}
|
||||
|
||||
public class STBezierKeyFrame : STKeyFrame
|
||||
{
|
||||
public float SlopeIn;
|
||||
public float SlopeOut;
|
||||
}
|
||||
|
||||
public class STHermiteCubicKeyFrame : STHermiteKeyFrame
|
||||
{
|
||||
public float Coef0 { get; set; }
|
||||
|
@ -373,7 +373,7 @@ namespace Toolbox.Library
|
||||
|
||||
foreach (var anim in currentAnimations)
|
||||
{
|
||||
if (frameNum > anim.FrameCount)
|
||||
if (frameNum < anim.StartFrame || frameNum > anim.FrameCount)
|
||||
continue;
|
||||
|
||||
float animFrameNum = frameNum;
|
||||
|
Loading…
x
Reference in New Issue
Block a user