Skip to content
SiteEmail

ICohtmlPlugin

More…

#include <ICohtmlPlugin.h>

Inherits from IModuleInterface

Inherited by FCohtmlPlugin

Name
structCustomMaterialDrawParams
Name
ICohtmlPlugin &Get()
boolIsAvailable()
DECLARE_DELEGATE_OneParam(FModifyLibraryParams , cohtml::LibraryParamsWithExternalRenderingLibrary * )
DECLARE_DELEGATE_OneParam(FModifySystemSettings , cohtml::SystemSettings * )
DECLARE_DELEGATE_OneParam(FModifyViewSettings , cohtml::ViewSettings * )
DECLARE_DELEGATE_OneParam(FOnURLRequest , FURLWithFallbacks & )
DECLARE_DELEGATE_TwoParams(FOnUserImageDropped , void * , void * )
DECLARE_DELEGATE_OneParam(FOnGetFallbackFormats , TArray< FOverridableFallbackFormat > & )
DECLARE_DELEGATE_RetVal(ICohtmlSpeechSynthesizer * , FOnGetSpeechSynthesizer )
DECLARE_DELEGATE_RetVal(cohtml::ILocalizationManager * , FOnGetLocalizationManager )
DECLARE_DELEGATE_FourParams(FOnShowVirtualKeyboard , TSharedPtr< FCohtmlVirtualKeyboardEntry > & , int32 , cohtml::View * , cohtml::IInputProxy * )
DECLARE_DELEGATE_RetVal(FCohtmlFileHandler * , FOnGetFileHandler )
DECLARE_DELEGATE_RetVal(cohtml::ITextTransformationManager * , FOnGetTextTransformationManager )
DECLARE_DELEGATE_RetVal(cohtml::IDataStorageHandler * , FOnGetDataStorageProvider )
DECLARE_DELEGATE_RetVal(TSharedPtr< FCohtmlInputPreprocessor > , FOnGetCohtmlInputPreprocessor )
DECLARE_DELEGATE_RetVal(cohtml::IInternationalizationManager * , FOnGetInternationalizationManager )
DECLARE_DELEGATE_RetVal(cohtml::IFileSystemWriter * , FOnGetFileSystemWriter )
DECLARE_DELEGATE_RetVal(CohtmlTimeFunctionData , FOnGetIncreasingTimeRequestFunc )
DECLARE_DELEGATE_RetVal_OneParam(UMaterialInterface * , FOnMapMaterialName , const FString & )
DECLARE_DELEGATE_OneParam(FOnGetResourceHostLocations , TArray< FResourceHostPair > & )
DECLARE_DELEGATE_RetVal_OneParam(UHUDSurfacePartitioningCompositor * , FOnGetHUDCompositor , UCohtmlHUD * )
DECLARE_DELEGATE_RetVal_OneParam(UWidgetSurfacePartitioningCompositor * , FOnGetWidgetCompositor , UCohtmlWidget * )
DECLARE_DELEGATE_RetVal(ICohtmlScriptProvider * , FOnGetScriptProvider )
DECLARE_DELEGATE_TwoParams(FOnBindCustomEffectParameters , UMaterialInstanceDynamic * , const CustomMaterialDrawParams & )
DECLARE_DELEGATE_RetVal(FCohTexture * , FOnProvideUITextureForViewWrapper )
DECLARE_DELEGATE_OneParam(FOnResizeOrRecreateTexture , FCohtmlViewWrapper * ViewWrapper)
DECLARE_DELEGATE_ThreeParams(FOnResizeView , FCohtmlViewWrapper * ViewWrapper, uint32 NewWidth, uint32 NewHeight)
DECLARE_DELEGATE_TwoParams(FOnViewSetUserBackground , FCohTexture * CohTexture, FCohtmlViewWrapper * ViewWrapper)
virtual voidEnableProfiling(bool bEnable =true, FString TraceFilePath =FString(""), ECohtmlTraceEventsLevel TraceLevel =ECohtmlTraceEventsLevel::BasicMarkers) =0
Name
COHTMLPLUGIN_API FModifyLibraryParamsModifyLibraryParams
COHTMLPLUGIN_API FModifySystemSettingsModifySystemSettings
COHTMLPLUGIN_API FModifyViewSettingsModifyViewSettings
COHTMLPLUGIN_API FOnURLRequestOnURLRequest
COHTMLPLUGIN_API FOnUserImageDroppedOnUserImageDropped
COHTMLPLUGIN_API FOnGetFallbackFormatsOnGetFallbackFormats
COHTMLPLUGIN_API FOnGetSpeechSynthesizerOnGetSpeechSynthesizer
COHTMLPLUGIN_API FOnGetLocalizationManagerOnGetLocalizationManager
COHTMLPLUGIN_API FOnShowVirtualKeyboardOnShowVirtualKeyboard
COHTMLPLUGIN_API FOnGetFileHandlerOnGetFileHandler
COHTMLPLUGIN_API FOnGetTextTransformationManagerOnGetTextTransformationManager
COHTMLPLUGIN_API FOnGetDataStorageProviderOnGetDataStorageProvider
COHTMLPLUGIN_API FOnGetCohtmlInputPreprocessorOnGetCohtmlInputPreprocessor
COHTMLPLUGIN_API FOnGetInternationalizationManagerOnGetInternationalizationManager
COHTMLPLUGIN_API FOnGetFileSystemWriterOnGetFileSystemWriter
COHTMLPLUGIN_API FOnGetIncreasingTimeRequestFuncOnGetIncreasingTimeRequestFunc
COHTMLPLUGIN_API FOnMapMaterialNameOnMapMaterialName
COHTMLPLUGIN_API FOnGetResourceHostLocationsOnGetResourceHostLocations
COHTMLPLUGIN_API FOnGetHUDCompositorOnGetHUDCompositor
COHTMLPLUGIN_API FOnGetWidgetCompositorOnGetWidgetCompositor
COHTMLPLUGIN_API FOnGetScriptProviderOnGetScriptProvider
COHTMLPLUGIN_API FOnBindCustomEffectParametersOnBindCustomEffectParameters
FOnCohtmlLibraryBeginDestroyOnCohtmlLibraryBeginDestroy
FOnViewSetUserBackgroundOnViewSetUserBackground
class ICohtmlPlugin;

The public interface to this module. In most cases, this interface is only public to sibling modules within this plugin.

static inline ICohtmlPlugin & Get()

Return: Returns singleton instance, loading the module on demand if needed

Singleton-like access to this module’s interface. This is just for convenience! Beware of calling this during the shutdown phase, though. Your module might have been unloaded already.

static inline bool IsAvailable()

Return: True if the module is loaded and ready to use

Checks to see if this module is loaded and ready. It is only valid to call Get() if IsAvailable() returns true.

DECLARE_DELEGATE_OneParam(
FModifyLibraryParams ,
cohtml::LibraryParamsWithExternalRenderingLibrary *
)

Parameters:

  • A pointer to the populated and modifiable cohtml::LibraryParamsWithExternalRenderingLibrary structure

A delegate that is fired right before creating a Cohtml Library. This delegate gives you the ability to modify the parameters used when creating a Cohtml Library.

DECLARE_DELEGATE_OneParam(
FModifySystemSettings ,
cohtml::SystemSettings *
)

Parameters:

  • A pointer to the populated and modifiable cohtml::SystemSettings structure

A delegate that is fired right before creating a Cohtml System. This delegate gives you the ability to modify the options used when creating a Cohtml System.

DECLARE_DELEGATE_OneParam(
FModifyViewSettings ,
cohtml::ViewSettings *
)

Parameters:

  • A pointer to the populated and modifiable cohtml::ViewSettings structure

A delegate that is fired right before creating a Cohtml View. This delegate gives you the ability to modify the options used when creating a Cohtml View.

DECLARE_DELEGATE_OneParam(
FOnURLRequest ,
FURLWithFallbacks &
)

Parameters:

  • A populated and modifiable structure, containing the URL and all fallbacks

A delegate that is fired on the FIRST request for each resource. Will not be called a second time when the fallback resource is requested. Will not be called twice if we have two Views sharing the resource.

DECLARE_DELEGATE_TwoParams(
FOnUserImageDropped ,
void * ,
void *
)

Parameters:

  • UserData contains passed arbitrary data (if any)
  • TexturePtr contains whatever has been passed to cohtml::IAsyncResourceResponse::UserImageData::Texture

Called in cases where the backend won’t receive a delete texture call for the user image Can be used to decrement reference counters for user image resources.

DECLARE_DELEGATE_OneParam(
FOnGetFallbackFormats ,
TArray< FOverridableFallbackFormat > &
)

Parameters:

  • A populated and modifiable array, which contains all of the image fallback formats from the Editor settings. Can be empty.

A delegate which you can use for control over the image fallback formats

DECLARE_DELEGATE_RetVal(
ICohtmlSpeechSynthesizer * ,
FOnGetSpeechSynthesizer
)

Return: A pointer to your SpeechSynthesizer object.

A delegate that is fired to receive your ICohtmlSpeechSynthesizer implementation.

DECLARE_DELEGATE_RetVal(
cohtml::ILocalizationManager * ,
FOnGetLocalizationManager
)

Return: A pointer to your LocalizationManager object.

A delegate that is fired to receive your custom ILocalizationManager implementation.

DECLARE_DELEGATE_FourParams(
FOnShowVirtualKeyboard ,
TSharedPtr< FCohtmlVirtualKeyboardEntry > & ,
int32 ,
cohtml::View * ,
cohtml::IInputProxy *
)

A delegate that is fired when a virtual keyboard should be shown on the screen. This gives control over whether to show virtual keyboard for given platform, the options given to the VirtualKeyboardEntry, and the actual implementation of the function showing the virtual keyboard.

DECLARE_DELEGATE_RetVal(
FCohtmlFileHandler * ,
FOnGetFileHandler
)

Return: A pointer to your CohtmlFileHandler object. The lifetime of the object will be controlled by the plugin, but you can also destroy it via FCohtmlSystemHolder::ResetResourceHandler.

A delegate that is fired to receive your custom CohtmlFileHandler implementation.

DECLARE_DELEGATE_RetVal(
cohtml::ITextTransformationManager * ,
FOnGetTextTransformationManager
)

Return: A pointer to your TextTransformationManager object.

A delegate that is fired to receive your custom ITextTransformationManager implementation.

DECLARE_DELEGATE_RetVal(
cohtml::IDataStorageHandler * ,
FOnGetDataStorageProvider
)

Return: A pointer to your DataStorageHandler object.

A delegate that is fired to receive your custom IDataStorageHandler implementation.

DECLARE_DELEGATE_RetVal(
TSharedPtr< FCohtmlInputPreprocessor > ,
FOnGetCohtmlInputPreprocessor
)

Return: A pointer to your FCohtmlInputPreprocessor-derived object. The FCohtmlSystemHolder will hold a shared pointer to it.

A delegate that is fired to receive your custom FCohtmlInputPreprocessor-derived implementation.

DECLARE_DELEGATE_RetVal(
cohtml::IInternationalizationManager * ,
FOnGetInternationalizationManager
)

Return: A pointer to your InternationalizationManager object.

A delegate that is fired to receive your custom IInternationalizationManager implementation.

DECLARE_DELEGATE_RetVal(
cohtml::IFileSystemWriter * ,
FOnGetFileSystemWriter
)

Return: A pointer to your FileSystemWriter object.

A delegate that is fired to receive your custom IFileSystemWriter implementation.

DECLARE_DELEGATE_RetVal(
CohtmlTimeFunctionData ,
FOnGetIncreasingTimeRequestFunc
)

Return: The MonotonicallyIncreasingTime function and optional user data

A delegate that is fired to receive your monotonically increasing time function data.

DECLARE_DELEGATE_RetVal_OneParam(
UMaterialInterface * ,
FOnMapMaterialName ,
const FString &
)

Return: A pointer to the UMaterial that will be used for drawing the custom effect.

A delegate fired whenever a custom effect needs to be drawn and a mapping between the effect name and a UMaterial* instance is required.

DECLARE_DELEGATE_OneParam(
FOnGetResourceHostLocations ,
TArray< FResourceHostPair > &
)

A delegate that is fired during World initialization, for example when starting PIE.

DECLARE_DELEGATE_RetVal_OneParam(
UHUDSurfacePartitioningCompositor * ,
FOnGetHUDCompositor ,
UCohtmlHUD *
)

Parameters:

  • - The HUD that is creating the Compositor.

Return: A pointer your own overriding object. It is good to set the provided UCohtmlHUD as the owner to your newly created object, to prevent it from being garbage collected by the Engine.

A delegate fired whenever a HUD is creating its Surface Partitioning Compositor. You can use this to provide your own override to the UHUDSurfacePartitioningCompositor class.

DECLARE_DELEGATE_RetVal_OneParam(
UWidgetSurfacePartitioningCompositor * ,
FOnGetWidgetCompositor ,
UCohtmlWidget *
)

Parameters:

  • - The Widget that is creating the Compositor.

Return: A pointer your own overriding object. It is good to set the provided UCohtmlWidget as the owner to your newly created object, to prevent it from being garbage collected by the Engine.

A delegate fired whenever a Widget is creating its Surface Partitioning Compositor. You can use this to provide your own override to the UWidgetSurfacePartitioningCompositor class.

DECLARE_DELEGATE_RetVal(
ICohtmlScriptProvider * ,
FOnGetScriptProvider
)

Return: A pointer to your own overriding object or nullptr if no provider is available.

You can use this delegate to specify a ScriptProvider object to handle loading of pre-compiled JavaScript data. This can be the default FCohtmlScriptProvider object or your own implementation of the ICohtmlScriptProvider interface. The delegate will be fired on every resource request to check if there is an existing provider to potentially query for compiled script data. If at some point your ScriptProvider is no longer needed, you can just return nullptr here or unbind the delegate.

DECLARE_DELEGATE_TwoParams(
FOnBindCustomEffectParameters ,
UMaterialInstanceDynamic * ,
const CustomMaterialDrawParams &
)

An optional delegate fired whenever a custom effect should bind additional custom properties. The provided arguments are the UMaterialInstanceDynamic that will be used, along with the custom parameters coming from the HTML page.

DECLARE_DELEGATE_RetVal(
FCohTexture * ,
FOnProvideUITextureForViewWrapper
)

Return: A pointer the FCohTexture that you have created.

Optional event that can be used to provide user-created FCohTextures when a ViewWrapper gets created.

DECLARE_DELEGATE_OneParam(
FOnResizeOrRecreateTexture ,
FCohtmlViewWrapper * ViewWrapper
)

Parameters:

  • - The ViewWrapper that got affected.

Optional event that can be used to execute custom code after a ViewWrapper’s render target texture has been created and/or resized.

DECLARE_DELEGATE_ThreeParams(
FOnResizeView ,
FCohtmlViewWrapper * ViewWrapper,
uint32 NewWidth,
uint32 NewHeight
)

Parameters:

  • - The ViewWrapper that got affected.
  • - The new width.
  • - The new height.

Optional event that can be used to execute custom code after a ViewWrapper’s cohtml::View gets resized.

DECLARE_DELEGATE_TwoParams(
FOnViewSetUserBackground ,
FCohTexture * CohTexture,
FCohtmlViewWrapper * ViewWrapper
)

Parameters:

  • - FCohTexture containing the user background texture.
  • - The ViewWrapper for which the user background texture got set.

Optional event that can be used to execute custom code after a cohtml::View’s SetUserBackground API is executed.

virtual void EnableProfiling(
bool bEnable =true,
FString TraceFilePath =FString(""),
ECohtmlTraceEventsLevel TraceLevel =ECohtmlTraceEventsLevel::BasicMarkers
) =0

Parameters:

  • bEnable - Enables or disables the emission of internal profile markers
  • TraceFilePath - For platforms using minitrace, the path to the JSON file to write to. Defaults to Game/Saved/Cohtml/profiling.
  • TraceLevel - the granularity and detail of the markers to emit

Reimplemented by: FCohtmlPlugin::EnableProfiling

An API for enabling Cohtml profile markers (usable only with libraries in Development configuration)

static COHTMLPLUGIN_API FModifyLibraryParams ModifyLibraryParams;

Override this when you want to modify the Cohtml Library parameters.

static COHTMLPLUGIN_API FModifySystemSettings ModifySystemSettings;

Override this when you want to modify the Cohtml System settings.

static COHTMLPLUGIN_API FModifyViewSettings ModifyViewSettings;

Override this when you want to modify the Cohtml View settings.

static COHTMLPLUGIN_API FOnURLRequest OnURLRequest;

Override this to change the fallback paths for image resources. By changing the contents of the referenced parameter you can inject your own fallback paths, add/remove fallbacks dynamically, etc. You can even change the URL that is currently being loaded. The StartupModule method of your GameModule class is a convenient place to bind your function.

static COHTMLPLUGIN_API FOnUserImageDropped OnUserImageDropped;

Override this before the cohtml::System creation.

static COHTMLPLUGIN_API FOnGetFallbackFormats OnGetFallbackFormats;

Use this to inject your own Fallback Formats. Useful for anything that the similar editor option lacks, such as having different fallbacks for different platforms or deciding dynamically which fallbacks you want to use during startup. Will get called once during the initialization of the Cohtml system The StartupModule method of your GameModule class is a convenient place to bind your function.

static COHTMLPLUGIN_API FOnGetSpeechSynthesizer OnGetSpeechSynthesizer;

Use this to override the default SpeechSynthesizer. Bind this delegate to a function that returns a pointer to your own implementation. The binding must be done before the CohtmlSystem initialization and the implementation must adhere to the restrictions outlined in the ICohtmlSpeechSynthesizer interface header. The StartupModule method of your GameModule class is a convenient place to bind your function.

static COHTMLPLUGIN_API FOnGetLocalizationManager OnGetLocalizationManager;

Use this to override the default Localization Manager. Bind this delegate to a function that returns a pointer to your own implementation. The binding must be done before the CohtmlSystem initialization and the implementation must adhere to the restrictions outlined in the ILocalizationManager interface header. The StartupModule method of your GameModule class is a convenient place to bind your function.

static COHTMLPLUGIN_API FOnShowVirtualKeyboard OnShowVirtualKeyboard;

Use this to override the default ShowVirtualKeyboard behavior. Bind this delegate to a function that creates new TSharedPtr of FCohtmlVirtualKeyboardEntry or inherited class (should be stored inside the supplied reference of the same type) and showing the virtual keyboard using that virtual keyboard entry. To disable virtual keyboard for specific platform, just leave the implementation of the bound function empty for the given platform. The binding must be done before the CohtmlSystem initialization. The StartupModule method of your GameModule class is a convenient place to bind your function.

static COHTMLPLUGIN_API FOnGetFileHandler OnGetFileHandler;

Use this to override the default File Handler. Bind a function that returns a pointer to your own implementation. The binding must be done before the CohtmlSystem initialization and the implementation must follow the guidelines outlined in the FCohtmlFileHandler/IAsyncResourceHandler headers. The StartupModule method of your GameModule class is a convenient place to bind this function.

static COHTMLPLUGIN_API FOnGetTextTransformationManager OnGetTextTransformationManager;

Use this to override the default Text Transformation Manager. Bind a function that returns a pointer to your own implementation. The binding must be done before the CohtmlSystem initialization and the implementation must adhere to the restrictions outlined in the ITextTransformationManager interface header. The StartupModule method of your GameModule class is a convenient place to bind your function.

static COHTMLPLUGIN_API FOnGetDataStorageProvider OnGetDataStorageProvider;

Use this to override the (missing) default Data Storage Provider. Bind a function that returns a pointer to your own implementation. The binding must be done before the CohtmlSystem initialization and the implementation must adhere to the restrictions outlined in the IDataStorageHandler interface header. The StartupModule method of your GameModule class is a convenient place to bind your function.

static COHTMLPLUGIN_API FOnGetCohtmlInputPreprocessor OnGetCohtmlInputPreprocessor;

Use this to override the default implementation of the FCohtmlInputPreprocessor. Bind a function that returns a pointer to your own implementation. The binding must be done before the CohtmlSystem initialization.

static COHTMLPLUGIN_API FOnGetInternationalizationManager OnGetInternationalizationManager;

Use this to override the default Internationalization Manager. Bind a function that returns a pointer to your own implementation. The binding must be done before the CohtmlSystem initialization and the implementation must adhere to the restrictions outlined in the IInternationalizationManager interface header. The StartupModule method of your GameModule class is a convenient place to bind your function.

static COHTMLPLUGIN_API FOnGetFileSystemWriter OnGetFileSystemWriter;

Use this to override the default File System Writer. Bind a function that returns a pointer to your own implementation. The binding must be done before the CohtmlSystem initialization and the implementation must adhere to the restrictions outlined in the IFileSystemWriter interface header. The StartupModule method of your GameModule class is a convenient place to bind your function.

static COHTMLPLUGIN_API FOnGetIncreasingTimeRequestFunc OnGetIncreasingTimeRequestFunc;

Use this to override the default OnMonotonicallyIncreasingTimeRequest function. This function is called by Cohtml during Advance, when accurate current time is needed. Bind a function that returns a pointer to your own implementation. The binding must be done before the CohtmlSystem initialization. The StartupModule method of your GameModule class is a convenient place to bind your function, as shown in the CoherentSample implementation.

static COHTMLPLUGIN_API FOnMapMaterialName OnMapMaterialName;

Required to be bound if custom effects are used. Bind a function that returns a UMaterial* corresponding to the string name passed in as an argument to the delegate. Binding can be done at any point before the system advances, but it’s usually good practice to do that before the initialization of the CohtmlSystem. The StartupModule method of your GameModule class is a convenient place to bind your function. Note that the implementation will be used for all CoHTML Views. At this moment there is no way to have different material mappings on a per-view basis. You’ll need to differentiate entirely by the effect name.

static COHTMLPLUGIN_API FOnGetResourceHostLocations OnGetResourceHostLocations;

Bind this to change the Host locations for resources. By changing the contents of the referenced parameter you can modify the existing hosts or add your own. You can also construct locations dynamically, for example using the FPaths static methods, querying the OS or a server for locations, etc. The StartupModule method of your GameModule class is a convenient place to bind your function.

static COHTMLPLUGIN_API FOnGetHUDCompositor OnGetHUDCompositor;
static COHTMLPLUGIN_API FOnGetWidgetCompositor OnGetWidgetCompositor;
static COHTMLPLUGIN_API FOnGetScriptProvider OnGetScriptProvider;
static COHTMLPLUGIN_API FOnBindCustomEffectParameters OnBindCustomEffectParameters;

Optional event that can be used to employ binding of additional parameters that the HTML provides when using custom effects. Use the UMaterialInstanceDynamic APIs (e.g. SetTextureParameterValue, SetScalarParameterValue, etc.) to set the appropriate Material parameters based on the values that the event provides.

FOnCohtmlLibraryBeginDestroy OnCohtmlLibraryBeginDestroy;

An event that is fired when the CohtmlLibrary is about to be destroyed. You can use this to clean up any leftover resources you may have allocated.

FOnViewSetUserBackground OnViewSetUserBackground;