1
0
mirror of synced 2024-09-24 19:48:21 +02:00

More fixes for bone transforms

This commit is contained in:
KillzXGaming 2019-05-07 21:55:24 -04:00
parent f86cb89716
commit f1e4124066
7 changed files with 30 additions and 3 deletions

Binary file not shown.

View File

@ -197,17 +197,17 @@ namespace FirstPlugin
if ((BoneFlagsRotation)rotModeCB.SelectedItem == BoneFlagsRotation.Quaternion)
{
activeBone.RotationType = STBone.BoneRotationType.Quaternion;
activeBone.ConvertToQuaternion();
SetBoneTransform(activeBone);
}
else
{
activeBone.RotationType = STBone.BoneRotationType.Euler;
activeBone.ConvertToEular();
SetBoneTransform(activeBone);
}
activeBone.skeletonParent.reset();
GetBoneTransform(activeBone);
LibraryGUI.Instance.UpdateViewport();
}
private void boneInfoPanel1_Load(object sender, EventArgs e)

View File

@ -52,6 +52,20 @@ namespace Switch_Toolbox.Library
return sca;
}
private void ApplyTransforms()
{
position = new float[] { pos.X, pos .Y, pos .Z};
if (RotationType == BoneRotationType.Quaternion)
rotation = new float[] { rot.X, rot.Y, rot.Z, rot.W };
else
{
var eul = Switch_Toolbox.Library.Animations.ANIM.quattoeul(rot);
rotation = new float[] { eul.X, eul.Y, eul.Z, 1 };
}
scale = new float[] { sca.X, sca.Y, sca.Z };
}
public int GetIndex()
{
if (skeletonParent != null)
@ -65,6 +79,13 @@ namespace Switch_Toolbox.Library
if (RotationType == BoneRotationType.Quaternion)
return;
RotationType = STBone.BoneRotationType.Quaternion;
//Update matrices
skeletonParent.reset();
skeletonParent.update();
ApplyTransforms();
}
public void ConvertToEular()
@ -72,7 +93,13 @@ namespace Switch_Toolbox.Library
if (RotationType == BoneRotationType.Euler)
return;
RotationType = STBone.BoneRotationType.Euler;
//Update matrices
skeletonParent.reset();
skeletonParent.update();
ApplyTransforms();
}
public override void OnClick(TreeView treeView)