void FLevelCollectionModel::Tick( float DeltaTime )
{
	if (bRequestedUpdateAllLevels)
	{
		UpdateAllLevels();
	}

	if (bRequestedRedrawAllLevels)
	{		
		RedrawAllLevels();
	}

	if (bRequestedUpdateActorsCount)
	{
		UpdateLevelActorsCount();
	}
	
	if (IsSimulating())
	{
		// Reset simulation status for all levels
		for (TSharedPtr<FLevelModel>& LevelModel : AllLevelsList)
		{
			LevelModel->UpdateSimulationStatus(nullptr);
		}

		// Traverse streaming levels and update simulation status for corresponding level models
		for (ULevelStreaming* StreamingLevel : GetSimulationWorld()->StreamingLevels)
		{
			// Rebuild the original NonPrefixedPackageName so we can find it
			const FString PrefixedPackageName = StreamingLevel->GetWorldAssetPackageName();
			const FString NonPrefixedPackageName = FPackageName::GetLongPackagePath(PrefixedPackageName) + "/" 
					+ FPackageName::GetLongPackageAssetName(PrefixedPackageName).RightChop(GetSimulationWorld()->StreamingLevelsPrefix.Len());
								
			TSharedPtr<FLevelModel> LevelModel = FindLevelModel(FName(*NonPrefixedPackageName));
			if (LevelModel.IsValid())
			{
				LevelModel->UpdateSimulationStatus(StreamingLevel);
			}
		}
	}
}
Beispiel #2
0
void FLevelModel::Update()
{
	UpdateLevelActorsCount();
	BroadcastChangedEvent();
}
Beispiel #3
0
void FLevelModel::OnLevelRemovedFromWorld()
{
	UpdateLevelActorsCount();
}
Beispiel #4
0
void FLevelModel::OnLevelAddedToWorld(ULevel* InLevel)
{
	UpdateLevelActorsCount();
}