本文整理汇总了C++中ULevelStreaming::Modify方法的典型用法代码示例。如果您正苦于以下问题:C++ ULevelStreaming::Modify方法的具体用法?C++ ULevelStreaming::Modify怎么用?C++ ULevelStreaming::Modify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ULevelStreaming
的用法示例。
在下文中一共展示了ULevelStreaming::Modify方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
}
示例2: ToggleLevelLock
/**
* Sets a level's edit lock.
*
* @param Level The level to modify.
*/
void FLevelUtils::ToggleLevelLock(ULevel* Level)
{
if ( !Level || Level->IsPersistentLevel() )
{
return;
}
ULevelStreaming* StreamingLevel = FindStreamingLevel( Level );
if ( StreamingLevel != NULL )
{
// We need to set the RF_Transactional to make a streaming level serialize itself. so store the original ones, set the flag, and put the original flags back when done
EObjectFlags cachedFlags = StreamingLevel->GetFlags();
StreamingLevel->SetFlags( RF_Transactional );
StreamingLevel->Modify();
StreamingLevel->SetFlags( cachedFlags );
StreamingLevel->bLocked = !StreamingLevel->bLocked;
}
else
{
Level->Modify();
Level->bLocked = !Level->bLocked;
}
}
示例3: SetLevelVisibility
void SetLevelVisibility(ULevel* Level, bool bShouldBeVisible, bool bForceLayersVisible)
{
// Nothing to do
if ( Level == NULL )
{
return;
}
// Handle the case of the p-level
// The p-level can't be unloaded, so its actors/BSP should just be temporarily hidden/unhidden
// Also, intentionally do not force layers visible for the p-level
if ( Level->IsPersistentLevel() )
{
//create a transaction so we can undo the visibilty toggle
const FScopedTransaction Transaction( LOCTEXT( "ToggleLevelVisibility", "Toggle Level Visibility" ) );
if ( Level->bIsVisible != bShouldBeVisible )
{
Level->Modify();
}
// Set the visibility of each actor in the p-level
for ( TArray<AActor*>::TIterator PLevelActorIter( Level->Actors ); PLevelActorIter; ++PLevelActorIter )
{
AActor* CurActor = *PLevelActorIter;
if ( CurActor && !FActorEditorUtils::IsABuilderBrush(CurActor) && CurActor->bHiddenEdLevel == bShouldBeVisible )
{
CurActor->Modify();
CurActor->bHiddenEdLevel = !bShouldBeVisible;
CurActor->RegisterAllComponents();
CurActor->MarkComponentsRenderStateDirty();
}
}
// Set the visibility of each BSP surface in the p-level
UModel* CurLevelModel = Level->Model;
if ( CurLevelModel )
{
CurLevelModel->Modify();
for ( TArray<FBspSurf>::TIterator SurfaceIterator( CurLevelModel->Surfs ); SurfaceIterator; ++SurfaceIterator )
{
FBspSurf& CurSurf = *SurfaceIterator;
CurSurf.bHiddenEdLevel = !bShouldBeVisible;
}
}
// Add/remove model components from the scene
for(int32 ComponentIndex = 0; ComponentIndex < Level->ModelComponents.Num(); ComponentIndex++)
{
UModelComponent* CurLevelModelCmp = Level->ModelComponents[ComponentIndex];
if(CurLevelModelCmp)
{
if (bShouldBeVisible && CurLevelModelCmp)
{
CurLevelModelCmp->RegisterComponentWithWorld(Level->OwningWorld);
}
else if (!bShouldBeVisible && CurLevelModelCmp->IsRegistered())
{
CurLevelModelCmp->UnregisterComponent();
}
}
}
FEditorSupportDelegates::RedrawAllViewports.Broadcast();
}
else
{
ULevelStreaming* StreamingLevel = NULL;
if (Level->OwningWorld == NULL || Level->OwningWorld->PersistentLevel != Level )
{
StreamingLevel = FLevelUtils::FindStreamingLevel( Level );
}
// If were hiding a level, lets make sure to close the level transform mode if its the same level currently selected for edit
FEdModeLevel* LevelMode = static_cast<FEdModeLevel*>(GEditorModeTools().GetActiveMode( FBuiltinEditorModes::EM_Level ));
if( LevelMode && LevelMode->IsEditing( StreamingLevel ) )
{
GEditorModeTools().DeactivateMode( FBuiltinEditorModes::EM_Level );
}
//create a transaction so we can undo the visibilty toggle
const FScopedTransaction Transaction( LOCTEXT( "ToggleLevelVisibility", "Toggle Level Visibility" ) );
// Handle the case of a streaming level
if ( StreamingLevel )
{
// We need to set the RF_Transactional to make a streaming level serialize itself. so store the original ones, set the flag, and put the original flags back when done
EObjectFlags cachedFlags = StreamingLevel->GetFlags();
StreamingLevel->SetFlags( RF_Transactional );
StreamingLevel->Modify();
StreamingLevel->SetFlags( cachedFlags );
// Set the visibility state for this streaming level.
StreamingLevel->bShouldBeVisibleInEditor = bShouldBeVisible;
}
if( !bShouldBeVisible )
{
GEditor->Layers->RemoveLevelLayerInformation( Level );
}
//.........这里部分代码省略.........