private UndoPropertyModification[] RegisterCandidates(UndoPropertyModification[] modifications)
        {
            bool createNewClip = (m_CandidateClip == null);

            if (createNewClip)
            {
                m_CandidateClip        = new AnimationClip();
                m_CandidateClip.legacy = state.activeAnimationClip.legacy;
                m_CandidateClip.name   = "CandidateClip";

                StartCandidateRecording();
            }

            CandidateRecordingState recordingState = new CandidateRecordingState(state, m_CandidateClip);

            UndoPropertyModification[] discardedModifications = AnimationRecording.Process(recordingState, modifications);

            // No modifications were added to the candidate clip, discard.
            if (createNewClip && discardedModifications.Length == modifications.Length)
            {
                ClearCandidates();
            }

            // Make sure inspector is repainted after adding new candidates to get appropriate feedback.
            InspectorWindow.RepaintAllInspectors();

            return(discardedModifications);
        }
Esempio n. 2
0
        private UndoPropertyModification[] RegisterCandidates(UndoPropertyModification[] modifications)
        {
            bool hasCandidates = AnimationMode.IsRecordingCandidates();

            if (!hasCandidates)
            {
                StartCandidateRecording();
            }

            CandidateRecordingState recordingState = new CandidateRecordingState(state, m_CandidateClip);

            UndoPropertyModification[] discardedModifications = AnimationRecording.Process(recordingState, modifications);

            // No modifications were added to the candidate clip, stop recording candidates.
            if (!hasCandidates && discardedModifications.Length == modifications.Length)
            {
                StopCandidateRecording();
            }

            // Make sure inspector is repainted after adding new candidates to get appropriate feedback.
            InspectorWindow.RepaintAllInspectors();

            return(discardedModifications);
        }