当前位置: 首页>>代码示例>>C++>>正文


C++ ULevel::GetOuter方法代码示例

本文整理汇总了C++中ULevel::GetOuter方法的典型用法代码示例。如果您正苦于以下问题:C++ ULevel::GetOuter方法的具体用法?C++ ULevel::GetOuter怎么用?C++ ULevel::GetOuter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ULevel的用法示例。


在下文中一共展示了ULevel::GetOuter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddInstanceBaseId

FFoliageInstanceBaseId FFoliageInstanceBaseCache::AddInstanceBaseId(UActorComponent* InComponent)
{
	FFoliageInstanceBaseId BaseId = FFoliageInstanceBaseCache::InvalidBaseId;
	if (InComponent && !InComponent->IsCreatedByConstructionScript())
	{
		BaseId = GetInstanceBaseId(InComponent);
		if (BaseId == FFoliageInstanceBaseCache::InvalidBaseId)
		{
			BaseId = NextBaseId++;

			FFoliageInstanceBaseInfo BaseInfo(InComponent);
			InstanceBaseMap.Add(BaseId, BaseInfo);
			InstanceBaseInvMap.Add(BaseInfo.BasePtr, BaseId);

			check(InstanceBaseMap.Num() == InstanceBaseInvMap.Num());

			ULevel* ComponentLevel = InComponent->GetComponentLevel();
			if (ComponentLevel)
			{
				UWorld* ComponentWorld = Cast<UWorld>(ComponentLevel->GetOuter());
				if (ComponentWorld)
				{
					auto WorldKey = TAssetPtr<UWorld>(ComponentWorld);
					InstanceBaseLevelMap.FindOrAdd(WorldKey).Add(BaseInfo.BasePtr);
				}
			}
		}
	}

	return BaseId;
}
开发者ID:stoneStyle,项目名称:Unreal4,代码行数:31,代码来源:FoliageInstanceBase.cpp

示例2: GetWorlds

/**
* Assembles the set of all referenced worlds.
*
* @param	OutWorlds			[out] The set of referenced worlds.
* @param	bIncludeGWorld		If true, include GWorld in the output list.
* @param	bOnlyEditorVisible	If true, only sub-levels that should be visible in-editor are included
*/
void GetWorlds(UWorld* InWorld, TArray<UWorld*>& OutWorlds, bool bIncludeInWorld, bool bOnlyEditorVisible)
{
    OutWorlds.Empty();
    if ( bIncludeInWorld )
    {
        OutWorlds.AddUnique( InWorld );
    }

    // Iterate over the world's level array to find referenced levels ("worlds"). We don't
    for ( int32 LevelIndex = 0 ; LevelIndex < InWorld->StreamingLevels.Num() ; ++LevelIndex )
    {
        ULevelStreaming* StreamingLevel = InWorld->StreamingLevels[LevelIndex];
        if ( StreamingLevel )
        {
            // If we asked for only sub-levels that are editor-visible, then limit our results appropriately
            bool bShouldAlwaysBeLoaded = false; // Cast< ULevelStreamingAlwaysLoaded >( StreamingLevel ) != NULL;
            if( !bOnlyEditorVisible || bShouldAlwaysBeLoaded || StreamingLevel->bShouldBeVisibleInEditor )
            {
                const ULevel* Level = StreamingLevel->GetLoadedLevel();

                // This should always be the case for valid level names as the Editor preloads all packages.
                if ( Level != NULL )
                {
                    // Newer levels have their packages' world as the outer.
                    UWorld* World = Cast<UWorld>( Level->GetOuter() );
                    if ( World != NULL )
                    {
                        OutWorlds.AddUnique( World );
                    }
                }
            }
        }
    }

    // Levels can be loaded directly without StreamingLevel facilities
    for ( int32 LevelIndex = 0 ; LevelIndex < InWorld->GetLevels().Num() ; ++LevelIndex )
    {
        ULevel* Level = InWorld->GetLevel(LevelIndex);
        if ( Level )
        {
            // Newer levels have their packages' world as the outer.
            UWorld* World = Cast<UWorld>( Level->GetOuter() );
            if ( World != NULL )
            {
                OutWorlds.AddUnique( World );
            }
        }
    }
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:56,代码来源:EditorLevelUtils.cpp

示例3: OnStreamingLevelsPropertyChanged

void FWorldTileModel::OnStreamingLevelsPropertyChanged()
{
	ULevel* Level = GetLevelObject();
	if (Level == NULL)
	{
		TileDetails->StreamingLevels.Empty();
		return;
	}
	
	// Delete all streaming levels from the world objects
	CastChecked<UWorld>(Level->GetOuter())->StreamingLevels.Empty();

	// Recreate streaming levels using settings stored in the tile details
	for (auto It = TileDetails->StreamingLevels.CreateIterator(); It; ++It)
	{
		FTileStreamingLevelDetails& StreamingLevelDetails = (*It);
		FName PackageName = StreamingLevelDetails.PackageName;
		if (PackageName != NAME_None && FPackageName::DoesPackageExist(PackageName.ToString()))
		{
			UClass* StreamingClass = FTileStreamingLevelDetails::StreamingMode2Class(StreamingLevelDetails.StreamingMode);
			AddStreamingLevel(StreamingClass, PackageName);
		}
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:24,代码来源:WorldTileModel.cpp

示例4: AddLevelToWorld

ULevel* AddLevelToWorld( UWorld* InWorld, const TCHAR* LevelPackageName, UClass* LevelStreamingClass)
{
    ULevel* NewLevel = NULL;
    bool bIsPersistentLevel = (InWorld->PersistentLevel->GetOutermost()->GetName() == FString(LevelPackageName));

    if ( bIsPersistentLevel || FLevelUtils::FindStreamingLevel( InWorld, LevelPackageName ) )
    {
        // Do nothing if the level already exists in the world.
        FMessageDialog::Open( EAppMsgType::Ok, NSLOCTEXT("UnrealEd", "LevelAlreadyExistsInWorld", "A level with that name already exists in the world.") );
    }
    else
    {
        // If the selected class is still NULL, abort the operation.
        if ( LevelStreamingClass == NULL )
        {
            return NULL;
        }

        const FScopedBusyCursor BusyCursor;

        ULevelStreaming* StreamingLevel = static_cast<ULevelStreaming*>( StaticConstructObject( LevelStreamingClass, InWorld, NAME_None, RF_NoFlags, NULL) );

        // Associate a package name.
        StreamingLevel->PackageName = LevelPackageName;

        // Seed the level's draw color.
        StreamingLevel->DrawColor = FColor::MakeRandomColor();

        // Add the new level to world.
        InWorld->StreamingLevels.Add( StreamingLevel );

        // Refresh just the newly created level.
        TArray<ULevelStreaming*> LevelsForRefresh;
        LevelsForRefresh.Add( StreamingLevel );
        InWorld->RefreshStreamingLevels( LevelsForRefresh );
        InWorld->MarkPackageDirty();

        NewLevel = StreamingLevel->GetLoadedLevel();
        if ( NewLevel != NULL )
        {
            EditorLevelUtils::SetLevelVisibility( NewLevel, true, true );
        }

        // Levels migrated from other projects may fail to load their world settings
        // If so we create a new AWorldSettings actor here.
        if ( NewLevel->Actors[0] == NULL )
        {
            UWorld *SubLevelWorld = CastChecked<UWorld>(NewLevel->GetOuter());
            if (SubLevelWorld != NULL)
            {
                FActorSpawnParameters SpawnInfo;
                SpawnInfo.bNoCollisionFail = true;
                SpawnInfo.Name = GEngine->WorldSettingsClass->GetFName();
                AWorldSettings* NewWorldSettings = SubLevelWorld->SpawnActor<AWorldSettings>( GEngine->WorldSettingsClass, SpawnInfo );
                NewLevel->Actors[0] = NewWorldSettings;
            }
            else
            {
                FMessageDialog::Open( EAppMsgType::Ok, NSLOCTEXT("UnrealEd", "LevelHasNoWorldSettings", "AddLevelToWorld: The level has no World Settings.") );
            }
        }
    }

    return NewLevel;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:65,代码来源:EditorLevelUtils.cpp


注:本文中的ULevel::GetOuter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。