本文整理汇总了C++中UMovieScene::GetRootFolders方法的典型用法代码示例。如果您正苦于以下问题:C++ UMovieScene::GetRootFolders方法的具体用法?C++ UMovieScene::GetRootFolders怎么用?C++ UMovieScene::GetRootFolders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMovieScene
的用法示例。
在下文中一共展示了UMovieScene::GetRootFolders方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetParentTree
TOptional<EItemDropZone> FSequencerFolderNode::CanDrop( FSequencerDisplayNodeDragDropOp& DragDropOp, EItemDropZone ItemDropZone ) const
{
DragDropOp.ResetToDefaultToolTip();
if ( ItemDropZone == EItemDropZone::AboveItem )
{
if ( GetParent().IsValid() )
{
// When dropping above, only allow it for root level nodes.
return TOptional<EItemDropZone>();
}
else
{
// Make sure there are no folder name collisions with the root folders
UMovieScene* FocusedMovieScene = GetParentTree().GetSequencer().GetFocusedMovieSceneSequence()->GetMovieScene();
TSet<FName> RootFolderNames;
for ( UMovieSceneFolder* RootFolder : FocusedMovieScene->GetRootFolders() )
{
RootFolderNames.Add( RootFolder->GetFolderName() );
}
for ( TSharedRef<FSequencerDisplayNode> DraggedNode : DragDropOp.GetDraggedNodes() )
{
if ( DraggedNode->GetType() == ESequencerNode::Folder )
{
TSharedRef<FSequencerFolderNode> DraggedFolder = StaticCastSharedRef<FSequencerFolderNode>( DraggedNode );
if ( RootFolderNames.Contains( DraggedFolder->GetFolder().GetFolderName() ) )
{
DragDropOp.CurrentHoverText = FText::Format(
NSLOCTEXT( "SeqeuencerFolderNode", "DuplicateRootFolderDragErrorFormat", "Root folder with name '{0}' already exists." ),
FText::FromName( DraggedFolder->GetFolder().GetFolderName() ) );
return TOptional<EItemDropZone>();
}
}
}
}
return TOptional<EItemDropZone>( EItemDropZone::AboveItem );
}
else
{
// When dropping onto, don't allow dropping into the same folder, don't allow dropping
// parents into children, and don't allow duplicate folder names.
TSet<FName> ChildFolderNames;
for ( UMovieSceneFolder* ChildFolder : GetFolder().GetChildFolders() )
{
ChildFolderNames.Add( ChildFolder->GetFolderName() );
}
for ( TSharedRef<FSequencerDisplayNode> DraggedNode : DragDropOp.GetDraggedNodes() )
{
TSharedPtr<FSequencerDisplayNode> ParentSeqNode = DraggedNode->GetParent();
if ( ParentSeqNode.IsValid() && ParentSeqNode.Get() == this )
{
DragDropOp.CurrentHoverText = NSLOCTEXT( "SeqeuencerFolderNode", "SameParentDragError", "Can't drag a node onto the same parent." );
return TOptional<EItemDropZone>();
}
if ( DraggedNode->GetType() == ESequencerNode::Folder )
{
TSharedRef<FSequencerFolderNode> DraggedFolder = StaticCastSharedRef<FSequencerFolderNode>( DraggedNode );
if ( ChildFolderNames.Contains( DraggedFolder->GetFolder().GetFolderName() ) )
{
DragDropOp.CurrentHoverText = FText::Format(
NSLOCTEXT( "SeqeuencerFolderNode", "DuplicateChildFolderDragErrorFormat", "Folder with name '{0}' already exists." ),
FText::FromName( DraggedFolder->GetFolder().GetFolderName() ) );
return TOptional<EItemDropZone>();
}
}
}
TSharedPtr<FSequencerDisplayNode> CurrentNode = SharedThis( ( FSequencerDisplayNode* )this );
while ( CurrentNode.IsValid() )
{
if ( DragDropOp.GetDraggedNodes().Contains( CurrentNode ) )
{
DragDropOp.CurrentHoverText = NSLOCTEXT( "SeqeuencerFolderNode", "ParentIntoChildDragError", "Can't drag a parent node into one of it's children." );
return TOptional<EItemDropZone>();
}
CurrentNode = CurrentNode->GetParent();
}
return TOptional<EItemDropZone>( EItemDropZone::OntoItem );
}
}
示例2: Drop
void FSequencerFolderNode::Drop( const TArray<TSharedRef<FSequencerDisplayNode>>& DraggedNodes, EItemDropZone ItemDropZone )
{
const FScopedTransaction Transaction( NSLOCTEXT( "SequencerFolderNode", "MoveIntoFolder", "Move items into folder." ) );
GetFolder().SetFlags(RF_Transactional);
GetFolder().Modify();
for ( TSharedRef<FSequencerDisplayNode> DraggedNode : DraggedNodes )
{
TSharedPtr<FSequencerDisplayNode> ParentSeqNode = DraggedNode->GetParent();
switch ( DraggedNode->GetType() )
{
case ESequencerNode::Folder:
{
TSharedRef<FSequencerFolderNode> DraggedFolderNode = StaticCastSharedRef<FSequencerFolderNode>( DraggedNode );
UMovieScene* FocusedMovieScene = GetParentTree().GetSequencer().GetFocusedMovieSceneSequence()->GetMovieScene();
if ( ItemDropZone == EItemDropZone::OntoItem )
{
GetFolder().AddChildFolder( &DraggedFolderNode->GetFolder() );
}
else
{
FocusedMovieScene->Modify();
FocusedMovieScene->GetRootFolders().Add( &DraggedFolderNode->GetFolder() );
}
if ( ParentSeqNode.IsValid() )
{
checkf( ParentSeqNode->GetType() == ESequencerNode::Folder, TEXT( "Can not remove from unsupported parent node." ) );
TSharedPtr<FSequencerFolderNode> ParentFolder = StaticCastSharedPtr<FSequencerFolderNode>( ParentSeqNode );
ParentFolder->GetFolder().Modify();
ParentFolder->GetFolder().RemoveChildFolder( &DraggedFolderNode->GetFolder() );
}
else
{
FocusedMovieScene->Modify();
FocusedMovieScene->GetRootFolders().Remove( &DraggedFolderNode->GetFolder() );
}
break;
}
case ESequencerNode::Track:
{
TSharedRef<FSequencerTrackNode> DraggedTrackNode = StaticCastSharedRef<FSequencerTrackNode>( DraggedNode );
if( ItemDropZone == EItemDropZone::OntoItem )
{
GetFolder().AddChildMasterTrack( DraggedTrackNode->GetTrack() );
}
if ( ParentSeqNode.IsValid() )
{
checkf( ParentSeqNode->GetType() == ESequencerNode::Folder, TEXT( "Can not remove from unsupported parent node." ) );
TSharedPtr<FSequencerFolderNode> ParentFolder = StaticCastSharedPtr<FSequencerFolderNode>( ParentSeqNode );
ParentFolder->GetFolder().Modify();
ParentFolder->GetFolder().RemoveChildMasterTrack( DraggedTrackNode->GetTrack() );
}
break;
}
case ESequencerNode::Object:
{
TSharedRef<FSequencerObjectBindingNode> DraggedObjectBindingNode = StaticCastSharedRef<FSequencerObjectBindingNode>( DraggedNode );
if ( ItemDropZone == EItemDropZone::OntoItem )
{
GetFolder().AddChildObjectBinding( DraggedObjectBindingNode->GetObjectBinding() );
}
if ( ParentSeqNode.IsValid() )
{
checkf( ParentSeqNode->GetType() == ESequencerNode::Folder, TEXT( "Can not remove from unsupported parent node." ) );
TSharedPtr<FSequencerFolderNode> ParentFolder = StaticCastSharedPtr<FSequencerFolderNode>( ParentSeqNode );
ParentFolder->GetFolder().Modify();
ParentFolder->GetFolder().RemoveChildObjectBinding( DraggedObjectBindingNode->GetObjectBinding() );
}
break;
}
}
}
SetExpansionState( true );
ParentTree.GetSequencer().NotifyMovieSceneDataChanged( EMovieSceneDataChangeType::MovieSceneStructureItemsChanged );
}