示例#1
0
        public static void Rescale(FSequence sequence, int frameRate)
        {
            if (sequence.FrameRate == frameRate)
            {
                return;
            }

            float scaleFactor = (float)frameRate / sequence.FrameRate;

            Undo.RecordObject(sequence, "Change Frame Rate");

            sequence.Length    = Mathf.RoundToInt(sequence.Length * scaleFactor);
            sequence.FrameRate = frameRate;

            foreach (FTimeline timeline in sequence.GetTimelines())
            {
                Rescale(timeline, scaleFactor);
            }

            EditorUtility.SetDirty(sequence);
        }
示例#2
0
        public void OpenSequence(FSequence sequence)
        {
#if FLUX_DEBUG
            Debug.Log("Opening sequence: " + sequence);
#endif
            if (sequence == null)
            {
                Debug.LogError("sequence == null");
                if (!object.Equals(sequence, null))
                {
                    sequence = (FSequence)EditorUtility.InstanceIDToObject(sequence.GetInstanceID());
                }
            }

            bool sequenceChanged = _sequence != sequence && (object.Equals(_sequence, null) || object.Equals(sequence, null) || _sequence.GetInstanceID() != sequence.GetInstanceID());

//			Debug.Log ("selected sequence! Changed? " + sequenceChanged );

            if (sequenceChanged)
            {
                if (_sequence != null)
                {
                    Stop();
                }
                _editorCache.Clear();
                _selectedEvents.Clear();
                _selectedTracks.Clear();
            }
            else
            {
                _editorCache.Refresh();
            }


            if (sequence != null)
            {
//				_sequenceInstanceID = sequence.GetInstanceID();
                if (_viewRange.Length == 0)
                {
                    _viewRange = new FrameRange(0, sequence.Length);
                }

                if (!EditorApplication.isPlaying)
                {
                    sequence.Rebuild();
                }

                List <FTimeline> timelines = sequence.GetTimelines();

                _timelineEditors.Clear();

                for (int i = 0; i < timelines.Count; ++i)
                {
                    FTimeline       timeline       = timelines[i];
                    FTimelineEditor timelineEditor = GetEditor <FTimelineEditor>(timeline);
                    timelineEditor.Init(timeline, this);
                    _timelineEditors.Add(timelineEditor);
                }

                if (_viewRange.Length == 0)
                {
                    _viewRange = new FrameRange(0, sequence.Length);
                }
            }
            else
            {
//				_sequenceInstanceID = int.MinValue;
            }

            _sequence = sequence;

            Repaint();
        }