Target Bone keying

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

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

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

Target Bone keying

Post by mkelley » Wed Jul 08, 2015 1:33 pm

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: 121
Joined: Sun Apr 19, 2009 3:22 pm
Contact:

Re: Target Bone keying

Post by Stan » Wed Jul 08, 2015 3:46 pm

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.
________________________________________________________________________
http://mohoscripting.com/ - Unofficial Moho (Anime Studio) Lua Scripting Documentation
http://2danimator.ru/ - Russian Anime Studio Forum
User avatar
mkelley
Posts: 1646
Joined: Fri Nov 02, 2007 5:29 pm
Location: Sunny Florida
Contact:

Re: Target Bone keying

Post by mkelley » Thu Jul 09, 2015 4:56 pm

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

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