public virtual void OnToggle(bool on) { Undo.RecordObject(Track, on ? "enable" : "disable"); Track.enabled = on; EditorUtility.SetDirty(Track); if (Track.RequiresEditorCache) { if (on) { Track.CreateCache(); } else { Track.ClearCache(); } } if (!SequenceEditor.Sequence.IsStopped) { int currentFrame = SequenceEditor.Sequence.CurrentFrame; SequenceEditor.Stop(); SequenceEditor.SetCurrentFrame(currentFrame); } SequenceEditor.SetDirty(this); SequenceEditor.NotifyDirtyTracks(); }
private void OnUpdate() { if (!_syncWithAnimationWindow) { return; } if (Selection.activeTransform != Track.Owner) { Selection.activeTransform = Track.Owner; } if (!AnimationMode.InAnimationMode()) { // AnimationMode.StartAnimationMode(); AnimationWindowProxy.StartAnimationMode(); } // if( _track.IsPreviewing ) { int animWindowFrame = AnimationWindowProxy.GetCurrentFrame(); FEvent[] evts = new FEvent[2]; int numEvts = Track.GetEventsAt(SequenceEditor.Sequence.CurrentFrame, ref evts); if (numEvts > 0) { FPlayAnimationEvent animEvt = (FPlayAnimationEvent)evts[numEvts - 1]; if (animEvt.ControlsAnimation) { int normCurrentFrame = SequenceEditor.Sequence.CurrentFrame - animEvt.Start; if (animWindowFrame > animEvt.Length) { animWindowFrame = animEvt.Length; AnimationWindowProxy.SetCurrentFrame(animWindowFrame, animEvt.LengthTime); } if (animWindowFrame >= 0 && animWindowFrame != normCurrentFrame) { SequenceEditor.SetCurrentFrame(animEvt.Start + animWindowFrame); SequenceEditor.Repaint(); // Debug.Log( "AnimWindow->Flux: " + (animEvt.Start + animWindowFrame) ); } } } } }