Last active
May 6, 2019 07:30
-
-
Save Muream/c7c1e88f92e1be8239f99394dd65a6a4 to your computer and use it in GitHub Desktop.
Maya Re-order Deformers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymel.core as _pymel | |
expectedOrder = ['cube_dmh', 'cube_ffd', 'cube_skn', 'cube00_twk'] | |
mesh = _pymel.PyNode('cube_geo') | |
currentIteration = 0 | |
indexToMatch = 0 | |
currentOrder = [x.name() for x in mesh.listHistory(type='geometryFilter')] | |
deformersInOrder = False | |
while expectedOrder != currentOrder: | |
if expectedOrder[indexToMatch] != currentOrder[indexToMatch]: | |
_pymel.reorderDeformers(expectedOrder[indexToMatch], currentOrder[indexToMatch], mesh) | |
else: | |
indexToMatch += 1 | |
currentOrder = [x.name() for x in mesh.listHistory(type='geometryFilter')] | |
currentIteration += 1 | |
if currentIteration > maxIteration: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment