Ejemplo n.º 1
0
 internal static bool GetKeyBroken(Keyframe key)
 {
     return(AnimationUtility.Internal_GetKeyBroken(key));
 }
Ejemplo n.º 2
0
        private static void Internal_UpdateTangents(AnimationCurve curve, int index)
        {
            if (index < 0 || index >= curve.length)
            {
                throw new ArgumentException("Index out of bounds.");
            }
            Keyframe key = curve[index];

            if (AnimationUtility.Internal_GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.Linear && index >= 1)
            {
                key.inTangent = AnimationUtility.Internal_CalculateLinearTangent(curve, index, index - 1);
                curve.MoveKey(index, key);
            }
            if (AnimationUtility.Internal_GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.Linear && index + 1 < curve.length)
            {
                key.outTangent = AnimationUtility.Internal_CalculateLinearTangent(curve, index, index + 1);
                curve.MoveKey(index, key);
            }
            if (AnimationUtility.Internal_GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.Auto || AnimationUtility.Internal_GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.Auto)
            {
                curve.SmoothTangents(index, 0f);
            }
            if (AnimationUtility.Internal_GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.Free && AnimationUtility.Internal_GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.Free && !AnimationUtility.Internal_GetKeyBroken(key))
            {
                key.outTangent = key.inTangent;
                curve.MoveKey(index, key);
            }
            if (AnimationUtility.Internal_GetKeyLeftTangentMode(key) == AnimationUtility.TangentMode.Constant)
            {
                key.inTangent = float.PositiveInfinity;
                curve.MoveKey(index, key);
            }
            if (AnimationUtility.Internal_GetKeyRightTangentMode(key) == AnimationUtility.TangentMode.Constant)
            {
                key.outTangent = float.PositiveInfinity;
                curve.MoveKey(index, key);
            }
        }