More fixes for bone transforms
This commit is contained in:
parent
f86cb89716
commit
f1e4124066
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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)
|
||||
|
Binary file not shown.
Binary file not shown.
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user