Page 1 of 1

Keying all the bones

Posted: Thu Sep 25, 2008 7:01 pm
by ejecta
Is there a way to key all the bones and all their channels at once without having to either move them? Basically I want to be able to go through and pose out my key poses but if I dont have to movea bone Id like to key it and the fastest way is to have a way to key them all at once.

Posted: Thu Sep 25, 2008 9:24 pm
by mkelley
If they are all selected you can just right click on the timeline and add a key.

I created a script which assigns this process to a key (I used the "K" key -- ahem). The script will actually create a key on any type layer that's selected (so if it's on a bone layer it will key all bones, including rotations, transforms and scales, but if it's on a vector layer it will key the vertices, switch layer the switch, bitmap layer the position, etc.). It's just easier for me to press the "K" key.

Posted: Thu Sep 25, 2008 10:01 pm
by synthsin75
I think there's also a 'key skeleton' script floating around here somewhere.

Posted: Thu Sep 25, 2008 10:36 pm
by ejecta
Thanks guys. Where can I get these scrpts and how do you install them?

Posted: Fri Sep 26, 2008 2:36 am
by mkelley
Wes,

The "Key Skeleton" was my jumping off point -- the same guy who did that did a "Key All" but it didn't really work (or at least not the way I wanted it to work) so I reworked it for my own use (if I recall his scripts require you click in the window somewhere to set the key with his tool selected, and you needed to press alt/shift/ctrl keys depending on what keys you wanted to set -- all extra steps that I didn't want. My version just allows you to press the "K" key no matter what other tool you have selected).

As for the OP, you can find scripts posted in the Script forum section -- just placing them in the appropriate scripts folder will enable them in AS (seems to me there is some difference in this regard between AS Pro and AS, but as I've never used AS I've never really paid attention here. Maybe something about how a non Pro script can't be a button? I dunno).

If you want my script I can either post it here direct (the good news is that scripts are simple ASCII) or send it to you if you PM me with your email address.

Posted: Fri Sep 26, 2008 3:55 am
by synthsin75
Thanks for clearing that up Mike. I'd be interested in your script myself. :wink:

Posted: Fri Sep 26, 2008 3:19 pm
by mkelley
Ah, I just looked at my script and it's so simplistic I think I'll just embed it in this message (so forget that private message to you, Wes :>).

Here it is: for the OP just cut and paste the lines in between the asterisk dividing lines into an ascii file. Call it mk_key_skeleton.lua and save it in your scripts directory under the tools folder.

Then to call it with the "K" key just alter your _tool_list.txt file so it says something like this:

button mk_key_skeleton K

(More details are contained in the text file in that directory explaining how things are called). After you restart AS it will then create a key on whatever layer is selected anytime you press "K".

*********************************************************
--[[
------------------------------------------------------------------------------
SetCurFrame(frame)

Class: AnimChannel

void AddKey(when)

M_Bone:
fAnimPos (AnimVec2)
fAnimAngle (AnimVal)
fAnimScale (AnimVal)

M_Skeleton:
Bone(id)
CountBones()

void StoreValue()
]]

-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************

ScriptName = "MK_key_skeleton"

-- **************************************************
-- General information about this script
-- **************************************************

MK_key_skeleton = {}

function MK_key_skeleton:Name()
return "Key Skeleton"
end

function MK_key_skeleton:Version()
return "1.0"
end

function MK_key_skeleton:Description()
return "Creates Skeleton Keys "
end

function MK_key_skeleton:Creator()
return "Mike Kelley"
end

function MK_key_skeleton:UILabel()
return("Key Skeleton")
end


-- **************************************************
-- The guts of this script
-- **************************************************

function MK_key_skeleton:Run(moho)
local skel = moho:Skeleton()
if (skel ~= nil) then

moho.document:PrepUndo(moho.layer)
moho.document:SetDirty()
for i = 0, skel:CountBones() - 1 do
local bone = skel:Bone(i)
bone.fAnimPos:AddKey( moho.frame )
bone.fAnimAngle:AddKey( moho.frame )
bone.fAnimScale:AddKey( moho.frame )

end
moho.layer:UpdateCurFrame()
moho:UpdateBonePointSelection()
-- moho:UpdateSelectedChannels()
moho:UpdateUI()
-- moho:Redraw()
end
local switchLayer = moho:LayerAsSwitch(moho.layer)
if (switchLayer) then

moho.document:PrepUndo(moho.layer)
moho.document:SetDirty()
local sLayer = moho:LayerAsSwitch( moho.layer)
local cFrame = moho.frame
sLayer:SetValue(cFrame, sLayer:GetValue(cFrame))
end
local aLayer = moho.layer
if ( aLayer:LayerType() == MOHO.LT_GROUP) then

moho.document:PrepUndo(moho.layer)
moho.document:SetDirty()
aLayer.fTranslation:AddKey( moho.frame )

end


local aMesh = moho:Mesh()
if (aMesh ~= nil) then
moho.document:PrepUndo(moho.layer)
moho.document:SetDirty()

moho:AddPointKeyframe(moho.frame)

end

end



**********************************************************

Posted: Fri Sep 26, 2008 10:07 pm
by synthsin75
Thanks Mike! That will definitely come in handy. :wink:

Posted: Fri Sep 26, 2008 11:31 pm
by heyvern
Dagnabbit!

I've used up all the keys. I don't have any keys left I'm not using for shortcuts. <sigh> The curse of too many custom tools.

;)

I think "K" was the last one I had left. I used it for the "standard" translate bone tool since Fazek's translate points tool works with bones too (T) and it kept messing stuff up. ;)

-vern

Posted: Sat Sep 27, 2008 12:51 am
by mkelley
Yeah, "K" was convenient because it also made sense (and was a left handed key, handy until I started using my Shuttle Pro, at which point it didn't make any difference).

I didn't look to see but are all the keys mappable? Even "[" for example? Or "~"? Has anyone tried them? They might not be as easy for some folks to type, but for me they would be just as valuable (since I just assign them to keys on my Shuttle).