unreal.MetaHumanCharacterEditorSubsystem¶
- class unreal.MetaHumanCharacterEditorSubsystem(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
EditorSubsystemSubsystem used to interface with the UMetaHumanCharacter asset. Any edits to a MetaHumanCharacter that may need to be exposed as an API should be done as part of this class, as UFUNCTIONs declared here are automatically exposed
C++ Source:
Plugin: MetaHumanCharacter
Module: MetaHumanCharacterEditor
File: MetaHumanCharacterEditorSubsystem.h
- align_to_target_meshes(meta_human_character, target_mesh_key, conform_target_params) bool¶
Synchronously aligns tthe body and head meshes to target meshes Python/Blueprint-friendly wrapper that calls AlignToTargetMeshesAsync in blocking mode.
- Parameters:
meta_human_character (MetaHumanCharacter)
target_mesh_key (MetaHumanCharacterTargetMeshKey)
conform_target_params (ConformTargetParams)
- Return type:
- assemble_for_preview(character) None¶
Runs the editor pipeline (Preview quality) for the given character. Use whenever changes are made that should be reflected in the preview
- Parameters:
character (MetaHumanCharacter)
- build_meta_human(character, params) None¶
brief: Assemble a MetaHuman Character. Which type of assembly and configuration options can be set using InParams
- Parameters:
character (MetaHumanCharacter) – The character to be assembled. The character must be opened for edit or the build will fail
params (MetaHumanCharacterEditorBuildParameters) – Parameter that determine which type of build to make
- can_build_meta_human(character, log_error=False) bool¶
brief: Checks if MetaHuman character is ready for assembly. If the character is not ready a message with the reason why can be printed in the logs using bInLogError.
- Parameters:
character (MetaHumanCharacter) – The character to verify
log_error (bool) – Set to log an error message if the character can’t be built
- Returns:
true if the character can be built and false otherwise
- Return type:
- commit_body_state(character) None¶
Commits the Body State of the given Character to be serialized. This needs to be done after after using the sculpting or blending APIs to persist the changes Requires the character to be added for edit using TryAddObjectToEdit
- Parameters:
character (MetaHumanCharacter)
- commit_eyes_settings(character, eyes_settings) None¶
brief: Commits the eyes settings to the character and updates the associated actors
- Parameters:
character (MetaHumanCharacter) – The character in which the eyes settings are going to be committed
eyes_settings (MetaHumanCharacterEyesSettings) – the eyes settings to commit to the character
- commit_face_state(character) None¶
Commits the Face State of the given Character to be serialized. This needs to be done after after using the sculpting or blending APIs to persist the changes Requires the character to be added for edit using TryAddObjectToEdit
- Parameters:
character (MetaHumanCharacter)
- commit_head_model_settings(meta_human_character, head_model_settings) None¶
Set all the Head Model settings to the character and apply the changes to all the registered actors.
- Parameters:
meta_human_character (MetaHumanCharacter)
head_model_settings (MetaHumanCharacterHeadModelSettings)
- commit_makeup_settings(character, makeup_settings) None¶
brief: Commits the makeup settings to the character and updates the associated actors
- Parameters:
character (MetaHumanCharacter) – The character in which the makeup settings are going to be commited
makeup_settings (MetaHumanCharacterMakeupSettings) – the makeup settings to commit to the character
- commit_posed_state_as_a_pose(meta_human_character, target_mesh_key) None¶
After conforming body state in pose, finalizes body and face states by evaluating solved body state in MetaHuman A Pose, and updating face state from it.
- Parameters:
meta_human_character (MetaHumanCharacter)
target_mesh_key (MetaHumanCharacterTargetMeshKey)
- commit_skin_settings(character, skin_settings) None¶
Set all the skin settings to the character and apply the changes to all registered actors. This will synthesize textures if needed based on skin settings. This will also discard any high resolution textures currently stored in the Character
- Parameters:
character (MetaHumanCharacter)
skin_settings (MetaHumanCharacterSkinSettings)
- commit_target_mesh_keypoints(meta_human_character, target_mesh_key, target_mesh_key_points, key_point_types) None¶
Commit the target mesh keypoints to the character (filters out preset keypoints, only commits Custom)
- Parameters:
meta_human_character (MetaHumanCharacter)
target_mesh_key (MetaHumanCharacterTargetMeshKey)
target_mesh_key_points (MetaHumanCharacterTargetKeyPoints)
key_point_types (Map[Name, KeyPointType])
- compare_body_state(character1, character2, tolerance) bool¶
Evaluate the body state for each of the supplied characters, and compare the vertices and vertex normals Requires the characters to have been added for edit using TryAddObjectToEdit Returns true if all corresponding vertices and vertex normals are within InTolerance of each other in terms of vector norm
- Parameters:
character1 (MetaHumanCharacter)
character2 (MetaHumanCharacter)
tolerance (float)
- Return type:
- compare_face_state(character1, character2, tolerance) bool¶
Evaluate the face state for each of the supplied characters, and compare the vertices and vertex normals Requires the characters to have been added for edit using TryAddObjectToEdit Returns true if all corresponding vertices and vertex normals are within InTolerance of each other in terms of vector norm
- Parameters:
character1 (MetaHumanCharacter)
character2 (MetaHumanCharacter)
tolerance (float)
- Return type:
- classmethod compare_face_textures(character1, character2, pixel_tolerance) bool¶
Compare the face textures for the two supplied characters Does NOT require the characters to have been added for edit Returns true if face textures are identical to within the specified tolerance for each channel of each pixel, false otherwise
- Parameters:
character1 (MetaHumanCharacter)
character2 (MetaHumanCharacter)
pixel_tolerance (int32)
- Return type:
- conform_body(meta_human_character, vertices, joint_rotations, repose, estimate_joints_from_mesh) bool¶
Conform Body deprecated: Use ConformBodyToTarget instead.
- conform_body_to_target(meta_human_character, vertices, joint_rotations, target_is_in_a_pose, estimate_joints_from_mesh) bool¶
Conform Body to Target
- conform_to_target_meshes(meta_human_character, target_mesh_key, conform_target_params) bool¶
Synchronously conforms the body and head meshes to target parameters. Python/Blueprint-friendly wrapper around ConformTargetMeshesAsync that runs with bBlocking=true and returns the solver result.
- Parameters:
meta_human_character (MetaHumanCharacter) – The character to conform. Must be open for editing.
target_mesh_key (MetaHumanCharacterTargetMeshKey) – Identifies which target mesh slot (body / head / combined) the conform applies to. Used as the per-mesh key for target-pose state storage so successive conforms against different meshes don’t overwrite each other.
conform_target_params (ConformTargetParams) – Solver inputs: target mesh data, keypoints, face tracking, solver settings.
- Returns:
true if the conform solver succeeded; false on invalid input or solve failure.
- Return type:
- fit_face_state_from_body_with_eyes_teeth_dna(meta_human_character, face_dna_file_path) bool¶
Updates the face state to fit the current body state, then re-fits teeth and eyes using vertex positions read from a face DNA file. The head shape is driven by the body, not the DNA — only teeth (mesh index 1), left eye (3), and right eye (4) are taken from the DNA. Call this after ConformBody.
- Parameters:
meta_human_character (MetaHumanCharacter) – The character whose face state will be updated.
face_dna_file_path (str) – Path to the face DNA file to extract teeth and eye vertices from.
- Returns:
true if the face state was successfully updated.
- Return type:
- fit_face_state_from_body_with_eyes_teeth_template(meta_human_character, teeth_mesh, left_eye_mesh, right_eye_mesh, match_vertices_by_u_vs) bool¶
Updates the face state to fit the current body state, and optionally re-fits teeth and/or eyes using vertices extracted from the supplied template mesh objects. Call this after ConformBody.
- Parameters:
meta_human_character (MetaHumanCharacter) – The character whose face state will be updated.
teeth_mesh (Object) – Optional static or skeletal mesh in MetaHuman teeth topology. Pass null to skip.
left_eye_mesh (Object) – Optional static or skeletal mesh in MetaHuman left eye topology. Pass null to skip.
right_eye_mesh (Object) – Optional static or skeletal mesh in MetaHuman right eye topology. Pass null to skip.
match_vertices_by_u_vs (bool) – When true, use UV correspondence to map template vertices to the DNA archetype order.
- Returns:
true if the face state was successfully updated.
- Return type:
- fit_state_to_target_vertices(character, params) bool¶
brief: Fit the character to the supplied vertices. Requires the character to be added for edit using TryAddObjectToEdit
- Parameters:
character (MetaHumanCharacter) – The character to be fitted
params (MetaHumanCharacterFitToVerticesParams) – Parameters to control the fitting process as well as the meshes
- Returns:
true if successful, false otherwise
- Return type:
- get_body_constraints(character, scale_measurement_ranges_with_height=False) Array[MetaHumanCharacterBodyConstraint]¶
brief: Gets the list of body constrains from the underlying parametric body model Requires the character to be added for edit using TryAddObjectToEdit
- Parameters:
character (MetaHumanCharacter) – the character to retrieve the body constraints for
scale_measurement_ranges_with_height (bool) – scale the measurement ranges by height to help stay within realistic model proportions
- Returns:
the list of body constraints provided by the underlying parametric body model
- Return type:
- get_face_landmarks(character) Array[Vector]¶
brief: Gets the positions of the face landmarks for a given character. Requires the character to be added for edit using TryAddObjectToEdit
- Parameters:
character (MetaHumanCharacter) – The character to obtain the landmarks for
- Returns:
out_face_landmarks (Array[Vector]): the list with the face landmarks positions
- Return type:
- get_face_model_coefficients(character) Array[float]¶
brief: Gets the coefficients of the underlying face model for the given character. Requires the character to be added for edit using TryAddObjectToEdit
- Parameters:
character (MetaHumanCharacter) – The character to obtain the coefficients for
- Returns:
out_coefficients (Array[float]): The coefficients array to fill
- Return type:
- get_joints_for_body_conforming(template_mesh) -> (ImportErrorCode, out_joint_world_translations=Array[Vector], out_joint_rotations=Array[Vector])¶
Get Joints for Body Conforming deprecated: Use GetJointsForBodyConformingFromTemplate instead.
- Parameters:
template_mesh (SkeletalMesh)
- Returns:
out_joint_world_translations (Array[Vector]):
out_joint_rotations (Array[Vector]):
- Return type:
tuple
- get_joints_for_body_conforming_from_dna(body_dna_file_path) -> (ImportErrorCode, out_joint_world_translations=Array[Vector3f], out_joint_rotations=Array[Vector3f])¶
Get the body joint data for conforming, from a DNA file path. Suitable for use from Python and Blueprints.
- Parameters:
body_dna_file_path (str) – Absolute file path to the body DNA file
- Returns:
EImportErrorCode::Success on success, otherwise an error code describing the failure
out_joint_world_translations (Array[Vector3f]): On success, contains the body joint world translations
out_joint_rotations (Array[Vector3f]): On success, contains the body joint rotations
- Return type:
tuple
- get_joints_for_body_conforming_from_template(template_mesh) -> (ImportErrorCode, out_joint_world_translations=Array[Vector3f], out_joint_rotations=Array[Vector3f])¶
Get Joints for Body Conforming from Template
- Parameters:
template_mesh (SkeletalMesh)
- Returns:
out_joint_world_translations (Array[Vector3f]):
out_joint_rotations (Array[Vector3f]):
- Return type:
tuple
- classmethod get_mesh_data_for_conforming(mesh) (out_vertices=Array[Vector3f], out_triangle_indices=Array[int32]) or None¶
Extract topology vertices and triangle indices from a static or skeletal mesh. Uses the MeshDescription to return the same data that the interactive conform tool uses internally.
- Parameters:
mesh (Object) – The source mesh (UStaticMesh or USkeletalMesh)
- Returns:
true if extraction succeeded
out_vertices (Array[Vector3f]): Topology vertex positions
out_triangle_indices (Array[int32]): Triangle indices (3 per triangle, referencing OutVertices)
- Return type:
tuple or None
- get_mesh_for_body_conforming(meta_human_character, body_template_mesh, head_template_mesh, match_vertices_by_u_vs) -> (ImportErrorCode, out_vertices=Array[Vector])¶
Get Mesh for Body Conforming deprecated: Use GetMeshForBodyConformingFromTemplate instead.
- get_mesh_for_body_conforming_from_dna(meta_human_character, body_dna_file_path, head_dna_file_path) -> (ImportErrorCode, out_vertices=Array[Vector3f])¶
Get the body mesh vertices for conforming, from DNA file paths.
- Parameters:
meta_human_character (MetaHumanCharacter) – The character to conform
body_dna_file_path (str) – Absolute file path to the body DNA file
head_dna_file_path (str) – Absolute file path to the head DNA file (optional, pass empty string to omit)
- Returns:
EImportErrorCode::Success on success, otherwise an error code describing the failure
out_vertices (Array[Vector3f]): On success, contains the body mesh vertices
- Return type:
- get_mesh_for_body_conforming_from_template(meta_human_character, body_template_mesh, head_template_mesh, match_vertices_by_u_vs) -> (ImportErrorCode, out_vertices=Array[Vector3f])¶
Get Mesh for Body Conforming from Template
- get_preset_body_key_points(character) Map[Name, int32]¶
Get preset keypoints from MetaHumanCreator API (body or head) without committing them
- Parameters:
character (MetaHumanCharacter)
- Return type:
- get_preview_collection(character) MetaHumanCollection¶
Returns the Collection used to build the Character’s preview.
If the Character is not being actively edited (i.e. TryAddObjectToEdit hasn’t been called) this will return nullptr, otherwise it will always return a valid Collection.
- Parameters:
character (MetaHumanCharacter) – The character whose preview Collection is requested.
- Returns:
The preview Collection, or nullptr if InCharacter is null or has not been added for editing.
- Return type:
- import_body_whole_rig(meta_human_character, body_dna_file_path, head_dna_file_path) ImportErrorCode¶
Import body as a fully rigged Character from DNA file paths, sets character to a fixed body type
- Parameters:
meta_human_character (MetaHumanCharacter)
body_dna_file_path (str)
head_dna_file_path (str)
- Return type:
- import_from_face_dna(character, dna_file_path, import_params) ImportErrorCode¶
brief: Either fits the Character face state to the input face DNA, or imports the DNA as-is, depending on options Requires the character to be added for edit using TryAddObjectToEdit
- Parameters:
character (MetaHumanCharacter) – The character to import the DNA to
dna_file_path (str) – Path to the DNA file to be imported
import_params (ImportFromDNAParams) – Options for how to perform the import operation
- Returns:
code indicating success or failure
- Return type:
- import_from_identity(meta_human_character, meta_human_identity, import_params) ImportErrorCode¶
Fits the Character face state to the conformed mesh of the input Identity asset. Suitable for use from Python and Blueprints.
- Parameters:
meta_human_character (MetaHumanCharacter) – The character to import into
meta_human_identity (MetaHumanIdentity) – The MetaHuman Identity asset to import from
import_params (ImportFromIdentityParams) – Options controlling the import
- Returns:
EImportErrorCode::Success on success, otherwise an error code describing the failure
- Return type:
- import_from_template(character, template_mesh, template_left_eye_mesh, template_right_eye_mesh, template_teeth_mesh, import_params) ImportErrorCode¶
brief: Fits the Character face state to the conformed mesh of the input asset, which must be a SkelMesh or Static Mesh which has the correct number of vertices. In addition, the user can (optionally) in the case of a StaticMesh pass in up to three additional meshes for left eye, right eye and teeth, which if not null will be used in the fitting. Note that for the StaticMesh, if the extra meshes are present, they will be used and the flags in the import options will be ignored. Eye and Teeth meshes must contain the correct number of vertices for a MetaHuman.
- Parameters:
character (MetaHumanCharacter) – The character to import the template mesh(es) to
template_mesh (Object) – The head mesh (either StaticMesh or SkelMesh) which much match the topology of a MetaHuman head mesh
template_left_eye_mesh (Object) – If not nullptr, must be a StaticMesh for the left eye which much match the topology of a MetaHuman left eye mesh
template_right_eye_mesh (Object) – If not nullptr, must be a StaticMesh for the right eye which much match the topology of a MetaHuman right eye mesh
template_teeth_mesh (Object) – If not nullptr, must be a StaticMesh for the teeth which much match the topology of a MetaHuman teeth mesh
import_params (ImportFromTemplateParams) – the parameters used during the fitting process
- Returns:
code indicating success or failure
- Return type:
- is_object_added_for_editing(character) bool¶
Returns true if the object is registered for editing
- Parameters:
character (MetaHumanCharacter)
- Return type:
- on_edit_preview_collection(character) None¶
Any code that modifies the preview collection for a Character must call this function afterwards, in order to propagate the edits back to the Character asset.
- Parameters:
character (MetaHumanCharacter) – The character whose preview Collection was edited.
- remove_face_rig(character) None¶
Remove the face rig from InCharacter, reverting the face mesh back to the archetype DNA and unregistering any morph targets.
- Parameters:
character (MetaHumanCharacter) – Character to remove the face rig from. No-op if null.
- remove_object_to_edit(character) None¶
Tells the subsystem that a character is no longer being edited. Unloads the texture synthesis model when the last object being edited is removed from the subsystem
- Parameters:
character (MetaHumanCharacter)
- request_auto_rigging(character, params=[MetaHumanRigType.JOINTS_ONLY, True, False]) None¶
brief: Make a request to auto-rig a character Requires the character to be added for edit using TryAddObjectToEdit
- Parameters:
character (MetaHumanCharacter) – The character to be auto-rigged
params (MetaHumanCharacterAutoRiggingRequestParams) – Parameters to control the auto-rigging process
- request_texture_sources(character, params=[True, False]) None¶
brief: Request high resolution textures for the given character. This function does nothing if there is already a pending request
- Parameters:
character (MetaHumanCharacter) – The character to request the textures for
params (MetaHumanCharacterTextureRequestParams) – Parameters to control the request
- set_body_constraints(character, body_constraints) None¶
brief: Set body constraints and evaluate the parametric body Requires the character to be added for edit using TryAddObjectToEdit
- Parameters:
character (MetaHumanCharacter) – The character to update the constraints
body_constraints (Array[MetaHumanCharacterBodyConstraint])
- set_body_joints(meta_human_character, component_joint_translations, joint_rotations, import_helper_joints) bool¶
Set custom body joints
- set_body_mesh(meta_human_character, vertices, reposition_helper_joints) bool¶
Set custom body neutral mesh
- Parameters:
meta_human_character (MetaHumanCharacter)
reposition_helper_joints (bool)
- Return type:
- set_face_model_coefficients(character, coefficients) None¶
brief: Sets the coefficients of the underlying face model for the given character. Requires the character to be added for edit using TryAddObjectToEdit
- Parameters:
character (MetaHumanCharacter) – The character to update
- spawn_meta_human_actor(character, keep_transient=False) Actor¶
brief: Spawns a MetaHuman Editor Actor in the main editor level The spawned actor will reflect any changes made to the character while its added to the subsystem
- Parameters:
character (MetaHumanCharacter)
keep_transient (bool) – If true, the spawned actor retains its RF_Transient flag and will not persist in the level
- Return type:
- track_face_landmarks_from_image(image_data, width, height) Map[str, TrackingPoints] or None¶
Run face landmark detection on an image and return tracking contour curves. Use with a front-facing portrait of the target mesh — typically a SceneCapture2D render. The first call after editor start synchronously loads the face contour tracker NNE models (the default tracker asset), so it can take several seconds; subsequent calls hit the cached models and are fast.
- Parameters:
- Returns:
true if any landmarks were detected; false on invalid input, model load failure, or no face found.
out_curve_tracking_points (Map[str, TrackingPoints]): Named contour curves (2D points in image space).
- Return type:
Map[str, TrackingPoints] or None
- translate_face_landmarks(character, landmark_indices, deltas) None¶
brief: Translates the face landmarks by the given deltas Requires the character to be added for edit using TryAddObjectToEdit The number of landmark indices and deltas must match
- Parameters:
character (MetaHumanCharacter) – the character to translate the landmarks for
landmark_indices (Array[int32]) – The index of each landmark to be translated
deltas (Array[Vector]) – the list of translation deltas to apply to each landmark
- try_add_object_to_edit(character) bool¶
Registers an object to be edited. The first object registered will also load the Texture Synthesis model to make it to be used
Most functions taking a Character on this class require the Character to be registered for editing first.
Call RemoveObjectToEdit when done editing. If TryAddObjectToEdit returns false, the Character is not registered, so there’s no need to call RemoveObjectToEdit.
- Parameters:
character (MetaHumanCharacter)
- Return type: