/// <summary> /// Cache all the revert data. /// </summary> private void saveRevertData() { revertCache.Clear(); // Build the cache of revert info. foreach (MonoBehaviour mb in this.GetComponentsInChildren <MonoBehaviour>()) { IRevertable revertable = mb as IRevertable; if (revertable != null) { revertCache.AddRange(revertable.CacheState()); } } }
/// <summary> /// Cache all the revert data. /// </summary> private void saveRevertData() { revertCache.Clear(); { var __array9 = this.GetComponentsInChildren <MonoBehaviour>(); var __arrayLength9 = __array9.Length; for (int __i9 = 0; __i9 < __arrayLength9; ++__i9) { var mb = (MonoBehaviour)__array9[__i9]; { IRevertable revertable = mb as IRevertable; if (revertable != null) { revertCache.AddRange(revertable.CacheState()); } } } } }
/// <summary> /// Cache all the revert data. /// </summary> private void saveRevertData() { revertCache.Clear(); // Build the cache of revert info. foreach (MonoBehaviour mb in this.GetComponentsInChildren <MonoBehaviour>()) { IRevertable revertable = mb as IRevertable; if (revertable != null) { RevertInfo[] ri = revertable.CacheState(); if (ri == null || ri.Length < 1) { Debug.Log(string.Format("Cinema Director tried to cache the state of {0}, but failed.", mb.name)); } else { revertCache.AddRange(ri); } } } }
/// <summary> /// Cache all the revert data. /// </summary> private void saveRevertData() { revertCache.Clear(); // Build the cache of revert info. MonoBehaviour[] mbArray = this.GetComponentsInChildren <MonoBehaviour>(); for (int i = 0; i < mbArray.Length; i++) { IRevertable revertable = mbArray[i] as IRevertable; if (revertable != null) { List <RevertInfo> ri = revertable.CacheState(); if (ri == null || ri.Count < 1) { //Debug.Log(HobaString.Format("Cinema Director tried to cache the state of {0}, but failed.", mbArray[i].name)); } else { revertCache.AddRange(ri); } } } }
/// <summary> /// Bake the Mecanim preview data. /// </summary> public void Bake() { if (Actor == null || Application.isPlaying) { return; } Animator animator = Actor.GetComponent <Animator>(); if (animator == null) { return; } List <RevertInfo> revertCache = new List <RevertInfo>(); // Build the cache of revert info. foreach (MonoBehaviour mb in this.GetComponentsInChildren <MonoBehaviour>()) { IRevertable revertable = mb as IRevertable; if (revertable != null) { revertCache.AddRange(revertable.CacheState()); } } Vector3 position = Actor.transform.localPosition; Quaternion rotation = Actor.transform.localRotation; Vector3 scale = Actor.transform.localScale; float frameRate = 30; int frameCount = (int)((Cutscene.Duration * frameRate) + 2); animator.StopPlayback(); animator.recorderStartTime = 0; animator.StartRecording(frameCount); base.SetRunningTime(0); for (int i = 0; i < frameCount - 1; i++) { foreach (TimelineTrack track in GetTracks()) { if (!(track is DialogueTrack)) { track.UpdateTrack(i * (1.0f / frameRate), (1.0f / frameRate)); } } animator.Update(1.0f / frameRate); } animator.recorderStopTime = frameCount * (1.0f / frameRate); animator.StopRecording(); animator.StartPlayback(); hasBeenBaked = true; // Return the Actor to his initial position. Actor.transform.localPosition = position; Actor.transform.localRotation = rotation; Actor.transform.localScale = scale; foreach (RevertInfo revertable in revertCache) { if (revertable != null) { if ((revertable.EditorRevert == RevertMode.Revert && !Application.isPlaying) || (revertable.RuntimeRevert == RevertMode.Revert && Application.isPlaying)) { revertable.Revert(); } } } base.Initialize(); }
/// <summary> /// Bake the Mecanim preview data. /// </summary> public void Bake() { #if PROFILE_FILE Profiler.BeginSample("CharacterTrackGroup.Bake"); #endif // PROFILE_FILE if (Actor == null || Application.isPlaying) { #if PROFILE_FILE Profiler.EndSample(); #endif // PROFILE_FILE return; } Animator animator = Actor.GetComponent <Animator>(); if (animator == null) { #if PROFILE_FILE Profiler.EndSample(); #endif // PROFILE_FILE return; } List <RevertInfo> revertCache = new List <RevertInfo>(); // Build the cache of revert info. var comps = this.GetComponentsInChildren <MonoBehaviour>(); for (var i = 0; i < comps.Length; ++i) { MonoBehaviour mb = comps[i]; IRevertable revertable = mb as IRevertable; if (revertable != null) { revertCache.AddRange(revertable.CacheState()); } } Vector3 position = Actor.transform.localPosition; Quaternion rotation = Actor.transform.localRotation; Vector3 scale = Actor.transform.localScale; float frameRate = 30; int frameCount = (int)((Cutscene.Duration * frameRate) + 2); animator.StopPlayback(); animator.recorderStartTime = 0; animator.StartRecording(frameCount); base.SetRunningTime(0); for (int i = 0; i < frameCount - 1; i++) { var tracks = GetTracks(); for (int j = 0; j < tracks.Length; ++j) { TimelineTrack track = tracks[j]; if (!(track is DialogueTrack)) { track.UpdateTrack(i * (1.0f / frameRate), (1.0f / frameRate)); } } animator.Update(1.0f / frameRate); } animator.recorderStopTime = frameCount * (1.0f / frameRate); animator.StopRecording(); animator.StartPlayback(); hasBeenBaked = true; // Return the Actor to his initial position. Actor.transform.localPosition = position; Actor.transform.localRotation = rotation; Actor.transform.localScale = scale; for (int i = 0; i < revertCache.Count; ++i) { RevertInfo revertable = revertCache[i]; if (revertable != null) { if ((revertable.EditorRevert == RevertMode.Revert && !Application.isPlaying) || (revertable.RuntimeRevert == RevertMode.Revert && Application.isPlaying)) { revertable.Revert(); } } } base.Initialize(); #if PROFILE_FILE Profiler.EndSample(); #endif // PROFILE_FILE }
/// <summary> /// Bake the Mecanim preview data. /// </summary> public void Bake() { if (Actor == null || Application.isPlaying) { return; } Animator animator = Actor.GetComponent <Animator>(); if (animator == null) { return; } List <RevertInfo> revertCache = new List <RevertInfo>(); { var __array1 = this.GetComponentsInChildren <MonoBehaviour>(); var __arrayLength1 = __array1.Length; for (int __i1 = 0; __i1 < __arrayLength1; ++__i1) { var mb = (MonoBehaviour)__array1[__i1]; { IRevertable revertable = mb as IRevertable; if (revertable != null) { revertCache.AddRange(revertable.CacheState()); } } } } Vector3 position = Actor.transform.localPosition; Quaternion rotation = Actor.transform.localRotation; Vector3 scale = Actor.transform.localScale; float frameRate = 30; int frameCount = (int)((Cutscene.Duration * frameRate) + 2); animator.StopPlayback(); animator.recorderStartTime = 0; animator.StartRecording(frameCount); base.SetRunningTime(0); for (int i = 0; i < frameCount - 1; i++) { { var __array2 = GetTracks(); var __arrayLength2 = __array2.Length; for (int __i2 = 0; __i2 < __arrayLength2; ++__i2) { var track = (TimelineTrack)__array2[__i2]; { if (!(track is DialogueTrack)) { track.UpdateTrack(i * (1.0f / frameRate), (1.0f / frameRate)); } } } } animator.Update(1.0f / frameRate); } animator.recorderStopTime = frameCount * (1.0f / frameRate); animator.StopRecording(); animator.StartPlayback(); hasBeenBaked = true; // Return the Actor to his initial position. Actor.transform.localPosition = position; Actor.transform.localRotation = rotation; Actor.transform.localScale = scale; { var __list3 = revertCache; var __listCount3 = __list3.Count; for (int __i3 = 0; __i3 < __listCount3; ++__i3) { var revertable = (RevertInfo)__list3[__i3]; { if (revertable != null) { if ((revertable.EditorRevert == RevertMode.Revert && !Application.isPlaying) || (revertable.RuntimeRevert == RevertMode.Revert && Application.isPlaying)) { revertable.Revert(); } } } } } base.Initialize(); }
/// <summary> /// Bake the Mecanim preview data. /// </summary> public void Bake() { if (Actor == null || Application.isPlaying) { return; } Animator animator = Actor.GetComponent <Animator>(); if (animator == null) { return; } AnimatorCullingMode cullingData = animator.cullingMode; animator.cullingMode = AnimatorCullingMode.AlwaysAnimate; List <RevertInfo> revertCache = new List <RevertInfo>(); // Build the cache of revert info. MonoBehaviour[] mb = this.GetComponentsInChildren <MonoBehaviour>(); for (int i = 0; i < mb.Length; i++) { IRevertable revertable = mb[i] as IRevertable; if (revertable != null) { revertCache.AddRange(revertable.CacheState()); } } Vector3 position = Actor.transform.localPosition; Quaternion rotation = Actor.transform.localRotation; Vector3 scale = Actor.transform.localScale; Cutscene cutScene = GetCutScene(); float frameRate = 30; int frameCount = (int)((cutScene.Duration * frameRate) + 2); animator.StopPlayback(); animator.recorderStartTime = 0; animator.StartRecording(frameCount); base.SetRunningTime(0); for (int i = 0; i < frameCount - 1; i++) { List <TimelineTrack> tracks = GetTracks(); for (int j = 0; j < tracks.Count; j++) { tracks[j].UpdateTrack(i * (1.0f / frameRate), (1.0f / frameRate)); } animator.Update(1.0f / frameRate); } animator.recorderStopTime = frameCount * (1.0f / frameRate); animator.StopRecording(); animator.StartPlayback(); hasBeenBaked = true; // Return the Actor to his initial position. Actor.transform.localPosition = position; Actor.transform.localRotation = rotation; Actor.transform.localScale = scale; for (int i = 0; i < revertCache.Count; i++) { RevertInfo revertable = revertCache[i]; if (revertable != null) { if ((revertable.EditorRevert == RevertMode.Revert && !Application.isPlaying) || (revertable.RuntimeRevert == RevertMode.Revert && Application.isPlaying)) { revertable.Revert(); } } } animator.cullingMode = cullingData; base.Initialize(); }