Target Bone keying

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
mkelley
Posts: 1647
Joined: Fri Nov 02, 2007 5:29 pm
Location: Sunny Florida
Contact:

Target Bone keying

Post by mkelley »

Either I'm once again blind or it isn't available anywhere, but I can't find any information on how to set and retrieve keys for bone targets (scripting, naturally). If there was a tool that did this I could just examine it, but apparently it's only done via the constraints menu.

Anyone have the syntax? (if this is just as easy as bone.fTarget:SetValue(frame, boneID) I'll be pretty embarassed).
Stan
Posts: 199
Joined: Sun Apr 19, 2009 3:22 pm

Re: Target Bone keying

Post by Stan »

bone.fTargetBone is an AnimVal that contains the ID of the current target bone.

So, this should get you the target bone:

local currentTargetBoneID = bone.fTargetBone.getValue(moho.layerFrame)
local currentTargetBone = skel:Bone(currentTargetBoneID)

Then you can manipulate the target bone's keys as usual.
________________________________________________________________________
https://mohoscripting.com/ - Unofficial Moho Lua scripting documentation
https://mohoscripts.com/ - The best place to publish and download scripts for Moho
User avatar
mkelley
Posts: 1647
Joined: Fri Nov 02, 2007 5:29 pm
Location: Sunny Florida
Contact:

Re: Target Bone keying

Post by mkelley »

Thanks. I assume I can SetValue the same way, although using both frame and the value:

bone.fTargetBone.setValue(frame, value)
Post Reply