Skip to content

Commit

Permalink
Update Shapery
Browse files Browse the repository at this point in the history
  • Loading branch information
klsruan committed Oct 22, 2023
1 parent 2a8a0ba commit e8d5eea
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
24 changes: 23 additions & 1 deletion macros/ILL.Shapery.moon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export script_name = "Shapery"
export script_description = "Does several types of shape manipulations from the simplest to the most complex"
export script_version = "2.5.0"
export script_version = "2.5.1"
export script_author = "ILLTeam"
export script_namespace = "ILL.Shapery"

Expand Down Expand Up @@ -721,6 +721,7 @@ ShaperyMacrosDialog = (macro) ->
cfg = getConfigElements!
ass = Ass sub, sel, activeLine, not cfg.saveLines
mergeShapesObj = {}
lines = {}
for l, s, i, n in ass\iterSel!
ass\progressLine s, i, n
Line.extend ass, l
Expand Down Expand Up @@ -854,6 +855,25 @@ ShaperyMacrosDialog = (macro) ->
mergeShapesObj[code] = {:i, pos: l.data.pos, line: lcopy, shape: table.concat clip}
else
ass\warning s, "Expected a shape"
when "Shape trim"
if l.isShape
Line.callBackExpand ass, l, nil, (line, j) ->
{px, py} = line.data.pos
line.shape = Path(line.shape)\move(px, py)\export!
table.insert lines, line
if i == n and n > 1
for j = #lines, 1, -1
cut = Path lines[j].shape
for k = j - 1, 1, -1
newShape = Path(lines[k].shape)\difference cut
lines[k].shape = newShape\export!
ass\deleteLines l, sel
for line in *lines
{px, py} = line.data.pos
line.shape = Path(line.shape)\move(-px, -py)\export!
ass\insertLine line, s
else
ass\warning s, "Expected a shape"
when "Shape to 0,0"
if l.isShape
{x, y} = l.data.pos
Expand Down Expand Up @@ -912,6 +932,7 @@ if haveDepCtrl
{"Clip to shape", "", ShaperyMacrosDialog "Clip to shape"}
{"Shape to clip", "", ShaperyMacrosDialog "Shape to clip"}
{"Shape merge", "", ShaperyMacrosDialog "Shape merge"}
{"Shape trim", "", ShaperyMacrosDialog "Shape trim"}
{"Shape to 0,0", "", ShaperyMacrosDialog "Shape to 0,0"}
{"Shape to origin", "", ShaperyMacrosDialog "Shape to origin"}
{"Shape to center", "", ShaperyMacrosDialog "Shape to center"}
Expand All @@ -931,6 +952,7 @@ else
aegisub.register_macro ": Shapery macros :/Clip to shape", "", ShaperyMacrosDialog "Clip to shape"
aegisub.register_macro ": Shapery macros :/Shape to clip", "", ShaperyMacrosDialog "Shape to clip"
aegisub.register_macro ": Shapery macros :/Shape merge", "", ShaperyMacrosDialog "Shape merge"
aegisub.register_macro ": Shapery macros :/Shape trim", "", ShaperyMacrosDialog "Shape trim"
aegisub.register_macro ": Shapery macros :/Shape to 0,0", "", ShaperyMacrosDialog "Shape to 0,0"
aegisub.register_macro ": Shapery macros :/Shape to origin", "", ShaperyMacrosDialog "Shape to origin"
aegisub.register_macro ": Shapery macros :/Shape to center", "", ShaperyMacrosDialog "Shape to center"
Expand Down
2 changes: 1 addition & 1 deletion modules/ILL/ILL.moon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module_version = "1.4.1"
module_version = "1.4.2"

haveDepCtrl, DependencyControl = pcall require, "l0.DependencyControl"

Expand Down
1 change: 1 addition & 0 deletions modules/ILL/ILL/Ass/Text/Tag.moon
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ export ASS_TAGS = {
["pattern"]: "%b()"
["pattern_value"]: "%((.+)%)"
["typer"]: "string"
["first_category"]: true
}
["q"]: {
["ass"]: "\\q"
Expand Down
3 changes: 2 additions & 1 deletion modules/ILL/ILL/Ass/Text/Tags.moon
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ class Tags

-- separates all tags and gets all possible information about them
split: =>
split, copy = {}, Tags @tags
split = {}
copy = Tags @tags
-- does split processing on all the tags
process = (name) ->
if tag = copy\getTag name, @tags
Expand Down

0 comments on commit e8d5eea

Please sign in to comment.