Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
purge unused deformers
from time import clock
xsi = Application
def purgeUnusedDeformers(inColl):
c = clock()
for o in inColl:
if o.Envelopes.Count > 0:
env = o.Envelopes(0)
d = env.Deformers
w = env.Weights.Array
zeroWeightDeformers = [deformer.FullName for deformer, weights in zip(d, w) if not any(weights)]
n = len(zeroWeightDeformers)
if n > 0:
xsi.RemoveFlexEnvDeformer( o.FullName +';'+ ','.join(zeroWeightDeformers), False )
xsi.LogMessage( 'REMOVED '+str(n)+' unused deformers from '+o.FullName )
xsi.LogMessage( 'There are NO UNUSED DEFORMERS in the envelope for %s' % o.FullName, 4 )
xsi.LogMessage( "Took %s seconds to purge unused deformers." % (clock() - c), 16 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.