SelectedBoneID() return value?
Posted: Thu Mar 17, 2016 5:30 pm
Documentation says SelectedBoneID() returns the ID of the selected bone. What does this mean? Isn't it possible to select multiple bones? Is the return value some array?
Ah, great! Thanks for a quick answer. I just wrote my own function to detect if there are bones selected, I'll replace it nowsynthsin75 wrote:This returns the first (lowest) selected bone ID. Looking at the select and transform bone tools, it seems to be a quick way to get bone names and settings to display in tool option texts, where only one can be shown, even if more are selected. It's also a quick way to check that any bones are selected, before running the code to count through all bones. If there's no selected bones, there may be no need to waste processing counting through them.
Thanks again. I don't know how I missed this, I was looking for it earlier. I'll go with this one!synthsin75 wrote:moho:CountSelectedBones(bool) would also work just to find if any are selected, but I'm not sure what the scope of that is. Maybe layer and parent layer?
Code: Select all
for j = 0, skel:CountBones()-1 do
if skel:Bone(j).fSelected then ...
Code: Select all
for i = 0, moho.document:CountLayers()-1 do
if moho.document:Layer(i):LayerType() = MOHO.LT_BONE then ...