Jump to content


Animation Splines Retiming


  • Please log in to reply
3 replies to this topic

#1 Gringo

Gringo

    Associate Administrator

  • Adv Members
  • PipPipPipPipPip
  • 1448 posts

Posted 10 November 2008 - 10:55 AM

This new comp script allows to retime animation in selected tools according to a TimeStretcher, Twixtor or Kronos retiming.
It also can do reverse action - unretiming.

The script can be useful in various situations.

For example, you'd tracked a source sequence in original speed, then retimed it and want to add another layer after the retiming using the tracking.

Or you'd made animation according to a retimed sequence and then the retiming curve was changed. You can do unretime for the animation and then retime it again with a new retiming tool.

Or you have a 3D-tracked camera and the master take is retimed. But textures you apply in 3D should be in their original speed. So, you can retime the camera animation and its path will correspond to the retimed sequence. You don't need to render excessive amount of frames to retime and apply a copy of the retiming tool to the result; your textures are in the original speed.

Or if you'd retimed a sequence and then your result was retimed by editors. So, you dont need to apply two retimer nodes, you can just retime your original retimer with the new one.


To use it, select all the tools you want to retime plus your retimer, select Script>bzRetimeCurves from the main menu.

To get a correct result, turn curved animation splines of the retimer and the retimed tools to a frame by frame animation (bake it so that they have linear interpolation). Unlock keyframes on motion paths.

This script was initially conceived to retime masks, but we've faced some difficulties. This feature will be available later on.

Coding by Roman Fedotov.

Attached File  bzRetimeCurves.eyeonscript.txt   5.31K   76 downloads

P.S. Remove the .TXT extension and put the script to Fusion:\Scripts\Comp

#2 Gringo

Gringo

    Associate Administrator

  • Adv Members
  • PipPipPipPipPip
  • 1448 posts

Posted 24 March 2009 - 12:10 PM

Hi!

Is there the One who knows scripting and wants to glorify himself by delivering all the fusioneers from necessity to decide whether to rotoscope the original sequence or a retimed one and what to do if a retimed sequence had been rotoscoped but the retiming was changed?

The script above needs to be finished in terms of masks retiming. I believe it's not too complicated for an experienced script-writer since the algorithm itself is complete and it just needs to be applied to masks too...

What I've learned from our experiments is that an animation keyframe of a mask can't be moved directly in time. And the mask shape cannot be stored externally to be reloaded in other time (animation resets in this case).

But animated masks have a certain mention of shape and time which can be seen in text mode.

The masks format is following:

			KeyFrames = {
				[60] = { 0, Flags = { Linear = true, LockedY = true, }, Value = Polyline {
						Closed = true,
						Points = {
							{ X = -0.00920545116969151, Y = -0.012122773565352, LX = -7.89145895362623e-005, LY = -0.0036351583566786, RX = 0.000169354098857928, RY = 0.00849562273886117, },
							{ X = -0.00703025236725807, Y = 0.013211608864367, LX = -0.00193170946607444, LY = -0.00810931250789818, RX = 0.000545978424262357, RY = 0.00229201634234921, },
							{ X = -0.00236741150729358, Y = 0.0169881638139486, LX = -0.00239120027981699, LY = 0.000472069921670482, RX = 0.00299352747863241, RY = -0.000590981146282148, },
							{ X = 0.0065995897166431, Y = 0.0150998858734965, LX = -0.00191296043340117, LY = 0.00062942533986643, RX = 0.00210238159113199, RY = -0.00069175097635157, },
							{ X = 0.0100668305531144, Y = 0.00786149129271507, LX = 0.000285416799144869, LY = 0.00283241544570773, RX = -0.000751424637564566, RY = -0.00745697785168886, },
							{ X = 0.00791474973084405, Y = -0.0146404756233096, LX = 0.000479024468000784, LY = 0.00204898991775849, RX = -0.000507241528543215, RY = -0.00216968620035449, },
							{ X = 0.00456706946715713, Y = -0.0198332366271643, LX = 0.00190820179262803, LY = 6.74170992352795e-010, RX = -0.00391171662718346, RY = -1.38201624791606e-009, },
							{ X = -0.00703025236725807, Y = -0.0174728911370039, LX = 0.00107248377561659, LY = -0.000627345309640809, RX = -0.00134154653816562, RY = 0.0011424782499731, },
						},
					}, },
				[200] = { 1, Flags = { Linear = true, LockedY = true, }, Value = Polyline {
						Closed = true,
						Points = {
							{ X = -0.00873795259798923, Y = -0.0130302393252547, LX = -8.87960944151944e-005, LY = -0.00409034459344797, RX = 0.000196197011384559, RY = 0.00984219338330609, },
							{ X = -0.00681549851717419, Y = 0.0163979033498836, LX = -0.00223788869984781, LY = -0.00939465232410917, RX = 0.00061434459704288, RY = 0.0025790174001081, },
							{ X = -0.00156878736176515, Y = 0.0206473498950389, LX = -0.00269062092396362, LY = 0.000531181440359183, RX = 0.00357494535802207, RY = -0.000705764460376735, },
							{ X = 0.00922119883696604, Y = 0.0192137111019463, LX = -0.00228450517667928, LY = 0.00075167547752224, RX = 0.00236563701794507, RY = -0.000778370455563117, },
							{ X = 0.0131225996613859, Y = 0.0110689412642453, LX = 0.000321156039630726, LY = 0.00318708404641131, RX = -0.000883392498388004, RY = -0.00876659875856335, },
							{ X = 0.0107010401898883, Y = -0.0154024789558004, LX = 0.000563152444598726, LY = 0.0024088407967126, RX = -0.000570757155609785, RY = -0.00244136935679671, },
							{ X = 0.00693417104043105, Y = -0.0212454656466446, LX = 0.00214714246804238, LY = 7.58589146072107e-010, RX = -0.00444309682412801, RY = -1.56975379027658e-009, },
							{ X = -0.00629038036365678, Y = -0.0190502864143484, LX = 0.00121817342909165, LY = -0.000712565918892662, RX = -0.00150953193529053, RY = 0.00128553677017227, },
						},
					}, },
				[300] = { 2, Flags = { Linear = true, LockedY = true, }, Value = Polyline {
						Closed = true,
						Points = {
							{ X = -0.0109698653742142, Y = -0.0146535916448044, LX = -9.88185092096294e-005, LY = -0.00455202177010423, RX = 0.000220340665021458, RY = 0.0110533561140582, },
							{ X = -0.00696346919609469, Y = 0.0180961053674083, LX = -0.00251327928437181, LY = -0.0105507414518268, RX = 0.000734706410080076, RY = 0.00308429605255439, },
							{ X = -0.000814436167116676, Y = 0.0234374318234627, LX = -0.00321776483336383, LY = 0.000635250006309114, RX = 0.00394614748649241, RY = -0.000779047054557561, },
							{ X = 0.0110383529269875, Y = 0.0212297333283261, LX = -0.00252171528736864, LY = 0.000829725212338211, RX = 0.00255559367315084, RY = -0.000840872287893335, },
							{ X = 0.0149149164373962, Y = 0.0121656633541016, LX = 0.000346944326939646, LY = 0.00344300150996278, RX = -0.00102549218090308, RY = -0.0101767657031572, },
							{ X = 0.0108244703618343, Y = -0.0183139941152903, LX = 0.000653739339700388, LY = 0.00279631919738595, RX = -0.000635178513306733, RY = -0.00271692670558989, },
							{ X = 0.00663243470769165, Y = -0.02481647868878, LX = 0.00238949042916831, LY = 8.44211099724044e-010, RX = -0.0050364519681072, RY = -1.77938718858188e-009, },
							{ X = -0.00824603567232781, Y = -0.0213531214229317, LX = 0.00138085488732256, LY = -0.000807725819776028, RX = -0.00167991279832924, RY = 0.00143063529988824, },
						},
					}, },
			},

Where [60], [200] and [300] are the positions of the keyframes in time.
So, it's possible to retime animated masks by altering these values.

#3 bfloch

bfloch

    Flying Pig

  • Adv Members
  • PipPipPipPipPip
  • 958 posts

Posted 10 May 2009 - 12:36 PM

Hey Gregory,

I just played around and realized that you can access the KeyFrames of a polyspline but you have to use:
dump(Polygon1Polyline:GetKeyFrames())

instead of
dump(Polygon1.Polyline:GetKeyFrames())

Still the values are kind of strange and don't represent the real Points. What the heck is this?
Documentation? Eyeon?

Cheers
Blazej

#4 Mipf

Mipf
  • Members
  • 1 posts

Posted 29 June 2009 - 11:57 AM

Heya Guys, I'm searching for an answer for this one too. What format does the SetKeyFrames function require the table to be put in? Any examples out there? And why does the GetKeyFrames function keep returning varying table names for a seemingly unchanging table?
Cheers,
E

View Postbfloch, on May 10 2009, 06:36 PM, said:

Hey Gregory,

I just played around and realized that you can access the KeyFrames of a polyspline but you have to use:
dump(Polygon1Polyline:GetKeyFrames())

instead of
dump(Polygon1.Polyline:GetKeyFrames())

Still the values are kind of strange and don't represent the real Points. What the heck is this?
Documentation? Eyeon?

Cheers
Blazej





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users