void UUMGSequencePlayer::InitSequencePlayer( const UWidgetAnimation& InAnimation, UUserWidget& UserWidget )
{
    Animation = &InAnimation;

    UMovieScene* MovieScene = Animation->MovieScene;

    // Cache the time range of the sequence to determine when we stop
    TimeRange = MovieScene->GetTimeRange();

    RuntimeBindings = NewObject<UMovieSceneBindings>(this);
    RuntimeBindings->SetRootMovieScene( MovieScene );

    UWidgetTree* WidgetTree = UserWidget.WidgetTree;

    TMap<FGuid, TArray<UObject*> > GuidToRuntimeObjectMap;
    // Bind to Runtime Objects
    for (const FWidgetAnimationBinding& Binding : InAnimation.AnimationBindings)
    {
        UObject* FoundObject = Binding.FindRuntimeObject( *WidgetTree );

        if( FoundObject )
        {
            TArray<UObject*>& Objects = GuidToRuntimeObjectMap.FindOrAdd(Binding.AnimationGuid);
            Objects.Add(FoundObject);
        }
    }

    for( auto It = GuidToRuntimeObjectMap.CreateConstIterator(); It; ++It )
    {
        RuntimeBindings->AddBinding( It.Key(), It.Value() );
    }

}
float UMovieSceneShotTrack::FindEndTimeForShot( float StartTime )
{
	float EndTime = 0;
	bool bFoundEndTime = false;
	for( UMovieSceneSection* Section : SubMovieSceneSections )
	{
		if( Section->GetStartTime() >= StartTime )
		{
			EndTime = Section->GetStartTime();
			bFoundEndTime = true;
			break;
		}
	}

	if( !bFoundEndTime )
	{
		UMovieScene* OwnerScene = GetTypedOuter<UMovieScene>();

		// End time should just end where the movie scene ends.  Ensure it is at least the same as start time (this should only happen when the movie scene has an initial time range smaller than the start time
		EndTime = FMath::Max( OwnerScene->GetTimeRange().GetUpperBoundValue(), StartTime );
	}

			
	if( StartTime == EndTime )
	{
		// Give the shot a reasonable length of time to start out with.  A 0 time shot is not usable
		EndTime = StartTime + .5f;
	}

	return EndTime;
}