本文整理汇总了C++中ULevel类的典型用法代码示例。如果您正苦于以下问题:C++ ULevel类的具体用法?C++ ULevel怎么用?C++ ULevel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ULevel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check
UK2Node_PlayMovieScene* FSequencerActorBindingManager::CreateNewPlayMovieSceneNode( UMovieScene* MovieScene ) const
{
// Grab the world object for this editor
check( MovieScene != NULL );
ULevel* Level = ActorWorld->GetCurrentLevel();
check( Level != NULL );
// Here, we'll create a level script if one does not yet exist.
const bool bDontCreate = false;
ULevelScriptBlueprint* LSB = Level->GetLevelScriptBlueprint( bDontCreate );
if( LSB != NULL )
{
UEdGraph* TargetGraph = NULL;
if( LSB->UbergraphPages.Num() > 0 )
{
TargetGraph = LSB->UbergraphPages[0]; // Just use the first graph
}
if( ensure( TargetGraph != NULL ) )
{
// Figure out a decent place to stick the node
const FVector2D NewNodePos = TargetGraph->GetGoodPlaceForNewNode();
// Create a new node
UK2Node_PlayMovieScene* TemplateNode = NewObject<UK2Node_PlayMovieScene>();
TemplateNode->SetMovieScene( MovieScene );
return FEdGraphSchemaAction_K2NewNode::SpawnNodeFromTemplate<UK2Node_PlayMovieScene>(TargetGraph, TemplateNode, NewNodePos);;
}
}
return NULL;
}
示例2: checkSlow
void UUnrealEdEngine::MakeSelectedActorsLevelCurrent()
{
ULevel* LevelToMakeCurrent = NULL;
// Look to the selected actors for the level to make current.
// If actors from multiple levels are selected, do nothing.
for ( FSelectionIterator It( GetSelectedActorIterator() ) ; It ; ++It )
{
AActor* Actor = static_cast<AActor*>( *It );
checkSlow( Actor->IsA(AActor::StaticClass()) );
ULevel* ActorLevel = Actor->GetLevel();
if ( !LevelToMakeCurrent )
{
// First assignment.
LevelToMakeCurrent = ActorLevel;
}
else if ( LevelToMakeCurrent != ActorLevel )
{
// Actors from multiple levels are selected -- abort.
LevelToMakeCurrent = NULL;
break;
}
}
// Change the current level to something different
if ( LevelToMakeCurrent && !LevelToMakeCurrent->IsCurrentLevel() )
{
EditorLevelUtils::MakeLevelCurrent( LevelToMakeCurrent );
}
}
示例3: RemoteEvent
bool ALevelScriptActor::RemoteEvent(FName EventName)
{
bool bFoundEvent = false;
// Iterate over all levels, and try to find a matching function on the level's script actor
for( TArray<ULevel*>::TConstIterator it = GetWorld()->GetLevels().CreateConstIterator(); it; ++it )
{
ULevel* CurLevel = *it;
if( CurLevel )
{
ALevelScriptActor* LSA = CurLevel->GetLevelScriptActor();
if( LSA )
{
// Find an event with no parameters
UFunction* EventTarget = LSA->FindFunction(EventName);
if( EventTarget && EventTarget->NumParms == 0)
{
LSA->ProcessEvent(EventTarget, NULL);
bFoundEvent = true;
}
}
}
}
return bFoundEvent;
}
示例4: ApplyPostEditMove
void FEdModeLevel::SetLevel( ULevelStreaming* LevelStream )
{
if( SelectedLevel != NULL && SelectedLevel != LevelStream )
{
// Changed level need to apply PostEditMove to the actors we moved in the last level
ApplyPostEditMove();
}
SelectedLevel = LevelStream;
bIsDirty = false;
if( SelectedLevel )
{
LevelTransform = SelectedLevel->LevelTransform;
ULevel* Level = SelectedLevel->GetLoadedLevel();
// Calculate the Level bounds box
LevelBounds = FBox(0);
if( Level )
{
for( int32 ActorIndex=0; ActorIndex< Level->Actors.Num(); ActorIndex++ )
{
AActor* Actor = Level->Actors[ActorIndex];
// Don't include the builder brush or the world settings as they can artificially make the level bounds bigger
if( Actor && FActorEditorUtils::IsABuilderBrush(Actor) == false && Level->GetWorldSettings() != Actor )
{
LevelBounds += Actor->GetComponentsBoundingBox();
}
}
}
}
GEditor->RedrawAllViewports();
}
示例5: GetInstanceBaseId
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;
}
示例6: IsDirty
void FLevelModel::SetVisible(bool bVisible)
{
//don't create unnecessary transactions
if (IsVisible() == bVisible)
{
return;
}
const bool oldIsDirty = IsDirty();
const FScopedTransaction Transaction(LOCTEXT("ToggleVisibility", "Toggle Level Visibility"));
//this call hides all owned actors, etc
EditorLevelUtils::SetLevelVisibility( GetLevelObject(), bVisible, false );
if (!oldIsDirty)
{
// don't set the dirty flag if we're just changing the visibility of the level within the editor
ULevel* Level = GetLevelObject();
if (Level)
{
Level->GetOutermost()->SetDirtyFlag(false);
}
}
}
示例7: MakeSubLevelsMenu
/** Generates a sub-level Blueprints sub-menu */
static void MakeSubLevelsMenu(FMenuBuilder& InMenuBuilder, TWeakPtr< SLevelEditor > InLvlEditor)
{
FSlateIcon EditBP(FEditorStyle::Get().GetStyleSetName(), TEXT("LevelEditor.OpenLevelBlueprint"));
InMenuBuilder.BeginSection(NAME_None, LOCTEXT("SubLevelsHeading", "Sub-Level Blueprints"));
{
UWorld* World = InLvlEditor.Pin()->GetWorld();
for (int32 iLevel = 0; iLevel < World->GetNumLevels(); iLevel++)
{
ULevel* Level = World->GetLevel(iLevel);
if (Level != NULL && Level->GetOutermost() != NULL)
{
if (!Level->IsPersistentLevel())
{
FUIAction UIAction
(
FExecuteAction::CreateStatic(&FLevelEditorToolBar::OnOpenSubLevelBlueprint, Level)
);
FText DisplayName = FText::Format(LOCTEXT("SubLevelBlueprintItem", "Edit {LevelName}"), FText::FromString(FPaths::GetCleanFilename(Level->GetOutermost()->GetName())));
InMenuBuilder.AddMenuEntry(DisplayName, FText::GetEmpty(), EditBP, UIAction);
}
}
}
}
InMenuBuilder.EndSection();
}
示例8: GetLevelObject
ULevelStreaming* FWorldTileModel::CreateAssosiatedStreamingLevel()
{
ULevelStreaming* AssociatedStreamingLevel = NULL;
ULevel* Level = GetLevelObject();
if (Level)
{
FName PackageName = Level->GetOutermost()->GetFName();
UWorld* PersistentWorld = LevelCollectionModel.GetWorld();
// Try to find existing object first
int32 FoundIndex = PersistentWorld->StreamingLevels.FindMatch(ULevelStreaming::FPackageNameMatcher(PackageName));
if (FoundIndex != INDEX_NONE)
{
AssociatedStreamingLevel = PersistentWorld->StreamingLevels[FoundIndex];
}
else
{
// Create new streaming level
AssociatedStreamingLevel = Cast<ULevelStreaming>(
StaticConstructObject(ULevelStreamingKismet::StaticClass(), PersistentWorld, NAME_None, RF_Transient, NULL)
);
//
AssociatedStreamingLevel->PackageName = PackageName;
AssociatedStreamingLevel->DrawColor = FColor::MakeRandomColor();
AssociatedStreamingLevel->LevelTransform = FTransform::Identity;
AssociatedStreamingLevel->PackageNameToLoad = PackageName;
//
PersistentWorld->StreamingLevels.Add(AssociatedStreamingLevel);
}
}
return AssociatedStreamingLevel;
}
示例9: GetLevel
void ALevelBounds::BroadcastLevelBoundsUpdated()
{
ULevel* Level = GetLevel();
if (Level &&
Level->LevelBoundsActor.Get() == this)
{
Level->BroadcastLevelBoundsActorUpdated();
}
}
示例10: ToSlateTextureData
FSlateTextureDataPtr FTileThumbnail::UpdateThumbnail()
{
// No need images for persistent and always loaded levels
if (TileModel.IsPersistent())
{
return ToSlateTextureData(nullptr);
}
// Load image from a package header
if (!TileModel.IsVisible() || TileModel.IsSimulating())
{
const FName LevelAssetName = TileModel.GetAssetName();
TSet<FName> ObjectFullNames;
ObjectFullNames.Add(LevelAssetName);
FThumbnailMap ThumbnailMap;
if (ThumbnailTools::ConditionallyLoadThumbnailsFromPackage(TileModel.GetPackageFileName(), ObjectFullNames, ThumbnailMap))
{
const FObjectThumbnail* ObjectThumbnail = ThumbnailMap.Find(LevelAssetName);
return ToSlateTextureData(ObjectThumbnail);
}
}
// Render image from a visible level
else
{
ULevel* TargetLevel = TileModel.GetLevelObject();
if (TargetLevel)
{
FIntPoint RTSize = ThumbnailRenderTarget->GetSizeXY();
// Set persistent world package as transient to avoid package dirtying during thumbnail rendering
FUnmodifiableObject ImmuneWorld(TargetLevel->OwningWorld);
FObjectThumbnail NewThumbnail;
// Generate the thumbnail
ThumbnailTools::RenderThumbnail(
TargetLevel,
RTSize.X,
RTSize.Y,
ThumbnailTools::EThumbnailTextureFlushMode::NeverFlush,
ThumbnailRenderTarget,
&NewThumbnail
);
UPackage* MyOutermostPackage = CastChecked<UPackage>(TargetLevel->GetOutermost());
ThumbnailTools::CacheThumbnail(TileModel.GetAssetName().ToString(), &NewThumbnail, MyOutermostPackage);
return ToSlateTextureData(&NewThumbnail);
}
}
return ToSlateTextureData(nullptr);
}
示例11: GetColorButtonVisibility
EVisibility SWorldHierarchyItem::GetColorButtonVisibility() const
{
EVisibility Result = EVisibility::Hidden;
if (LevelModel.IsValid())
{
ULevel* LevelObject = LevelModel->GetLevelObject();
if (LevelObject && !LevelObject->IsPersistentLevel())
{
Result = EVisibility::Visible;
}
}
return Result;
}
示例12: RestoreReferencesToRendererModuleClasses
/** Restores systems that need references to classes in the renderer module. */
void RestoreReferencesToRendererModuleClasses(
const TMap<UWorld*, bool>& WorldsToUpdate,
const TMap<FMaterialShaderMap*, TScopedPointer<TArray<uint8> > >& ShaderMapToSerializedShaderData,
const TScopedPointer<TArray<uint8> >& GlobalShaderData,
const TMap<FShaderType*, FString>& ShaderTypeNames,
const TMap<FVertexFactoryType*, FString>& VertexFactoryTypeNames)
{
FlushShaderFileCache();
// Initialize cached shader type data
InitializeShaderTypes();
IRendererModule& RendererModule = GetRendererModule();
FSceneViewStateReference::AllocateAll();
// Recreate all renderer scenes
for (TMap<UWorld*, bool>::TConstIterator It(WorldsToUpdate); It; ++It)
{
UWorld* World = It.Key();
RendererModule.AllocateScene(World, World->RequiresHitProxies(), It.Value(), World->FeatureLevel);
for (int32 LevelIndex = 0; LevelIndex < World->GetNumLevels(); LevelIndex++)
{
ULevel* Level = World->GetLevel(LevelIndex);
Level->InitializeRenderingResources();
}
}
// Restore FShaders from the serialized memory blobs
// Shader maps may still not be complete after this due to code changes picked up in the recompile
RestoreGlobalShaderMap(GRHIShaderPlatform_DEPRECATED, *GlobalShaderData);
UMaterial::RestoreMaterialShadersFromMemory(GRHIShaderPlatform_DEPRECATED, ShaderMapToSerializedShaderData);
FMaterialShaderMap::FixupShaderTypes(GRHIShaderPlatform_DEPRECATED, ShaderTypeNames, VertexFactoryTypeNames);
TArray<FShaderType*> OutdatedShaderTypes;
TArray<const FVertexFactoryType*> OutdatedFactoryTypes;
FShaderType::GetOutdatedTypes(OutdatedShaderTypes, OutdatedFactoryTypes);
// Recompile any missing shaders
UMaterialInterface::IterateOverActiveFeatureLevels([&](ERHIFeatureLevel::Type FeatureLevel)
{
auto ShaderPlatform = GShaderPlatformForFeatureLevel[FeatureLevel];
BeginRecompileGlobalShaders(OutdatedShaderTypes, ShaderPlatform);
UMaterial::UpdateMaterialShaders(OutdatedShaderTypes, OutdatedFactoryTypes, ShaderPlatform);
});
// Block on global shader jobs
FinishRecompileGlobalShaders();
}
示例13: 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 );
}
}
}
}
示例14:
TArray<UPackage*> FLevelCollectionModel::GetPackagesList(const FLevelModelList& InList)
{
TArray<UPackage*> ResultList;
for (auto It = InList.CreateConstIterator(); It; ++It)
{
ULevel* Level = (*It)->GetLevelObject();
if (Level)
{
ResultList.Add(Level->GetOutermost());
}
}
return ResultList;
}
示例15: OnLevelInfoUpdated
void FWorldTileModel::SetLevelPosition(const FIntPoint& InPosition)
{
// Parent absolute position
TSharedPtr<FWorldTileModel> ParentModel = StaticCastSharedPtr<FWorldTileModel>(GetParent());
FIntPoint ParentAbsolutePostion = ParentModel.IsValid() ? ParentModel->GetAbsoluteLevelPosition() : FIntPoint::ZeroValue;
// Actual offset
FIntPoint Offset = InPosition - TileDetails->AbsolutePosition;
// Update absolute position
TileDetails->AbsolutePosition = InPosition;
// Assign new position as relative to parent
TileDetails->Position = TileDetails->AbsolutePosition - ParentAbsolutePostion;
// Flush changes to level package
OnLevelInfoUpdated();
// Move actors if necessary
ULevel* Level = GetLevelObject();
if (Level != NULL && Level->bIsVisible)
{
// Shelve level, if during this translation level will end up out of Editable area
if (!ShouldBeVisible(LevelCollectionModel.EditableWorldArea()))
{
Shelve();
}
// Move actors
if (Offset != FIntPoint::ZeroValue)
{
Level->ApplyWorldOffset(FVector(Offset), false);
}
}
if (IsLandscapeBased())
{
FixLandscapeSectionsOffset();
}
// Transform child levels
for (auto It = AllChildren.CreateIterator(); It; ++It)
{
TSharedPtr<FWorldTileModel> ChildModel = StaticCastSharedPtr<FWorldTileModel>(*It);
FIntPoint ChildPosition = TileDetails->AbsolutePosition + ChildModel->GetRelativeLevelPosition();
ChildModel->SetLevelPosition(ChildPosition);
}
}