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


C++ ULevelStreaming类代码示例

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


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

示例1: FlushLevelStreaming

void UWorld::RefreshStreamingLevels( const TArray<class ULevelStreaming*>& InLevelsToRefresh )
{
	// Reassociate levels in case we changed streaming behavior. Editor-only!
	if( GIsEditor )
	{
		// Load and associate levels if necessary.
		FlushLevelStreaming();

		// Remove all currently visible levels.
		for( int32 LevelIndex=0; LevelIndex<InLevelsToRefresh.Num(); LevelIndex++ )
		{
			ULevelStreaming* StreamingLevel = InLevelsToRefresh[LevelIndex];
			ULevel* LoadedLevel = StreamingLevel ? StreamingLevel->GetLoadedLevel() : nullptr;

			if( LoadedLevel &&
				LoadedLevel->bIsVisible )
			{
				RemoveFromWorld( LoadedLevel );
			}
		}

		// Load and associate levels if necessary.
		FlushLevelStreaming();

		// Update the level browser so it always contains valid data
		FEditorSupportDelegates::WorldChange.Broadcast();
	}
}
开发者ID:magetron,项目名称:UnrealEngine4-mod,代码行数:28,代码来源:LevelActor.cpp

示例2: AddRequiredLevels

	void AddRequiredLevels( EStaticMeshLightingInfoObjectSets InObjectSet, UWorld* InWorld, TArray<ULevel*>& OutLevels )
	{
		switch (InObjectSet)
		{ 
		case StaticMeshLightingInfoObjectSets_CurrentLevel:
			{
				check(InWorld);
				OutLevels.AddUnique(InWorld->GetCurrentLevel());
			}
			break;
		case StaticMeshLightingInfoObjectSets_SelectedLevels:
			{
				TArray<class ULevel*>& SelectedLevels = InWorld->GetSelectedLevels();
				for(auto It = SelectedLevels.CreateIterator(); It; ++It)
				{
					ULevel* Level = *It;
					if (Level)
					{
						OutLevels.AddUnique(Level);
					}
				}

				if (OutLevels.Num() == 0)
				{
					// Fall to the current level...
					check(InWorld);
					OutLevels.AddUnique(InWorld->GetCurrentLevel());
				}
			}
			break;
		case StaticMeshLightingInfoObjectSets_AllLevels:
			{
				if (InWorld != NULL)
				{
					// Add main level.
					OutLevels.AddUnique(InWorld->PersistentLevel);

					// Add secondary levels.
					for (int32 LevelIndex = 0; LevelIndex < InWorld->StreamingLevels.Num(); ++LevelIndex)
					{
						ULevelStreaming* StreamingLevel = InWorld->StreamingLevels[LevelIndex];
						if ( StreamingLevel != NULL )
						{
							ULevel* Level = StreamingLevel->GetLoadedLevel();
							if ( Level != NULL )
							{
								OutLevels.AddUnique( Level );
							}
						}
					}
				}
			}
			break;
		}
	}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:55,代码来源:StaticMeshLightingInfoStatsPage.cpp

示例3: TickDemoRecord

void UDemoNetDriver::TickFlush( float DeltaSeconds )
{
	Super::TickFlush( DeltaSeconds );

	if ( FileAr )
	{
		if ( ClientConnections.Num() > 0 )
		{
			TickDemoRecord( DeltaSeconds );
		}
		else if ( ServerConnection != NULL )
		{
			// Wait until all levels are streamed in
			for ( int32 i = 0; i < World->StreamingLevels.Num(); ++i )
			{
				ULevelStreaming * StreamingLevel = World->StreamingLevels[i];
				if ( StreamingLevel != NULL && ( !StreamingLevel->IsLevelLoaded() || !StreamingLevel->GetLoadedLevel()->GetOutermost()->IsFullyLoaded() || !StreamingLevel->IsLevelVisible() ) )
				{
					// Abort, we have more streaming levels to load
					return;
				}
			}

			World->GetWorldSettings()->DemoPlayTimeDilation = CVarDemoTimeDilation.GetValueOnGameThread();

			// Clamp time between 1000 hz, and 2 hz 
			// (this is useful when debugging and you set a breakpoint, you don't want all that time to pass in one frame)
			DeltaSeconds = FMath::Clamp( DeltaSeconds, 1.0f / 1000.0f, 1.0f / 2.0f );

			// We need to compensate for the fact that DeltaSeconds is real-time for net drivers
			DeltaSeconds *= World->GetWorldSettings()->GetEffectiveTimeDilation();

			// Update time dilation on spectator pawn to compensate for any demo dilation 
			//	(we want to continue to fly around in real-time)
			if ( SpectatorController != NULL )
			{
				if ( SpectatorController->GetSpectatorPawn() != NULL )
				{
					// Disable collision on the spectator
					SpectatorController->GetSpectatorPawn()->SetActorEnableCollision( false );
					
					// Apply time dilation on spectator to reverse the effects of global dilation
					SpectatorController->GetSpectatorPawn()->CustomTimeDilation = 1.0f / World->GetWorldSettings()->DemoPlayTimeDilation;
				}
			}

			if ( bDemoPlaybackDone )
			{
				return;
			}

			TickDemoPlayback( DeltaSeconds );
		}
	}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:55,代码来源:DemoNetDriver.cpp

示例4: GetLevelObject

ULevel* FStreamingLevelModel::GetLevelObject() const
{
	ULevelStreaming* StreamingObj = LevelStreaming.Get();
	
	if (StreamingObj)
	{
		return StreamingObj->GetLoadedLevel();
	}
	else // persistent level does not have associated level streaming object
	{
		return LevelCollectionModel.GetWorld()->PersistentLevel;
	}
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:13,代码来源:StreamingLevelModel.cpp

示例5: IsStreamingMethodChecked

bool FStreamingLevelCollectionModel::IsStreamingMethodChecked(UClass* InClass) const
{
	for (auto It = SelectedLevelsList.CreateConstIterator(); It; ++It)
	{
		TSharedPtr<FStreamingLevelModel> TargetModel = StaticCastSharedPtr<FStreamingLevelModel>(*It);
		ULevelStreaming* LevelStreaming = TargetModel->GetLevelStreaming().Get();
		
		if (LevelStreaming && LevelStreaming->GetClass() == InClass)
		{
			return true;
		}
	}
	return false;
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:14,代码来源:StreamingLevelCollectionModel.cpp

示例6: 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

示例7: GetLevelStreamingForPackageName

/** Utility for returning the ULevelStreaming object for a particular sub-level, specified by package name */
ULevelStreaming* UWorld::GetLevelStreamingForPackageName(FName InPackageName)
{
	// iterate over each level streaming object
	for( int32 LevelIndex=0; LevelIndex<StreamingLevels.Num(); LevelIndex++ )
	{
		ULevelStreaming* LevelStreaming = StreamingLevels[LevelIndex];
		// see if name matches
		if(LevelStreaming && LevelStreaming->GetWorldAssetPackageFName() == InPackageName)
		{
			// it doesn't, return this one
			return LevelStreaming;
		}
	}

	// failed to find one
	return NULL;
}
开发者ID:magetron,项目名称:UnrealEngine4-mod,代码行数:18,代码来源:LevelActor.cpp

示例8: ChangeColor

void FLevelViewModel::ChangeColor(const TSharedRef<SWidget>& InPickerParentWidget)
{
	if( !Level.IsValid() )
	{
		return;
	}

	if ( !Level->IsPersistentLevel())
	{
		// Initialize the color data for the picker window.
		ULevelStreaming* StreamingLevel = FLevelUtils::FindStreamingLevel( Level.Get() );
		check( StreamingLevel );

		FLinearColor NewColor = StreamingLevel->LevelColor;
		TArray<FLinearColor*> ColorArray;
		ColorArray.Add(&NewColor);

		FColorPickerArgs PickerArgs;
		PickerArgs.bIsModal = true;
		PickerArgs.DisplayGamma = TAttribute<float>::Create( TAttribute<float>::FGetter::CreateUObject(GEngine, &UEngine::GetDisplayGamma) );
		PickerArgs.LinearColorArray = &ColorArray;
		PickerArgs.OnColorPickerCancelled = FOnColorPickerCancelled::CreateSP(this, &FLevelViewModel::OnColorPickerCancelled);
		PickerArgs.ParentWidget = InPickerParentWidget;

		// ensure this is true, will be set to false in OnColorPickerCancelled if necessary
		bColorPickerOK = true;
		if (OpenColorPicker(PickerArgs))
		{
			if ( bColorPickerOK )
			{
				StreamingLevel->LevelColor = NewColor;
				StreamingLevel->Modify();

				// Update the loaded level's components so the change in color will apply immediately
				ULevel* LoadedLevel = StreamingLevel->GetLoadedLevel();
				if ( LoadedLevel )
				{
					LoadedLevel->UpdateLevelComponents(false);
				}

				ULevel::LevelDirtiedEvent.Broadcast();
			}
			FEditorSupportDelegates::RedrawAllViewports.Broadcast();
		}
	}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:46,代码来源:LevelViewModel.cpp

示例9: check

void FEditorModeTools::SetBookmark( uint32 InIndex, FEditorViewportClient* InViewportClient )
{
	UWorld* World = InViewportClient->GetWorld();
	if ( World )
	{
		AWorldSettings* WorldSettings = World->GetWorldSettings();

		// Verify the index is valid for the bookmark
		if ( WorldSettings && InIndex < AWorldSettings::MAX_BOOKMARK_NUMBER )
		{
			// If the index doesn't already have a bookmark in place, create a new one
			if ( !WorldSettings->BookMarks[ InIndex ] )
			{
				WorldSettings->BookMarks[ InIndex ] = ConstructObject<UBookMark>( UBookMark::StaticClass(), WorldSettings );
			}

			UBookMark* CurBookMark = WorldSettings->BookMarks[ InIndex ];
			check(CurBookMark);
			check(InViewportClient);

			// Use the rotation from the first perspective viewport can find.
			FRotator Rotation(0,0,0);
			if( !InViewportClient->IsOrtho() )
			{
				Rotation = InViewportClient->GetViewRotation();
			}

			CurBookMark->Location = InViewportClient->GetViewLocation();
			CurBookMark->Rotation = Rotation;

			// Keep a record of which levels were hidden so that we can restore these with the bookmark
			CurBookMark->HiddenLevels.Empty();
			for ( int32 LevelIndex = 0 ; LevelIndex < World->StreamingLevels.Num() ; ++LevelIndex )
			{
				ULevelStreaming* StreamingLevel = World->StreamingLevels[LevelIndex];
				if ( StreamingLevel )
				{
					if( !StreamingLevel->bShouldBeVisibleInEditor )
					{
						CurBookMark->HiddenLevels.Add( StreamingLevel->GetFullName() );
					}
				}
			}
		}
	}
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:46,代码来源:EditorModeManager.cpp

示例10: PrivateRemoveLevelFromWorld

/**
* Removes a level from the world.  Returns true if the level was removed successfully.
*
* @param	Level		The level to remove from the world.
* @return				true if the level was removed successfully, false otherwise.
*/
bool PrivateRemoveLevelFromWorld(ULevel* Level)
{
    if ( !Level || Level->IsPersistentLevel() )
    {
        return false;
    }

    if ( FLevelUtils::IsLevelLocked(Level) )
    {
        FMessageDialog::Open( EAppMsgType::Ok, NSLOCTEXT("UnrealEd", "Error_OperationDisallowedOnLockedLevelRemoveLevelFromWorld", "RemoveLevelFromWorld: The requested operation could not be completed because the level is locked.") );
        return false;
    }

    int32 StreamingLevelIndex = INDEX_NONE;

    for( int32 LevelIndex = 0 ; LevelIndex < Level->OwningWorld->StreamingLevels.Num() ; ++LevelIndex )
    {
        ULevelStreaming* StreamingLevel = Level->OwningWorld->StreamingLevels[ LevelIndex ];
        if( StreamingLevel && StreamingLevel->GetLoadedLevel() == Level )
        {
            StreamingLevelIndex = LevelIndex;
            break;
        }
    }

    if (StreamingLevelIndex != INDEX_NONE)
    {
        Level->OwningWorld->StreamingLevels[StreamingLevelIndex]->MarkPendingKill();
        Level->OwningWorld->StreamingLevels.RemoveAt( StreamingLevelIndex );
        Level->OwningWorld->RefreshStreamingLevels();
    }
    else if (Level->bIsVisible)
    {
        Level->OwningWorld->RemoveFromWorld(Level);
        check(Level->bIsVisible == false);
    }

    const bool bSuccess = EditorDestroyLevel(Level);
    // Since we just removed all the actors from this package, we do not want it to be saved out now
    // and the user was warned they would lose any changes from before removing, so we're good to clear
    // the dirty flag
    UPackage* LevelPackage = Level->GetOutermost();
    LevelPackage->SetDirtyFlag(false);

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

示例11: check

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;
		}
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:45,代码来源:LevelModel.cpp

示例12: PackageName

/**
 * Returns the streaming level by package name, or NULL if none exists.
 *
 * @param		PackageName		Name of the package containing the ULevel to query
 * @return						The level's streaming level, or NULL if none exists.
 */
ULevelStreaming* FLevelUtils::FindStreamingLevel(UWorld* InWorld, const TCHAR* InPackageName)
{
	const FName PackageName( InPackageName );
	ULevelStreaming* MatchingLevel = NULL;
	if( InWorld)
	{
		for( int32 LevelIndex = 0 ; LevelIndex< InWorld->StreamingLevels.Num() ; ++LevelIndex )
		{
			ULevelStreaming* CurStreamingLevel = InWorld->StreamingLevels[ LevelIndex ];
			if( CurStreamingLevel && CurStreamingLevel->GetWorldAssetPackageFName() == PackageName )
			{
				MatchingLevel = CurStreamingLevel;
				break;
			}
		}
	}
	return MatchingLevel;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:24,代码来源:LevelUtils.cpp

示例13: check

void FLevelViewModel::RefreshStreamingLevelIndex()
{
	if ( IsLevel() )
	{
		UWorld *OwningWorld = Level->OwningWorld;
		check( OwningWorld );

		for( int32 LevelIndex = 0 ; LevelIndex < OwningWorld->StreamingLevels.Num() ; ++LevelIndex )
		{
			ULevelStreaming *StreamingLevel = OwningWorld->StreamingLevels[LevelIndex];
			if ( Level.Get() == StreamingLevel->GetLoadedLevel() )
			{
				StreamingLevelIndex = LevelIndex;
				LevelStreaming = StreamingLevel;
				break;
			}
		}
	}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:19,代码来源:LevelViewModel.cpp

示例14: GetWorld

bool UWorldComposition::UpdateEditorStreamingState(const FVector& InLocation)
{
	UWorld* OwningWorld = GetWorld();
	bool bStateChanged = false;
	
	// Handle only editor worlds
	if (!OwningWorld->IsGameWorld() && 
		!OwningWorld->IsVisibilityRequestPending())
	{
		// Get the list of visible and hidden levels from current view point
		TArray<FDistanceVisibleLevel> DistanceVisibleLevels;
		TArray<FDistanceVisibleLevel> DistanceHiddenLevels;
		GetDistanceVisibleLevels(InLocation, DistanceVisibleLevels, DistanceHiddenLevels);

		// Hidden levels
		for (const auto& Level : DistanceHiddenLevels)
		{
			ULevelStreaming* EditorStreamingLevel = OwningWorld->GetLevelStreamingForPackageName(TilesStreaming[Level.TileIdx]->GetWorldAssetPackageFName());
			if (EditorStreamingLevel && 
				EditorStreamingLevel->IsLevelLoaded() &&
				EditorStreamingLevel->bShouldBeVisibleInEditor != false)
			{
				EditorStreamingLevel->bShouldBeVisibleInEditor = false;
				bStateChanged = true;
			}
		}

		// Visible levels
		for (const auto& Level : DistanceVisibleLevels)
		{
			ULevelStreaming* EditorStreamingLevel = OwningWorld->GetLevelStreamingForPackageName(TilesStreaming[Level.TileIdx]->GetWorldAssetPackageFName());
			if (EditorStreamingLevel &&
				EditorStreamingLevel->IsLevelLoaded() &&
				EditorStreamingLevel->bShouldBeVisibleInEditor != true)
			{
				EditorStreamingLevel->bShouldBeVisibleInEditor = true;
				bStateChanged = true;
			}
		}
	}

	return bStateChanged;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:43,代码来源:WorldComposition.cpp

示例15: FindStreamingLevel

/**
 * Returns the streaming level corresponding to the specified ULevel, or NULL if none exists.
 *
 * @param		Level		The level to query.
 * @return					The level's streaming level, or NULL if none exists.
 */
ULevelStreaming* FLevelUtils::FindStreamingLevel(const ULevel* Level)
{
	ULevelStreaming* MatchingLevel = NULL;

	if (Level && Level->OwningWorld)
	{
		for( int32 LevelIndex = 0 ; LevelIndex < Level->OwningWorld->StreamingLevels.Num() ; ++LevelIndex )
		{
			ULevelStreaming* CurStreamingLevel = Level->OwningWorld->StreamingLevels[ LevelIndex ];
			if( CurStreamingLevel && CurStreamingLevel->GetLoadedLevel() == Level )
			{
				MatchingLevel = CurStreamingLevel;
				break;
			}
		}
	}

	return MatchingLevel;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:25,代码来源:LevelUtils.cpp


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