Exemple #1
0
void FSequencer::ResetToNewRootMovieScene( UMovieScene& NewRoot, TSharedRef<ISequencerObjectBindingManager> NewObjectBindingManager )
{
	DestroySpawnablesForAllMovieScenes();

	//@todo Sequencer - Encapsulate this better
	MovieSceneStack.Empty();
	Selection.Empty();
	FilteringShots.Empty();
	UnfilterableSections.Empty();
	UnfilterableObjects.Empty();
	MovieSceneSectionToInstanceMap.Empty();

	NewRoot.SetFlags(RF_Transactional);

	ObjectBindingManager = NewObjectBindingManager;

	// Focusing the initial movie scene needs to be done before the first time GetFocusedMovieSceneInstane or GetRootMovieSceneInstance is used
	RootMovieSceneInstance = MakeShareable(new FMovieSceneInstance(NewRoot));
	MovieSceneStack.Add(RootMovieSceneInstance.ToSharedRef());

	SequencerWidget->ResetBreadcrumbs();

	NotifyMovieSceneDataChanged();
}
Exemple #2
0
void FSequencer::OnRequestNodeDeleted( TSharedRef<const FSequencerDisplayNode>& NodeToBeDeleted )
{
	bool bAnySpawnablesRemoved = false;
	bool bAnythingRemoved = false;
	
	TSharedRef<FMovieSceneInstance> MovieSceneInstance = GetFocusedMovieSceneInstance();
	UMovieScene* OwnerMovieScene = MovieSceneInstance->GetMovieScene();

	// Only object nodes or section areas can be deleted
	if( NodeToBeDeleted->GetType() == ESequencerNode::Object  )
	{
		OwnerMovieScene->SetFlags( RF_Transactional );
		const FGuid& BindingToRemove = StaticCastSharedRef<const FObjectBindingNode>( NodeToBeDeleted )->GetObjectBinding();

		//@todo Sequencer - add transaction
		
		// Try to remove as a spawnable first
		bool bRemoved = OwnerMovieScene->RemoveSpawnable( BindingToRemove );
		if( bRemoved )
		{
			bAnySpawnablesRemoved = true;
		}

		if( !bRemoved )
		{
			// The guid should be associated with a possessable if it wasnt a spawnable
			bRemoved = OwnerMovieScene->RemovePossessable( BindingToRemove );
			
			// @todo Sequencer - undo needs to work here
			ObjectBindingManager->UnbindPossessableObjects( BindingToRemove );
			
			// If this check fails the guid was not associated with a spawnable or possessable so there was an invalid guid being stored on a node
			check( bRemoved );
		}

		bAnythingRemoved = true;
	}
	else if( NodeToBeDeleted->GetType() == ESequencerNode::Track  )
	{
		TSharedRef<const FTrackNode> SectionAreaNode = StaticCastSharedRef<const FTrackNode>( NodeToBeDeleted );
		UMovieSceneTrack* Track = SectionAreaNode->GetTrack();

		UMovieScene* FocusedMovieScene = GetFocusedMovieScene();

		FocusedMovieScene->SetFlags( RF_Transactional );
		
		if( FocusedMovieScene->IsAMasterTrack( Track ) )
		{
			FocusedMovieScene->RemoveMasterTrack( Track );
		}
		else
		{
			FocusedMovieScene->RemoveTrack( Track );
		}
		
		bAnythingRemoved = true;
	}

	
	if( bAnythingRemoved )
	{
		if( bAnySpawnablesRemoved )
		{
			// @todo Sequencer Sub-MovieScenes needs to destroy objects for all movie scenes that had this node
			SpawnOrDestroyPuppetObjects( MovieSceneInstance );
		}

		NotifyMovieSceneDataChanged();
	}
}