[Closed] get bone node from skin modifier?
hey all
i’m trying to write a script that relies on bone nodes. here’s a quick rundown: because of merging of multiple characters, i will have multiple skeletons with same name bones. i can’t use handle for unique id’s because of the merging thing (handles get re-numbered), and my workaround is that if i know one of the bone’s nodes, i can trace through the node heirarchies and do what i have to do and it stays unique to that character.
in this script i’m trying to get the mesh name to populate a pickButton name… so i know a bone’s name ($head), and what i want to do is check the meshes in the scene to see if the skin mod for the mesh contains that node. unfortunately, skinOp seemingly relies entirely on names, so there’s no way to verify that I am operating on the same $head that i want to be operating on. is there another max command that returns nodes instead of names, or a way to get nodes out of skin modifiers?
the method getbonename has a flag called “nameflag_index”, if it is false, the method returns the node,but actually that flag doesn’t work (bugs bugs bugs) .
some days ago i coded a method to get a node from the skin using the bone id even if there are several nodes with the same name (i use a reference check), maybe you can modify it to do what you need
fn getBoneFromSkin theSkin boneID=
(
local boneArray=for o in objects where (refs.dependencyLoopTest theSkin o) collect o
local boneName=(skinOps.GetBoneName theSkin boneID 1)
local notFound=true
local i=0
while notFound and i<boneArray.count do
(
i+=1
if boneArray[i].name==boneName then notFound=false
)
if notFound then undefined else boneArray[i]
)
phoelix, that is exactly what i needed. didn’t even have to modify it. i had the same logic as you did, but just relying on names was not guaranteeing 100% results. using refs seems to fix it. i wasn’t aware of those prior to this so i’ll have to read up on that now. thanks for your help!