sjtCopySkinWeights

This is a simple plug-in command to copy skin weights from one object to another with some significant restrictions: Download sjtCopySkinWeights

  1. The meshes must be exactly mirrors of each other vertex-number wise. This plugin simply uses the vertex numbers of the mesh so each vertex of object A must have a corresponding vertex on object B.
  2. The joint names must be somehow side-differentiated e.g. L_joint and R_joint or left_side_arm_JNT and right_side_arm_JNT or you must somehow be able to map one side of joint names to the other.

This has mostly been useful when dealing with hands, you skin one and then you have to copy the weights over, but sometimes maya does a lousy job. This plug-in is pretty much like going in the component editor and copying each value for each vertex between meshes (which would be insane to do by hand). Note: this is not a very fast script (I was trying to learn the Maya API while writing this) so give it some time to work through dense meshes. If you have questions or comments just either send me an email or comment below.

Usage

  1. Select the object with the correct weights.
  2. Select the object with the incorrect weights.
  3. Run the command e.g. ‘sjtCopySkinWeights -s “L_” -r “R_”’

Arguments

This command accepts two arguments -search/-s and -replace/-r and each argument requires a string to follow it that tells the plugin how to map the right joint names to the left ones. Yes it works kind of backwards. The command first constructs a list of all the influences on the first object, then it goes over every vertex on the other object and tries to map it’s influences to the ones in the influence-list from the first object.

Example

On one side the joints are called L_….._JNT and the other R_……_JNT the proper arguments for this command to work would be (MEL syntax):

sjtCopySkinWeights -s "L_" -r "R_"

(if no arguments are givien, this is the default search pattern) This would also have worked (since the search strings can be regular expressions):

sjtCopySkinWeights -s "L_" -r "^[rR]_"

This would allow the right side joints to be named either R_…._JNT or r_…._JNT Just remember the regular expression should go with the -r flag, the -s flag is just used to replace the match from the -r flag with.

Example file

To test the command immediately you can load up th test file included in the zip download ‘copyWeights_example.ma’. First try scrubbing in the timeline to see the difference in weighting. The right side (pCube1) bends in the middle but the left side(pCube2) does not. To copy the weights from pCube1 to pCube2 first load the plugin, select pCube1 then pCube2 and type (MEL syntax):

sjtCopySkinWeights

into the command line (or script editor) and then the weights will have been copied from pCube1 to pCube2. Voila.