示例#1
0
    private void DoKeyframeTangentToConstant()
    {
        AnimationWindowReflect animationWindowReflect = AnimationWindowUtil.GetAnimationWindowReflect();

        if (!animationWindowReflect.firstAnimationWindow)
        {
            SimpleDisplayDialog("Animation 窗口没有打开");
            return;
        }

        AnimationClip activeAnimationClip = animationWindowReflect.activeAnimationClip;

        if (activeAnimationClip == null)
        {
            SimpleDisplayDialog("Animation 窗口没有任何动画片段");
            return;
        }

        float currentTime = animationWindowReflect.currentTime;

        if ((activeAnimationClip.hideFlags & HideFlags.NotEditable) != HideFlags.None)
        {
            // FBX 动画则自动执行拷贝
            AnimationClip oldClip = activeAnimationClip;
            activeAnimationClip = CopyAnimationClipAsset(activeAnimationClip);
            animationWindowReflect.activeAnimationClip = activeAnimationClip;
            animationWindowReflect.currentTime         = currentTime;
            if (onClipCopyModify != null)
            {
                onClipCopyModify(oldClip, activeAnimationClip);
            }
        }

        KeyframeTangentToConstant(activeAnimationClip, currentTime);
        animationWindowReflect.firstAnimationWindow.Repaint();
    }