PDA

View Full Version : LW bones list



fortress
12-08-2003, 03:42 AM
hello i have noticed something kinda of strange
when looping to get the names and pos of all bones what i have noticed
is lightwave doesnt always return the very first bone in the parent child order

i have a rig setup that has about 80 bones or so
and when i call mesh.bone(); it returns a bone that is way down on the list like one of the face bones not the pelvis like i would think it should

now the other thing i have noticed is that the bone it returns is the same as the first bone in the speard sheet.

does anybody know why this is or if there is an easy way to get the first bone i.e the one with the parent as the mesh.

i have tried calling mesh.firstChild(); and it likes to return the secound bone in the list.

any help would be great

Thank you

faulknermano
12-08-2003, 09:56 AM
Originally posted by fortress
hello i have noticed something kinda of strange
when looping to get the names and pos of all bones what i have noticed
is lightwave doesnt always return the very first bone in the parent child order

i have a rig setup that has about 80 bones or so
and when i call mesh.bone(); it returns a bone that is way down on the list like one of the face bones not the pelvis like i would think it should

now the other thing i have noticed is that the bone it returns is the same as the first bone in the speard sheet.

does anybody know why this is or if there is an easy way to get the first bone i.e the one with the parent as the mesh.

i have tried calling mesh.firstChild(); and it likes to return the secound bone in the list.

any help would be great

Thank you


well, you've actually solved your problem in a way. cycle through all the bones and see which one has the mesh as the parent:




s = Scene().firstSelect();
b = s.bone();
while(b)
{
pbone = b.parent;
if(pbone.id == s.id)
myFirstBone = pbone;
b = b.next();
}

fortress
12-08-2003, 06:40 PM
once again faulknermano thank you
i thought abut it after i posted the question and had come to fact that all i need to do is check the parent of the bones
i just wasnt real sure about how to code it.

i had started trying a few things and was very close to the coe you posted.

but i must say yours is a much simpler and faster solution.
:)

and it works like a charm

thanks again