Exemplo n.º 1
0
        public static ICurvesOwner ToCurvesOwner(IPlayableAsset playableAsset, TimelineAsset timeline)
        {
            if (playableAsset == null)
            {
                return(null);
            }

            var curvesOwner = playableAsset as ICurvesOwner;

            if (curvesOwner == null)
            {
                // If the asset is not directly an ICurvesOwner, it might be the asset for a TimelineClip
                curvesOwner = TimelineRecording.FindClipWithAsset(timeline, playableAsset);
            }

            return(curvesOwner);
        }
        public override bool Execute(ActionContext actionContext)
        {
            WindowState      state    = TimelineEditor.state;
            PlayableDirector director = TimelineEditor.inspectedDirector;

            if (!CanExecute(state, actionContext) || director == null)
            {
                return(false);
            }

            IEnumerable <TrackAsset> keyableTracks = GetKeyableTracks(state, actionContext);

            var curveSelected = SelectionManager.GetCurrentInlineEditorCurve();

            if (curveSelected != null)
            {
                var sel = curveSelected.clipCurveEditor.GetSelectedProperties().ToList();
                var go  = (director.GetGenericBinding(curveSelected.owner) as Component).gameObject;
                if (sel.Count > 0)
                {
                    TimelineRecording.KeyProperties(go, state, sel);
                }
                else
                {
                    var binding = director.GetGenericBinding(curveSelected.owner) as Component;
                    TimelineRecording.KeyAllProperties(binding, state);
                }
            }
            else
            {
                foreach (var track in keyableTracks)
                {
                    var binding = director.GetGenericBinding(track) as Component;
                    TimelineRecording.KeyAllProperties(binding, state);
                }
            }
            return(true);
        }
        UndoPropertyModification[] PostprocessAnimationRecordingModifications(UndoPropertyModification[] modifications)
        {
            DirtyModifiedObjects(modifications);

            var remaining = TimelineRecording.ProcessUndoModification(modifications, state);

            // if we've changed, we need to repaint the sequence window to show clip length changes
            if (remaining != modifications)
            {
                // only update if us or the sequencer window has focus
                // Prevents color pickers and other dialogs from being wrongly dismissed
                bool repaint = (focusedWindow == null) ||
                               (focusedWindow is InspectorWindow) ||
                               (focusedWindow is TimelineWindow);

                if (repaint)
                {
                    Repaint();
                }
            }


            return(remaining);
        }
 public void AddKey(PropertyModification[] modifications)
 {
     TimelineRecording.AddKey(modifications, state);
     state.Refresh();
 }
 public void GoToPreviousKeyframe(PropertyModification[] modifications)
 {
     TimelineRecording.PrevKey(modifications[0].target, modifications, state);
     TimelineEditor.Refresh(RefreshReason.SceneNeedsUpdate);
 }
 public void GoToPreviousKeyframe(PropertyModification[] modifications)
 {
     TimelineRecording.PrevKey(modifications[0].target, modifications, state);
     state.Refresh();
 }
 internal static bool HasAnyPlayableAssetModifications(UndoPropertyModification[] modifications)
 {
     return(modifications.Any(x => (TimelineRecording.GetTarget(x) as IPlayableAsset) != null));
 }
 public void AddKey(PropertyModification[] modifications)
 {
     TimelineRecording.AddKey(modifications, this.state);
     this.state.Refresh(false);
 }
 public bool CurveExists(PropertyModification[] modifications)
 {
     return(modifications.Length != 0 && !(modifications[0].target == null) && TimelineRecording.HasCurve(modifications, modifications[0].target, this.state));
 }