PDA

View Full Version : How to select bones??



RebelHill
04-11-2010, 02:02 PM
Ok... so just had a first go at LS today...

Im trying tosetup a script where I can show/hide items and bones, and also switch their IK/FK/Target/Pole motion options too.

All is fine for objects... no probs jsut using {SelectItem("")} etc...

But HOW can I get lscript to select a given bone???

I can use {SelectByName} no problem... but the issue is with having more than one object that has a bone of that name in the scene... so how can I specify which bone, underwhich object I want LS to select and do whatever to??

Ive tried {SelectItem("Objname.BoneName")}, as you'd normally reference a bone in expressions, and also SelectByName the same way... but no dice.

Any help... Please??

dpont
04-11-2010, 02:35 PM
SelectItem() works with the item id,
so given an obj,

objID = obj.id;

SelectItem(objID);

nextBone = obj.bone();

while(true)
{
if(nextBone.name==bonename)
{
boneID = nextBone;
break;
}
nextBone = nextBone.next();
}

SelectItem(boneID);

Denis.

RebelHill
04-15-2010, 06:40 AM
Lovely... thanks for that, I got it now.

Now onto the next thing...