Page 3 of 3

Re: Keyframe many layers at once?

Posted: Sat Nov 24, 2012 10:54 am
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.

Re: Keyframe many layers at once?

Posted: Sat Nov 24, 2012 12:21 pm
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...

Re: Keyframe many layers at once?

Posted: Thu Nov 29, 2012 3:11 pm
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 ? :?

Re: Keyframe many layers at once?

Posted: Thu Nov 29, 2012 3:52 pm
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).

Re: Keyframe many layers at once?

Posted: Thu Nov 29, 2012 4:18 pm
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




Re: Keyframe many layers at once?

Posted: Mon Dec 07, 2015 9:56 pm
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 :)