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

Represents a handle to a viewport world. More...

#include "ViewportWorldTypes.h"

Public Member Functions

void InitializeActors ()
 Initializes the actors in the viewport world.
 
void WorldBeginPlay ()
 Calls the BeginPlay function on the world associated with the viewport world handle.
 
void Reset ()
 Resets the FViewportWorldHandle to its default state.
 
FORCEINLINE bool IsHandleValid () const
 Checks if the handle is valid.
 
FORCEINLINE bool WorldIsReady () const
 Checks if the world is ready for use. This method checks if the handle is valid, if the actors have been initialized, and if the world has begun play.
 
 FViewportWorldHandle ()
 
 FViewportWorldHandle (FWorldContext &WorldContext, const EViewportWorldRenderingMode &RenderingMode, ULocalPlayer *LocalPlayer, const FURL &BaseURL)
 

Public Attributes

TWeakPtr< SViewportWorldViewportWorldWidget
 
TWeakObjectPtr< ULocalPlayer > LocalPlayer
 A weak pointer to the local player associated with the viewport world.
 
FWorldContext * WorldContext
 
FURL BaseURL
 
EViewportWorldRenderingMode RenderingMode
 
FOnWorldUnloadedDelegate OnWorldUnloadedDelegate
 Delegate called when a world is unloaded.
 

Detailed Description

Represents a handle to a viewport world.

Constructor & Destructor Documentation

◆ FViewportWorldHandle() [1/2]

FViewportWorldHandle::FViewportWorldHandle ( )
inline

Default constructor

◆ FViewportWorldHandle() [2/2]

FViewportWorldHandle::FViewportWorldHandle ( FWorldContext & WorldContext,
const EViewportWorldRenderingMode & RenderingMode,
ULocalPlayer * LocalPlayer,
const FURL & BaseURL )
inline

Constructs a new handle from the given parameters.

Member Function Documentation

◆ InitializeActors()

void FViewportWorldHandle::InitializeActors ( )

Initializes the actors in the viewport world.

This method initializes the actors in the viewport world by calling the InitializeActorsForPlay method of the world associated with the viewport. If the actors have already been initialized or if the world context or world associated with the viewport is invalid, this method does nothing.

This method should be called before beginning play in the viewport world.

Here is the caller graph for this function:

◆ IsHandleValid()

FORCEINLINE bool FViewportWorldHandle::IsHandleValid ( ) const
inline

Checks if the handle is valid.

This method checks if the handle is valid by verifying that the WorldContext is not nullptr and that the WorldContext's World is valid using the IsValid() function.

Returns
true if the handle is valid, false otherwise.
Here is the caller graph for this function:

◆ Reset()

void FViewportWorldHandle::Reset ( )

Resets the FViewportWorldHandle to its default state.

This method detaches the viewport client from the game viewport, resets the game viewport to nullptr, sets the current world to nullptr, and sets the world context to nullptr.

It also resets the viewport world widget, the local player, the base URL, and unbinds the OnWorldUnloadedDelegate. Finally, it sets the bActorsInitialized and bWorldHasBegunPlay flags to false.

Warning
This method does not destroy any objects or deallocate any memory. It simply resets the state of the FViewportWorldHandle.
Here is the caller graph for this function:

◆ WorldBeginPlay()

void FViewportWorldHandle::WorldBeginPlay ( )

Calls the BeginPlay function on the world associated with the viewport world handle.

This function should be called after initializing actors in the viewport world. If the actors have not been initialized or if the world context or world associated with the handle is invalid, this function does nothing.

This function also spawns the player actors for the local players in the viewport world. It calls the SpawnPlayActor function on each local player in the owning game instance of the world context, passing the base URL and the world context's world as parameters.

After that, it calls the BeginPlay function on the world associated with the world context.

Note
This function logs a warning if the actors have not been initialized, and logs the time it took to call BeginPlay, if called successfully.
Here is the caller graph for this function:

◆ WorldIsReady()

FORCEINLINE bool FViewportWorldHandle::WorldIsReady ( ) const
inline

Checks if the world is ready for use. This method checks if the handle is valid, if the actors have been initialized, and if the world has begun play.

Returns
true if the world is ready, false otherwise.
Here is the caller graph for this function:

Member Data Documentation

◆ BaseURL

FURL FViewportWorldHandle::BaseURL

The FURL structure contains information about a URL, including the protocol, host, port, map, and options.

◆ LocalPlayer

TWeakObjectPtr<ULocalPlayer> FViewportWorldHandle::LocalPlayer

A weak pointer to the local player associated with the viewport world.

This variable is a TWeakObjectPtr<ULocalPlayer> that represents the local player associated with the viewport world. A weak pointer is used to avoid issues with dangling pointers when the player is destroyed. The local player is used in various operations within the viewport world, such as setting the viewport frame and focusing the viewport widget. It is set in the SViewportWorld::InitializeViewportWorld() function, using the ULocalPlayer from the FViewportWorldHandle parameter.

◆ OnWorldUnloadedDelegate

FOnWorldUnloadedDelegate FViewportWorldHandle::OnWorldUnloadedDelegate

Delegate called when a world is unloaded.

The OnWorldUnloadedDelegate is a delegate that can be bound to a function and called when a world is unloaded. It is used in the FViewportWorldHandle structure to track the unloading of a world.

◆ RenderingMode

EViewportWorldRenderingMode FViewportWorldHandle::RenderingMode

Represents current rendering mode for a viewport world.

◆ ViewportWorldWidget

TWeakPtr<SViewportWorld> FViewportWorldHandle::ViewportWorldWidget

Weak pointer to track a SViewportWorld widget in a viewport.

◆ WorldContext

FWorldContext* FViewportWorldHandle::WorldContext

The FWorldContext structure is used to store information about the world in a viewport. It is used in various operations within the viewport world, such as spawning actors, updating view modes, setting the tick enabled state, and executing commands.


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