DV Tween Machine v1.0

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

Moderators: Víctor Paredes, Belgarath, slowtiger

chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Re: Tween machine (DONE)

Post by chucky »

Davoodice2 this is BRILLIANT!
I don't know what most of the options do, but the slider alone is magic!
Thanks so much for sharing such a great time saving tool.
User avatar
Víctor Paredes
Site Admin
Posts: 5718
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Re: Tween machine (DONE)

Post by Víctor Paredes »

Hey, davoodice2
I want to try the tool, but the Mediafire link is not working here.
Is anyone else having that issue?
Image Image Image Image Image Image
Moho Product Manager

Rigged animation supervisor: My father's dragon, Wolfwalkers & Star Wars Visions "Screecher's Reach"
My personal Youtube Channel
Daxel
Posts: 1029
Joined: Wed Mar 27, 2019 8:34 pm

Re: Tween machine

Post by Daxel »

davoodice2 wrote: Thu Sep 23, 2021 7:55 am
those parameters are for actual ae_key_tools.I used them in my function. you can find them on middle combo box. slider and percentage text box and ok are for tween machine
Oh I see them now. Thanks.

Can't find any information about "moho string channel". What is it?

Link seems to be down.
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

Re: Tween machine

Post by davoodice2 »

Daxel wrote: Thu Sep 23, 2021 10:37 am
davoodice2 wrote: Thu Sep 23, 2021 7:55 am
those parameters are for actual ae_key_tools.I used them in my function. you can find them on middle combo box. slider and percentage text box and ok are for tween machine
Oh I see them now. Thanks.

Can't find any information about "moho string channel". What is it?

Link seems to be down.
I dont know too. :D . but i Think its a kind of keyframe type.
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
User avatar
SimplSam
Posts: 1094
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: Tween machine (DONE)

Post by SimplSam »

--
Last edited by SimplSam on Thu Sep 23, 2021 5:46 pm, edited 1 time in total.
Moho 14.1 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

Re: Tween machine (DONE)

Post by davoodice2 »

Víctor Paredes wrote: Thu Sep 23, 2021 9:58 am Hey, davoodice2
I want to try the tool, but the Mediafire link is not working here.
Is anyone else having that issue?
I'm sorry. I fixed that
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

Re: Tween machine (DONE)

Post by davoodice2 »

chucky wrote: Thu Sep 23, 2021 9:47 am Davoodice2 this is BRILLIANT!
I don't know what most of the options do, but the slider alone is magic!
Thanks so much for sharing such a great time saving tool.
I hope you find it useful
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
User avatar
Víctor Paredes
Site Admin
Posts: 5718
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Re: Tween machine (DONE)

Post by Víctor Paredes »

Thanks! I'm just playing with it. It's a lot of fun and very useful!
I don't know if that makes sense for the way you are using it, but I think it would be great if the keyframes created by this tool had a different color, so you can visually know where the extremes are.
Image Image Image Image Image Image
Moho Product Manager

Rigged animation supervisor: My father's dragon, Wolfwalkers & Star Wars Visions "Screecher's Reach"
My personal Youtube Channel
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Re: Tween machine (DONE)

Post by chucky »

Víctor Paredes wrote: Thu Sep 23, 2021 5:34 pm Thanks! I'm just playing with it. It's a lot of fun and very useful!
I don't know if that makes sense for the way you are using it, but I think it would be great if the keyframes created by this tool had a different color, so you can visually know where the extremes are.
Hey Victor,
Here's what I found is excellent:
Open the motion graph, as the keys are going on all selected bones, if you just have one of the channels showing it'll reflect the changes ( I guess) on all the keys that are being laid.
You can easily see the ease and overshoot there, it's just like the Maya tween machine , but super elegant
User avatar
Víctor Paredes
Site Admin
Posts: 5718
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Re: Tween machine (DONE)

Post by Víctor Paredes »

Yes! thanks, I was just checking that!
I was just wondering about retakes. I'm not sure yet, but I was thinking it would be nice to have these special keys labeled with a special color. That would make the timeline easier to understand and also it would be easier to remove these interpolations and apply them again with different values.
I hope it makes sense.
Image Image Image Image Image Image
Moho Product Manager

Rigged animation supervisor: My father's dragon, Wolfwalkers & Star Wars Visions "Screecher's Reach"
My personal Youtube Channel
User avatar
synthsin75
Posts: 10045
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Tween machine

Post by synthsin75 »

Daxel wrote: Thu Sep 23, 2021 10:37 am Can't find any information about "moho string channel". What is it?
The switch layer channel is an example of a string channel, as it's keyframes store the active layer name. Other examples are layer and shape ordering, that store ordered lists of layer/shape names.
A string is just a string of number/letter characters.
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Re: Tween machine (DONE)

Post by chucky »

Víctor Paredes wrote: Thu Sep 23, 2021 6:16 pm Yes! thanks, I was just checking that!
I was just wondering about retakes. I'm not sure yet, but I was thinking it would be nice to have these special keys labeled with a special color. That would make the timeline easier to understand and also it would be easier to remove these interpolations and apply them again with different values.
I hope it makes sense.
Yes, it does ,make sense, I use coloured keys a lot, it's super useful especially when bones are coloured by 'groups' ( eg. right leg)
What about a symbol, ( like the interpolation ones ) could it be a dash instead of a full key circle, then the combined power of colours and shape could ne leveraged?
Just spit balling, to see if anything sticks .

Hey I was just watching some a recording of live scripting ( sounds agonizing, especially as I have no clue about code), but it was cool to see the dev collaborating with other scripters in the chat to build the code with their help.
This could be a good thing for Moho users to try, Eh?
Daxel
Posts: 1029
Joined: Wed Mar 27, 2019 8:34 pm

Re: Tween machine

Post by Daxel »

synthsin75 wrote: Thu Sep 23, 2021 6:45 pm The switch layer channel is an example of a string channel, as it's keyframes store the active layer name. Other examples are layer and shape ordering, that store ordered lists of layer/shape names.
A string is just a string of number/letter characters.
Thanks!

Víctor Paredes wrote: Thu Sep 23, 2021 6:16 pm I'm not sure yet, but I was thinking it would be nice to have these special keys labeled with a special color. That would make the timeline easier to understand and also it would be easier to remove these interpolations and apply them again with different values.
I hope it makes sense.

Yes any improvement on timeline legibility works wonders on animation.
User avatar
Lukas
Posts: 1308
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: Tween machine (DONE)

Post by Lukas »

Great work!

I'm excited to use that Tween Machine functionality.

Have you tried getting it to preview the new pose while dragging the slider? That's one thing that I really miss when I tried it. Now its a bit too much trial-and-error to get the keys right, which makes it slower or at least more tedious than manually posing the overshoot in my case.

The toolbar is also a bit crowded and unclear. Maybe cut down on the buttons and focus on the slider + its settings? I would also maybe have the slider go from -50% to 150% so you can show slider-ticks every 50% (or -100% to 200% and a tick every 100%). Because it would be nice to see where the 0% and 100% points are.
User avatar
Lukas
Posts: 1308
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: Tween machine (DONE)

Post by Lukas »

Lukas wrote: Fri Sep 24, 2021 9:58 amHave you tried getting it to preview the new pose while dragging the slider? That's one thing that I really miss when I tried it. Now its a bit too much trial-and-error to get the keys right, which makes it slower or at least more tedious than manually posing the overshoot in my case.
This makes it show a preview of the pose while sliding the slider:

Code: Select all

elseif msg == self.SLIDER_CHANGE then
		if not self.undoPrepped then
			moho.document:PrepMultiUndo()
			moho.document:SetDirty()
			self.undoPrepped = true
		end
		self.slidertext:SetValue(self.slider:Value())
		self.slidertextVal = self.slider:Value()
		self.sliderVal = self.slider:Value()
		self:SetKeyTween(moho,self.slider:Value())
		moho:UpdateUI()
		moho.layer:UpdateCurFrame()
		if(not self.slider:IsMouseDragging()) then	
			self.undoPrepped = false
		end
Lukas wrote: Fri Sep 24, 2021 9:58 amI would also maybe have the slider go from -50% to 150% so you can show slider-ticks every 50% (or -100% to 200% and a tick every 100%). Because it would be nice to see where the 0% and 100% points are.
This shows ticks at 0% and 100%

Code: Select all

	self.slider = LM.GUI.Slider(500,false,false, self.SLIDER_CHANGE)
	layout:AddChild(self.slider)
	self.slider:SetRange(-100,200)
	self.slider:SetNumTicks(3)
	self.slider:SetShowTicks(true)
	self.slider:SetSnapToTicks(false)
	self.slider:SetFatSlider(true)
Also, here's how to have the slider show (an approximation of course, because it won't be accurate when multiple channels have keys on different frames) of the current slider value. So you have a sense of the current percentage of the tween even before you start using the tween machine. This could be improved if you actually inpur the correct channels into the FindKey function, but this gives good feedback 99% of the time (they way I'd use it) by just using the moho.layer channels:

Code: Select all

-- **************************************************
-- Find key
-- **************************************************
function DV_Key_Tools:FindKey(channels, start_frame, end_frame, moho)
	local found_key = false
	local layer = moho.layer
	local timing_offset
	local increment
	if end_frame > start_frame then
		increment = 1
	else
		increment = -1
	end
	
	if layer.TotalTimingOffset ~= nil then
		timing_offset = layer:TotalTimingOffset()
	else
	timing_offset = 0
	end

	-- Go through next/previous frames and stop when a keyframe is found
	for frame = start_frame, end_frame, increment do
		for i, channel in ipairs(channels) do
		   if channel.HasKey ~= nil and channel:HasKey(frame) then
			   found_key = true
			   break
		   end
		end
		if found_key then
			return frame-timing_offset
		end
	end
	return 0
end

function DV_Key_Tools:UpdateWidgets(moho)
	if(not self.slider:IsMouseDragging()) then
		local layer = moho.layer  
		local current_frame 
		if moho.layerFrame ~= nil then
			current_frame = moho.layerFrame
		else
			current_frame = moho.frame
		end
		-- Get channels, this could be improved!
		local channels = RT_Utilities:get_layer_channels(moho, layer)
		-- * Check whether there are any keys to the left of the cursor
		local prevKey = self:FindKey(channels, current_frame-1, 0, moho)
		local nextKey = self:FindKey(channels, current_frame, moho.document:AnimDuration(), moho)
		-- *
		local range = math.abs(nextKey-prevKey)
		local tempPercentage = (current_frame-prevKey)/range*100
		if tempPercentage < 0 then
			tempPercentage = 0
		elseif tempPercentage >= 100 then
			tempPercentage = 0
		end
		self.sliderVal = tempPercentage
		self.slidertextVal = tempPercentage
	end
	self.slider:SetValue(self.sliderVal)
	self.slidertext:SetValue(self.slidertextVal)
Also, this fixes an error in the SetKeyTween function in a specific case:

Code: Select all

						-- * Fix:
						if nID == channel:CountKeys() then
							return
						end
						-- * Before:
						fromFrameN = channel:GetKeyWhen(nID)
Man, this tween machine slider is such a simple but great idea. It will definitely speed up creating basic anticipation and overshoot poses. 👍
Post Reply