ibandik
6/15/2016 - 4:55 AM

Python and Mel example

Python and Mel example

From https://www.creativecrash.com/forums/cloth/topics/transfer-ncloth-presets-to-multiple-objectsimport maya.cmds as mc
import maya.mel as mel
 
def applyClothPreset(name, blendVal=1):
    nCloths = mc.ls(sl=True, type="transform")
 
    for n in nCloths:
        nClothShapes = mc.listRelatives(n, shapes=True)
        for s in nClothShapes:
            print "%s|%s %s %4.1f" % (n, s, name, blendVal)
            mel.eval("applyAttrPreset %s|%s \"C:/Program Files/Autodesk/Maya2014/presets/attrPresets/nCloth/%s.mel\" %4.1f" % (n, s, name, blendVal))
 
applyClothPreset("solidRubber")
applyClothPreset("waterBalloon", 0.3)