本文整理汇总了C++中UPackage::IsFullyLoaded方法的典型用法代码示例。如果您正苦于以下问题:C++ UPackage::IsFullyLoaded方法的具体用法?C++ UPackage::IsFullyLoaded怎么用?C++ UPackage::IsFullyLoaded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UPackage
的用法示例。
在下文中一共展示了UPackage::IsFullyLoaded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadSecondaryLevels
void UWorld::LoadSecondaryLevels(bool bForce, TSet<FString>* CookedPackages)
{
check( GIsEditor );
// streamingServer
// Only load secondary levels in the Editor, and not for commandlets.
if( (!IsRunningCommandlet() || bForce)
// Don't do any work for world info actors that are part of secondary levels being streamed in!
&& !IsAsyncLoading())
{
for( int32 LevelIndex=0; LevelIndex<StreamingLevels.Num(); LevelIndex++ )
{
ULevelStreaming* const StreamingLevel = StreamingLevels[LevelIndex];
if( StreamingLevel )
{
bool bAlreadyCooked = false;
// If we are cooking don't cook sub levels multiple times if they've already been cooked
FString PackageFilename;
const FString StreamingLevelWorldAssetPackageName = StreamingLevel->GetWorldAssetPackageName();
if (CookedPackages)
{
if (FPackageName::DoesPackageExist(StreamingLevelWorldAssetPackageName, NULL, &PackageFilename))
{
PackageFilename = FPaths::ConvertRelativePathToFull(PackageFilename);
bAlreadyCooked |= CookedPackages->Contains( PackageFilename );
}
}
bool bAlreadyLoaded = false;
UPackage* LevelPackage = FindObject<UPackage>(NULL, *StreamingLevelWorldAssetPackageName,true);
// don't need to do any extra work if the level is already loaded
if ( LevelPackage && LevelPackage->IsFullyLoaded() )
{
bAlreadyLoaded = true;
}
if ( !bAlreadyCooked && !bAlreadyLoaded )
{
bool bLoadedLevelPackage = false;
const FName StreamingLevelWorldAssetPackageFName = StreamingLevel->GetWorldAssetPackageFName();
// Load the package and find the world object.
if( FPackageName::IsShortPackageName(StreamingLevelWorldAssetPackageFName) == false )
{
ULevel::StreamedLevelsOwningWorld.Add(StreamingLevelWorldAssetPackageFName, this);
LevelPackage = LoadPackage( NULL, *StreamingLevelWorldAssetPackageName, LOAD_None );
ULevel::StreamedLevelsOwningWorld.Remove(StreamingLevelWorldAssetPackageFName);
if( LevelPackage )
{
bLoadedLevelPackage = true;
// Find the world object in the loaded package.
UWorld* LoadedWorld = UWorld::FindWorldInPackage(LevelPackage);
// If the world was not found, it could be a redirector to a world. If so, follow it to the destination world.
if (!LoadedWorld)
{
LoadedWorld = UWorld::FollowWorldRedirectorInPackage(LevelPackage);
}
check(LoadedWorld);
if ( !LevelPackage->IsFullyLoaded() )
{
// LoadedWorld won't be serialized as there's a BeginLoad on the stack so we manually serialize it here.
check( LoadedWorld->GetLinker() );
LoadedWorld->GetLinker()->Preload( LoadedWorld );
}
// Keep reference to prevent garbage collection.
check( LoadedWorld->PersistentLevel );
ULevel* NewLoadedLevel = LoadedWorld->PersistentLevel;
NewLoadedLevel->OwningWorld = this;
StreamingLevel->SetLoadedLevel(NewLoadedLevel);
}
}
else
{
UE_LOG(LogSpawn, Warning, TEXT("Streaming level uses short package name (%s). Level will not be loaded."), *StreamingLevelWorldAssetPackageName);
}
// Remove this level object if the file couldn't be found.
if ( !bLoadedLevelPackage )
{
StreamingLevels.RemoveAt( LevelIndex-- );
MarkPackageDirty();
}
}
}
}
}
}