コード例 #1
0
 public void SaveCurve(AnimationWindowCurve curve)
 {
     curve.m_Keyframes.Sort((AnimationWindowKeyframe a, AnimationWindowKeyframe b) => a.time.CompareTo(b.time));
     Undo.RegisterCompleteObjectUndo(this.m_ActiveAnimationClip, "Edit Curve");
     if (curve.isPPtrCurve)
     {
         ObjectReferenceKeyframe[] array = curve.ToObjectCurve();
         if (array.Length == 0)
         {
             array = null;
         }
         AnimationUtility.SetObjectReferenceCurve(this.m_ActiveAnimationClip, curve.binding, array);
     }
     else
     {
         AnimationCurve animationCurve = curve.ToAnimationCurve();
         if (animationCurve.keys.Length == 0)
         {
             animationCurve = null;
         }
         else
         {
             QuaternionCurveTangentCalculation.UpdateTangentsFromMode(animationCurve, this.m_ActiveAnimationClip, curve.binding);
         }
         AnimationUtility.SetEditorCurve(this.m_ActiveAnimationClip, curve.binding, animationCurve);
     }
     this.Repaint();
 }
コード例 #2
0
 public static void SaveModifiedCurve(AnimationWindowCurve curve, AnimationClip clip)
 {
     curve.m_Keyframes.Sort((AnimationWindowKeyframe a, AnimationWindowKeyframe b) => a.time.CompareTo(b.time));
     if (curve.isPPtrCurve)
     {
         ObjectReferenceKeyframe[] array = curve.ToObjectCurve();
         if (array.Length == 0)
         {
             array = null;
         }
         AnimationUtility.SetObjectReferenceCurve(clip, curve.binding, array);
     }
     else
     {
         AnimationCurve animationCurve = curve.ToAnimationCurve();
         if (animationCurve.keys.Length == 0)
         {
             animationCurve = null;
         }
         else
         {
             QuaternionCurveTangentCalculation.UpdateTangentsFromMode(animationCurve, clip, curve.binding);
         }
         AnimationUtility.SetEditorCurve(clip, curve.binding, animationCurve);
     }
 }
コード例 #3
0
 public static void RenameCurvePath(AnimationWindowCurve curve, EditorCurveBinding newBinding, AnimationClip clip)
 {
     if (curve.isPPtrCurve)
     {
         AnimationUtility.SetObjectReferenceCurve(clip, curve.binding, null);
         AnimationUtility.SetObjectReferenceCurve(clip, newBinding, curve.ToObjectCurve());
     }
     else
     {
         AnimationUtility.SetEditorCurve(clip, curve.binding, null);
         AnimationUtility.SetEditorCurve(clip, newBinding, curve.ToAnimationCurve());
     }
 }