I wrote this script to compensate lack of copy/paste operations on bone objects. This script can duplicate selected bone with child bones. This is pre-alpha version with some restictions. For example, a bone can have more than one child bone, but only first children will be included in copy sequence (yet):
Seems a bit strange that this isn't part of the main moho package. Oh well, I guess that's why scripting is so great.
Anyway I was looking at your script and it seems like it would be pretty easy to make it clone all the selected bone's children. You could probably change the RB_CloneBone:Run() function so that it loops through the id of every bone in the skeleton and checks to see if it's a child of the selected bone instead of using the GetFirstChildBone() method. Something like this:
function RB_CloneBone:Run(moho)
local skel = moho:Skeleton()
local parId = skel:SelectedBoneID()
if parId == -1 then
MESSAGE = 'Select a bone first'
RB_CloneBoneMsg:new(moho):DoModal()
return
end
local dlog = RB_CloneBoneDialog:new(moho)
if (dlog:DoModal() == LM.GUI.MSG_CANCEL) then
return
end
-- Enum all child bones
PARENT= -1
Clone(moho:Skeleton(), parId)
local numBones = skel:CountBones()
for x = 1, numBones, 1 do
if skel:IsBoneParent(x, parId) then
Clone(moho:Skeleton(), x)
end
end
end
Although for some reason this copies the entire skeleton instead of just the children. Pretty good for my first crack at moho scripting though.