I have written an useful Maya python API plugin which exports out weights from polygon mesh or vertices to text file(optionally binary),Which can be used later.
This process is mostly useful when User wish to change position of joints in a rig with skinCluster , or just want to update rig file with latest weights from other file.
I have in past used Michael comets famous Mel script cometSaveWeights, which works great but is very slow when importing weights on dense mesh.
It was my first attempt at writing something in Maya API. Attached in plugin which I have tested on Maya 2008 to 2011.
Mel Command to export weights
scSaveWeights -roundOff 5 -action “export” -file “d:/weights.txt”;
Mel Command to import weights
scSaveWeights -action “import” -file “d:/weights.txt;
Go to windows>Settings/prefrence > plug-in manager and browse to the scSaveWeights.py
I would suggest to open the py file in IDE and read through comments in the beginning of script.
Exporting weights on polygon mesh with vertex count 12432 skinned with 255 joints took 7.6378 seconds
whereas Importing took 66.3445147672 seconds and in quick mode it takes 19.937 seconds while exporting
and takes 7.5559 seconds while importing.
Importing weights with cometSaveWeights.mel took more than 7 minutes on same Mesh.
edit: updated script to work with selected polygon object and in component mode, while importing weights.