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.
gtafan's picture

I know that skinops can´t do

I know that skinops can´t do what I need, but may be there are some other posibilities. I am rally new to maxscript and unfortunatelly there is no much information about it. There is also skinutils and some other stuff, that can worck with skin, so may be there is a solution? It´s really anoing to export 100 or more characters manually, but it seems to be the only solution.

ZalitZ's picture

What do you want to export

What do you want to export exactly ? Do you use the skin only to know wich bones of your character you have to export ? Or do you really need to do something with the skin ?

gtafan's picture

I want to export the skined

I want to export the skined mesh with all bones, that influence the mesh.

gtafan's picture

I think there is a

I think there is a misunderstanding, I have many characters that should be exported, every character has a bone named head, hand, foot and so on. As you see the names shouldn´t be uniqe. Really don´t understand why maxscript can´t just return a reference to the bone instead of useles name.

ZalitZ's picture

I'm afraid skinOps can't return bone directly

I am not totally sure but I think it's impossible to get the bone directly. So you will have to get the names list and get the bones inside the good hierachy with a script like that :

firstBone = $ /*select the root bone*/
 
boneList = #()
namelist = #(/*your list of bones*/)
 
for i in firstBone do (
	for j in namelist do (
		if  i.name == j do append boneList i
	)
)
 
select boneList

It's a way to get your bones list without getNodeByName.

ZalitZ's picture

You could use uniquename()

That script make sure that all of your objects names are unique :

for i in objects do (
	i.name = uniquename(i.name + "_")
)

After that, you could use ListSkinBones() properly.
Then you can revert the name back by removing the 4 last characters with Tools > Rename Objects

gtafan's picture

Thanks for the script, even

Thanks for the script, even it´s a bit complikated, but like I said geting Nodes by name is not a solution as there are nodes with the same name. So if I have to rename nodes manually, I can do the rest of the job manually to and no need for any script. I really don´t understand, why max gives a lot of useless functions, but none to get the node from bone list of a skin modifier.

gtafan's picture

Sorry for dobleposting.

Sorry for dobleposting.

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.