Пример #1
0
        private static void CopyCurvesToClip(AnimationClip fromClip, AnimationClip toClip)
        {
            var rotationBinding = new EditorCurveBinding();
            var bindings        = AnimationUtility.GetCurveBindings(fromClip);

            foreach (var binding in bindings)
            {
                var curve = AnimationUtility.GetEditorCurve(fromClip, binding);

                if (EditorCurveBindingUtils.RemapRotationBinding(toClip, binding, ref rotationBinding))
                {
                    AnimationUtility.SetEditorCurve(toClip, rotationBinding, curve);
                }
                else
                {
                    AnimationUtility.SetEditorCurve(toClip, binding, curve);
                }
            }
        }
Пример #2
0
        private static void RemoveCurves(AnimationClip clip, IEnumerable <EditorCurveBinding> bindings)
        {
            if (clip == null)
            {
                throw new ArgumentNullException("The destination animation clip cannot be null.");
            }

            var rotationBinding = new EditorCurveBinding();

            foreach (var binding in bindings)
            {
                // Remove the correct editor curve binding for a rotation curves
                if (EditorCurveBindingUtils.RemapRotationBinding(clip, binding, ref rotationBinding))
                {
                    AnimationUtility.SetEditorCurve(clip, rotationBinding, null);
                }
                else
                {
                    AnimationUtility.SetEditorCurve(clip, binding, null);
                }
            }
        }