Operating System Simulator Plugin  3.5.1
Unreal Engine plugin that simulates an Operating System Environment
Loading...
Searching...
No Matches
UViewportWorldStatics Class Reference

A static class that provides utility functions for working with viewport worlds. More...

#include "ViewportWorldStatics.h"

Inheritance diagram for UViewportWorldStatics:
[legend]
Collaboration diagram for UViewportWorldStatics:
[legend]

Static Public Member Functions

static AActor * SpawnActorForWorldHandle (UPARAM(ref) FViewportWorldHandle &WorldHandle, const TSubclassOf< AActor > ActorClass, const FTransform &SpawnTransform, const ESpawnActorCollisionHandlingMethod CollisionHandlingMethod=ESpawnActorCollisionHandlingMethod::Undefined, const ESpawnActorScaleMethod TransformScaleMethod=ESpawnActorScaleMethod::MultiplyWithRoot, AActor *Owner=nullptr)
 
static void OnWorldUnloaded (UPARAM(ref) FViewportWorldHandle &WorldHandle, const FOnWorldUnloaded &OnWorldUnloaded)
 
static void AddWidgetToHandle (const UObject *WorldContextObject, const FViewportWorldHandle &WorldHandle, UUserWidget *Widget, const int32 ZOrder=0)
 
static bool RemoveWidgetFromHandle (const FViewportWorldHandle &WorldHandle, UUserWidget *Widget)
 
static void ClearAllWidgetsFromHandle (const FViewportWorldHandle &WorldHandle)
 
static void InitializeActorsForWorldHandle (UPARAM(ref) FViewportWorldHandle &WorldHandle)
 
static void BeginPlayForWorldHandle (UPARAM(ref) FViewportWorldHandle &WorldHandle)
 
static void UnloadWorldHandle (const UObject *WorldContextObject, UPARAM(ref) FViewportWorldHandle &WorldHandle)
 
static bool UpdateViewMode (const FViewportWorldHandle &WorldHandle, const EViewportWorldViewMode NewViewMode)
 
static void SetWorldTickForHandle (const FViewportWorldHandle &WorldHandle, const bool bEnabled)
 
static bool ExecuteCommandForHandle (const FViewportWorldHandle &WorldHandle, const FString Command)
 
static bool IsViewportWorldHandleValid (const FViewportWorldHandle &TestHandle)
 
static bool BelongsToSecondaryWorld (const UObject *Target)
 
static AGameModeBase * GetGameModeFromHandle (const FViewportWorldHandle &WorldHandle)
 
static AGameStateBase * GetGameStateFromHandle (const FViewportWorldHandle &WorldHandle)
 
static const FViewportWorldHandleFindViewportWorldHandlePtr (const UObject *WorldContextObject, const TSoftObjectPtr< UWorld > &TargetWorld)
 Find the pointer to the viewport world handle associated with the specified target world.
 
static bool AddSlateWidgetToHandle (const UObject *WorldContextObject, const FViewportWorldHandle &WorldHandle, const TSharedRef< SWidget > &WidgetContent, const int32 &ZOrder)
 Adds a Slate widget to a viewport world handle.
 
static bool RemoveSlateWidgetFromHandle (const FViewportWorldHandle &WorldHandle, const TSharedRef< SWidget > &SlateWidget)
 Removes the specified Slate widget from the given viewport world handle.
 

Static Protected Member Functions

static bool FindViewportWorldHandle (const UObject *WorldContextObject, const TSoftObjectPtr< UWorld > TargetWorld, FViewportWorldHandle &OutHandle)
 

Detailed Description

A static class that provides utility functions for working with viewport worlds.

This class provides functions for handling viewport worlds, including finding viewport world handles, spawning actors, adding widgets to viewports, initializing actors, and manipulating view modes and tick settings.

Member Function Documentation

◆ AddSlateWidgetToHandle()

bool UViewportWorldStatics::AddSlateWidgetToHandle ( const UObject * WorldContextObject,
const FViewportWorldHandle & WorldHandle,
const TSharedRef< SWidget > & WidgetContent,
const int32 & ZOrder )
static

Adds a Slate widget to a viewport world handle.

This function adds the specified Slate widget content to the viewport world handle in the given world context object.

Parameters
WorldContextObjectThe world context object to add the Slate widget to.
WorldHandleThe viewport world handle to add the Slate widget to.
WidgetContentThe Slate widget content to add.
ZOrderThe Z order of the added widget.
Returns
true if the widget was successfully added, false otherwise.
Here is the call graph for this function:

◆ AddWidgetToHandle()

void UViewportWorldStatics::AddWidgetToHandle ( const UObject * WorldContextObject,
const FViewportWorldHandle & WorldHandle,
UUserWidget * Widget,
const int32 ZOrder = 0 )
static

Adds the given widget to the viewport. If the given world handle is not valid this works the same as Widget->AddToViewport

Parameters
WorldContextObjectWorld object.
WorldHandleWorld to add widget to.
WidgetTarget widget to add. Must not be null.
ZOrderLarger ZOrder will draw above others with smaller ZOrder. Same ZOrder between different widget will simply draw in the order they were added.
Here is the call graph for this function:

◆ BeginPlayForWorldHandle()

void UViewportWorldStatics::BeginPlayForWorldHandle ( UPARAM(ref) FViewportWorldHandle & WorldHandle)
static

Calls begin play for given world handle if not done while loading world. If begin play was already called, this function does nothing.

See also
UViewportWorldWidget::LoadGameWorld
Parameters
WorldHandleWorld handle to begin play
Here is the call graph for this function:

◆ BelongsToSecondaryWorld()

bool UViewportWorldStatics::BelongsToSecondaryWorld ( const UObject * Target)
static

Returns true if the given object or actor exists in the viewport world instead of the main game world.

Parameters
TargetTarget Object/Actor to check
Returns
True if the object/actor exists in secondary world.

◆ ClearAllWidgetsFromHandle()

void UViewportWorldStatics::ClearAllWidgetsFromHandle ( const FViewportWorldHandle & WorldHandle)
static

Clears all widget from viewport.

Parameters
WorldHandleWorld to remove all widgets from.
Here is the call graph for this function:

◆ ExecuteCommandForHandle()

bool UViewportWorldStatics::ExecuteCommandForHandle ( const FViewportWorldHandle & WorldHandle,
const FString Command )
static

Runs command for the world in given handle. Not all commands are supported and returning true doesn't mean the command was success either.

Parameters
WorldHandleTarget world handle
CommandCommand to run. Not all commands are supported though.
Returns
True if the command was executed. This doesn't mean the command actually worked.
Here is the call graph for this function:

◆ FindViewportWorldHandle()

bool UViewportWorldStatics::FindViewportWorldHandle ( const UObject * WorldContextObject,
const TSoftObjectPtr< UWorld > TargetWorld,
FViewportWorldHandle & OutHandle )
staticprotected

Returns a reference to the world handle if the world was loaded. If not, then returns an empty world.

See also
UViewportWorldStatics::IsViewportWorldHandleValid.
Parameters
WorldContextObjectWorld object
TargetWorldWorld to look for.
OutHandleReference to the handle or invalid empty handle if world is not loaded.
Returns
True if OutHandle is valid. False otherwise.
Here is the call graph for this function:

◆ FindViewportWorldHandlePtr()

const FViewportWorldHandle * UViewportWorldStatics::FindViewportWorldHandlePtr ( const UObject * WorldContextObject,
const TSoftObjectPtr< UWorld > & TargetWorld )
static

Find the pointer to the viewport world handle associated with the specified target world.

This function searches for the viewport world handle that is associated with the specified target world. It utilizes the UViewportWorldSubsystem to retrieve the handle.

Parameters
WorldContextObjectThe object that serves as the world context.
TargetWorldThe target world for which to find the viewport world handle.
Returns
A pointer to the found viewport world handle, or nullptr if no handle is found.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetGameModeFromHandle()

AGameModeBase * UViewportWorldStatics::GetGameModeFromHandle ( const FViewportWorldHandle & WorldHandle)
static

Returns game mode from handle.

Parameters
WorldHandleTarget handle.
Returns
Returns the game mode from given handle.
Here is the call graph for this function:

◆ GetGameStateFromHandle()

AGameStateBase * UViewportWorldStatics::GetGameStateFromHandle ( const FViewportWorldHandle & WorldHandle)
static

Returns game state from handle.

Parameters
WorldHandleTarget handle.
Returns
Returns game state from given handle.
Here is the call graph for this function:

◆ InitializeActorsForWorldHandle()

void UViewportWorldStatics::InitializeActorsForWorldHandle ( UPARAM(ref) FViewportWorldHandle & WorldHandle)
static

Initializes actors for given world handle if not done while loading world. If they are initialized, this function does nothing.

See also
UViewportWorldWidget::LoadGameWorld
Parameters
WorldHandleWorld handle to initialize
Here is the call graph for this function:

◆ IsViewportWorldHandleValid()

bool UViewportWorldStatics::IsViewportWorldHandleValid ( const FViewportWorldHandle & TestHandle)
static

Returns true if the given handle is valid. This typically means that there is an actual world for the handle.

Parameters
TestHandleHandle to check
Returns
True if the given handle is valid.
Here is the call graph for this function:

◆ OnWorldUnloaded()

void UViewportWorldStatics::OnWorldUnloaded ( UPARAM(ref) FViewportWorldHandle & WorldHandle,
const FOnWorldUnloaded & OnWorldUnloaded )
static

Triggers the given event when the world handle calls Unload World.

See also
UViewportWorldStatics::UnloadWorldHandle
Parameters
WorldHandleWorld handle to listen to.
OnWorldUnloadedEvent that should execute when the world unloads from given handle.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RemoveSlateWidgetFromHandle()

bool UViewportWorldStatics::RemoveSlateWidgetFromHandle ( const FViewportWorldHandle & WorldHandle,
const TSharedRef< SWidget > & SlateWidget )
static

Removes the specified Slate widget from the given viewport world handle.

This function removes the specified Slate widget from the given viewport world handle. The viewport world handle is used to identify a specific viewport world where the widget is attached.

Parameters
WorldHandleThe handle of the viewport world from which the widget should be removed.
SlateWidgetThe Slate widget to be removed from the viewport world.
Returns
Returns true if the removal was successful, false otherwise.
Here is the call graph for this function:

◆ RemoveWidgetFromHandle()

bool UViewportWorldStatics::RemoveWidgetFromHandle ( const FViewportWorldHandle & WorldHandle,
UUserWidget * Widget )
static

Removes the given widget (if it was added before) from viewport.

Parameters
WorldHandleWorld to remove widget from.
WidgetWidget to remove.
Returns
True if the widget was removed successfully.
Here is the call graph for this function:

◆ SetWorldTickForHandle()

void UViewportWorldStatics::SetWorldTickForHandle ( const FViewportWorldHandle & WorldHandle,
const bool bEnabled )
static

Toggles ticking for the world. This affects the entire world (of the handle) including all actors, objects as well.

Parameters
WorldHandleTarget world handle
bEnabledTrue to enable ticking. False otherwise.
Here is the call graph for this function:

◆ SpawnActorForWorldHandle()

AActor * UViewportWorldStatics::SpawnActorForWorldHandle ( UPARAM(ref) FViewportWorldHandle & WorldHandle,
const TSubclassOf< AActor > ActorClass,
const FTransform & SpawnTransform,
const ESpawnActorCollisionHandlingMethod CollisionHandlingMethod = ESpawnActorCollisionHandlingMethod::Undefined,
const ESpawnActorScaleMethod TransformScaleMethod = ESpawnActorScaleMethod::MultiplyWithRoot,
AActor * Owner = nullptr )
static

Spawns an actor for the given world handle. This function will ONLY return a valid actor if the following conditions are met: 1: ActorClass is valid. 2: Given world handle is valid. 3: Given world handle has actors initialized. If not initialized, call UViewportWorldStatics::InitializeActorsForWorldHandle 4: Given world handle has begun play.

Parameters
WorldHandleReference to the world handle.
ActorClassObvious right? This is the actor you want to spawn.
SpawnTransformLocation, rotation and scale for your target actor.
CollisionHandlingMethodDefines available strategies for handling the case where an actor is spawned in such a way that it penetrates blocking collision
TransformScaleMethodDetermines how the transform being passed into actor spawning methods interact with the actor's default root component.
OwnerSet an owner for the newly spawned actor.
Returns
Returns a valid actor if the spawning was successful.
Here is the call graph for this function:

◆ UnloadWorldHandle()

void UViewportWorldStatics::UnloadWorldHandle ( const UObject * WorldContextObject,
UPARAM(ref) FViewportWorldHandle & WorldHandle )
static

Unloads the given world handle.

Parameters
WorldContextObjectWorld object.
WorldHandleWorld handle that should be unloaded
Here is the call graph for this function:

◆ UpdateViewMode()

bool UViewportWorldStatics::UpdateViewMode ( const FViewportWorldHandle & WorldHandle,
const EViewportWorldViewMode NewViewMode )
static

Changes the world view mode to a new one.

Parameters
WorldHandleWorld handle to update view mode for.
NewViewModeNew view mode
Returns
True if the view mode was changed.
Here is the call graph for this function:

The documentation for this class was generated from the following files: