// Drag handler for the gui void OnTrackDurationDrag(double newTime) { if (state.editSequence.asset.durationMode == TimelineAsset.DurationMode.FixedLength && !state.editSequence.isReadOnly) { // this is the first call to the drag if (m_TimelineDuration.firstDrag) { UndoExtensions.RegisterTimeline(state.editSequence.asset, L10n.Tr("Change Duration")); } state.editSequence.asset.fixedDuration = newTime; // when setting a new length, modify the duration of the timeline playable directly instead of // rebuilding the whole graph state.UpdateRootPlayableDuration(newTime); } m_TimelineDuration.showTooltip = true; }
static void SelectDurationCallback(WindowState state, TimelineAsset.DurationMode mode) { if (mode == state.editSequence.asset.durationMode) { return; } UndoExtensions.RegisterTimeline(state.editSequence.asset, "Duration Mode"); // if we switched from Auto to Fixed, use the auto duration as the new fixed duration so the end marker stay in the same position. if (state.editSequence.asset.durationMode == TimelineAsset.DurationMode.BasedOnClips && mode == TimelineAsset.DurationMode.FixedLength) { state.editSequence.asset.UpdateFixedDurationWithItemsDuration(); } state.editSequence.asset.durationMode = mode; state.UpdateRootPlayableDuration(state.editSequence.duration); }