Python Scripting and Vertex Weights

My background is in building 3D assets and some game engine scripting (C#, JS), but I’m new to this forum and to Python & 3ds Max API. My team is building out some character models and we are using a rig that’s been provided in the game engine sample folders.

Some of the geometry we build falls outside the envelopes of certain bones and we typically have to edit these vertex weights manually. I got to thinking that it might be possible to edit the vertex weights through a script that would do something like:

  1. Find all vertices with weight 0 or No Value
  2. For Each vertex find adjacent vertices and apply average weights to this vertex.
  3. Check that all vertices have a weight that totals 1.0

I’ve tried using iNode.GetObject().GetWeight() but I believe this returns vertex weights for NURMS and not the weight for specific bones (not sure what the difference is).

I’ve also tried accessing the weight table parameter through the iNode.GetModifier().GetParameterBlock() but the parameters of the weight table aren’t the values within the weight table so this seems like a dead-end.

At this point I’m just trying to find out if it’s possible to script weights for envelopes, but I’m definitely stuck and need a some guidance.