Example #1
0
void FLevelModel::UpdateSimulationStatus(ULevelStreaming* StreamingLevel)
{
	SimulationStatus = FSimulationLevelStatus();
	
	// Persistent level always loaded and visible in PIE
	if (IsPersistent())
	{
		SimulationStatus.bLoaded = true;
		SimulationStatus.bVisible = true;
		return;
	}

	if (StreamingLevel == nullptr)
	{
		return;
	}
		
	if (StreamingLevel->GetLoadedLevel())
	{
		SimulationStatus.bLoaded = true;
				
		if (StreamingLevel->GetLoadedLevel()->bIsVisible)
		{
			SimulationStatus.bVisible = true;
		}
	}
	else if (StreamingLevel->bHasLoadRequestPending)
	{
		SimulationStatus.bLoading = true;
	}
}
Example #2
0
FLevelModel::FLevelModel(FLevelCollectionModel& InLevelCollectionModel,
						const TWeakObjectPtr<UEditorEngine>& InEditor)
	: LevelCollectionModel(InLevelCollectionModel)
	, Editor(InEditor)
	, bSelected(false)
	, bExpanded(false)
	, bLoadingLevel(false)
	, bFilteredOut(false)
	, LevelTranslationDelta(0,0)
	, LevelActorsCount(0)
{
	SimulationStatus = FSimulationLevelStatus();
}
Example #3
0
FLevelModel::FLevelModel(FLevelCollectionModel& InLevelCollectionModel,
						const TWeakObjectPtr<UEditorEngine>& InEditor)
	: LevelCollectionModel(InLevelCollectionModel)
	, Editor(InEditor)
	, bSelected(false)
	, bExpanded(false)
	, bLoadingLevel(false)
	, bFilteredOut(false)
	, LevelTranslationDelta(0,0)
	, LevelActorsCount(0)
{
	SimulationStatus = FSimulationLevelStatus();

	FAssetRegistryModule& AssetRegistryModule = FModuleManager::GetModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
	AssetRegistryModule.Get().OnAssetRenamed().AddRaw(this, &FLevelModel::OnAssetRenamed);
}
Example #4
0
void FLevelModel::UpdateSimulationStatus(UWorld* InWorld)
{
	check(InWorld);
	SimulationStatus = FSimulationLevelStatus();
	
	// Matcher for finding streaming level in PIE world by package name
	struct FSimulationLevelStreamingMatcher
	{
		FSimulationLevelStreamingMatcher( const FName& InPackageName )
			: PackageName( InPackageName )
		{}

		bool Matches( const ULevelStreaming* Candidate ) const
		{
			if (Candidate->PackageNameToLoad != NAME_None)
			{
				return Candidate->PackageNameToLoad == PackageName;
			}
			return Candidate->PackageName == PackageName;
		}

		FName PackageName;
	};
	
	// Find corresponding streaming level
	int32 StreamingLevelIdx = InWorld->StreamingLevels.FindMatch(FSimulationLevelStreamingMatcher(GetLongPackageName()));
	if (StreamingLevelIdx != INDEX_NONE)
	{
		ULevelStreaming* StreamingLevel = InWorld->StreamingLevels[StreamingLevelIdx];

		if (StreamingLevel->GetLoadedLevel())
		{
			SimulationStatus.bLoaded = true;
				
			if (StreamingLevel->GetLoadedLevel()->bIsVisible)
			{
				SimulationStatus.bVisible = true;
			}
		}
		else if (StreamingLevel->bHasLoadRequestPending)
		{
			SimulationStatus.bLoading = true;
		}
	}
}