1
0
mirror of synced 2024-12-11 15:25:59 +01:00
Switch-Toolbox/Switch_FileFormatsMain/GUI/BFRES/BfresBoneEditor.cs

77 lines
2.5 KiB
C#
Raw Normal View History

2018-11-12 02:51:12 +01:00
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 Switch_Toolbox.Library;
2018-11-17 23:33:00 +01:00
using Bfres.Structs;
2018-11-12 02:51:12 +01:00
namespace FirstPlugin
{
public partial class BfresBoneEditor : UserControl
{
public BfresBoneEditor()
{
InitializeComponent();
foreach (var type in Enum.GetValues(typeof(STBone.BoneRotationType)).Cast<STBone.BoneRotationType>())
rotModeCB.Items.Add(type);
rotMeasureCB.SelectedIndex = 1;
}
2018-11-17 23:33:00 +01:00
BfresBone activeBone;
public void LoadBone(BfresBone bone)
2018-11-12 02:51:12 +01:00
{
activeBone = bone;
if (bone.Parent == null)
parentUD.Value = bone.parentIndex;
else
parentUD.Value = -1;
billboardIDUD.Value = bone.BillboardIndex;
rotModeCB.SelectedIndex = (int)bone.boneRotationType;
chkboxVisible.Checked = bone.IsVisible;
textBoxName.Text = bone.Text;
transXUD.Value = (decimal)bone.position[0];
transYUD.Value = (decimal)bone.position[1];
transZUD.Value = (decimal)bone.position[2];
rotUDX.Value = (decimal)bone.rotation[0];
rotUDY.Value = (decimal)bone.rotation[1];
rotUDZ.Value = (decimal)bone.rotation[2];
scaleUDX.Value = (decimal)bone.scale[0];
scaleUDY.Value = (decimal)bone.scale[1];
scaleUDZ.Value = (decimal)bone.scale[2];
}
private void rotMeasureCB_SelectedIndexChanged(object sender, EventArgs e)
{
if (activeBone == null)
return;
if (rotMeasureCB.SelectedIndex == 0)
{
rotUDX.Value = (decimal)OpenTK.MathHelper.RadiansToDegrees(activeBone.rotation[0]);
rotUDY.Value = (decimal)OpenTK.MathHelper.RadiansToDegrees(activeBone.rotation[1]);
rotUDZ.Value = (decimal)OpenTK.MathHelper.RadiansToDegrees(activeBone.rotation[2]);
}
else if (rotMeasureCB.SelectedIndex == 1)
{
rotUDX.Value = (decimal)activeBone.rotation[0];
rotUDY.Value = (decimal)activeBone.rotation[1];
rotUDZ.Value = (decimal)activeBone.rotation[2];
}
}
private void valueUD_ValueChanged(object sender, EventArgs e)
{
Viewport.Instance.UpdateViewport();
}
}
}