geting bones from skin modifier

So I want to get all bones from a skin modifier, something like this:

getBones skin

unfortunatelly there is no such function in max, at least haven´t found it. The solution with geting the names of every bone and than searching for the nod with the same name is useless, as names are not uniq and there are defenetly more than 1 node with the same name. So any solution for the problem?

Comments

Comment viewing options

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

Use skinOps.GetNumberBones and skinOps.GetBoneName

Hi,
there is no such function in Max, so I wrote this script :

fn ListSkinBones obj toNode:false = 
( 
    skinMod
    bonesList = #()
    result
    -------------------------------------------------------------------------------
 
    clearSelection()
    max modify mode
 
    hiddenState = obj.ishidden 
    obj.ishidden = false
    select obj
 
    skinMod = obj.modifiers[#skin]
    modPanel.setCurrentObject obj.modifiers[#Skin]
 
    bonesList = for i=1 to (skinOps.GetNumberBones skinMod) collect (skinOps.GetBoneName skinMod i 0)
 
    obj.ishidden = hiddenState 
    result = bonesList 
 
    if toNode == true do 
    (
        result = for i in bonesList collect (getNodebyName(i) ) 
    )
 
    result
)
 
select (ListSkinBones $ toNode:true)

You shouldn't have bones with the same name, it will be confusing for any script. So, the solution is to rename these or at least rename the first bone of your hierarchy and search inside this particuliar hierarchy.

Comment viewing options

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