unreal.MLDeformerComponent

class unreal.MLDeformerComponent(outer: Object | None = None, name: Name | str = 'None')

Bases: ActorComponent

The ML mesh deformer component. This works in combination with a MLDeformerAsset and SkeletalMeshComponent. The component will perform runtime inference of the deformer model setup inside the asset. When you have multiple skeletal mesh components on your actor, this component will try to use the skeletal mesh component that uses the same skeletal mesh as the applied deformer was trained on. If it cannot find that, it will use the first skeletal mesh component it finds.

C++ Source:

  • Plugin: MLDeformerFramework

  • Module: MLDeformerFramework

  • File: MLDeformerComponent.h

Editor Properties: (see get_editor_property/set_editor_property)

  • asset_user_data (Array[AssetUserData]): [Read-Write] Array of user data stored with the component

  • asset_user_data_editor_only (Array[AssetUserData]): [Read-Write] Array of user data stored with the component

  • auto_activate (bool): [Read-Write] Whether the component is activated at creation or must be explicitly activated.

  • can_ever_affect_navigation (bool): [Read-Write] Whether this component can potentially influence navigation

  • component_tags (Array[Name]): [Read-Write] Array of tags that can be used for grouping and categorizing. Can also be accessed from scripting.

  • deformer_asset (MLDeformerAsset): [Read-Write] The deformer asset to use.

  • editable_when_inherited (bool): [Read-Write] True if this component can be modified when it was inherited from a parent actor class

  • is_editor_only (bool): [Read-Write] If true, the component will be excluded from non-editor builds

  • on_component_activated (ActorComponentActivatedSignature): [Read-Write] Called when the component has been activated, with parameter indicating if it was from a reset

  • on_component_deactivated (ActorComponentDeactivateSignature): [Read-Write] Called when the component has been deactivated

  • primary_component_tick (ActorComponentTickFunction): [Read-Write] Main tick function for the Component

  • replicate_using_registered_sub_object_list (bool): [Read-Write] When true the replication system will only replicate the registered subobjects list When false the replication system will instead call the virtual ReplicateSubObjects() function where the subobjects need to be manually replicated.

  • replicates (bool): [Read-Write] Is this component currently replicating? Should the network code consider it for replication? Owning Actor must be replicating first!

  • weight (float): [Read-Write] How active is this deformer? Can be used to blend it in and out.

find_skeletal_mesh_component(asset) SkeletalMeshComponent

Find the skeletal mesh component to apply the deformer on. This will return the skeletal mesh component (on this actor) which uses the same skeletal mesh as the passed in ML Deformer asset was trained on. If there is no such skeletal mesh component then it will return a nullptr.

Parameters:

asset (MLDeformerAsset) – The ML Deformer asset to search a component for.

Returns:

The skeletal mesh component that would be the best.

Return type:

SkeletalMeshComponent

get_deformer_asset() MLDeformerAsset

Get the ML Deformer asset that is used by this component.

Returns:

A pointer to the ML Deformer asset.

Return type:

MLDeformerAsset

get_model_instance() MLDeformerModelInstance

Get the ML Deformer model instance that this component currently uses. The instance is responsible for running inference and feeding the neural network with inputs.

Returns:

A pointer to the model instance object.

Return type:

MLDeformerModelInstance

get_skeletal_mesh_component() SkeletalMeshComponent

Get the skeletal mesh component that the ML Deformer will work on. The skeletal mesh that is setup inside the skeletal mesh component will be the mesh that will be deformed by this ML Deformer component.

Returns:

A pointer to the skeletal mesh component who’s mesh will be deformed by this ML Deformer component.

Return type:

SkeletalMeshComponent

get_weight() float

Get the current ML Deformer weight. A value of 0 means it is fully disabled, while 1 means fully active. Values can be anything between 0 and 1.

Return type:

float

set_deformer_asset(deformer_asset) None

Set the deformer asset that is used by this component. This will trigger the internal ML Deformer instance to be recreated.

Parameters:

deformer_asset (MLDeformerAsset) – A pointer to the deformer asset.

set_weight(normalized_weight_value) None

Set the ML Deformer weight. This determines how active the deformer is. You can see it as a blend weight. A value of 0 means it is inactive. Certain calculations will be skipped in that case. A value of 1 means it is fully active. Values between 0 and 1 blend between the two states. Call this after you call SetupComponent.

Parameters:

normalized_weight_value (float) – The weight value.

update_skeletal_mesh_component() None

Find the skeletal mesh component that this deformer should work on, and set it as our target component.