UCohtmlBaseComponent

Inherits from UActorComponent

Inherited by UCohtmlComponent, UCohtmlHUD

Public Types

Name
typedef TArray< TWeakObjectPtr< UCohtmlBaseComponent > >WeakCohtmlComponentsArray

Public Functions

Name
voidSetSoundAttenuation(const FSoundAttenuationSettings & Settings)
voidRegisterForEvent(UPARAM(DisplayName=“JavaScript Event Name”) FString JSEventName, UPARAM(DisplayName=“Event”) FCohtmlJSEventBPCallback Delegate)
virtual voidResize(int32 width, int32 height)
virtual voidResizeRenderTarget(int32 width, int32 height)
boolIsReadyToCreateView() const
boolIsReadyForBindings() const
boolHasRequestedView() const
voidShowPaintRects(bool show)
voidLoad(const FString & path)
voidReload()
voidDebugSaveNextFrame()
voidBeginDebugFrameSave()
voidEndDebugFrameSave()
voidEnableDelayedUpdate(bool bEnabled)
voidEnableRendering(bool bEnabled)
UCohtmlJSEvent *CreateJSEvent()
voidTriggerJSEvent(const FString & name, UCohtmlJSEvent * eventData) const
voidCreateDataModelFromObject(const FString & Name, UObject * Model)
voidRemoveDataModelFromObject(UObject * Model)
voidCreateDataModelFromStruct(const FString & Name, const TFieldPath< FStructProperty > Struct)
voidUpdateWholeDataModelFromStruct(const TFieldPath< FStructProperty > Struct) const
voidRemoveDataModelFromStruct(const TFieldPath< FStructProperty > Struct) const
voidUpdateWholeDataModelFromObject(UObject * Model) const
voidSynchronizeModels() const
voidPreloadTextureSync(const FString & AssetPath)
voidPreloadTextureAsync(const FString & AssetPath)
voidAddPreloadedTexture(UTexture2D * Texture)
boolRemovePreloadedTextureFromPath(const FString & AssetPath)
boolRemovePreloadedTexture(UTexture2D * Texture)
voidRemoveAllPreloadedTextures()
virtual boolEnsureMeshData(ECohtmlComponentMeshInit MeshInitialization =ECohtmlComponentMeshInit::LazyInit)
voidSetCohtmlTickGroup(ECohtmlTickGroup InTickGroup)
virtual~UCohtmlBaseComponent()
virtual voidInitializeComponent() override
virtual voidBeginDestroy() override
virtual boolIsReadyForFinishDestroy() override
virtual voidFinishDestroy() override
virtual boolGetMeshes(TArray< TWeakObjectPtr< UStaticMeshComponent » & WeakMeshes) const
virtual voidTickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction * ThisTickFunction) override
cohtml::View *GetView() const
cohtml::ViewRenderer *GetViewRenderer() const
FCohtmlGesturePolicy *GetGesturePolicy()
FCohtmlViewWrapper *GetViewWrapper() const
const FCohtmlCaretRect &GetCaretRect() const
voidSetCaretRect(int x, int y, unsigned width, unsigned height)
virtual int32GetUserIndex()
voidSetInputFocusToUI()
voidRestoreInputFocusFromUI(bool bForceFocusToGame =false)
cohtml::ECohtmlPageLoadStateGetCurrentPageState() const
voidSetUEViewSettings(const FCohtmlUEViewSettings & InViewSettings)
DECLARE_FUNCTION(execCreateDataModelFromStruct )
DECLARE_FUNCTION(execUpdateWholeDataModelFromStruct )
DECLARE_FUNCTION(execRemoveDataModelFromStruct )
WeakCohtmlComponentsArray::TIteratorGetUCohtmlBaseComponentIterator(UWorld * world)

Protected Functions

Name
voidCreateView(const cohtml::ViewSettings & info, const FString & url)
virtual voidSendRenderDynamicData_Concurrent() override
virtual boolRequiresGameThreadEndOfFrameUpdates() const override

Public Attributes

Name
FCohtmlReadyForBindingsReadyForBindings
FCohtmlBindingsReleasedBindingsReleased
FCohtmlScriptingReadyScriptingReady
FCohtmlScriptContextCreatedScriptContextCreated
FCohtmlDOMBuiltDOMBuilt
FCohtmlFinishLoadFinishLoad
FCohtmlLoadFailedLoadFailed
FCohtmlOnNavigateToOnNavigateTo
TArray< UTexture2D * >PreloadedTextures
boolbEnableComplexCSSSupport
UTextureRenderTarget2D *Texture
TEnumAsByte< enum TextureFilter >Filter
boolbReceiveInput
boolbDelayedUpdate
boolbExecuteCommandProcessingWithLayout
boolbUseSurfacePartitioning
boolbRunAdvanceConcurrently
TEnumAsByte< ECohtmlTickGroup >TickGroup
TArray< FCohtmlMeshData >MeshData
TArray< CohtmlDelegateFunctorWrapper >JSEventCallbackWrappers
EMouseCursor::TypeCurrentMouseCursor

Protected Attributes

Name
FCohtmlUEViewSettingsUEViewSettings
UMultithreadAwareCompositorWrapper *CohCompositorWrapper

Friends

Name
classTCohtmlViewListener< UCohtmlBaseComponent >

Public Types Documentation

typedef WeakCohtmlComponentsArray

typedef TArray<TWeakObjectPtr<UCohtmlBaseComponent> > UCohtmlBaseComponent::WeakCohtmlComponentsArray;

Public Functions Documentation

function SetSoundAttenuation

void SetSoundAttenuation(
    const FSoundAttenuationSettings & Settings
)

Sets the AttenuationSettings for the Sound Components Note: Sound is 2D by default. It can be changed to 3D if appropriate AttenuationSettings is set. for more details look at Unreal’s documentation for AttenuationSettings.

function RegisterForEvent

void RegisterForEvent(
    UPARAM(DisplayName="JavaScript Event Name") FString JSEventName,
    UPARAM(DisplayName="Event") FCohtmlJSEventBPCallback Delegate
)

You can use this to bind a Blueprint event to an arbitrary JavaScript event. The Blueprint event must have no parameters.

function Resize

virtual void Resize(
    int32 width,
    int32 height
)

Reimplemented by: UCohtmlComponent::Resize, UCohtmlHUD::Resize

Resizes the View

function ResizeRenderTarget

virtual void ResizeRenderTarget(
    int32 width,
    int32 height
)

Resizes the texture where the View is drawn

function IsReadyToCreateView

bool IsReadyToCreateView() const

Tells if the View is ready to be created

function IsReadyForBindings

bool IsReadyForBindings() const

Tells if the View is ready for binding operations

function HasRequestedView

bool HasRequestedView() const

Tells if a View has been scheduled for creation

function ShowPaintRects

void ShowPaintRects(
    bool show
)

Tells the view to show/hide debug paint rectangles

function Load

void Load(
    const FString & path
)

Requests a new URL to be loaded in the View

function Reload

void Reload()

Requests the View to reload the current URL

function DebugSaveNextFrame

void DebugSaveNextFrame()

Saves next render frame to disk

function BeginDebugFrameSave

void BeginDebugFrameSave()

Starts saving render frames to disk

function EndDebugFrameSave

void EndDebugFrameSave()

Stops saving render frames to disk

function EnableDelayedUpdate

void EnableDelayedUpdate(
    bool bEnabled
)

Delays UI updates until after cameras are updated. Read the section in the FAQ page of the documentation before using

function EnableRendering

void EnableRendering(
    bool bEnabled
)

Enables or disables the recording of rendering commands for the view. Enabled by default.

function CreateJSEvent

UCohtmlJSEvent * CreateJSEvent()

Creates an event that will be executed in JavaScript

function TriggerJSEvent

void TriggerJSEvent(
    const FString & name,
    UCohtmlJSEvent * eventData
) const

Triggers an event in JavaScript

function CreateDataModelFromObject

void CreateDataModelFromObject(
    const FString & Name,
    UObject * Model
)

Creates a global variable (data model) in JavaScript from an UObject

function RemoveDataModelFromObject

void RemoveDataModelFromObject(
    UObject * Model
)

Removes a global variable (data model) in JavaScript from a UObject

function CreateDataModelFromStruct

void CreateDataModelFromStruct(
    const FString & Name,
    const TFieldPath< FStructProperty > Struct
)

Creates a global variable (data model) in JavaScript from a UStruct

function UpdateWholeDataModelFromStruct

void UpdateWholeDataModelFromStruct(
    const TFieldPath< FStructProperty > Struct
) const

Marks a Struct model for update. The UI using this data model will be updated during the next call to SynchronizeModels. For optimum performance, call SynchronizeModels as rarely as possible (e.g. once per frame).

function RemoveDataModelFromStruct

void RemoveDataModelFromStruct(
    const TFieldPath< FStructProperty > Struct
) const

Removes a global variable (data model) in JavaScript from a UStruct

function UpdateWholeDataModelFromObject

void UpdateWholeDataModelFromObject(
    UObject * Model
) const

Marks an Object model for update. The UI using this data model will be updated during the next call to SynchronizeModels. For optimum performance, call SynchronizeModels as rarely as possible (e.g. once per frame).

function SynchronizeModels

void SynchronizeModels() const

Synchronize all models marked for update.

function PreloadTextureSync

void PreloadTextureSync(
    const FString & AssetPath
)

Loads a Texture Synchronously (BLOCKING the main thread) from asset Path. Once loaded, the Texture will be added to the PreloadedTextures collection. This is useful for ensuring that the requests for UE4 textures will be working over already loaded assets, leading to fast response times.

function PreloadTextureAsync

void PreloadTextureAsync(
    const FString & AssetPath
)

Loads a Texture Asynchronously from asset Path. Once loaded, the Texture will be added to the PreloadedTextures collection. This is useful for ensuring that the requests for UE4 textures will be working over already loaded assets, leading to fast response times.

function AddPreloadedTexture

void AddPreloadedTexture(
    UTexture2D * Texture
)

Adds an already loaded Texture to the PreloadedTextures collection. This is useful for ensuring that the requests for UE4 textures will be working over already loaded assets, leading to fast response times.

function RemovePreloadedTextureFromPath

bool RemovePreloadedTextureFromPath(
    const FString & AssetPath
)

Removes a Texture from the PreloadedTextures collection. This can be used when you no longer need a specific texture inside the collection to be kept loaded, for example after changing URL and View is fully loaded. Note: The removal of elements is an operation with linear complexity, consider using RemoveAllPreloadedTextures instead. Note: Upon destruction of the CohtmlBaseComponent, PreloadedTextures collection will be cleared automatically, so calling this method isn’t mandatory.

function RemovePreloadedTexture

bool RemovePreloadedTexture(
    UTexture2D * Texture
)

Removes a Texture from the PreloadedTextures collection. This can be used when you no longer need a specific texture inside the collection to be kept loaded, for example after changing URL and View is fully loaded. Note: The removal of elements is an operation with linear complexity, consider using RemoveAllPreloadedTextures instead. Note: Upon destruction of the CohtmlBaseComponent, PreloadedTextures collection will be cleared automatically, so calling this method isn’t mandatory.

function RemoveAllPreloadedTextures

void RemoveAllPreloadedTextures()

Removes all Textures from the PreloadedTextures collection. * This can be used when you no longer need any of the textures inside the collection to be kept loaded, for example after changing URL and View is fully loaded. Note: Upon destruction of the CohtmlBaseComponent, PreloadedTextures collection will be cleared automatically, so calling this method isn’t mandatory.

function EnsureMeshData

virtual bool EnsureMeshData(
    ECohtmlComponentMeshInit MeshInitialization =ECohtmlComponentMeshInit::LazyInit
)

Used for specifying when the mesh needs to be ready to receive input. If left unspecified, the mesh will be loaded lazily, which means it will take between 2-4 frames for the render thread to have it available. If set to “Immediate”, the render state will be flagged as dirty and the mesh will be loaded either on the same frame or at most the next. Note: Call manually right after a component’s creation to guarantee that all input will be handled in the first frames.

function SetCohtmlTickGroup

void SetCohtmlTickGroup(
    ECohtmlTickGroup InTickGroup
)

Use this over the native UACtorComponent::SetTickGroup during runtime to change the TickGroup. This method will esentially do the same, but also perform extra plugin-related checks, updates, etc.

function ~UCohtmlBaseComponent

virtual ~UCohtmlBaseComponent()

function InitializeComponent

virtual void InitializeComponent() override

Reimplemented by: UCohtmlComponent::InitializeComponent, UCohtmlHUD::InitializeComponent

function BeginDestroy

virtual void BeginDestroy() override

function IsReadyForFinishDestroy

virtual bool IsReadyForFinishDestroy() override

function FinishDestroy

virtual void FinishDestroy() override

function GetMeshes

virtual bool GetMeshes(
    TArray< TWeakObjectPtr< UStaticMeshComponent >> & WeakMeshes
) const

Reimplemented by: UCohtmlComponent::GetMeshes

function TickComponent

virtual void TickComponent(
    float DeltaTime,
    enum ELevelTick TickType,
    FActorComponentTickFunction * ThisTickFunction
) override

Reimplemented by: UCohtmlComponent::TickComponent, UCohtmlHUD::TickComponent

function GetView

cohtml::View * GetView() const

function GetViewRenderer

cohtml::ViewRenderer * GetViewRenderer() const

function GetGesturePolicy

FCohtmlGesturePolicy * GetGesturePolicy()

function GetViewWrapper

inline FCohtmlViewWrapper * GetViewWrapper() const

function GetCaretRect

const FCohtmlCaretRect & GetCaretRect() const

function SetCaretRect

void SetCaretRect(
    int x,
    int y,
    unsigned width,
    unsigned height
)

function GetUserIndex

inline virtual int32 GetUserIndex()

Reimplemented by: UCohtmlComponent::GetUserIndex, UCohtmlHUD::GetUserIndex

function SetInputFocusToUI

void SetInputFocusToUI()

function RestoreInputFocusFromUI

void RestoreInputFocusFromUI(
    bool bForceFocusToGame =false
)

function GetCurrentPageState

cohtml::ECohtmlPageLoadState GetCurrentPageState() const

function SetUEViewSettings

void SetUEViewSettings(
    const FCohtmlUEViewSettings & InViewSettings
)

function DECLARE_FUNCTION

DECLARE_FUNCTION(
    execCreateDataModelFromStruct 
)

function DECLARE_FUNCTION

DECLARE_FUNCTION(
    execUpdateWholeDataModelFromStruct 
)

function DECLARE_FUNCTION

DECLARE_FUNCTION(
    execRemoveDataModelFromStruct 
)

function GetUCohtmlBaseComponentIterator

static WeakCohtmlComponentsArray::TIterator GetUCohtmlBaseComponentIterator(
    UWorld * world
)

Protected Functions Documentation

function CreateView

void CreateView(
    const cohtml::ViewSettings & info,
    const FString & url
)

function SendRenderDynamicData_Concurrent

virtual void SendRenderDynamicData_Concurrent() override

function RequiresGameThreadEndOfFrameUpdates

inline virtual bool RequiresGameThreadEndOfFrameUpdates() const override

Public Attributes Documentation

variable ReadyForBindings

FCohtmlReadyForBindings ReadyForBindings;

When fired, the View is ready for binding events. Any event bound prior to this will be ignored

variable BindingsReleased

FCohtmlBindingsReleased BindingsReleased;

When fired, the View has released its bindings.

variable ScriptingReady

FCohtmlScriptingReady ScriptingReady;

Called when the View is ready to accept events

variable ScriptContextCreated

FCohtmlScriptContextCreated ScriptContextCreated;

Called immediately after the View’s script context has been created for the page. This happens before starting to build the DOM. You can execute any scripts that will influence DOM creation here.

variable DOMBuilt

FCohtmlDOMBuilt DOMBuilt;

Called when the View’s DOM for the pages is fully constructed, but the referenced resources may not finish loading.

variable FinishLoad

FCohtmlFinishLoad FinishLoad;

Called when a View’s navigation change request failed.

variable LoadFailed

FCohtmlLoadFailed LoadFailed;

Called when the View’s page, including the resources it refers to, is completely loaded and initialized.

variable OnNavigateTo

FCohtmlOnNavigateTo OnNavigateTo;

Called whenever the View is about to navigate to a different URL. You can return false to stop the navigation to the URL.

variable PreloadedTextures

TArray< UTexture2D * > PreloadedTextures;

PreloadedTextures collection, keeping the Textures loaded and ready for use. Ideally, the Textures are to be loaded ahead of time and kept in this collection for ensuring that the requests for UE4 textures will be working over already loaded assets, leading to fast response times.

variable bEnableComplexCSSSupport

bool bEnableComplexCSSSupport;

Whether to enable support for complex CSS selectors (e.g. div > p, div ~ p)

variable Texture

UTextureRenderTarget2D * Texture;

Gives access to the UI Texture

variable Filter

TEnumAsByte< enum TextureFilter > Filter;

variable bReceiveInput

bool bReceiveInput;

Indicates whether input is forwarded to this view

variable bDelayedUpdate

bool bDelayedUpdate;

Changes this component’s tick group to TG_PostUpdateWork and sends bindings before drawing. For more information refer to the FAQ section of the documentation.

variable bExecuteCommandProcessingWithLayout

bool bExecuteCommandProcessingWithLayout;

Tells the View to process all collected front-end commands right after the layout execution on the same thread. Note: This option is mandatory when using the Custom Effects and/or the Compositor API features. Note: When this setting is enabled, the rendering library will be used on two different threads: the Game Thread and the Render Thread. Normally the library will detect that but if you have a use case where Game Thread and Rendering tasks are to be executed on the same thread, you’ll have to enable the multithreaded awareness manually by setting LibraryParams::AllowMultithreadedCommandProcessing in the Coherent Rendering plugin to true.

variable bUseSurfacePartitioning

bool bUseSurfacePartitioning;

Enables the Surface Partitioning mode, which does not create a texture for your view, but instead draws separate parts of the HTML in separate small textures. Useful when you have a view with a high resolution that is mostly empty, apart from some content in the corners of the screen that you can draw separately, omitting the big screen texture that you would have otherwise.

variable bRunAdvanceConcurrently

bool bRunAdvanceConcurrently;

When enabled, forces cohtml::View::Advance to be scheduled on background tasks, reducing the load on the Game Thread. This imposes restrictions on what View operations can be performed on the Game Thread. Please see the documentation for more details.

variable TickGroup

TEnumAsByte< ECohtmlTickGroup > TickGroup;

Sets the tick group in which this component will be ticked and Advance the View. If set to “No tick”, this component will not tick on its own. You are expected to call its Tick function manually from your own code. Useful if you want to control the exact time at which to Advance the View.

variable MeshData

TArray< FCohtmlMeshData > MeshData;

variable JSEventCallbackWrappers

TArray< CohtmlDelegateFunctorWrapper > JSEventCallbackWrappers;

variable CurrentMouseCursor

EMouseCursor::Type CurrentMouseCursor;

Protected Attributes Documentation

variable UEViewSettings

FCohtmlUEViewSettings UEViewSettings;

variable CohCompositorWrapper

UMultithreadAwareCompositorWrapper * CohCompositorWrapper;

Friends

friend TCohtmlViewListener< UCohtmlBaseComponent >

friend class TCohtmlViewListener< UCohtmlBaseComponent >;