Deleting folders in the World Outliner now promotes all children to the level above instead of directly to the root.

#jira UE-12338 - Level Editor: Deleting a folder item within another folder item in the World Outliner results in the instances "contained" within the deleted folder item being moved to the root level rather than to underneath the parent folder item.

[CL 2506580 by Richard TalbotWatkin in Main branch]
This commit is contained in:
Richard TalbotWatkin
2015-04-09 05:36:40 -04:00
committed by epic@richtech.es
parent 4643698344
commit dcbedf3fa6

View File

@@ -213,27 +213,29 @@ void FFolderTreeItem::Delete()
struct FResetActorFolders : IMutableTreeItemVisitor
{
explicit FResetActorFolders(FName InParentPath) : ParentPath(InParentPath) {}
virtual void Visit(FActorTreeItem& ActorItem) const override
{
if (AActor* Actor = ActorItem.Actor.Get())
{
Actor->SetFolderPath(FName());
Actor->SetFolderPath(ParentPath);
}
}
virtual void Visit(FFolderTreeItem& FolderItem) const override
{
FResetActorFolders ResetFolders;
for (auto& Child : FolderItem.GetChildren())
{
Child.Pin()->Visit(ResetFolders);
}
FolderItem.Delete();
UWorld* World = FolderItem.SharedData->RepresentingWorld;
check(World != nullptr);
MoveFolderTo(FolderItem.Path, ParentPath, *World);
}
FName ParentPath;
};
const FScopedTransaction Transaction( LOCTEXT("DeleteFolder", "Delete Folder") );
FResetActorFolders ResetFolders;
FResetActorFolders ResetFolders(GetParentPath(Path));
for (auto& Child : GetChildren())
{
Child.Pin()->Visit(ResetFolders);