Esempio n. 1
0
void print(TRange range)
{
    for(int i = 0; !range.IsEmpty() && i < 77; range.Pop(), ++i)
    {
        putchar(48 + range.Front());
    }
    puts("");
}
Esempio n. 2
0
FReply FSequencer::OnStepToBeginning()
{
	PlaybackState = EMovieScenePlayerStatus::Stopped;
	TRange<float> TimeBounds = GetTimeBounds();
	if (!TimeBounds.IsEmpty())
	{
		SetGlobalTime(TimeBounds.GetLowerBoundValue());
	}
	return FReply::Handled();
}
Esempio n. 3
0
void FSequencer::ZoomToSelectedSections()
{
	TArray< TRange<float> > Bounds;
	for (TWeakObjectPtr<UMovieSceneSection> SelectedSection : *Selection.GetSelectedSections())
	{
		Bounds.Add(SelectedSection->GetRange());
	}
	TRange<float> BoundsHull = TRange<float>::Hull(Bounds);

	if (BoundsHull.IsEmpty())
	{
		BoundsHull = GetTimeBounds();
	}

	if (!BoundsHull.IsEmpty() && !BoundsHull.IsDegenerate())
	{
		OnViewRangeChanged(BoundsHull, true);
	}
}
Esempio n. 4
0
void FSequencer::Tick(float InDeltaTime)
{
	if (bNeedTreeRefresh)
	{
		// @todo - Sequencer Will be called too often
		UpdateRuntimeInstances();

		SequencerWidget->UpdateLayoutTree();
		bNeedTreeRefresh = false;
	}

	float NewTime = GetGlobalTime() + InDeltaTime;
	if (PlaybackState == EMovieScenePlayerStatus::Playing ||
		PlaybackState == EMovieScenePlayerStatus::Recording)
	{
		TRange<float> TimeBounds = GetTimeBounds();
		if (!TimeBounds.IsEmpty())
		{
			if (NewTime > TimeBounds.GetUpperBoundValue())
			{
				if (bLoopingEnabled)
				{
					NewTime -= TimeBounds.Size<float>();
				}
				else
				{
					NewTime = TimeBounds.GetUpperBoundValue();
					PlaybackState = EMovieScenePlayerStatus::Stopped;
				}
			}

			if (NewTime < TimeBounds.GetLowerBoundValue())
			{
				NewTime = TimeBounds.GetLowerBoundValue();
			}

			SetGlobalTime(NewTime);
		}
		else
		{
			// no bounds at all, stop playing
			PlaybackState = EMovieScenePlayerStatus::Stopped;
		}
	}

	// Tick all the tools we own as well
	for (int32 EditorIndex = 0; EditorIndex < TrackEditors.Num(); ++EditorIndex)
	{
		TrackEditors[EditorIndex]->Tick(InDeltaTime);
	}
}
Esempio n. 5
0
TRange<float> FSequencer::GetTimeBounds() const
{
	// When recording, we never want to constrain the time bound range.  You might not even have any sections or keys yet
	// but we need to be able to move the time cursor during playback so you can capture data in real-time
	if( PlaybackState == EMovieScenePlayerStatus::Recording )
	{
		return TRange<float>( -100000.0f, 100000.0f );
	}

	const UMovieScene* MovieScene = GetFocusedMovieScene();
	const UMovieSceneTrack* AnimatableShot = MovieScene->FindMasterTrack( UMovieSceneDirectorTrack::StaticClass() );
	if (AnimatableShot)
	{
		// try getting filtered shot boundaries
		TRange<float> Bounds = GetFilteringShotsTimeBounds();
		if (!Bounds.IsEmpty()) {return Bounds;}

		// try getting the bounds of all shots
		Bounds = AnimatableShot->GetSectionBoundaries();
		if (!Bounds.IsEmpty()) {return Bounds;}
	}
	
	return MovieScene->GetTimeRange();
}
Esempio n. 6
0
void FSequencer::OnViewRangeChanged( TRange<float> NewViewRange, bool bSmoothZoom )
{
	if (!NewViewRange.IsEmpty())
	{
		if (bSmoothZoom)
		{
			if (!ZoomAnimation.IsPlaying())
			{
				LastViewRange = TargetViewRange;

				ZoomAnimation.Play( SequencerWidget.ToSharedRef() );
			}
			TargetViewRange = NewViewRange;
		}
		else
		{
			TargetViewRange = LastViewRange = NewViewRange;
			ZoomAnimation.JumpToEnd();
		}
	}
}