Skip to content

Instantly share code, notes, and snippets.

@line0
Created January 9, 2015 20:19
Show Gist options
  • Save line0/22f02ecd9edca8af23b1 to your computer and use it in GitHub Desktop.
Save line0/22f02ecd9edca8af23b1 to your computer and use it in GitHub Desktop.
2 little scripts for conkerer
script_name="Little Scripts"
script_description=""
script_version="0.0.1"
script_author="line0"
local LineCollection = require("a-mo.LineCollection")
local l0Common = require("l0.Common")
local ASSTags = require("l0.ASSTags")
function flattenClips(sub, sel)
local lines = LineCollection(sub, sel)
lines:runCallback(function(lines, line, i)
local sect = ASS.parse(line)
sect:modTags({"clip_vect", "iclip_vect"}, function(clip)
clip:flatten()
end)
sect:commit()
end, true)
lines:replaceLines()
end
function clipBeziersToLines(sub, sel)
local lines = LineCollection(sub,sel)
lines:runCallback(function(lines, line, i)
local sect = ASS.parse(line)
sect:modTags({"clip_vect", "iclip_vect"}, function(clip)
clip:modCommands(function(cmd)
return ASSDrawLine(cmd.p3)
end, ASSDrawBezier)
end)
sect:commit()
end, true)
lines:replaceLines()
end
aegisub.register_macro(script_name.."/Flatten Clips", script_description, flattenClips)
aegisub.register_macro(script_name.."/Beziers -> Lines (Clips)", script_description, clipBeziersToLines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment