unreal.GeometryScript_BoneWeights

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

Bases: BlueprintFunctionLibrary

Geometry Script Library Mesh Bone Weight Functions

C++ Source:

  • Plugin: GeometryScripting

  • Module: GeometryScriptingCore

  • File: MeshBoneWeightFunctions.h

classmethod blend_bone_weights(bone_weights_a, bone_weights_b, alpha, debug=None) Array[GeometryScriptBoneWeight]

Blends two bone weights using an Alpha value that ranges from 0 to 1, inclusive. If Alpha is 0, then only weights from BoneWeightsA are used, and if Alpha is 1, then only weights from BoneWeightsB are used. For any value in between the weights are linearly interpolated. Each bone weight from either array, that has the same bone index, are linearly interpolated. Any bone weights that are missing from either BoneWeightsA or BoneWeightsB, are assumed to exist and have a weight of 0. After blending, the result is renormalized and sorted. Values that are below the influence threshold, or exceeding the default bone weight limit (currently set to 12) will be thrown away.

Parameters:
  • bone_weights_a (Array[GeometryScriptBoneWeight]) – List of bone weights to blend, such that its influence is greatest when Alpha is 0 and smallest when Alpha is 1.

  • bone_weights_b (Array[GeometryScriptBoneWeight]) – List of bone weights to blend, such that its influence is greatest when Alpha is 1 and smallest when Alpha is 0.

  • alpha (float) – The blending factor, ranging from 0 to 1, inclusive. Values outside of this range are clamped.

  • debug (GeometryScriptDebug)

Returns:

result (Array[GeometryScriptBoneWeight]): The resulting blend of the two bone weight arrays.

Return type:

Array[GeometryScriptBoneWeight]

classmethod compute_smooth_bone_weights(target_mesh, skeleton, options, profile=['Default'], debug=None) DynamicMesh

Computes a smooth skin binding for the given mesh to the skeleton provided.

Parameters:
Return type:

DynamicMesh

classmethod copy_bones_from_mesh(source_mesh, target_mesh, options=[False, BonesToCopyFromSource.ALL_BONES], debug=None) DynamicMesh

Copy the bone attributes (skeleton) from the SourceMesh to the TargetMesh.

Parameters:
Return type:

DynamicMesh

classmethod copy_bones_from_skeleton(source_skeleton, target_mesh, options=[False, BonesToCopyFromSource.ALL_BONES], debug=None) DynamicMesh

Copy the bone attributes (skeleton) from the SourceSkeleton to the TargetMesh.

Parameters:
Return type:

DynamicMesh

classmethod discard_bones_from_mesh(target_mesh, debug=None) DynamicMesh

Discard the bone attributes (skeleton) from the TargetMesh.

Parameters:
Return type:

DynamicMesh

classmethod get_all_bones_info(target_mesh, debug=None) -> (DynamicMesh, bones_info=Array[GeometryScriptBoneInfo])

Get an array of bones representing the skeleton. Each entry contains information about the bone.

Parameters:
Returns:

bones_info (Array[GeometryScriptBoneInfo]): Skeleton information.

Return type:

Array[GeometryScriptBoneInfo]

classmethod get_bone_children(target_mesh, bone_name, recursive, debug=None) -> (DynamicMesh, is_valid_bone_name=bool, children_info=Array[GeometryScriptBoneInfo])

Get the information about the children of the bone.

Parameters:
  • target_mesh (DynamicMesh) – Mesh containing the bone attributes.

  • bone_name (Name) – The name of bone.

  • recursive (bool) – If set to true, grandchildren will also be added recursively

  • debug (GeometryScriptDebug)

Returns:

is_valid_bone_name (bool): Set to true if the TargetMesh contains a bone with the given name, false otherwise.

children_info (Array[GeometryScriptBoneInfo]): The informattion of the children.

Return type:

tuple

classmethod get_bone_index(target_mesh, bone_name, debug=None) -> (DynamicMesh, is_valid_bone_name=bool, bone_index=int32)

Get Bone Index

Parameters:
Returns:

is_valid_bone_name (bool):

bone_index (int32):

Return type:

tuple

classmethod get_bone_info(target_mesh, bone_name, debug=None) -> (DynamicMesh, is_valid_bone_name=bool, bone_info=GeometryScriptBoneInfo)

Get the bone information.

Parameters:
Returns:

is_valid_bone_name (bool): Set to true if the TargetMesh contains a bone with the given name, false otherwise.

bone_info (GeometryScriptBoneInfo): The information about the bone.

Return type:

tuple

classmethod get_largest_vertex_bone_weight(target_mesh, vertex_id, profile=["Default"]) -> (DynamicMesh, bone_weight=GeometryScriptBoneWeight, has_valid_bone_weights=bool)

Return the Bone/Skin Weight with the maximum weight at a given vertex of TargetMesh

Parameters:
Returns:

bone_weight (GeometryScriptBoneWeight): the bone index and weight that was found to have the maximum weight

has_valid_bone_weights (bool): will be returned as true if the vertex has bone weights in the given profile and a largest weight was found

Return type:

tuple

classmethod get_max_bone_weight_index(target_mesh, profile=["Default"]) -> (DynamicMesh, has_bone_weights=bool, max_bone_index=int32)

Determine the largest bone weight index that exists on the Mesh

Parameters:
Returns:

has_bone_weights (bool): will be returned true if the requested bone weight profile exists

max_bone_index (int32): maximum bone index will be returned here, or -1 if no bone indices exist

Return type:

tuple

classmethod get_root_bone_name(target_mesh, debug=None) -> (DynamicMesh, bone_name=Name)

Get the name of the root bone.

Parameters:
Returns:

bone_name (Name): The name of the root bone.

Return type:

Name

classmethod get_vertex_bone_weights(target_mesh, vertex_id, profile=["Default"]) -> (DynamicMesh, bone_weights=Array[GeometryScriptBoneWeight], has_valid_bone_weights=bool)

Return an array of Bone/Skin Weights at a given vertex of TargetMesh

Parameters:
Returns:

bone_weights (Array[GeometryScriptBoneWeight]): output array of bone index/weight pairs for the given Vertex

has_valid_bone_weights (bool): will be returned as true if the vertex has bone weights in the given profile, ie BoneWeights is valid

Return type:

tuple

classmethod mesh_copy_bone_weights(target_mesh, target_profile, source_profile=["Default"]) -> (DynamicMesh, profile_existed=bool)

Copies all bone weights from a source profile onto a target profile, on the same mesh, replacing all weights that existed on the target profile. If either the source or the target profile didn’t exist, then bProfileExisted will be set to false and no weights are copied.

Parameters:
Returns:

profile_existed (bool): will be returned true if both of the requested bone weight profiles exist

Return type:

bool

classmethod mesh_create_bone_weights(target_mesh, replace_existing_profile=False, profile=["Default"]) -> (DynamicMesh, profile_existed=bool)

Create a new BoneWeights attribute on the TargetMesh, if it does not already exist. If it does exist, and bReplaceExistingProfile is passed as true, the attribute will be removed and re-added, to reset it.

Parameters:
Returns:

profile_existed (bool): will be returned true if the requested bone weight profile already existed

Return type:

bool

classmethod mesh_has_bone_weights(target_mesh, profile=["Default"]) -> (DynamicMesh, has_bone_weights=bool)

Check whether the TargetMesh has a per-vertex Bone/Skin Weight Attribute set

Parameters:
Returns:

has_bone_weights (bool): will be returned true if the requested bone weight profile exists

Return type:

bool

classmethod prune_bone_weights(target_mesh, bones_to_prune, options, profile=['Default'], debug=None) DynamicMesh

Prunes the given bones from any bone weight assignment on the given profile. The bone weights are re-assigned based on the type of re-assignment specified in the options, although in the case where the bone(s) being pruned are the sole bone weight on a vertex, then the parent bone will be assigned as the sole bone weight for that vertex. Bones are pruned iteratively from leaf to root, to ensure that weighs are progressively re-assigned in case multiple bones along the same branch are being pruned.

Parameters:
Return type:

DynamicMesh

classmethod set_all_vertex_bone_weights(target_mesh, bone_weights, profile=['Default'], debug=None) DynamicMesh

Set all vertices of the TargetMesh to the given Bone/Skin Weights

Parameters:
Return type:

DynamicMesh

classmethod set_vertex_bone_weights(target_mesh, vertex_id, bone_weights, profile=["Default"], debug=None) -> (DynamicMesh, is_valid_vertex_id=bool)

Set the Bone/Skin Weights at a given vertex of TargetMesh

Parameters:
Returns:

is_valid_vertex_id (bool): will be returned as true if the vertex ID is valid

Return type:

bool

classmethod transfer_bone_weights_from_mesh(source_mesh, target_mesh, options=[TransferBoneWeightsMethod.CLOSEST_POINT_ON_SURFACE, OutputTargetMeshBones.SOURCE_BONES, ['Default'], ['Default'], -1.000000, -1.000000, True, 0, 0.000000, 'None'], selection=[], debug=None) DynamicMesh

Transfer the bone weights from the SourceMesh to the TargetMesh. Assumes that the meshes are aligned. Otherwise, use the TransformMesh geometry script function to align them.

Parameters:
Return type:

DynamicMesh