Skins

apply_skin_weights_from_file(file_path, *skins: List[pymel.core.nt.SkinCluster])

Load skin weights from a .weights file, and apply it to one or more skin clusters.

Parameters:
  • file_path (str) – A full path to the .weights file to read

  • *skins (PyNode) – One or more skin cluster nodes

apply_skin_weights_map(skin_weights, *skins: List[pymel.core.nt.SkinCluster])

Set the skin weights for multiple skin clusters.

Parameters:
  • skin_weights (dict) – A map of skin node names to weights data, as given by get_skin_weights

  • *skins (PyNode) – One or more skin cluster nodes

get_meshes_from_skin(skin)

Return the mesh connected to a skin cluster

get_skin_from_mesh(mesh)

Return the main skin node from a mesh.

Parameters:

mesh (PyNode) – A mesh node

get_skin_influences(skin)

Return all influences affecting a sking.

Parameters:

skin (PyNode) – A skin cluster node

Returns:

A dictionary with influence index (id) as keys and influence nodes as values.

get_skin_weights(skin, indices=None, influences=None, influences_as_strings=True)

Return the vertex weights of a skin, optionally filtered to only a set of vertex indices or influences.

Parameters:
  • skin (PyNode) – A skin cluster node

  • indices (list of int) – If given, only return weights for the vertices at these indices

  • influences (list of PyNode) – An optional list of known influences, if omitted will retrieve all the influences from the skin

  • influences_as_strings (bool) – If true, return influences as strings instead of PyNode objects

Returns:

A list of tuples representing each vertex and the weights for each influence.

e.g. [(index, [(influence, weight), …]), …]

get_skin_weights_map(*skins)

Return a dict containing weights for multiple skin clusters

Parameters:

*skins (PyNode) – One or more skin cluster nodes

Returns:

weights} for all the skin clusters

Return type:

A dict of {skinName

get_skins_from_joint(joint)

Return a list of skin clusters in which a joint is an influence

Parameters:

joint (PyNode) – A joint node

normalize_skin_weights(skin)

Normalize the weights of a skin manually be retrieving the weights, applying numerical normalization, then reapplying the new weights.

normalize_weights_data(weights)

Return a copy of the given weights data, with all weight values normalized such that the sum of all weights for any vertex is equal to 1.

Parameters:

weights (list) – A list of vertex weights, as given by get_skin_weights

save_skin_weights_to_file(file_path, *skins)

Save skin weights to a .weights file for one or more skin clusters.

Parameters:
  • file_path (str) – A full path to the .weights file to write

  • *skins (PyNode) – One or more skin cluster nodes

set_skin_weights(skin, weights, prune=True)

Set the exact weights for a skin.

Parameters:
  • skin (PyNode) – A skin cluster node

  • weights (list) – A list of vertex weights, as given by get_skin_weights

  • prune (bool) – If true, remove influences that have no weights