aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgarret <garret@airmail.cc>2021-12-22 20:12:24 +0000
committergarret <garret@airmail.cc>2021-12-22 20:12:24 +0000
commit140b7f3fd2fbc6fb07121dacd60a5bee1c5f5d41 (patch)
treec96fbb7b0cc42ad87b9d85d9dcfe2c09d64646ba
parent37de70000ec5bd76ceaa436cd05d57f201e29b33 (diff)
downloadaegisub-scripts-140b7f3fd2fbc6fb07121dacd60a5bee1c5f5d41.tar.gz
aegisub-scripts-140b7f3fd2fbc6fb07121dacd60a5bee1c5f5d41.tar.bz2
aegisub-scripts-140b7f3fd2fbc6fb07121dacd60a5bee1c5f5d41.zip
new script
-rw-r--r--README.md10
-rw-r--r--macros/garret.order-layers.lua33
2 files changed, 43 insertions, 0 deletions
diff --git a/README.md b/README.md
index 4384cb7..2161fbe 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,8 @@ Some scripts do the same things as other peoples',
Tested on official-ish aegi for linux,
but _should_ work fine on any build that has automation v4 (read: all of them).
+assume garbage-in garbage-out.
+
----
## Script List
@@ -79,6 +81,14 @@ makes doing alpha timing significantly easier
originally created to convert stuff that should've been alpha timed in the first place
but used a weird hack with `\ko` instead.
+### Order layers
+
+for typesetting.
+
+Puts each selected line on its own layer, so they don't clash.
+Tries to be a bit clever and check if you actually need it
+, but it's not so clever that it'll check if they actually overlap.
+
### Restyler
`become-fansubber.lua`
diff --git a/macros/garret.order-layers.lua b/macros/garret.order-layers.lua
new file mode 100644
index 0000000..62fec03
--- /dev/null
+++ b/macros/garret.order-layers.lua
@@ -0,0 +1,33 @@
+script_name = "Order layers"
+script_description = "puts each selected line on its own layer so they don't clash"
+script_author = "garret"
+script_version = "1.0.0"
+
+local haveDepCtrl, DependencyControl, depctrl = pcall(require, "l0.DependencyControl")
+if haveDepCtrl then
+ depctrl = DependencyControl {
+ --feed="TODO",
+ }
+end
+
+local function main(sub, sel)
+ local i = 0
+ local last_start, last_end
+ for si,li in ipairs(sel) do
+ line = sub[li]
+ if line.start_time == last_start or line.end_time == last_end or si == 1 then
+ line.layer = i
+ i = i + 1
+ end
+ last_start = line.start_time
+ last_end = line.end_time
+ sub[li] = line
+ end
+ aegisub.set_undo_point(script_name)
+end
+
+if haveDepCtrl then
+ depctrl:registerMacro(main)
+else
+ aegisub.register_macro(script_name, script_description, main)
+end