Skip to content

Commit

Permalink
[ChromaticAbberation] Add option to convert text to shape before appl…
Browse files Browse the repository at this point in the history
…ying CA
  • Loading branch information
PhosCity committed Sep 16, 2024
1 parent 636059b commit 61fc4df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 5 additions & 1 deletion macros/phos.ChromaticAbberation.moon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export script_name = "Chromatic Abberation"
export script_description = "Add chromatic abberation to shape and text."
export script_version = "1.0.2"
export script_version = "1.0.3"
export script_author = "PhosCity"
export script_namespace = "phos.ChromaticAbberation"

Expand All @@ -27,6 +27,7 @@ createGUI = ->
| label, x Offset | float,xOffset, 2 | pad, 10 | label, Color 1 | color, color1, &H00FFFF& |
| label, y Offset | float,yOffset, 2 | null | label, Color 2 | color, color2, &HFF00FF& |
| check, keepBaseColor, Keep Original Color | | | label, Color 3 | color, color3, &HFFFF00& |
| check, textToShape, Convert text to shape | | | | |
"
btn, res = AegiGui.open str, "Apply:ok, Revert, Cancel:cancel"
aegisub.cancel! unless btn
Expand Down Expand Up @@ -149,6 +150,9 @@ main = (sub, sel) ->
table.insert toDelete, line
AssfPlus._util.setOgLineExtradata line, "phos.ca"

if res["textToShape"]
AssfPlus.lineData.convertTextToShape data

pos = data\getPosition!
posInLine = data\getTags "position"
if #posInLine == 0
Expand Down
11 changes: 9 additions & 2 deletions source/phos.ChromaticAbberation.norg
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tangle: {
@code moon
export script_name = "Chromatic Abberation"
export script_description = "Add chromatic abberation to shape and text."
export script_version = "1.0.2"
export script_version = "1.0.3"
export script_author = "PhosCity"
export script_namespace = "phos.ChromaticAbberation"
@end
Expand Down Expand Up @@ -53,11 +53,12 @@ tangle: {
| label, x Offset | float,xOffset, 2 | pad, 10 | label, Color 1 | color, color1, &H00FFFF& |
| label, y Offset | float,yOffset, 2 | null | label, Color 2 | color, color2, &HFF00FF& |
| check, keepBaseColor, Keep Original Color | | | label, Color 3 | color, color3, &HFFFF00& |
| check, textToShape, Convert text to shape | | | | |
"
btn, res = AegiGui.open str, "Apply:ok, Revert, Cancel:cancel"
aegisub.cancel! unless btn
res, btn

@end

** Color Mixing
Expand Down Expand Up @@ -239,6 +240,12 @@ tangle: {
table.insert toDelete, line
AssfPlus._util.setOgLineExtradata line, "phos.ca"
@end
*** Optionally convert text to shape
If user has asked to convert text to shape, then we do it here and then proceed to treat the lines as shape from now on.
@code moon
if res["textToShape"]
AssfPlus.lineData.convertTextToShape data
@end
*** Get position
If there is no `pos` tag in the line, then the resulting lines will appear on different rows. So we're inserting the position if it doesn't exist.
@code moon
Expand Down

0 comments on commit 61fc4df

Please sign in to comment.