Code: Select all
function ProcessBonePair(skel, ik, b, layerFrame)
local boneik = skel:BoneByName(ik)
local bone = skel:BoneByName(b)
if bone and boneik then
if bone.fTargetBone.value == -1 then
boneik.fIgnoredByIK = true
else
local parent = skel:Bone(bone.fParent)
local animScaleValue = bone.fAnimScale:GetValue(layerFrame)
if animScaleValue > 0.5 then
boneik.fIgnoredByIK = true
bone.fMaxAutoScaling = 1
parent.fMaxAutoScaling = 1
else
boneik.fIgnoredByIK = false
bone.fMaxAutoScaling = 100
parent.fMaxAutoScaling = 100
end
end
end
end
function LayerScript(moho)
local skel = moho:Skeleton()
if not skel then return end
local layerFrame = moho.layerFrame
ProcessBonePair(skel, "IKLeftArm", "LeftForeArm", layerFrame)
ProcessBonePair(skel, "IKRightArm", "RightForeArm", layerFrame)
ProcessBonePair(skel, "IKLeftLeg", "LeftLeg", layerFrame)
ProcessBonePair(skel, "IKRightLeg", "RightLeg", layerFrame)
moho.layer:UpdateCurFrame()
end