My suggestion would be to entirely wrap skinOps into your own struct. So, you’d have another method, “xpecSkinOps.GetVertexWeightBoneIDByName” that would do what you want, and all the needed stuff under the hood. This will make working with skinOps stuff much easier in the future, since it is one of the worst systems in Max.
However it won’t solve your current problem- IIRC the way to do this is to create an array of bone names and then get the index of the name you are looking for (make sure skinMod is in modpanel, but running “modPanel.setCurrentObject skinMod” before hand, where skinMod is your modifier:
struct xpecSkinOpsDef
(
fn getBoneNames skinMod =
(
local cnt = skinOps.getNumberBones skinMod
for i = 1 to cnt collect skinOps.getBoneName skinMod i 1
),
fn getBoneId skinMod boneName =
(
findItem (getBoneNames skinMod) boneName
),
fn getVertexWeightBoneIdByName skinMod vert boneName =
(
skinOps.getVertexWeightBoneId skinMod vert (getBoneId skinMod boneName)
)
)
global xpecSkinOps = xpecSkinOpsDef()
xpecSkinOps.getVertexWeightBoneIdByName obj.modifiers[#Skin] 1 "LeftKnee"