1
0
mirror of synced 2024-11-15 03:27:38 +01:00
Switch-Toolbox/File_Format_Library/GUI/BFLYT/Animations/LytKeyPaneSRTPanel.cs
KillzXGaming a8e6d104f2 A few improvements.
Panes can now be selected and moved around.
Panes can be resized from corners or edges.
Improved hit detection for panes.
Mouse left click now selects and moves panes. Use middle mouse or hold shift + left mouse to pan/move camera.
More progress on timeline, but currently not functional so currently disabled atm.
Multiple layout animations can be selected and played at once. Goes to the highest amount of frames.
Start to impliment a parts manager. Will allow editing external layout and animation data, and saving back properly.
2019-10-05 13:25:28 -04:00

83 lines
3.3 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Toolbox.Library.Forms;
using Toolbox.Library.Animations;
namespace LayoutBXLYT
{
public partial class LytKeyPanePanel : LytAnimEditorKeyGUI
{
public LytKeyPanePanel()
{
InitializeComponent();
}
public void SetSRT(float frame, float startFrame, BasePane pane, List<STAnimGroup> groups)
{
foreach (var group in groups)
{
if (group is LytPaneSRTGroup)
{
SetValue(rotXUD, pane.Rotate.X, false);
SetValue(rotYUD, pane.Rotate.Y, false);
SetValue(rotZUD, pane.Rotate.Z, false);
SetValue(tranXUD, pane.Translate.X, false);
SetValue(tranYUD, pane.Translate.Y, false);
SetValue(tranZUD, pane.Translate.Z, false);
SetValue(scaleXUD, pane.Scale.X, false);
SetValue(scaleYUD, pane.Scale.Y, false);
SetValue(sizeXUD, pane.Width, false);
SetValue(sizeYUD, pane.Height, false);
for (int i = 0; i < 10; i++)
{
var track = ((LytPaneSRTGroup)group).GetTrack(i);
if (track.HasKeys)
{
float value = track.GetFrameValue(frame, startFrame);
bool keyed = track.IsKeyed(frame - startFrame);
Console.WriteLine($"SetSRT track {track.Name} {value}" + frame);
switch ((LPATarget)i)
{
case LPATarget.RotateX:
SetValue(rotXUD, value, keyed); break;
case LPATarget.RotateY:
SetValue(rotYUD, value, keyed); break;
case LPATarget.RotateZ:
SetValue(rotZUD, value, keyed); break;
case LPATarget.TranslateX:
SetValue(tranXUD, value, keyed); break;
case LPATarget.TranslateY:
SetValue(tranYUD, value, keyed); break;
case LPATarget.TranslateZ:
SetValue(tranZUD, value, keyed); break;
case LPATarget.ScaleX:
SetValue(scaleXUD, value, keyed); break;
case LPATarget.ScaleY:
SetValue(scaleYUD, value, keyed); break;
case LPATarget.SizeX:
SetValue(sizeXUD, value, keyed); break;
case LPATarget.SizeY:
SetValue(sizeYUD, value, keyed); break;
}
}
}
}
}
}
private void LytKeyPaneSRTPanel_Load(object sender, EventArgs e)
{
}
}
}