public void initializeKeyframeWrappers() { KeyframeControls = new CinemaKeyframeWrapper[curve.length]; for (int i = 0; i < curve.length; i++) { KeyframeControls[i] = new CinemaKeyframeWrapper(this, curve[i]); } }
public int MoveKey(int index, Keyframe kf) { int num = this.curve.MoveKey(index, kf); CinemaKeyframeWrapper wrapper = this.KeyframeControls[index]; this.KeyframeControls[index] = this.KeyframeControls[num]; this.KeyframeControls[num] = wrapper; if (this.IsAuto(num)) { this.SmoothTangents(num, 0f); } if (this.IsBroken(num)) { if (this.IsLeftLinear(num)) { this.SetKeyLeftLinear(num); } if (this.IsRightLinear(num)) { this.SetKeyRightLinear(num); } } if (index > 0) { if (this.IsAuto(index - 1)) { this.SmoothTangents(index - 1, 0f); } if (this.IsBroken(index - 1) && this.IsRightLinear(index - 1)) { this.SetKeyRightLinear(index - 1); } } if (index < (this.curve.length - 1)) { if (this.IsAuto(index + 1)) { this.SmoothTangents(index + 1, 0f); } if (this.IsBroken(index + 1) && this.IsLeftLinear(index + 1)) { this.SetKeyLeftLinear(index + 1); } } return(num); }
public int MoveKey(int index, Keyframe kf) { int num = -1; if (index == 0 && curve.keys.Length > 1) { Keyframe key1 = curve.keys[1]; if (key1.time < kf.time) { index = 1; curve.RemoveKey(0); num = curve.AddKey(kf); } else { num = curve.MoveKey(index, kf); } } else if (index == curve.keys.Length - 1) { Keyframe key1 = curve.keys[index - 1]; if (key1.time > kf.time) { index = index - 1; curve.RemoveKey(index); num = curve.AddKey(kf); } else { num = curve.MoveKey(index, kf); } } else { num = curve.MoveKey(index, kf); } if (num < 0) { return(num); } CinemaKeyframeWrapper cinemaKeyframeWrapper = KeyframeControls[index]; CinemaKeyframeWrapper cinemaKeyframeWrapper2 = KeyframeControls[num]; KeyframeControls[index] = cinemaKeyframeWrapper2; KeyframeControls[num] = cinemaKeyframeWrapper; if (IsAuto(num)) { SmoothTangents(num, 0f); } if (IsBroken(num)) { if (this.IsLeftLinear(num)) { this.SetKeyLeftLinear(num); } if (this.IsRightLinear(num)) { this.SetKeyRightLinear(num); } } if (index > 0) { if (this.IsAuto(index - 1)) { this.SmoothTangents(index - 1, 0f); } if (this.IsBroken(index - 1) && this.IsRightLinear(index - 1)) { this.SetKeyRightLinear(index - 1); } } if (index < this.curve.length - 1) { if (this.IsAuto(index + 1)) { this.SmoothTangents(index + 1, 0f); } if (this.IsBroken(index + 1) && this.IsLeftLinear(index + 1)) { this.SetKeyLeftLinear(index + 1); } } return(num); }