Iterate through all the channels in the layer

local chInfo  =  MOHO.MohoLayerChannel:new_local()
-- iterate channels
for i = 0, moho.layer:CountChannels()-1 do
moho.layer:GetChannelInfo(i, chInfo)
if not chInfo.selectionBased then
-- do something
print(chInfo.name:Buffer())
-- iterate subchannels
for j=0, chInfo.subChannelCount-1 do
local subChannel = moho.layer:Channel(i, j, moho.document)
local channel = nil
if subChannel:ChannelType() == MOHO.CHANNEL_VAL then channel = moho:ChannelAsAnimVal(subChannel)
elseif subChannel:ChannelType() == MOHO.CHANNEL_VEC2 then channel = moho:ChannelAsAnimVec2(subChannel)
elseif subChannel:ChannelType() == MOHO.CHANNEL_VEC3 then channel = moho:ChannelAsAnimVec3(subChannel)
elseif subChannel:ChannelType() == MOHO.CHANNEL_BOOL then channel = moho:ChannelAsAnimBool(subChannel)
elseif subChannel:ChannelType() == MOHO.CHANNEL_COLOR then channel = moho:ChannelAsAnimColor(subChannel)
elseif subChannel:ChannelType() == MOHO.CHANNEL_STRING then channel = moho:ChannelAsAnimString(subChannel)
end
-- do something with it
if channel then currentVal = channel:GetValue(moho.frame) end
-- iterate actions
local skel = moho.layer:ControllingSkeleton()
for a = 0, subChannel:CountActions()-1 do
local actionSubChannel = subChannel:Action(a)
local actionName = subChannel:ActionName(a)
if skel then
local smartBone = skel:BoneByName(actionName)
if not smartBone and string.sub(actionName, -2) == " 2" then smartBone = skel:BoneByName(string.sub(actionName, 1, -3)) end
if smartBone then
local smartBoneChannel = moho:ChannelAsAnimVal(smartBone.fAnimAngle:ActionByName(actionName))
local currentSmartBoneVal = smartBone.fAnimAngle:GetValue(moho.frame)
-- now You can find a frame with this value in smartBoneChannel and get the amount of smartBone's influence
-- see note below
end
end
end
end
end
end


Note! Smartbones' influences are allways summated, not multiplied, even on scale channels.

local smartBoneInfluence = actionChannel:GetValue(smartBoneFrame) - actionChannel:GetValue(0)
smartBonesInfluences = smartBonesInfluences + smartBoneInfluence