Keyframe many layers at once?

Wondering how to accomplish a certain animation task? Ask here.

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
Touched
Posts: 504
Joined: Mon Dec 11, 2006 7:33 am
Location: Sunny California
Contact:

Re: Keyframe many layers at once?

Post by Touched »

I wouldn't know about those things, since I use 5.6, so I hope someone else will speak up with that answer.
User avatar
jahnocli
Posts: 3471
Joined: Fri Oct 29, 2004 2:13 pm
Location: UK

Re: Keyframe many layers at once?

Post by jahnocli »

Touched wrote:I've reuploaded the key skeleton, key all, and my own "key none" variation to my Dropbox account.
https://dl.dropbox.com/u/27739431/Anime ... scripts.7z

These work in version 5.6, which is the version I'm still using.
Thanks, Touched -- still using 5.6 too, although I'm looking on with envy at the 'smart bones' feature, the first time I've considered upgrading. It's a lot of spondulicks if you're just a hobbyist, though...
You can't have everything. Where would you put it?
cekilinbendoktorum
Posts: 7
Joined: Wed Nov 24, 2010 9:30 am

Re: Keyframe many layers at once?

Post by cekilinbendoktorum »

It works on anime 9 but i want to key just a character or selected layer not all document how can i do that any ideas ? :?
User avatar
Víctor Paredes
Site Admin
Posts: 5658
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Re: Keyframe many layers at once?

Post by Víctor Paredes »

cekilinbendoktorum wrote:It works on anime 9 but i want to key just a character or selected layer not all document how can i do that any ideas ? :?
Freeze pose (ctrl+F) add keyframes for all the bones in the angle channel. If you have added keyframes for scale or translation at least once in the document, it will add keyframes for that channels too.
It works the same for vector layers (translation, width, curvature).
Image Image Image Image
Moho Product Manager

www.mohoanimation.com
Rigged animation supervisor in My father's dragon - Lead Moho artist in Wolfwalkers - Cartoon Saloon - My personal Youtube Channel
cekilinbendoktorum
Posts: 7
Joined: Wed Nov 24, 2010 9:30 am

Re: Keyframe many layers at once?

Post by cekilinbendoktorum »

selgin wrote:
cekilinbendoktorum wrote:It works on anime 9 but i want to key just a character or selected layer not all document how can i do that any ideas ? :?
Freeze pose (ctrl+F) add keyframes for all the bones in the angle channel. If you have added keyframes for scale or translation at least once in the document, it will add keyframes for that channels too.
It works the same for vector layers (translation, width, curvature).
Hi selgin, thanks for the tip... The goal is keyframe a character (with sublayers,bones,vector,swtich,groups that in the character). And add keyframes to every keyable things. This script does that perfectly anyhow it keyframes entire document. And it's a waste of time. Which part of this script must change ? Can you give and idea ? I just want to the keyframe the selected layer.

Code: Select all

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

ScriptName = "JS_key_all"

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

JS_key_all = {}

function JS_key_all:Name()
	return "Key All"
end

function JS_key_all:Version()
	return "1.1"
end

function JS_key_all:Description()
	return "Key all channels in all layers!"
end

function JS_key_all:Creator()
	return "Julien Stiegler"
end

function JS_key_all:UILabel()
	return("Key All")
end


-- **************************************************
-- The guts of this script
-- **************************************************
function JS_key_all:OnMouseDown(moho, mouseEvent)
	self:key_all(moho, mouseEvent)
end
--[[
function JS_key_all:Run(moho)
	self:key_all(moho)
end
]]

function JS_key_all:key_all(moho, mouseEvent)
	JS_key_all.verbose = true
	
	JS_key_all.initLayer = moho.layer
	JS_key_all.currentFrame = moho.frame
	
	moho.document:PrepUndo(moho.layer)
	moho.document:SetDirty()
		
	
		
		--BONE layers : key every layer's layer specific channels
		if( aLayer:IsBoneType() ) then
			moho:SetSelLayer(aLayer)
			local skel = moho:Skeleton()
			for j = 0, skel:CountBones() - 1 do
				local bone = skel:Bone(j)
				bone.fAnimPos:AddKey( self.currentFrame )
				bone.fAnimAngle:AddKey( self.currentFrame )
				bone.fAnimScale:AddKey( self.currentFrame )
				if(self.stepMode:Value()==true) then
					bone.fAnimPos:SetKeyInterp(  self.currentFrame , MOHO.INTERP_STEP , 0.0, 0.0)
					bone.fAnimAngle:SetKeyInterp(  self.currentFrame , MOHO.INTERP_STEP , 0.0, 0.0)
					bone.fAnimScale:SetKeyInterp(  self.currentFrame , MOHO.INTERP_STEP , 0.0, 0.0)
				end
			end
		end
		--VECTOR layers : key every shapes AND mesh points
		if (aLayer:LayerType() == MOHO.LT_VECTOR) then 
			moho:SetSelLayer(aLayer)
			local aMesh = moho:Mesh()
			--
			for j = aMesh:CountShapes() -1, 0, -1 do
				local shape = aMesh:Shape(j)
				shape.fMyStyle.fFillCol:AddKey( self.currentFrame )
				shape.fMyStyle.fLineCol:AddKey( self.currentFrame )
				if(self.stepMode:Value()==true) then
					shape.fMyStyle.fFillCol:SetKeyInterp(  self.currentFrame , MOHO.INTERP_STEP , 0.0, 0.0)
					shape.fMyStyle.fLineCol:SetKeyInterp(  self.currentFrame , MOHO.INTERP_STEP , 0.0, 0.0)
				end
			end 
			for k = aMesh:CountPoints() -1, 0, -1 do
				local aPoint = aMesh:Point(k)
				aPoint.fAnimPos:AddKey( self.currentFrame )
				if(self.stepMode:Value()==true) then
					aPoint.fAnimPos:SetKeyInterp(  self.currentFrame , MOHO.INTERP_STEP , 0.0, 0.0)
				end
			end
			--
		end
		
--		]]
		aLayer:UpdateCurFrame()
	end
	moho:SetSelLayer(JS_key_all.initLayer )
--	moho.layer:UpdateCurFrame()
--	moho:UpdateBonePointSelection()
--	moho:UpdateSelectedChannels()
	moho:UpdateUI() 
--	moho:Redraw()
 
end

--add an auto-step 
-- void SetKeyInterp(when, interpMode, val1, val2)
-- fAnimPos:SetKeyInterp(  self.currentFrame , INTERP_STEP , 0, 0)

JS_key_all.STEP = MOHO.MSG_BASE;

function JS_key_all:key_all_recursive(moho, currentLayer)
	
	local lInitLayer = moho.layer
	
	moho.document:PrepUndo(moho.layer)
	moho.document:SetDirty()
		
	s
		--BONE layers : key every layer's layer specific channels
		if( aLayer:IsBoneType() ) then
			moho:SetSelLayer(aLayer)
			local skel = moho:Skeleton()
			for j = 0, skel:CountBones() - 1 do
				local bone = skel:Bone(j)
				bone.fAnimPos:AddKey( self.currentFrame )
				bone.fAnimAngle:AddKey( self.currentFrame )
				bone.fAnimScale:AddKey( self.currentFrame )
				if(self.stepMode:Value()==true) then
					bone.fAnimPos:SetKeyInterp(  self.currentFrame , MOHO.INTERP_STEP , 0.0, 0.0)
					bone.fAnimAngle:SetKeyInterp(  self.currentFrame , MOHO.INTERP_STEP , 0.0, 0.0)
					bone.fAnimScale:SetKeyInterp(  self.currentFrame , MOHO.INTERP_STEP , 0.0, 0.0)
				end
			end
		end
		--VECTOR layers : key every shapes AND mesh points
		if (aLayer:LayerType() == MOHO.LT_VECTOR) then 
			moho:SetSelLayer(aLayer)
			local aMesh = moho:Mesh()
			--
			for j = aMesh:CountShapes() -1, 0, -1 do
				local shape = aMesh:Shape(j)
				shape.fMyStyle.fFillCol:AddKey( self.currentFrame )
				shape.fMyStyle.fLineCol:AddKey( self.currentFrame )
				if(self.stepMode:Value()==true) then
					shape.fMyStyle.fFillCol:SetKeyInterp(  self.currentFrame , MOHO.INTERP_STEP , 0.0, 0.0)
					shape.fMyStyle.fLineCol:SetKeyInterp(  self.currentFrame , MOHO.INTERP_STEP , 0.0, 0.0)
				end
			end 
			for k = aMesh:CountPoints() -1, 0, -1 do
				local aPoint = aMesh:Point(k)
				aPoint.fAnimPos:AddKey( self.currentFrame )
				if(self.stepMode:Value()==true) then
					aPoint.fAnimPos:SetKeyInterp(  self.currentFrame , MOHO.INTERP_STEP , 0.0, 0.0)
				end
			end
			--
		end
		
--		]]
		aLayer:UpdateCurFrame()
--	end
	moho:SetSelLayer(lInitLayer )
end

function JS_key_all:DoLayout(moho, layout)
	
	self.stepMode = LM.GUI.CheckBox("step mode", self.STEP)
	layout:AddChild(self.stepMode)
	self.stepMode:SetValue(false)
end



User avatar
Lúthien
Posts: 30
Joined: Tue Apr 21, 2015 12:36 pm
Location: Unquendor
Contact:

Re: Keyframe many layers at once?

Post by Lúthien »

Touched wrote:I've reuploaded the key skeleton, key all, and my own "key none" variation to my Dropbox account.
https://dl.dropbox.com/u/27739431/Anime ... scripts.7z

These work in version 5.6, which is the version I'm still using.
I'm glad to report that they still work in 11.1 - great work, thanks! It's a time-saver :)
reniad nu elin luin
Post Reply