Set layer length for loops automatically
Posted: 20 Jan 2023, 08:20
I recently updated this script and wanted to share it here. This will set markin and markout for you depending on how many loops you want and sets the layers to loop. It should take into account if the animation does not start on the first frame of your selected layer. You just need to manually export the clip. You can add it to your panel as a button and use when needed. Let me know if you have any suggestions for improving the code.
Code: Select all
// Script to set layer length to repeat for a set number of loops
tv_LayerInfo [tv_layercurrentid]
PARSE Result layerDisplay layerPosition layerOpacity layerName layerType layerFirstFrame layerLastFrame layerPrelighttable layerPostlighttable selectable editable stencil
Anim_Offset = layerFirstFrame - 1
Anim_Length = layerLastFrame - Anim_Offset
Loop_Count = 1
Loop_Min = 1
Loop_Max = 10
Loop_Title = "How many Loops?"
tv_reqnum Loop_Count Loop_Min Loop_Max Loop_Title
PARSE Result Loop_Count Loop_Min Loop_Max Loop_Title
IF ( CMP( Result, "cancel") == 1 )
exit
END
Loop_Markout = (Anim_Length * Loop_Count) + Anim_Offset
tv_markin [0] ["set"]
tv_markout [Loop_Markout] ["set"]
tv_layerpostbehavior [tv_layercurrentid] ["repeat"]