RemoveKey() private method

private RemoveKey ( int index ) : void
index int
return void
 static public int RemoveKey(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.AnimationCurve self = (UnityEngine.AnimationCurve)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         self.RemoveKey(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 public static void RemoveKeysInRange(AnimationCurve curve, float beginTime, float endTime)
 {
   for (int index = curve.length - 1; index >= 0; --index)
   {
     if ((double) curve[index].time >= (double) beginTime && (double) curve[index].time < (double) endTime)
       curve.RemoveKey(index);
   }
 }
		public static void RemoveKeysInRange(AnimationCurve curve, float beginTime, float endTime)
		{
			for (int i = curve.length - 1; i >= 0; i--)
			{
				if (curve[i].time >= beginTime && curve[i].time < endTime)
				{
					curve.RemoveKey(i);
				}
			}
		}
 static public int RemoveKey(IntPtr l)
 {
     try {
         UnityEngine.AnimationCurve self = (UnityEngine.AnimationCurve)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         self.RemoveKey(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #5
0
 static int RemoveKey(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.AnimationCurve obj = (UnityEngine.AnimationCurve)ToLua.CheckObject(L, 1, typeof(UnityEngine.AnimationCurve));
         int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         obj.RemoveKey(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
        /// <summary>
        /// Remove a key from an AnimationCurve.
        /// </summary>
        /// <param name="curve">The existing AnimationCurve.</param>
        /// <param name="index">The index of the Key to be removed.</param>
        public static void RemoveKey(AnimationCurve curve, int index)
        {
            curve.RemoveKey(index);

            // Update left neighbour.
            if (index > 0)
            {
                // Update tangent data based on tangent mode.
                int tangentMode = curve[index-1].tangentMode;

                if (IsAuto(tangentMode))
                {
                    curve.SmoothTangents(index - 1, 0);
                }
                if (IsBroken(tangentMode))
                {
                    if (IsRightLinear(tangentMode))
                    {
                        SetKeyRightLinear(curve, index - 1);
                    }
                }
            }

            // Update right neighbour.
            if (index < curve.length)
            {
                // Update tangent data based on tangent mode.
                int tangentMode = curve[index].tangentMode;

                if (IsAuto(tangentMode))
                {
                    curve.SmoothTangents(index, 0);
                }
                if (IsBroken(tangentMode))
                {
                    if (IsLeftLinear(tangentMode))
                    {
                        SetKeyLeftLinear(curve, index);
                    }
                }
            }
        }
Example #7
0
	// Function ----------------------------------------------------------------------
	public static void NormalizeCurveTime(AnimationCurve curve)
	{
		int n = 0;
		while (n < curve.keys.Length)
		{
			Keyframe	key = curve[n];
			float	fMax = Mathf.Max(0, key.time);
			float	fVal = Mathf.Min(1, Mathf.Max(fMax, key.time));
			if (fVal != key.time)
			{
				Keyframe	newKey = new Keyframe(fVal, key.value, key.inTangent, key.outTangent);
				curve.RemoveKey(n);
				n = 0;
				curve.AddKey(newKey);
				continue;
			}
			n++;
		}
	}
 public static void RemoveKeysInRange(AnimationCurve curve, float beginTime, float endTime)
 {
     for (int i = curve.length - 1; i >= 0; i--)
     {
         Keyframe keyframe = curve[i];
         if (keyframe.time >= beginTime)
         {
             Keyframe keyframe2 = curve[i];
             if (keyframe2.time < endTime)
             {
                 curve.RemoveKey(i);
             }
         }
     }
 }
Example #9
0
 void RemoveKeyframe(AnimationCurve curve, int keyframeIndex)
 {
     curve.RemoveKey(keyframeIndex);
     Invalidate();
 }