コード例 #1
0
void FMovieSceneShotTrackInstance::Update( float Position, float LastPosition, const TArray<UObject*>& RuntimeObjects, class IMovieScenePlayer& Player )
{
    FSubMovieSceneTrackInstance::Update( Position, LastPosition, RuntimeObjects, Player );

    const TArray<UMovieSceneSection*>& ShotSections = SubMovieSceneTrack->GetAllSections();

    for (int32 ShotIndex = 0; ShotIndex < ShotSections.Num(); ++ShotIndex)
    {
        UMovieSceneShotSection* ShotSection = CastChecked<UMovieSceneShotSection>(ShotSections[ShotIndex]);

        // Note shot times are not inclusive
        // @todo Sequencer: This could be faster with a binary search
        if( ShotSection->GetStartTime() <= Position && ShotSection->GetEndTime() > Position )
        {
            UObject* Camera = RuntimeCameraObjects[ShotIndex].Get();

            const bool bNewCameraCut = CurrentCameraObject != Camera;
            Player.UpdateCameraCut(Camera, bNewCameraCut);

            CurrentCameraObject = Camera;

            // no need to process any more shots.  Only one shot can be active at a time
            break;
        }
    }
}
コード例 #2
0
void UMovieSceneDirectorTrack::AddNewShot(FGuid CameraHandle, float Time)
{
	UMovieSceneShotSection* NewSection = ConstructObject<UMovieSceneShotSection>( UMovieSceneShotSection::StaticClass(), this );
	NewSection->InitialPlacement(ShotSections, Time, Time + 1.f, SupportsMultipleRows()); //@todo find a better default end time
	NewSection->SetCameraGuid(CameraHandle);
	NewSection->SetTitle(LOCTEXT("AddNewShot", "New Shot"));

	ShotSections.Add(NewSection);
}
コード例 #3
0
void FMovieSceneDirectorTrackInstance::Update( float Position, float LastPosition, const TArray<UObject*>& RuntimeObjects, class IMovieScenePlayer& Player ) 
{
	// possess the 'first' shot section in order of track index
	ACameraActor* PossessedCamera = NULL;
	UMovieSceneShotSection* FirstShotSection = NULL;

	const TArray<UMovieSceneSection*>& ShotSections = DirectorTrack->GetShotSections();

	for (int32 ShotIndex = 0; ShotIndex < ShotSections.Num(); ++ShotIndex)
	{
		UMovieSceneShotSection* ShotSection = CastChecked<UMovieSceneShotSection>(ShotSections[ShotIndex]);

		if (ShotSection->IsTimeWithinSection(Position) &&
			(FirstShotSection == NULL || FirstShotSection->GetRowIndex() > ShotSection->GetRowIndex()))
		{
			TArray<UObject*> CameraObjects;
			// @todo Sequencer - Sub-moviescenes: Get the cameras from the root movie scene instance.  We should support adding cameras for sub-moviescenes as shots
			Player.GetRuntimeObjects( Player.GetRootMovieSceneInstance(), ShotSection->GetCameraGuid(), CameraObjects);

			if (CameraObjects.Num() > 0)
			{
				check(CameraObjects.Num() == 1 && CameraObjects[0]->IsA(ACameraActor::StaticClass()));

				PossessedCamera = Cast<ACameraActor>(CameraObjects[0]);

				FirstShotSection = ShotSection;
			}
		}
	}

	Player.UpdatePreviewViewports(PossessedCamera);
}
コード例 #4
0
void UMovieSceneShotTrack::AddNewShot(FGuid CameraHandle, UMovieScene& ShotMovieScene, const TRange<float>& TimeRange, const FText& ShotName, int32 ShotNumber )
{
	Modify();

	FName UniqueShotName = MakeUniqueObjectName( this, UMovieSceneShotSection::StaticClass(), *ShotName.ToString() );

	UMovieSceneShotSection* NewSection = NewObject<UMovieSceneShotSection>( this, UniqueShotName, RF_Transactional );
	NewSection->SetMovieScene( &ShotMovieScene );
	NewSection->SetStartTime( TimeRange.GetLowerBoundValue() );
	NewSection->SetEndTime( TimeRange.GetUpperBoundValue() );
	NewSection->SetCameraGuid( CameraHandle );
	NewSection->SetShotNameAndNumber( ShotName , ShotNumber );

	SubMovieSceneSections.Add( NewSection );
	
	// When a new shot is added, sort all shots to ensure they are in the correct order
	SortShots();
}
コード例 #5
0
void UMovieSceneShotTrack::AddNewShot(FGuid CameraHandle, UMovieSceneSequence& ShotMovieSceneSequence, float StartTime, const FText& ShotName, int32 ShotNumber )
{
	Modify();

	FName UniqueShotName = MakeUniqueObjectName( this, UMovieSceneShotSection::StaticClass(), *ShotName.ToString() );

	UMovieSceneShotSection* NewSection = NewObject<UMovieSceneShotSection>( this, UniqueShotName, RF_Transactional );
	NewSection->SetMovieSceneAnimation( &ShotMovieSceneSequence );
	NewSection->SetStartTime( StartTime );
	NewSection->SetEndTime( FindEndTimeForShot( StartTime ) );
	NewSection->SetCameraGuid( CameraHandle );
	NewSection->SetShotNameAndNumber( ShotName , ShotNumber );

	SubMovieSceneSections.Add( NewSection );

	// When a new shot is added, sort all shots to ensure they are in the correct order
	SortShots();



	// Once shots are sorted fixup the surrounding shots to fix any gaps
	FixupSurroundingShots( *NewSection, false );
}