diff options
author | garret <garret@airmail.cc> | 2021-12-23 13:04:43 +0000 |
---|---|---|
committer | garret <garret@airmail.cc> | 2021-12-23 13:04:43 +0000 |
commit | 8e13d9167e8f4c05a8901f673bb34c2c99b7041d (patch) | |
tree | cf7a7ecaecde55330a88f8f52c8d164163dc574f | |
parent | 140b7f3fd2fbc6fb07121dacd60a5bee1c5f5d41 (diff) | |
download | aegisub-scripts-8e13d9167e8f4c05a8901f673bb34c2c99b7041d.tar.gz aegisub-scripts-8e13d9167e8f4c05a8901f673bb34c2c99b7041d.tar.bz2 aegisub-scripts-8e13d9167e8f4c05a8901f673bb34c2c99b7041d.zip |
new script
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | macros/garret.inverse-glow.lua | 55 | ||||
-rw-r--r-- | macros/inverse-glow.ass | 34 |
3 files changed, 103 insertions, 0 deletions
@@ -73,6 +73,20 @@ I do not have an em-dash key on my keyboard. **Done better by**: Ctrl-H (partially) +### Inverse Glow + +For typesetting. + +Glow, but it goes inside the letters. + +- `\c` = dark colour +- `\3c` = light colour +- `\bord` = amount of blur on light colour + +won't work if doesn't have all three + +see `inverse-glow.ass` for an example + ### K-Timing -> Alpha Timing makes doing alpha timing significantly easier diff --git a/macros/garret.inverse-glow.lua b/macros/garret.inverse-glow.lua new file mode 100644 index 0000000..9733424 --- /dev/null +++ b/macros/garret.inverse-glow.lua @@ -0,0 +1,55 @@ +script_name = "Inverse Glow" +script_description = "glow but it goes inside the letter" +script_author = "garret" +script_version = "1.0.0" +script_namespace = "garret.inverse-glow" + +local haveDepCtrl, DependencyControl, depctrl = pcall(require, "l0.DependencyControl") +local util +if haveDepCtrl then + depctrl = DependencyControl({ + --feed="TODO", + { "aegisub.util" }, + }) + util = depctrl:requireModules() +else + util = require("aegisub.util") +end + +local patterns = { tags_text = "(%b{})(.*)", bord = "\\bord(%d+)", dark = "\\c(&?H*%x+&?)", light = "\\3c(&?H*%x+&?)" } + +local function main(subs, sel) + for i = #sel, 1, -1 do + local line = subs[sel[i]] + local tags, text = line.text:match(patterns.tags_text) + local blur = string.match(tags, patterns.bord) -- \bord = value of \blur + local dark = tags:match(patterns.dark) -- \c = colour of dark layer + local light = tags:match(patterns.light) -- \3c = colour of light layer + + if tags and blur and dark and light then -- skip lines that don't have everything needed + tags = string.gsub(tags, patterns.bord, "") -- remove \bord + tags = string.gsub(tags, patterns.dark, "") -- and both colours + tags = string.gsub(tags, patterns.light, "") + + -- light layer + local light_line = util.copy(line) + light_line.layer = line.layer + 1 + local light_tags = string.gsub(tags, "}", "\\bord0\\shad0\\c" .. light .. "}") -- } (end of tag block) --> \cLightColour} + light_line.text = light_tags .. text + subs[sel[i]] = light_line + + local dark_line = util.copy(line) + dark_line.layer = line.layer + 2 + local dark_tags = string.gsub(tags, "}", "\\bord0\\shad0\\c" .. dark .. "\\blur" .. blur .. "}") -- } -> \cDarkColour\blurBord} + dark_line.text = dark_tags .. text + subs.insert(sel[i] + 1, dark_line) + end + end + aegisub.set_undo_point(script_name) +end + +if haveDepCtrl then + depctrl:registerMacro(main) +else + aegisub.register_macro(script_name, script_description, main) +end diff --git a/macros/inverse-glow.ass b/macros/inverse-glow.ass new file mode 100644 index 0000000..4688da7 --- /dev/null +++ b/macros/inverse-glow.ass @@ -0,0 +1,34 @@ +[Script Info] +; Script generated by Aegisub 6962-master-6f54695 +; http://www.aegisub.org/ +Title: Default Aegisub file +ScriptType: v4.00+ +WrapStyle: 0 +ScaledBorderAndShadow: yes +PlayResX: 1920 +PlayResY: 1080 +YCbCr Matrix: None + +[Aegisub Project Garbage] +Last Style Storage: Default +Video File: ?dummy:23.976000:120:1920:1080:77:196:237: +Video AR Value: 1.777778 +Video Zoom Percent: 0.375000 +Scroll Position: 3 +Active Line: 6 + +[V4+ Styles] +Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding +Style: Default,Gandhi Sans,74,&H00FFFFFF,&H000000FF,&H00000000,&H96000000,-1,0,0,0,100,100,0,0,1,4,1.5,2,135,135,50,1 +Style: Overlap,Gandhi Sans,74,&H00FFFFFF,&H00000000,&H00651018,&H96000000,-1,0,0,0,100,100,0,0,1,4,1.5,2,135,135,50,1 +Style: Signs,Arial,48,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,0,0,2,10,10,10,1 + +[Events] +Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text +Dialogue: 0,0:00:00.00,0:00:05.00,Signs,input,0,0,0,normal text,{\pos(976,404)\fs200\c&H4D4D4B&\3c&HF8F7F0&\bord5}Inverse Glow +Comment: 0,0:00:00.00,0:00:05.00,Signs,---------,0,0,0,-------------------------,----------------- +Dialogue: 1,0:00:00.00,0:00:05.00,Signs,output,0,0,0,light below,{\pos(976,758.667)\fs200\c&HF8F7F0&}Inverse Glow +Dialogue: 2,0:00:00.00,0:00:05.00,Signs,output,0,0,0,blurred dark above,{\pos(976,758.667)\fs200\c&H4D4D4B&\blur5}Inverse Glow +Dialogue: 0,0:00:00.00,0:00:05.00,Signs,,0,0,0,,(lines moved manually) +Dialogue: 0,0:00:00.00,0:00:00.00,Default,,0,0,0,,layer 1: light on bottom +Dialogue: 0,0:00:00.00,0:00:00.00,Default,,0,0,0,,layer 2: dark w/blur on top, light "shines" through the blurred bits |