1
0
mirror of synced 2025-02-24 22:15:20 +01:00
KillzXGaming 644d94090f A big layout editor update.
Added support for previewing layout animations.
This includes pane SRT, tex SRT, material color (white/black blending), texture patterns, pane visibilty, and vertex colors.
Added textbox previewing.  The scaling will be off, and more features is planned (caching font data to disk for faster loading, improve rendering, etc).
Rotations now render correctly for X/Y axis.
Added game window preview. This removes any editor only drawn objects and also fits the layout to the screen (aka root pane) size.
Add support for rendering custom blending with layout materials.
Add support for loading character icons for mk8d. These are hardcoded and have been manually set. Note these will only load if within the menu.szs.
2019-09-28 17:27:48 -04:00

72 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Toolbox.Library.Forms
{
class BoneAnimTimeline : TimeLine
{
int[] keyFrames = new int[] { 0, 5, 15, 20, 40, 100 };
protected static int lineHeight = TextRenderer.MeasureText("§", font).Height;
protected int scrollY = 0;
protected int trackCount = 30;
public BoneAnimTimeline()
{
margin = 100;
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.FillRectangle(brush3, new Rectangle(0, 0, margin, Height));
e.Graphics.SetClip(new Rectangle(0, barHeight, Width, Height - barHeight));
bool v = false;
int y = -scrollY;
for (int _i = 0; _i < trackCount; _i++)
{
e.Graphics.DrawString("bone" + _i, font, brush5, new Point(10, barHeight + y));
for (int i = 1; i < keyFrames.Length; i++)
{
int l = Math.Max(-20, (int)((
keyFrames[i - 1]
- frameLeft) * (Width - 40 - margin) / (frameRight - frameLeft)));
int r = (int)((
keyFrames[i]
- frameLeft) * (Width - 40 - margin) / (frameRight - frameLeft));
if (v = !v)
e.Graphics.FillRectangle(brush5, new Rectangle(l + margin + 20, barHeight + y, r - l, lineHeight));
}
y += lineHeight;
}
base.OnPaint(e);
}
protected override void OnMouseWheel(MouseEventArgs e)
{
if (e.X < margin)
{
scrollY = Math.Max(Math.Min(trackCount * lineHeight + barHeight - Height, scrollY - e.Delta / 2), 0);
Refresh();
}
else
base.OnMouseWheel(e);
}
protected override void OnResize(EventArgs e)
{
scrollY = Math.Max(Math.Min(trackCount * lineHeight + barHeight - Height, scrollY), 0);
base.OnResize(e);
}
}
}