Max Script skinOps.ReplaceVertexWeights issue

Hi,

I am having a problem with skinOps.ReplaceVertexWeights.

When I use it to replace a bone by another new bone on a skinned mesh, no problem everything works great.

However, when I use it to replace a bone by another bone already skinned, I am getting unexpected results :

You can see on this cube bellow :

I am trying to put the weight from point 1 to point 4 and I would expect then :
Point to be 0 > that’s good
Point 4 to be : 592
Point 2 and 3 to be unchanged.

As you can see it isnt working as expected.

Here’s my code :

skinOps.unNormalizeVertex MyObject.modifiers[#Skin] vert true
					
skinOps.ReplaceVertexWeights MyObject.modifiers[#skin] TheVert MySelectedFromBoneIndex  0
					
skinOps.ReplaceVertexWeights MyObject.modifiers[#skin] TheVert BoneArray WeightArray			
					
skinOps.unNormalizeVertex MyObject.modifiers[#Skin] TheVert false		

I am on max 2015, and I have read there was some bugs with that function in 2015 that got sorted in 2017, would this be one of the bug ? Is there a workaround ?

Thanks !
Blob-

There is indeed a bug affecting the “replaceVertexWeights” method in 3DS Max 2015. I believe that the issue was that the function as implemented in 2015 no longer handled undefined weight values in the “weight_array” parameter as it previously had (3DS Max 2011 handled undefined values gracefully). My solution to this problem was to replace undefined weight values in the array that I supplied as the “weight_array” parameter with a value of zero.

There may well be a service pack that addresses the bug at this point.

Yep. Service Pack 4 addresses this very issue. See the readme (and the related excerpt below) for more information:

“MAXX-27484 skinOps.ReplaceVertexWeights not working Animation”

Hey eevans,

Thanks a lot for the help, I’m going to look at that, I definietly saw a change of behavior with that function between max 12 and 15, that seems to confirm it.