AnimationCurve DrawCurvePointsHandle(AnimationCurve curve) { AnimationCurve ret = curve; if (curve == null) { return(null); } keyframeHandle.SetTransform(this); keyframeHandle.SetCurve(curve); for (int i = 0; i < curve.length; i++) { Keyframe keyframe = curve.keys[i]; Keyframe movedKeyframe; movedKeyframe = keyframeHandle.DrawHandle(new Vector2(width, height), keyframe, .03f, i != 0, i != curve.length - 1); if (selectedKeyframeIndex == i) { EditorGUIUtility.keyboardControl = keyframeHandle.pointHandle.controlId; EditorGUIUtility.hotControl = keyframeHandle.pointHandle.controlId; selectedKeyframeIndex = -1; } //it the key have been moved if (!keyframe.Equal(movedKeyframe)) { //we duplicate the curve to return another modified one: ret = new AnimationCurve(curve.keys); ret.MoveKey(i, movedKeyframe); } } return(ret); }