public static void AddKeyframes(AnimationWindowState state, AnimationWindowCurve[] curves, AnimationKeyTime time) { string undoLabel = "Add Key"; state.SaveKeySelection(undoLabel); state.ClearKeySelections(); foreach (AnimationWindowCurve curve in curves) { if (curve.animationIsEditable) { AnimationKeyTime time2 = AnimationKeyTime.Time(time.time - curve.timeOffset, time.frameRate); object currentValue = CurveBindingUtility.GetCurrentValue(state, curve); AnimationWindowKeyframe keyframe = AddKeyframeToCurve(curve, currentValue, curve.valueType, time2); state.SaveCurve(curve, undoLabel); state.SelectKey(keyframe); } } }
public static void AddKeyframes(AnimationWindowState state, AnimationWindowCurve[] curves, AnimationKeyTime time) { string undoLabel = "Add Key"; state.SaveKeySelection(undoLabel); state.ClearKeySelections(); for (int i = 0; i < curves.Length; i++) { AnimationWindowCurve animationWindowCurve = curves[i]; if (animationWindowCurve.animationIsEditable) { AnimationKeyTime time2 = AnimationKeyTime.Time(time.time - animationWindowCurve.timeOffset, time.frameRate); object currentValue = CurveBindingUtility.GetCurrentValue(state, animationWindowCurve); AnimationWindowKeyframe keyframe = AnimationWindowUtility.AddKeyframeToCurve(animationWindowCurve, currentValue, animationWindowCurve.valueType, time2); state.SaveCurve(animationWindowCurve, undoLabel); state.SelectKey(keyframe); } } }