unreal.MVVMToolset

class unreal.MVVMToolset

Bases: ToolsetDefinition

C++ Source:

  • Plugin: MVVMToolset

  • Module: MVVMToolset

  • File: MVVMToolset.h

classmethod add_view_model_property(view_model, property_name, property_type, default_value) bool

Add a property to an existing ViewModel

Parameters:
  • view_model (Blueprint) – ViewModel asset to use.

  • property_name (str) – Desired name of the new property

  • property_type (str) – Desired type of the new property. Corresponds with PinType

  • default_value (str) – If a default property is desired, string representation of the value

Returns:

True if property was succesfully added.

Return type:

bool

classmethod add_view_model_to_widget(widget_blueprint, view_model_class) None

Adds a ViewModel to the WidgetBlueprint

Parameters:
  • widget_blueprint (WidgetBlueprint) – WidgetBlueprint to use

  • view_model_class (type(Class)) – ViewModel class to use.

classmethod create_view_binding(widget_blueprint, source_context, source_property_path, destination_context, destination_property_path, conversion_name) Guid

Creates a View Binding from the SourceProperty to the Destination property. If there is a type mismatch, an existing conversion function will try to be used.

Parameters:
  • widget_blueprint (WidgetBlueprint) – WidgetBlueprint to use

  • source_context (Object) – Source object that contains the source property. Can be the following: - UWidget: source property is from a widget in the widget blueprint’s widgettree - UClass: source property is from a widget blueprint’s ViewModel - Null: source property is from the widget blueprint

  • source_property_path (str) – Property to read data from. Contains a dot ‘.’ separated path to the field (path.subfield)

  • destination_context (Object) – Destination object that contains the destination property. Can be the following: - UWidget: destination property is from a widget in the widget blueprint’s widgettree - UClass: destination property is from a widget blueprint’s ViewModel - Null: destination property is from the widget blueprint

  • destination_property_path (str) – Property to write data to. Contains a dot ‘.’ separated path to the field (path.subfield)

  • conversion_name (Name) – Optional parameter, name of a conversion function to use if needed. If none is provided, this will be inferred.

Returns:

Valid FGuid if the binding was created

Return type:

Guid

classmethod create_view_model(view_model_name, package_path, parent_class) Blueprint

Creates a new ViewModel asset

Parameters:
  • view_model_name (str) – Desired ViewModel asset name.

  • package_path (str) – Target path in which the asset should reside

  • parent_class (type(Class)) – Class of which the ViewModel should derive. Must derive UMVVMViewModelBase

Returns:

newly created ViewModel blueprint.

Return type:

Blueprint

classmethod list_conversion_functions(widget_blueprint) Array[MVVMViewConversionFunctionDescription]

List Available Conversion functions for a WidgetBlueprint that bind a Source Property to a Destination Property

Parameters:

widget_blueprint (WidgetBlueprint) – WidgetBlueprint to use

Returns:

the FMVVMViewConversionFunctionDescription for available conversion functions.

Return type:

Array[MVVMViewConversionFunctionDescription]

classmethod list_view_models(search_path) Array[type(Class)]

List all ViewModel under the search path

Parameters:

search_path (str) – Mount point search path for ViewModel assets

Returns:

List of ViewModel classes.

Return type:

Array[type(Class)]

classmethod list_widget_view_bindings(widget_blueprint) Array[MVVMBlueprintViewBinding]

List all view bindings on the WidgetBlueprint

Parameters:

widget_blueprint (WidgetBlueprint) – WidgetBlueprint to use

Returns:

List of FMVVMBlueprintViewBinding that describe each available view binding.

Return type:

Array[MVVMBlueprintViewBinding]

classmethod list_widget_view_models(widget_blueprint) Array[type(Class)]

List all ViewModel on the WidgetBlueprint

Parameters:

widget_blueprint (WidgetBlueprint) – WidgetBlueprint to use

Returns:

List of ViewModel classes.

Return type:

Array[type(Class)]

classmethod remove_widget_view_binding(widget_blueprint, binding_id) bool

Removes View Binding on the WidgetBlueprint

Parameters:
Returns:

True if binding was removed.

Return type:

bool