public static BooleanKeyGroup CreateBooleanTrack(AnimCurve animCurve) { BooleanKeyGroup track = new BooleanKeyGroup(); track.AnimDataOffset = animCurve.AnimDataOffset; track.Scale = animCurve.Scale; track.Offset = animCurve.Offset; track.StartFrame = animCurve.StartFrame; track.EndFrame = animCurve.EndFrame; track.Delta = animCurve.Delta; for (int i = 0; i < (ushort)animCurve.Frames.Length; i++) { switch (animCurve.CurveType) { case AnimCurveType.StepBool: //1 element are stored for step track.Keys.Add(new BooleanKeyFrame() { IsKeyed = true, InterType = InterpolationType.STEPBOOL, Frame = (int)animCurve.Frames[i], Visible = animCurve.KeyStepBoolData[i], }); break; default: throw new Exception("Unsupported anim type!"); } } return(track); }
private void btnAdd_Click(object sender, EventArgs e) { BoneVisListEditor editor = new BoneVisListEditor(); editor.LoadBones(activeFVIS.BoneNames); if (editor.ShowDialog() == DialogResult.OK) { activeFVIS.BoneNames = editor.GetNewBones(); foreach (string bone in activeFVIS.BoneNames) { bool HasBone = activeFVIS.Values.Any(x => x.Text == bone); if (!HasBone) { BooleanKeyGroup group = new BooleanKeyGroup(); group.Text = bone; group.Offset = 0; group.Scale = 0; group.Delta = 0; for (int frame = 0; frame <= activeFVIS.FrameCount; frame++) { group.Keys.Add(new BooleanKeyFrame() { Frame = frame, InterType = InterpolationType.STEPBOOL, Visible = false }); } activeFVIS.Values.Add(group); } } //If a keygroup exists not in the bonename, we need to remove it as it was removed from the list activeFVIS.Values.RemoveAll(x => !activeFVIS.BoneNames.Contains(x.Text)); UpdateBoneColumns(activeFVIS); UpdateFrameCells(activeFVIS); } }