public static void GetSQT(DataGridView viewSRT, out Vector3 localScale, out Quaternion localRotation, out Vector3 localTranslation) { DataTable table = (DataTable)viewSRT.DataSource; Vector3[] srt = new Vector3[3]; for (int i = 0; i < 3; i++) { srt[0][i] = (float)table.Rows[2][i + 1]; srt[1][i] = (float)table.Rows[1][i + 1]; srt[2][i] = (float)table.Rows[0][i + 1]; } localTranslation = srt[2]; localRotation = FbxUtility.EulerToQuaternion(srt[1]); localScale = srt[0]; }
public void SetKeyframeRotation(xaAnimationTrack track, int keyframeIdx, object rotation) { xaAnimationKeyframe keyframe = track.KeyframeList[keyframeIdx]; if (((object[])rotation).Length == 3) { Vector3 rot = new Vector3((float)(double)((object[])rotation)[0], (float)(double)((object[])rotation)[1], (float)(double)((object[])rotation)[2]); keyframe.Rotation = FbxUtility.EulerToQuaternion(rot); } else if (((object[])rotation).Length == 4) { Quaternion rot = new Quaternion((float)(double)((object[])rotation)[0], (float)(double)((object[])rotation)[1], (float)(double)((object[])rotation)[2], (float)(double)((object[])rotation)[3]); keyframe.Rotation = rot; } else { throw new Exception("SetKeyframeRotation must be called with three or four arguments"); } Changed = true; }