コード例 #1
0
void FMoveKeys::OnBeginDrag(const FVector2D& LocalMousePos, TSharedPtr<FTrackNode> SequencerNode)
{
	check( SelectedKeys.Num() > 0 )

	// Begin an editor transaction and mark the section as transactional so it's state will be saved
	GEditor->BeginTransaction( NSLOCTEXT("Sequencer", "MoveKeysTransaction", "Move Keys") );

	TSet<UMovieSceneSection*> ModifiedSections;
	for( FSelectedKey SelectedKey : SelectedKeys )
	{
		UMovieSceneSection* OwningSection = SelectedKey.Section;

		// Only modify sections once
		if( !ModifiedSections.Contains( OwningSection ) )
		{
			OwningSection->SetFlags( RF_Transactional );

			// Save the current state of the section
			OwningSection->Modify();

			// Section has been modified
			ModifiedSections.Add( OwningSection );
		}
	}
}
コード例 #2
0
void FSequencerDragOperation::BeginTransaction( UMovieSceneSection& Section, const FText& TransactionDesc )
{
	// Begin an editor transaction and mark the section as transactional so it's state will be saved
	GEditor->BeginTransaction( TransactionDesc );
	Section.SetFlags( RF_Transactional );
	// Save the current state of the section
	Section.Modify();
}
コード例 #3
0
FReply SAnimationOutlinerTreeNode::OnAddKeyClicked()
{
	FSequencer& Sequencer = DisplayNode->GetSequencer();
	float CurrentTime = Sequencer.GetCurrentLocalTime(*Sequencer.GetFocusedMovieScene());

	TSet<TSharedPtr<IKeyArea>> KeyAreas;
	GetAllKeyAreas(DisplayNode, KeyAreas);

	FScopedTransaction Transaction(LOCTEXT("AddKeys", "Add keys at current time"));
	for (TSharedPtr<IKeyArea> KeyArea : KeyAreas)
	{
		UMovieSceneSection* OwningSection = KeyArea->GetOwningSection();
		OwningSection->SetFlags(RF_Transactional);
		OwningSection->Modify();
		KeyArea->AddKeyUnique(CurrentTime);
	}
	return FReply::Handled();
}