void LoadAnimationRecordings() { Report("Loading Animation Recordings", 1); morphAnimationData = new List <List <List <string> > > (); for (int fileloop = 0; fileloop < animationRecordings.Length; fileloop++) { AnimationRecording ar = animationRecordings[fileloop]; List <List <string> > animationArray = ReadAnimationFile(ar.text); // Okay, we have the data for this animation kit... // Let's store it! morphAnimationData.Add(animationArray); // Now it's stored in the format: Morph_Sequence_Data[animationset][frame1-xxx][name/amountmorph] } }
internal static UndoPropertyModification[] ProcessMonoBehaviourModification(UndoPropertyModification[] modifications, WindowState state) { if (!state.recording) { return(modifications); } if (state == null || state.editSequence.director == null) { return(modifications); } s_UnprocessedMods.Clear(); s_TrackRecorder.PrepareForRecord(state); s_ModsToProcess.Clear(); s_ModsToProcess.AddRange(modifications.Reverse()); while (s_ModsToProcess.Count > 0) { var modification = s_ModsToProcess[s_ModsToProcess.Count - 1]; s_ModsToProcess.RemoveAt(s_ModsToProcess.Count - 1); // grab the clip we need to apply to var modifiedGO = GetGameObjectFromModification(modification); var track = GetTrackForGameObject(modifiedGO, state); if (track != null) { IsRecordingAnimationTrack = true; double startTime = 0; var clip = s_TrackRecorder.PrepareTrack(track, state, modifiedGO, out startTime); if (clip == null) { s_ModsToProcess.Reverse(); return(s_ModsToProcess.ToArray()); } s_RecordState.activeAnimationClip = clip; s_RecordState.activeRootGameObject = state.GetSceneReference(track); s_RecordState.activeGameObject = modifiedGO; s_RecordState.currentFrame = Mathf.RoundToInt((float)startTime); EditorUtility.SetDirty(clip); var toProcess = GatherRelatedModifications(modification, s_ModsToProcess); var animator = s_RecordState.activeRootGameObject.GetComponent <Animator>(); var animTrack = track as AnimationTrack; // update preview mode before recording so the correct values get placed (in case we modify offsets) // Case 900624 UpdatePreviewMode(toProcess, modifiedGO); // if this is the first position/rotation recording, copy the current position / rotation to the track offset AddTrackOffset(animTrack, toProcess, clip, animator); // same for clip mod clips being created AddClipOffset(animTrack, toProcess, s_TrackRecorder.recordClip, animator); // Check if we need to handle position/rotation offsets var handleOffsets = animator != null && modification.currentValue != null && modification.currentValue.target == s_RecordState.activeRootGameObject.transform && HasOffsets(animTrack, s_TrackRecorder.recordClip); if (handleOffsets) { toProcess = HandleEulerModifications(animTrack, s_TrackRecorder.recordClip, clip, s_RecordState.currentFrame * clip.frameRate, toProcess); RemoveOffsets(modification, animTrack, s_TrackRecorder.recordClip, toProcess); } var remaining = AnimationRecording.Process(s_RecordState, toProcess); if (remaining != null && remaining.Length != 0) { s_UnprocessedMods.AddRange(remaining); } if (handleOffsets) { ReapplyOffsets(modification, animTrack, s_TrackRecorder.recordClip, toProcess); } s_TrackRecorder.FinializeTrack(track, state); IsRecordingAnimationTrack = false; } else { s_UnprocessedMods.Add(modification); } } s_TrackRecorder.FinalizeRecording(state); return(s_UnprocessedMods.ToArray()); }