本文整理汇总了C++中FLevelModelList类的典型用法代码示例。如果您正苦于以下问题:C++ FLevelModelList类的具体用法?C++ FLevelModelList怎么用?C++ FLevelModelList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FLevelModelList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeLevelCurrent
void FLevelModel::MakeLevelCurrent()
{
if (LevelCollectionModel.IsReadOnly())
{
return;
}
if (!IsLoaded())
{
// Load level from disk
FLevelModelList LevelsList; LevelsList.Add(this->AsShared());
LevelCollectionModel.LoadLevels(LevelsList);
}
ULevel* Level = GetLevelObject();
if (Level == NULL)
{
return;
}
// Locked levels can't be made current.
if (!FLevelUtils::IsLevelLocked(Level))
{
// Make current.
if (LevelCollectionModel.GetWorld()->SetCurrentLevel(Level))
{
FEditorDelegates::NewCurrentLevel.Broadcast();
// Deselect all selected builder brushes.
bool bDeselectedSomething = false;
for (FSelectionIterator It(Editor->GetSelectedActorIterator()); It; ++It)
{
AActor* Actor = static_cast<AActor*>(*It);
checkSlow(Actor->IsA(AActor::StaticClass()));
ABrush* Brush = Cast< ABrush >( Actor );
if (Brush && FActorEditorUtils::IsABuilderBrush(Brush))
{
Editor->SelectActor(Actor, /*bInSelected=*/ false, /*bNotify=*/ false);
bDeselectedSomething = true;
}
}
// Send a selection change callback if necessary.
if (bDeselectedSomething)
{
Editor->NoteSelectionChange();
}
}
// Force the current level to be visible.
SetVisible(true);
}
else
{
FMessageDialog::Open(EAppMsgType::Ok, NSLOCTEXT("UnrealEd", "Error_OperationDisallowedOnLockedLevelMakeLevelCurrent", "MakeLevelCurrent: The requested operation could not be completed because the level is locked."));
}
Update();
}
示例2: OnSave
FReply SWorldHierarchyItem::OnSave()
{
FLevelModelList LevelList;
LevelList.Add(LevelModel);
WorldModel->SaveLevels(LevelList);
return FReply::Handled();
}
示例3: GetLevelObjectList
void FLevelCollectionModel::UnloadLevels(const FLevelModelList& InLevelList)
{
if (InLevelList.Num() == 0)
{
return;
}
// If matinee is opened, and if it belongs to the level being removed, close it
if (GLevelEditorModeTools().IsModeActive(FBuiltinEditorModes::EM_InterpEdit))
{
TArray<ULevel*> LevelsToRemove = GetLevelObjectList(InLevelList);
const FEdModeInterpEdit* InterpEditMode = (const FEdModeInterpEdit*)GLevelEditorModeTools().GetActiveMode(FBuiltinEditorModes::EM_InterpEdit);
if (InterpEditMode && InterpEditMode->MatineeActor && LevelsToRemove.Contains(InterpEditMode->MatineeActor->GetLevel()))
{
GLevelEditorModeTools().ActivateDefaultMode();
}
}
else if(GLevelEditorModeTools().IsModeActive(FBuiltinEditorModes::EM_Landscape))
{
GLevelEditorModeTools().ActivateDefaultMode();
}
// Remove each level!
// Take a copy of the list rather than using a reference to the selected levels list, as this will be modified in the loop below
const FLevelModelList LevelListCopy = InLevelList;
for (auto It = LevelListCopy.CreateConstIterator(); It; ++It)
{
TSharedPtr<FLevelModel> LevelModel = (*It);
ULevel* Level = LevelModel->GetLevelObject();
if (Level != NULL && !LevelModel->IsPersistent())
{
// Unselect all actors before removing the level
// This avoids crashing in areas that rely on getting a selected actors level. The level will be invalid after its removed.
for (auto ActorIt = Level->Actors.CreateIterator(); ActorIt; ++ActorIt)
{
Editor->SelectActor((*ActorIt), /*bInSelected=*/ false, /*bSelectEvenIfHidden=*/ false);
}
{
FUnmodifiableObject ImmuneWorld(CurrentWorld.Get());
EditorLevelUtils::RemoveLevelFromWorld(Level);
}
}
}
Editor->ResetTransaction( LOCTEXT("RemoveLevelTransReset", "Removing Levels from World") );
// Collect garbage to clear out the destroyed level
CollectGarbage( GARBAGE_COLLECTION_KEEPFLAGS );
PopulateLevelsList();
}
示例4: RefreshView
/** Updates all the items in the grid view */
void RefreshView()
{
RemoveAllNodes();
FLevelModelList AllLevels = WorldModel->GetAllLevels();
for (auto It = AllLevels.CreateConstIterator(); It; ++It)
{
AddItem(StaticCastSharedPtr<FWorldTileModel>(*It));
}
}
示例5: GetLoadedLevels
FLevelModelList FLevelCollectionModel::GetLoadedLevels(const FLevelModelList& InList)
{
FLevelModelList ResultList;
for (auto It = InList.CreateConstIterator(); It; ++It)
{
if ((*It)->IsLoaded())
{
ResultList.Add(*It);
}
}
return ResultList;
}
示例6: InvertSelection_Executed
void FLevelCollectionModel::InvertSelection_Executed()
{
FLevelModelList InvertedLevels;
for (auto It = FilteredLevelsList.CreateIterator(); It; ++It)
{
if (!SelectedLevelsList.Contains(*It))
{
InvertedLevels.Add(*It);
}
}
SetSelectedLevels(InvertedLevels);
}
示例7: SetSelectedLevelsFromWorld
void FLevelCollectionModel::SetSelectedLevelsFromWorld()
{
TArray<ULevel*>& SelectedLevelObjects = CurrentWorld->GetSelectedLevels();
FLevelModelList LevelsToSelect;
for (ULevel* LevelObject : SelectedLevelObjects)
{
TSharedPtr<FLevelModel> LevelModel = FindLevelModel(LevelObject);
if (LevelModel.IsValid())
{
LevelsToSelect.Add(LevelModel);
}
}
SetSelectedLevels(LevelsToSelect);
}
示例8: OnToggleVisibility
FReply SWorldHierarchyItem::OnToggleVisibility()
{
FLevelModelList LevelList;
LevelList.Add(LevelModel);
if (LevelModel->IsVisible())
{
WorldModel->HideLevels(LevelList);
}
else
{
WorldModel->ShowLevels(LevelList);
}
return FReply::Handled();
}
示例9: OnToggleLock
FReply SWorldHierarchyItem::OnToggleLock()
{
FLevelModelList LevelList;
LevelList.Add(LevelModel);
if (LevelModel->IsLocked())
{
WorldModel->UnlockLevels(LevelList);
}
else
{
WorldModel->LockLevels(LevelList);
}
return FReply::Handled();
}
示例10: UnloadLevels
void FStreamingLevelCollectionModel::UnloadLevels(const FLevelModelList& InLevelList)
{
if (IsReadOnly())
{
return;
}
// Persistent level cannot be unloaded
if (InLevelList.Num() == 1 && InLevelList[0]->IsPersistent())
{
return;
}
bool bHaveDirtyLevels = false;
for (auto It = InLevelList.CreateConstIterator(); It; ++It)
{
if ((*It)->IsDirty() && !(*It)->IsLocked() && !(*It)->IsPersistent())
{
// this level is dirty and can be removed from the world
bHaveDirtyLevels = true;
break;
}
}
// Depending on the state of the level, create a warning message
FText LevelWarning = LOCTEXT("RemoveLevel_Undo", "Removing levels cannot be undone. Proceed?");
if (bHaveDirtyLevels)
{
LevelWarning = LOCTEXT("RemoveLevel_Dirty", "Removing levels cannot be undone. Any changes to these levels will be lost. Proceed?");
}
// Ask the user if they really wish to remove the level(s)
FSuppressableWarningDialog::FSetupInfo Info( LevelWarning, LOCTEXT("RemoveLevel_Message", "Remove Level"), "RemoveLevelWarning" );
Info.ConfirmText = LOCTEXT( "RemoveLevel_Yes", "Yes");
Info.CancelText = LOCTEXT( "RemoveLevel_No", "No");
FSuppressableWarningDialog RemoveLevelWarning( Info );
if (RemoveLevelWarning.ShowModal() == FSuppressableWarningDialog::Cancel)
{
return;
}
// This will remove streaming levels from a persistent world, so we need to re-populate levels list
FLevelCollectionModel::UnloadLevels(InLevelList);
PopulateLevelsList();
}
示例11: OnDrop
void FWorldTileModel::OnDrop(const TSharedPtr<FLevelDragDropOp>& Op)
{
FLevelModelList LevelModelList;
for (auto It = Op->LevelsToDrop.CreateConstIterator(); It; ++It)
{
ULevel* Level = (*It).Get();
TSharedPtr<FLevelModel> LevelModel = LevelCollectionModel.FindLevelModel(Level);
if (LevelModel.IsValid())
{
LevelModelList.Add(LevelModel);
}
}
if (LevelModelList.Num())
{
LevelCollectionModel.AssignParent(LevelModelList, this->AsShared());
}
}
示例12: AssignParent
void FLevelCollectionModel::AssignParent(const FLevelModelList& InLevels, TSharedPtr<FLevelModel> InParent)
{
// Attach levels to the new parent
for (auto It = InLevels.CreateConstIterator(); It; ++It)
{
(*It)->AttachTo(InParent);
}
OnLevelsHierarchyChanged();
}
示例13: SaveSelectedLevels_Executed
void FStreamingLevelCollectionModel::SetStreamingLevelsClass_Executed(UClass* InClass)
{
// First prompt to save the selected levels, as changing the streaming method will unload/reload them
SaveSelectedLevels_Executed();
// Stash off a copy of the original array, as changing the streaming method can destroy the selection
FLevelModelList SelectedLevelsCopy = GetSelectedLevels();
// Apply the new streaming method to the selected levels
for (auto It = SelectedLevelsCopy.CreateIterator(); It; ++It)
{
TSharedPtr<FStreamingLevelModel> TargetModel = StaticCastSharedPtr<FStreamingLevelModel>(*It);
TargetModel->SetStreamingClass(InClass);
}
SetSelectedLevels(SelectedLevelsCopy);
// Force a cached level list rebuild
PopulateLevelsList();
}
示例14: OnParentPackageNamePropertyChanged
void FWorldTileModel::OnParentPackageNamePropertyChanged()
{
if (GetLevelObject() && !TileDetails->bAlwaysLoaded)
{
TSharedPtr<FLevelModel> NewParent = LevelCollectionModel.FindLevelModel(TileDetails->ParentPackageName);
// Assign to a root level if new parent is not found
if (!NewParent.IsValid())
{
NewParent = static_cast<FWorldTileCollectionModel&>(LevelCollectionModel).GetWorldRootModel();
}
FLevelModelList LevelList; LevelList.Add(this->AsShared());
LevelCollectionModel.AssignParent(LevelList, NewParent);
return;
}
// Restore original parent
FWorldTileInfo Info = LevelCollectionModel.GetWorld()->WorldComposition->GetTileInfo(TileDetails->PackageName);
TileDetails->ParentPackageName = FName(*Info.ParentTilePackageName);
}
示例15: LockLevels
void FLevelCollectionModel::LockLevels(const FLevelModelList& InLevelList)
{
if (IsReadOnly())
{
return;
}
for (auto It = InLevelList.CreateConstIterator(); It; ++It)
{
(*It)->SetLocked(true);
}
}