unreal.MetaHumanInstance

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

Bases: Object

Used to assemble a renderable character from a MetaHuman Collection.

Can be either an asset used in the editor or a transient object generated at runtime.

C++ Source:

  • Plugin: MetaHumanCharacter

  • Module: MetaHumanCharacterPalette

  • File: MetaHumanInstance.h

Editor Properties: (see get_editor_property/set_editor_property)

  • should_cook_as_assembled (MetaHumanInstanceCookBehavior): [Read-Write] Determines whether this Instance should be assembled at cook time and have its assembly output baked into the cooked package.

  • will_cook_as_assembled (MetaHumanInstanceCookBehavior): [Read-Only] The effective resolved value of ShouldCookAsAssembled.

    The purpose of this property is purely to display in the editor UI what the cook behavior will be. It has no effect on any logic.

assemble(on_assembled) None

Runs the associated Character Pipeline’s assembly function to populate the AssemblyOutput.

Fails gracefully if no MetaHuman Collection is set.

Parameters:

on_assembled (MetaHumanCharacterAssembled)

clear_assembly_output() None

Clear the result of the last assembly.

GetAssemblyOutput will return an empty struct after calling this.

get_allowed_item_keys_for_slot(slot_name) Array[MetaHumanPaletteItemKey]

Returns the item keys targeting the given slot that are allowed by the Instance’s Collection Pipeline given the Instance’s current slot selections.

Use this to ask “with what I’ve already picked, which items can I now select for SlotName?”. For example, after picking a body, this can return the heads compatible with that body.

Parameters:

slot_name (Name)

Return type:

Array[MetaHumanPaletteItemKey]

get_assembly_output() InstancedStruct

Assemble if necessary and return the assembly output

Return type:

InstancedStruct

get_existing_assembly_output() InstancedStruct

GetAssemblyOutput should be used instead of this function in most cases.

Returns the existing assembly output, if any.

This is useful if you’re in a const-only context and are triggering assembly via a different path, or deliberately want to avoid triggering assembly if it hasn’t been done yet.

Return type:

InstancedStruct

get_instance_parameter_item_paths() Array[MetaHumanPaletteItemPath]

Returns every item path on this instance that has any instance parameters defined.

The empty path represents the Collection itself.

Return type:

Array[MetaHumanPaletteItemPath]

get_instance_parameters(item_path) Array[MetaHumanCharacterInstanceParameter]

brief: Gets the list of all instance parameters for a given item.

Parameters:

item_path (MetaHumanPaletteItemPath)

Return type:

Array[MetaHumanCharacterInstanceParameter]

get_meta_human_collection() MetaHumanCollection

Return the MetaHuman Collection that this instance will assemble from.

Returns nullptr if no collection has been set.

Return type:

MetaHumanCollection

get_slot_selection_data() Array[MetaHumanPipelineSlotSelectionData]

Get Slot Selection Data

Return type:

Array[MetaHumanPipelineSlotSelectionData]

is_assembled() bool

Returns true if the Instance is assembled and up to date

Return type:

bool

set_meta_human_collection(collection) None

Set the MetaHuman Collection that this instance will assemble from.

Call with nullptr to clear the existing Collection.

Parameters:

collection (MetaHumanCollection)

set_single_slot_selection(slot_name, item_key) None

Remove any existing selections for this slot and select only the given item.

If ItemKey is NAME_None, no item will be selected for this slot.

Parameters:
try_add_slot_selection(selection) bool

Adds the provided slot selection if valid, e.g. won’t allow duplicate selections or multiple selections for slots that don’t allow it

Parameters:

selection (MetaHumanPipelineSlotSelection)

Return type:

bool

try_get_instance_parameter(item_path, parameter_name) MetaHumanCharacterInstanceParameter or None

Look up a single parameter on the instance by item path and name.

Parameters:
Returns:

true if found.

out_parameter (MetaHumanCharacterInstanceParameter):

Return type:

MetaHumanCharacterInstanceParameter or None