Copy/Paste Skin Modifier via Max Script

0 votes
Version: 
1
Date Updated: 
07/22/2016
Author Name: 
Martin Lutteral

I recently discovered that copying a skin modifier via maxscript (using addmodifier) doesn't set the weights correctly, so I wrote a function to transfer the weights from one mesh to another. (they need to have the same topology though)
Some other scripts out there won't work because at some point autodesk decided to change the way that the skin's bone table is indexed, and they would need a lookup table with the bone names to convert the old index to the new one. *sight It seems I fixed it.

The script defines a data structure used to gather the weight table of the source object, and a function. I didn't create any interface but you could easily create one to wrap it around.

the usage of the function is pretty simple:

xCopySkin [node source] [node target]

node source: the source object, must have a skin modifier applied (or you'll get an error)
node target: the target object, if the topology is not the same you'll get unexpected results

Enjoy!

AttachmentSize
xcopyskin.ms1.41 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
SuperTrampy's picture

Having difficulties... Help!?

Hi lutteral, thanks for writing this script was about to give up on this one! I'm having a couple of issues with it though.

GetBoneNamebyListID was depreciated for max 2015 by the looks of things so I've had to replace:
boneName = skinOps.GetBoneNamebyListID theSkin boneID 0

With:
boneName = skinOps.GetBoneIDByListID theSkin boneID

but now I'm getting this error:
-- Runtime error: Bone ID out of range: 0

Any thoughts? Thanks in advance!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.