Esempio n. 1
0
 public static RotationCurveInterpolation.Mode GetModeFromCurveData(EditorCurveBinding data)
 {
     if (AnimationWindowUtility.IsTransformType(data.type) && data.propertyName.StartsWith("localEulerAngles"))
     {
         if (data.propertyName.StartsWith("localEulerAnglesBaked"))
         {
             return(RotationCurveInterpolation.Mode.Baked);
         }
         return(data.propertyName.StartsWith("localEulerAnglesRaw") ? RotationCurveInterpolation.Mode.RawEuler : RotationCurveInterpolation.Mode.NonBaked);
     }
     return(AnimationWindowUtility.IsTransformType(data.type) && data.propertyName.StartsWith("m_LocalRotation") ? RotationCurveInterpolation.Mode.RawQuaternions : RotationCurveInterpolation.Mode.Undefined);
 }
Esempio n. 2
0
 public static EditorCurveBinding[] RemapAnimationBindingForRotationAddKey(EditorCurveBinding binding, AnimationClip clip)
 {
     if (!AnimationWindowUtility.IsTransformType(binding.type))
     {
         return((EditorCurveBinding[])null);
     }
     if (binding.propertyName.StartsWith("m_LocalRotation"))
     {
         return(RotationCurveInterpolation.SelectRotationBindingForAddKey(binding, clip));
     }
     return((EditorCurveBinding[])null);
 }
Esempio n. 3
0
 public static EditorCurveBinding RemapAnimationBindingForRotationCurves(EditorCurveBinding curveBinding, AnimationClip clip)
 {
     if (AnimationWindowUtility.IsTransformType(curveBinding.type))
     {
         Mode modeFromCurveData = GetModeFromCurveData(curveBinding);
         if (modeFromCurveData == Mode.Undefined)
         {
             return(curveBinding);
         }
         char[]             separator = new char[] { '.' };
         string             str       = curveBinding.propertyName.Split(separator)[1];
         EditorCurveBinding binding   = curveBinding;
         if (modeFromCurveData != Mode.NonBaked)
         {
             binding.propertyName = GetPrefixForInterpolation(Mode.NonBaked) + "." + str;
             if (AnimationUtility.GetEditorCurve(clip, binding) != null)
             {
                 return(binding);
             }
         }
         if (modeFromCurveData != Mode.Baked)
         {
             binding.propertyName = GetPrefixForInterpolation(Mode.Baked) + "." + str;
             if (AnimationUtility.GetEditorCurve(clip, binding) != null)
             {
                 return(binding);
             }
         }
         if (modeFromCurveData == Mode.RawEuler)
         {
             return(curveBinding);
         }
         binding.propertyName = GetPrefixForInterpolation(Mode.RawEuler) + "." + str;
         if (AnimationUtility.GetEditorCurve(clip, binding) != null)
         {
             return(binding);
         }
     }
     return(curveBinding);
 }
 public static EditorCurveBinding[] RemapAnimationBindingForAddKey(EditorCurveBinding binding, AnimationClip clip)
 {
     if (!AnimationWindowUtility.IsTransformType(binding.type))
     {
         return(null);
     }
     if (binding.propertyName.StartsWith("m_LocalPosition."))
     {
         if (binding.type == typeof(Transform))
         {
             return(RotationCurveInterpolation.GenerateTransformCurveBindingArray(binding.path, "m_LocalPosition.", binding.type, 3));
         }
         return(null);
     }
     else
     {
         if (binding.propertyName.StartsWith("m_LocalScale."))
         {
             return(RotationCurveInterpolation.GenerateTransformCurveBindingArray(binding.path, "m_LocalScale.", binding.type, 3));
         }
         if (!binding.propertyName.StartsWith("m_LocalRotation"))
         {
             return(null);
         }
         EditorCurveBinding binding2 = binding;
         binding2.propertyName = "localEulerAnglesBaked.x";
         if (AnimationUtility.GetEditorCurve(clip, binding2) != null)
         {
             return(RotationCurveInterpolation.GenerateTransformCurveBindingArray(binding.path, "localEulerAnglesBaked.", binding.type, 3));
         }
         binding2.propertyName = "localEulerAngles.x";
         if (AnimationUtility.GetEditorCurve(clip, binding2) != null)
         {
             return(RotationCurveInterpolation.GenerateTransformCurveBindingArray(binding.path, "localEulerAngles.", binding.type, 3));
         }
         return(RotationCurveInterpolation.GenerateTransformCurveBindingArray(binding.path, "localEulerAnglesRaw.", binding.type, 3));
     }
 }
Esempio n. 5
0
 public static EditorCurveBinding[] RemapAnimationBindingForAddKey(EditorCurveBinding binding, AnimationClip clip)
 {
     if (AnimationWindowUtility.IsTransformType(binding.type))
     {
         if (binding.propertyName.StartsWith("m_LocalPosition."))
         {
             if (binding.type == typeof(Transform))
             {
                 return(GenerateTransformCurveBindingArray(binding.path, "m_LocalPosition.", binding.type, 3));
             }
             return(null);
         }
         if (binding.propertyName.StartsWith("m_LocalScale."))
         {
             return(GenerateTransformCurveBindingArray(binding.path, "m_LocalScale.", binding.type, 3));
         }
         if (binding.propertyName.StartsWith("m_LocalRotation"))
         {
             return(SelectRotationBindingForAddKey(binding, clip));
         }
     }
     return(null);
 }
        public static EditorCurveBinding RemapAnimationBindingForRotationCurves(EditorCurveBinding curveBinding, AnimationClip clip)
        {
            if (!AnimationWindowUtility.IsTransformType(curveBinding.type))
            {
                return(curveBinding);
            }
            if (!curveBinding.propertyName.StartsWith("m_LocalRotation"))
            {
                return(curveBinding);
            }
            string str = curveBinding.propertyName.Split(new char[]
            {
                '.'
            })[1];
            EditorCurveBinding editorCurveBinding = curveBinding;

            editorCurveBinding.propertyName = "localEulerAngles." + str;
            AnimationCurve editorCurve = AnimationUtility.GetEditorCurve(clip, editorCurveBinding);

            if (editorCurve != null)
            {
                return(editorCurveBinding);
            }
            editorCurveBinding.propertyName = "localEulerAnglesBaked." + str;
            editorCurve = AnimationUtility.GetEditorCurve(clip, editorCurveBinding);
            if (editorCurve != null)
            {
                return(editorCurveBinding);
            }
            editorCurveBinding.propertyName = "localEulerAnglesRaw." + str;
            editorCurve = AnimationUtility.GetEditorCurve(clip, editorCurveBinding);
            if (editorCurve != null)
            {
                return(editorCurveBinding);
            }
            return(curveBinding);
        }
Esempio n. 7
0
 public static EditorCurveBinding RemapAnimationBindingForRotationCurves(EditorCurveBinding curveBinding, AnimationClip clip)
 {
     if (AnimationWindowUtility.IsTransformType(curveBinding.type))
     {
         if (!curveBinding.propertyName.StartsWith("m_LocalRotation"))
         {
             return(curveBinding);
         }
         char[]             separator = new char[] { '.' };
         string             str       = curveBinding.propertyName.Split(separator)[1];
         EditorCurveBinding binding   = curveBinding;
         binding.propertyName = "localEulerAngles." + str;
         if (AnimationUtility.GetEditorCurve(clip, binding) != null)
         {
             return(binding);
         }
         binding.propertyName = "localEulerAnglesBaked." + str;
         if (AnimationUtility.GetEditorCurve(clip, binding) != null)
         {
             return(binding);
         }
     }
     return(curveBinding);
 }