Skip to content

Instantly share code, notes, and snippets.

@chris-lesage
Last active June 10, 2025 09:49
Show Gist options
  • Select an option

  • Save chris-lesage/8c77edabf4f8ab81ea21f0c20703884e to your computer and use it in GitHub Desktop.

Select an option

Save chris-lesage/8c77edabf4f8ab81ea21f0c20703884e to your computer and use it in GitHub Desktop.

Revisions

  1. chris-lesage revised this gist Jan 20, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion reset_skin_cluster.py
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@
    oldSel = pm.selected()

    for eachGeo in pm.selected():
    skinInputs = eachGeo.getShape().listHistory(interestLevel=1, type='skinCluster')
    skinInputs = eachGeo.listHistory(interestLevel=1, type='skinCluster')
    # filters out a bug where if a geo has an FFD lattice which is skinned,
    # it finds the lattice skinCluster instead of your geometry.
    correctSkins = [
  2. chris-lesage created this gist Jul 1, 2020.
    34 changes: 34 additions & 0 deletions reset_skin_cluster.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    import pymel.core as pm

    ### SNIPPET Reset Skin Cluster ###
    # This script can be used to reset geometry to its neutral rest pose
    # after joints have been moved. Use it when making adjustments to your rig/skeleton.
    # USAGE: 1. Select the geo 2. Run this script.

    # Limitation:
    # Sometimes depending on your history, Maya may give an error and fail to reset the geo.
    # Sometimes running it twice solves this... ¯\_( ツ )_/¯
    # For more advanced cases, like resetting a single joint, see Cole O'Brien's script here:
    # https://gist.github.com/obriencole11/cfb1545a61bbbaff23498f5f9042d0e3

    oldSel = pm.selected()

    for eachGeo in pm.selected():
    skinInputs = eachGeo.getShape().listHistory(interestLevel=1, type='skinCluster')
    # filters out a bug where if a geo has an FFD lattice which is skinned,
    # it finds the lattice skinCluster instead of your geometry.
    correctSkins = [
    skin for skin in skinInputs
    if eachGeo.name() in [sk.getTransform().name() for sk in skin.getGeometry()]
    ]
    for oSkin in correctSkins:
    skinJointList = pm.listConnections(oSkin.matrix, t='joint')
    bindPose = pm.listConnections(skinJointList[0].name(), d=True, s=False, t='dagPose')
    if bindPose:
    if not (pm.referenceQuery(bindPose[0], inr=True)):
    pm.delete(bindPose[0])
    sourceGeo = pm.skinCluster(oSkin, q=True, g=True)[0]
    pm.skinCluster(oSkin, e=True, ubk=True)
    pm.skinCluster(skinJointList, sourceGeo, ibp=True, tsb=True)

    pm.select(oldSel)