public static void SetKeyModeFromContext(AnimationCurve curve, int keyIndex) { Keyframe key = curve[keyIndex]; bool flag = false; bool flag2 = false; if (keyIndex > 0) { if (AnimationUtility.GetKeyBroken(curve[keyIndex - 1])) { flag = true; } if (AnimationUtility.GetKeyRightTangentMode(curve[keyIndex - 1]) == AnimationUtility.TangentMode.ClampedAuto) { flag2 = true; } } if (keyIndex < curve.length - 1) { if (AnimationUtility.GetKeyBroken(curve[keyIndex + 1])) { flag = true; } if (AnimationUtility.GetKeyLeftTangentMode(curve[keyIndex + 1]) == AnimationUtility.TangentMode.ClampedAuto) { flag2 = true; } } AnimationUtility.SetKeyBroken(ref key, flag); if (flag && !flag2) { if (keyIndex > 0) { AnimationUtility.SetKeyLeftTangentMode(ref key, AnimationUtility.GetKeyRightTangentMode(curve[keyIndex - 1])); } if (keyIndex < curve.length - 1) { AnimationUtility.SetKeyRightTangentMode(ref key, AnimationUtility.GetKeyLeftTangentMode(curve[keyIndex + 1])); } } else { AnimationUtility.TangentMode tangentMode = AnimationUtility.TangentMode.Free; if ((keyIndex == 0 || AnimationUtility.GetKeyRightTangentMode(curve[keyIndex - 1]) == AnimationUtility.TangentMode.ClampedAuto) && (keyIndex == curve.length - 1 || AnimationUtility.GetKeyLeftTangentMode(curve[keyIndex + 1]) == AnimationUtility.TangentMode.ClampedAuto)) { tangentMode = AnimationUtility.TangentMode.ClampedAuto; } else if ((keyIndex == 0 || AnimationUtility.GetKeyRightTangentMode(curve[keyIndex - 1]) == AnimationUtility.TangentMode.Auto) && (keyIndex == curve.length - 1 || AnimationUtility.GetKeyLeftTangentMode(curve[keyIndex + 1]) == AnimationUtility.TangentMode.Auto)) { tangentMode = AnimationUtility.TangentMode.Auto; } AnimationUtility.SetKeyLeftTangentMode(ref key, tangentMode); AnimationUtility.SetKeyRightTangentMode(ref key, tangentMode); } curve.MoveKey(keyIndex, key); }
public static void SetKeyModeFromContext(AnimationCurve curve, int keyIndex) { Keyframe key = curve[keyIndex]; bool broken = false; bool flag2 = false; if (keyIndex > 0) { if (AnimationUtility.GetKeyBroken(curve[keyIndex - 1])) { broken = true; } if (AnimationUtility.GetKeyRightTangentMode(curve[keyIndex - 1]) == AnimationUtility.TangentMode.ClampedAuto) { flag2 = true; } } if (keyIndex < (curve.length - 1)) { if (AnimationUtility.GetKeyBroken(curve[keyIndex + 1])) { broken = true; } if (AnimationUtility.GetKeyLeftTangentMode(curve[keyIndex + 1]) == AnimationUtility.TangentMode.ClampedAuto) { flag2 = true; } } AnimationUtility.SetKeyBroken(ref key, broken); if (broken && !flag2) { if (keyIndex > 0) { AnimationUtility.SetKeyLeftTangentMode(ref key, AnimationUtility.GetKeyRightTangentMode(curve[keyIndex - 1])); } if (keyIndex < (curve.length - 1)) { AnimationUtility.SetKeyRightTangentMode(ref key, AnimationUtility.GetKeyLeftTangentMode(curve[keyIndex + 1])); } } else { AnimationUtility.TangentMode free = AnimationUtility.TangentMode.Free; if (((keyIndex == 0) || (AnimationUtility.GetKeyRightTangentMode(curve[keyIndex - 1]) == AnimationUtility.TangentMode.ClampedAuto)) && ((keyIndex == (curve.length - 1)) || (AnimationUtility.GetKeyLeftTangentMode(curve[keyIndex + 1]) == AnimationUtility.TangentMode.ClampedAuto))) { free = AnimationUtility.TangentMode.ClampedAuto; } else if (((keyIndex == 0) || (AnimationUtility.GetKeyRightTangentMode(curve[keyIndex - 1]) == AnimationUtility.TangentMode.Auto)) && ((keyIndex == (curve.length - 1)) || (AnimationUtility.GetKeyLeftTangentMode(curve[keyIndex + 1]) == AnimationUtility.TangentMode.Auto))) { free = AnimationUtility.TangentMode.Auto; } AnimationUtility.SetKeyLeftTangentMode(ref key, free); AnimationUtility.SetKeyRightTangentMode(ref key, free); } curve.MoveKey(keyIndex, key); }
public static bool GetKeyBroken(AnimationCurve curve, int index) { if (curve == null) { throw new ArgumentNullException("curve"); } if (index < 0 || index >= curve.length) { throw new ArgumentOutOfRangeException("index", string.Format("Index ({0}) must be in the range of 0 to {1}.", index, curve.length - 1)); } Keyframe key = curve[index]; return(AnimationUtility.GetKeyBroken(key)); }
public void AddTangentMenuItems(GenericMenu menu, List <KeyIdentifier> keyList) { bool flag = keyList.Count > 0; bool on = flag; bool on2 = flag; bool on3 = flag; bool on4 = flag; bool on5 = flag; bool flag2 = flag; bool flag3 = flag; bool on6 = flag; bool flag4 = flag; bool flag5 = flag; bool flag6 = flag; bool on7 = flag; bool flag7 = flag; foreach (KeyIdentifier current in keyList) { Keyframe keyframe = current.keyframe; AnimationUtility.TangentMode keyLeftTangentMode = AnimationUtility.GetKeyLeftTangentMode(keyframe); AnimationUtility.TangentMode keyRightTangentMode = AnimationUtility.GetKeyRightTangentMode(keyframe); bool keyBroken = AnimationUtility.GetKeyBroken(keyframe); if (keyLeftTangentMode != AnimationUtility.TangentMode.ClampedAuto || keyRightTangentMode != AnimationUtility.TangentMode.ClampedAuto) { on = false; } if (keyLeftTangentMode != AnimationUtility.TangentMode.Auto || keyRightTangentMode != AnimationUtility.TangentMode.Auto) { on2 = false; } if (keyBroken || keyLeftTangentMode != AnimationUtility.TangentMode.Free || keyRightTangentMode != AnimationUtility.TangentMode.Free) { on3 = false; } if (keyBroken || keyLeftTangentMode != AnimationUtility.TangentMode.Free || keyframe.inTangent != 0f || keyRightTangentMode != AnimationUtility.TangentMode.Free || keyframe.outTangent != 0f) { on4 = false; } if (!keyBroken) { on5 = false; } if (!keyBroken || keyLeftTangentMode != AnimationUtility.TangentMode.Free) { flag3 = false; } if (!keyBroken || keyLeftTangentMode != AnimationUtility.TangentMode.Linear) { on6 = false; } if (!keyBroken || keyLeftTangentMode != AnimationUtility.TangentMode.Constant) { flag4 = false; } if (!keyBroken || keyRightTangentMode != AnimationUtility.TangentMode.Free) { flag6 = false; } if (!keyBroken || keyRightTangentMode != AnimationUtility.TangentMode.Linear) { on7 = false; } if (!keyBroken || keyRightTangentMode != AnimationUtility.TangentMode.Constant) { flag7 = false; } if ((keyframe.weightedMode & WeightedMode.In) == WeightedMode.None) { flag2 = false; } if ((keyframe.weightedMode & WeightedMode.Out) == WeightedMode.None) { flag5 = false; } } if (flag) { menu.AddItem(EditorGUIUtility.TrTextContent("Clamped Auto", null, null), on, new GenericMenu.MenuFunction2(this.SetClampedAuto), keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Auto", null, null), on2, new GenericMenu.MenuFunction2(this.SetAuto), keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Free Smooth", null, null), on3, new GenericMenu.MenuFunction2(this.SetEditable), keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Flat", null, null), on4, new GenericMenu.MenuFunction2(this.SetFlat), keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Broken", null, null), on5, new GenericMenu.MenuFunction2(this.SetBroken), keyList); menu.AddSeparator(""); menu.AddItem(EditorGUIUtility.TrTextContent("Left Tangent/Free", null, null), flag3, new GenericMenu.MenuFunction2(this.SetLeftEditable), keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Left Tangent/Linear", null, null), on6, new GenericMenu.MenuFunction2(this.SetLeftLinear), keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Left Tangent/Constant", null, null), flag4, new GenericMenu.MenuFunction2(this.SetLeftConstant), keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Left Tangent/Weighted", null, null), flag2, new GenericMenu.MenuFunction2(this.ToggleLeftWeighted), keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Right Tangent/Linear", null, null), on7, new GenericMenu.MenuFunction2(this.SetRightLinear), keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Right Tangent/Constant", null, null), flag7, new GenericMenu.MenuFunction2(this.SetRightConstant), keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Both Tangents/Free", null, null), flag6 && flag3, new GenericMenu.MenuFunction2(this.SetBothEditable), keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Right Tangent/Weighted", null, null), flag5, new GenericMenu.MenuFunction2(this.ToggleRightWeighted), keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Both Tangents/Constant", null, null), flag7 && flag4, new GenericMenu.MenuFunction2(this.SetBothConstant), keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Both Tangents/Weighted", null, null), flag5 && flag2, new GenericMenu.MenuFunction2(this.ToggleBothWeighted), keyList); } else { menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Weighted", null, null)); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Auto", null, null)); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Free Smooth", null, null)); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Flat", null, null)); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Broken", null, null)); menu.AddSeparator(""); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Left Tangent/Free", null, null)); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Left Tangent/Linear", null, null)); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Left Tangent/Constant", null, null)); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Right Tangent/Free", null, null)); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Right Tangent/Linear", null, null)); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Right Tangent/Constant", null, null)); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Both Tangents/Free", null, null)); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Both Tangents/Linear", null, null)); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Both Tangents/Constant", null, null)); } }
// Move me to CurveEditor.cs public static void SetKeyModeFromContext(AnimationCurve curve, int keyIndex) { Keyframe key = curve[keyIndex]; bool broken = false; bool smoothTangent = false; if (keyIndex > 0) { if (AnimationUtility.GetKeyBroken(curve[keyIndex - 1])) { broken = true; } TangentMode prevTangentMode = AnimationUtility.GetKeyRightTangentMode(curve[keyIndex - 1]); if (prevTangentMode == TangentMode.ClampedAuto || prevTangentMode == TangentMode.Auto) { smoothTangent = true; } } if (keyIndex < curve.length - 1) { if (AnimationUtility.GetKeyBroken(curve[keyIndex + 1])) { broken = true; } TangentMode nextTangentMode = AnimationUtility.GetKeyLeftTangentMode(curve[keyIndex + 1]); if (nextTangentMode == TangentMode.ClampedAuto || nextTangentMode == TangentMode.Auto) { smoothTangent = true; } } AnimationUtility.SetKeyBroken(ref key, broken); if (broken && !smoothTangent) { if (keyIndex > 0) { AnimationUtility.SetKeyLeftTangentMode(ref key, AnimationUtility.GetKeyRightTangentMode(curve[keyIndex - 1])); } if (keyIndex < curve.length - 1) { AnimationUtility.SetKeyRightTangentMode(ref key, AnimationUtility.GetKeyLeftTangentMode(curve[keyIndex + 1])); } // Keys at boundaries. Make sure left and right tangent modes are the same. if (keyIndex == 0) { AnimationUtility.SetKeyLeftTangentMode(ref key, AnimationUtility.GetKeyRightTangentMode(key)); } if (keyIndex == curve.length - 1) { AnimationUtility.SetKeyRightTangentMode(ref key, AnimationUtility.GetKeyLeftTangentMode(key)); } } else { // If both neighbors or only neighbor are set to TangentMode.Auto or TangentMode.ClampedAuto, set new key to this mode as well. // If there are no neighbors, set new key to TangentMode.ClampedAuto. // Otherwise, fall back to TangentMode.Free. TangentMode mode = TangentMode.Free; if ((keyIndex == 0 || AnimationUtility.GetKeyRightTangentMode(curve[keyIndex - 1]) == TangentMode.ClampedAuto) && (keyIndex == curve.length - 1 || AnimationUtility.GetKeyLeftTangentMode(curve[keyIndex + 1]) == TangentMode.ClampedAuto)) { mode = TangentMode.ClampedAuto; } else if ((keyIndex == 0 || AnimationUtility.GetKeyRightTangentMode(curve[keyIndex - 1]) == TangentMode.Auto) && (keyIndex == curve.length - 1 || AnimationUtility.GetKeyLeftTangentMode(curve[keyIndex + 1]) == TangentMode.Auto)) { mode = TangentMode.Auto; } AnimationUtility.SetKeyLeftTangentMode(ref key, mode); AnimationUtility.SetKeyRightTangentMode(ref key, mode); } curve.MoveKey(keyIndex, key); }
private static void Internal_UpdateTangents(AnimationCurve curve, int index) { if (index >= 0 && index < curve.length) { Keyframe key = curve[index]; if (AnimationUtility.GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.Linear && index >= 1) { key.inTangent = AnimationUtility.Internal_CalculateLinearTangent(curve, index, index - 1); curve.MoveKey(index, key); } if (AnimationUtility.GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.Linear && index + 1 < curve.length) { key.outTangent = AnimationUtility.Internal_CalculateLinearTangent(curve, index, index + 1); curve.MoveKey(index, key); } if (AnimationUtility.GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.ClampedAuto || AnimationUtility.GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.ClampedAuto) { AnimationUtility.Internal_CalculateAutoTangent(curve, index); } if (AnimationUtility.GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.Auto || AnimationUtility.GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.Auto) { curve.SmoothTangents(index, 0f); } if (AnimationUtility.GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.Free && AnimationUtility.GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.Free && !AnimationUtility.GetKeyBroken(key)) { key.outTangent = key.inTangent; curve.MoveKey(index, key); } if (AnimationUtility.GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.Constant) { key.inTangent = float.PositiveInfinity; curve.MoveKey(index, key); } if (AnimationUtility.GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.Constant) { key.outTangent = float.PositiveInfinity; curve.MoveKey(index, key); } } }
public void AddTangentMenuItems(GenericMenu menu, List <KeyIdentifier> keyList) { bool anyKeys = (keyList.Count > 0); // Find out which qualities apply to all the keys bool allClampedAuto = anyKeys; bool allAuto = anyKeys; bool allFreeSmooth = anyKeys; bool allFlat = anyKeys; bool allBroken = anyKeys; bool allLeftWeighted = anyKeys; bool allLeftFree = anyKeys; bool allLeftLinear = anyKeys; bool allLeftConstant = anyKeys; bool allRightWeighted = anyKeys; bool allRightFree = anyKeys; bool allRightLinear = anyKeys; bool allRightConstant = anyKeys; foreach (KeyIdentifier sel in keyList) { Keyframe key = sel.keyframe; TangentMode leftMode = AnimationUtility.GetKeyLeftTangentMode(key); TangentMode rightMode = AnimationUtility.GetKeyRightTangentMode(key); bool broken = AnimationUtility.GetKeyBroken(key); if (leftMode != TangentMode.ClampedAuto || rightMode != TangentMode.ClampedAuto) { allClampedAuto = false; } if (leftMode != TangentMode.Auto || rightMode != TangentMode.Auto) { allAuto = false; } if (broken || leftMode != TangentMode.Free || rightMode != TangentMode.Free) { allFreeSmooth = false; } if (broken || leftMode != TangentMode.Free || key.inTangent != 0 || rightMode != TangentMode.Free || key.outTangent != 0) { allFlat = false; } if (!broken) { allBroken = false; } if (!broken || leftMode != TangentMode.Free) { allLeftFree = false; } if (!broken || leftMode != TangentMode.Linear) { allLeftLinear = false; } if (!broken || leftMode != TangentMode.Constant) { allLeftConstant = false; } if (!broken || rightMode != TangentMode.Free) { allRightFree = false; } if (!broken || rightMode != TangentMode.Linear) { allRightLinear = false; } if (!broken || rightMode != TangentMode.Constant) { allRightConstant = false; } if ((key.weightedMode & WeightedMode.In) == WeightedMode.None) { allLeftWeighted = false; } if ((key.weightedMode & WeightedMode.Out) == WeightedMode.None) { allRightWeighted = false; } } if (anyKeys) { menu.AddItem(EditorGUIUtility.TrTextContent("Clamped Auto"), allClampedAuto, SetClampedAuto, keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Auto"), allAuto, SetAuto, keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Free Smooth"), allFreeSmooth, SetEditable, keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Flat"), allFlat, SetFlat, keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Broken"), allBroken, SetBroken, keyList); menu.AddSeparator(""); menu.AddItem(EditorGUIUtility.TrTextContent("Left Tangent/Free"), allLeftFree, SetLeftEditable, keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Left Tangent/Linear"), allLeftLinear, SetLeftLinear, keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Left Tangent/Constant"), allLeftConstant, SetLeftConstant, keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Left Tangent/Weighted"), allLeftWeighted, ToggleLeftWeighted, keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Right Tangent/Free"), allRightFree, SetRightEditable, keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Right Tangent/Linear"), allRightLinear, SetRightLinear, keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Right Tangent/Constant"), allRightConstant, SetRightConstant, keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Right Tangent/Weighted"), allRightWeighted, ToggleRightWeighted, keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Both Tangents/Free"), allRightFree && allLeftFree, SetBothEditable, keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Both Tangents/Linear"), allRightLinear && allLeftLinear, SetBothLinear, keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Both Tangents/Constant"), allRightConstant && allLeftConstant, SetBothConstant, keyList); menu.AddItem(EditorGUIUtility.TrTextContent("Both Tangents/Weighted"), allRightWeighted && allLeftWeighted, ToggleBothWeighted, keyList); } else { menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Weighted")); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Auto")); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Free Smooth")); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Flat")); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Broken")); menu.AddSeparator(""); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Left Tangent/Free")); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Left Tangent/Linear")); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Left Tangent/Constant")); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Left Tangent/Weighted")); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Right Tangent/Free")); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Right Tangent/Linear")); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Right Tangent/Constant")); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Right Tangent/Weighted")); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Both Tangents/Free")); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Both Tangents/Linear")); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Both Tangents/Constant")); menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Both Tangents/Weighted")); } }
public void AddTangentMenuItems(GenericMenu menu, List <KeyIdentifier> keyList) { bool flag = keyList.Count > 0; bool on = flag; bool flag3 = flag; bool flag4 = flag; bool flag5 = flag; bool flag6 = flag; bool flag7 = flag; bool flag8 = flag; bool flag9 = flag; bool flag10 = flag; bool flag11 = flag; bool flag12 = flag; foreach (KeyIdentifier identifier in keyList) { Keyframe key = identifier.keyframe; AnimationUtility.TangentMode keyLeftTangentMode = AnimationUtility.GetKeyLeftTangentMode(key); AnimationUtility.TangentMode keyRightTangentMode = AnimationUtility.GetKeyRightTangentMode(key); bool keyBroken = AnimationUtility.GetKeyBroken(key); if ((keyLeftTangentMode != AnimationUtility.TangentMode.ClampedAuto) || (keyRightTangentMode != AnimationUtility.TangentMode.ClampedAuto)) { on = false; } if ((keyLeftTangentMode != AnimationUtility.TangentMode.Auto) || (keyRightTangentMode != AnimationUtility.TangentMode.Auto)) { flag3 = false; } if ((keyBroken || (keyLeftTangentMode != AnimationUtility.TangentMode.Free)) || (keyRightTangentMode != AnimationUtility.TangentMode.Free)) { flag4 = false; } if ((keyBroken || (keyLeftTangentMode != AnimationUtility.TangentMode.Free)) || (((key.inTangent != 0f) || (keyRightTangentMode != AnimationUtility.TangentMode.Free)) || (key.outTangent != 0f))) { flag5 = false; } if (!keyBroken) { flag6 = false; } if (!keyBroken || (keyLeftTangentMode != AnimationUtility.TangentMode.Free)) { flag7 = false; } if (!keyBroken || (keyLeftTangentMode != AnimationUtility.TangentMode.Linear)) { flag8 = false; } if (!keyBroken || (keyLeftTangentMode != AnimationUtility.TangentMode.Constant)) { flag9 = false; } if (!keyBroken || (keyRightTangentMode != AnimationUtility.TangentMode.Free)) { flag10 = false; } if (!keyBroken || (keyRightTangentMode != AnimationUtility.TangentMode.Linear)) { flag11 = false; } if (!keyBroken || (keyRightTangentMode != AnimationUtility.TangentMode.Constant)) { flag12 = false; } } if (flag) { menu.AddItem(EditorGUIUtility.TextContent("Clamped Auto"), on, new GenericMenu.MenuFunction2(this.SetClampedAuto), keyList); menu.AddItem(EditorGUIUtility.TextContent("Auto"), flag3, new GenericMenu.MenuFunction2(this.SetAuto), keyList); menu.AddItem(EditorGUIUtility.TextContent("Free Smooth"), flag4, new GenericMenu.MenuFunction2(this.SetEditable), keyList); menu.AddItem(EditorGUIUtility.TextContent("Flat"), flag5, new GenericMenu.MenuFunction2(this.SetFlat), keyList); menu.AddItem(EditorGUIUtility.TextContent("Broken"), flag6, new GenericMenu.MenuFunction2(this.SetBroken), keyList); menu.AddSeparator(""); menu.AddItem(EditorGUIUtility.TextContent("Left Tangent/Free"), flag7, new GenericMenu.MenuFunction2(this.SetLeftEditable), keyList); menu.AddItem(EditorGUIUtility.TextContent("Left Tangent/Linear"), flag8, new GenericMenu.MenuFunction2(this.SetLeftLinear), keyList); menu.AddItem(EditorGUIUtility.TextContent("Left Tangent/Constant"), flag9, new GenericMenu.MenuFunction2(this.SetLeftConstant), keyList); menu.AddItem(EditorGUIUtility.TextContent("Right Tangent/Free"), flag10, new GenericMenu.MenuFunction2(this.SetRightEditable), keyList); menu.AddItem(EditorGUIUtility.TextContent("Right Tangent/Linear"), flag11, new GenericMenu.MenuFunction2(this.SetRightLinear), keyList); menu.AddItem(EditorGUIUtility.TextContent("Right Tangent/Constant"), flag12, new GenericMenu.MenuFunction2(this.SetRightConstant), keyList); menu.AddItem(EditorGUIUtility.TextContent("Both Tangents/Free"), flag10 && flag7, new GenericMenu.MenuFunction2(this.SetBothEditable), keyList); menu.AddItem(EditorGUIUtility.TextContent("Both Tangents/Linear"), flag11 && flag8, new GenericMenu.MenuFunction2(this.SetBothLinear), keyList); menu.AddItem(EditorGUIUtility.TextContent("Both Tangents/Constant"), flag12 && flag9, new GenericMenu.MenuFunction2(this.SetBothConstant), keyList); } else { menu.AddDisabledItem(EditorGUIUtility.TextContent("Clamped Auto")); menu.AddDisabledItem(EditorGUIUtility.TextContent("Auto")); menu.AddDisabledItem(EditorGUIUtility.TextContent("Free Smooth")); menu.AddDisabledItem(EditorGUIUtility.TextContent("Flat")); menu.AddDisabledItem(EditorGUIUtility.TextContent("Broken")); menu.AddSeparator(""); menu.AddDisabledItem(EditorGUIUtility.TextContent("Left Tangent/Free")); menu.AddDisabledItem(EditorGUIUtility.TextContent("Left Tangent/Linear")); menu.AddDisabledItem(EditorGUIUtility.TextContent("Left Tangent/Constant")); menu.AddDisabledItem(EditorGUIUtility.TextContent("Right Tangent/Free")); menu.AddDisabledItem(EditorGUIUtility.TextContent("Right Tangent/Linear")); menu.AddDisabledItem(EditorGUIUtility.TextContent("Right Tangent/Constant")); menu.AddDisabledItem(EditorGUIUtility.TextContent("Both Tangents/Free")); menu.AddDisabledItem(EditorGUIUtility.TextContent("Both Tangents/Linear")); menu.AddDisabledItem(EditorGUIUtility.TextContent("Both Tangents/Constant")); } }