From 5f2dbd1b565b0e03044a171bd482eaf3e4e6c9a1 Mon Sep 17 00:00:00 2001 From: KillzXGaming Date: Sat, 19 Oct 2019 14:58:13 -0400 Subject: [PATCH] Add fps counter to animation timeline and fix tick speed (layout editor) --- .../GUI/BFLYT/Editor/PaneEditor.resx | 3 ++ File_Format_Library/GUI/BFLYT/LayoutEditor.cs | 6 +-- .../Rewrite/AnimationPanel.Designer.cs | 37 +++++++++++++++++-- .../Forms/Animation/Rewrite/AnimationPanel.cs | 11 +++++- 4 files changed, 49 insertions(+), 8 deletions(-) diff --git a/File_Format_Library/GUI/BFLYT/Editor/PaneEditor.resx b/File_Format_Library/GUI/BFLYT/Editor/PaneEditor.resx index 7930f31b..3d8e968b 100644 --- a/File_Format_Library/GUI/BFLYT/Editor/PaneEditor.resx +++ b/File_Format_Library/GUI/BFLYT/Editor/PaneEditor.resx @@ -120,4 +120,7 @@ 17, 17 + + 17, 17 + \ No newline at end of file diff --git a/File_Format_Library/GUI/BFLYT/LayoutEditor.cs b/File_Format_Library/GUI/BFLYT/LayoutEditor.cs index 1c4c7863..b2eb99e4 100644 --- a/File_Format_Library/GUI/BFLYT/LayoutEditor.cs +++ b/File_Format_Library/GUI/BFLYT/LayoutEditor.cs @@ -661,9 +661,9 @@ namespace LayoutBXLYT } } else if (file is BFLAN) - { - - } + LoadBxlan(((BFLAN)file).BxlanHeader); + else if (file is BRLAN) + LoadBxlan(((BRLAN)file).BxlanHeader); else if (file is BNTX) { diff --git a/Switch_Toolbox_Library/Forms/Animation/Rewrite/AnimationPanel.Designer.cs b/Switch_Toolbox_Library/Forms/Animation/Rewrite/AnimationPanel.Designer.cs index 88419bd4..73e39ad8 100644 --- a/Switch_Toolbox_Library/Forms/Animation/Rewrite/AnimationPanel.Designer.cs +++ b/Switch_Toolbox_Library/Forms/Animation/Rewrite/AnimationPanel.Designer.cs @@ -30,6 +30,8 @@ { this.button2 = new System.Windows.Forms.Button(); this.panel1 = new System.Windows.Forms.Panel(); + this.stLabel1 = new Toolbox.Library.Forms.STLabel(); + this.frameSpeedUD = new System.Windows.Forms.NumericUpDown(); this.loopChkBox = new Toolbox.Library.Forms.STCheckBox(); this.totalFrame = new System.Windows.Forms.NumericUpDown(); this.currentFrameUpDown = new System.Windows.Forms.NumericUpDown(); @@ -37,6 +39,7 @@ this.stPanel1 = new Toolbox.Library.Forms.STPanel(); this.animationTrackBar = new Toolbox.Library.Forms.KeyedAnimTimeline(); this.panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.frameSpeedUD)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.totalFrame)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.currentFrameUpDown)).BeginInit(); this.SuspendLayout(); @@ -57,6 +60,8 @@ // panel1 // this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(45)))), ((int)(((byte)(45))))); + this.panel1.Controls.Add(this.stLabel1); + this.panel1.Controls.Add(this.frameSpeedUD); this.panel1.Controls.Add(this.loopChkBox); this.panel1.Controls.Add(this.totalFrame); this.panel1.Controls.Add(this.currentFrameUpDown); @@ -69,6 +74,26 @@ this.panel1.TabIndex = 4; this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); // + // stLabel1 + // + this.stLabel1.AutoSize = true; + this.stLabel1.Location = new System.Drawing.Point(114, 11); + this.stLabel1.Name = "stLabel1"; + this.stLabel1.Size = new System.Drawing.Size(27, 13); + this.stLabel1.TabIndex = 7; + this.stLabel1.Text = "FPS"; + // + // frameSpeedUD + // + this.frameSpeedUD.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.frameSpeedUD.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.frameSpeedUD.ForeColor = System.Drawing.Color.White; + this.frameSpeedUD.Location = new System.Drawing.Point(158, 9); + this.frameSpeedUD.Name = "frameSpeedUD"; + this.frameSpeedUD.Size = new System.Drawing.Size(87, 16); + this.frameSpeedUD.TabIndex = 6; + this.frameSpeedUD.ValueChanged += new System.EventHandler(this.frameSpeedUD_ValueChanged); + // // loopChkBox // this.loopChkBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -131,24 +156,25 @@ // // animationTrackBar // + this.animationTrackBar.ActiveAnimation = null; this.animationTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.animationTrackBar.CurrentFrame = 0; - this.animationTrackBar.FrameCount = 1000; + this.animationTrackBar.CurrentFrame = 0F; + this.animationTrackBar.FrameCount = 1002F; this.animationTrackBar.Location = new System.Drawing.Point(0, 14); this.animationTrackBar.Name = "animationTrackBar"; this.animationTrackBar.Size = new System.Drawing.Size(631, 149); this.animationTrackBar.TabIndex = 6; // - // AnimationPanel + // STAnimationPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.animationTrackBar); this.Controls.Add(this.stPanel1); this.Controls.Add(this.panel1); - this.Name = "AnimationPanel"; + this.Name = "STAnimationPanel"; this.Size = new System.Drawing.Size(631, 194); this.Load += new System.EventHandler(this.AnimationPanel_Load); this.Click += new System.EventHandler(this.AnimationPanel_Click); @@ -156,6 +182,7 @@ this.Leave += new System.EventHandler(this.AnimationPanel_Leave); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.frameSpeedUD)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.totalFrame)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.currentFrameUpDown)).EndInit(); this.ResumeLayout(false); @@ -171,5 +198,7 @@ private Forms.STPanel stPanel1; private Forms.STCheckBox loopChkBox; private Forms.KeyedAnimTimeline animationTrackBar; + private Forms.STLabel stLabel1; + private System.Windows.Forms.NumericUpDown frameSpeedUD; } } \ No newline at end of file diff --git a/Switch_Toolbox_Library/Forms/Animation/Rewrite/AnimationPanel.cs b/Switch_Toolbox_Library/Forms/Animation/Rewrite/AnimationPanel.cs index 15dd6e30..f3a63714 100644 --- a/Switch_Toolbox_Library/Forms/Animation/Rewrite/AnimationPanel.cs +++ b/Switch_Toolbox_Library/Forms/Animation/Rewrite/AnimationPanel.cs @@ -183,6 +183,10 @@ namespace Toolbox.Library currentFrameUpDown.ForeColor = FormThemes.BaseTheme.FormForeColor; currentFrameUpDown.BackColor = FormThemes.BaseTheme.FormBackColor; + frameSpeedUD.Minimum = 1; + frameSpeedUD.Value = 60; + frameSpeedUD.Maximum = 120; + SetupTimer(); this.LostFocus += new System.EventHandler(AnimationPanel_LostFocus); @@ -241,7 +245,7 @@ namespace Toolbox.Library { animationTimer = new Timer { - Interval = 100 / 60 + Interval = 1000 / 60 }; animationTimer.Tick += new EventHandler(animationTimer_Tick); } @@ -426,5 +430,10 @@ namespace Toolbox.Library { } + + private void frameSpeedUD_ValueChanged(object sender, EventArgs e) { + if (animationTimer != null) + animationTimer.Interval = (int)(1000 / frameSpeedUD.Value); + } } }