diff --git a/DependencyControl.json b/DependencyControl.json index 70fba61..dd3bf8f 100644 --- a/DependencyControl.json +++ b/DependencyControl.json @@ -7,7 +7,7 @@ "url": "@{baseUrl}", "maintainer": "unanimated", "macros": { - + "ua.Cycles": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -28,10 +28,10 @@ } }, "changelog": { - "2.0.0": ["Check the Updates page"] + "2.0.0": [ "Check the Updates page" ] } }, - + "ua.iBus": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -52,10 +52,10 @@ } }, "changelog": { - "1.7.0": ["merged Italics and Bold scripts and added Underline and Strikeout; added DependencyControl"] + "1.7.0": [ "merged Italics and Bold scripts and added Underline and Strikeout; added DependencyControl" ] } }, - + "ua.LineBreaker": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -76,10 +76,10 @@ } }, "changelog": { - "2.4.0": ["Check the Updates page"] + "2.4.0": [ "Check the Updates page" ] } }, - + "ua.JoinSplitSnap": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -100,11 +100,11 @@ } }, "changelog": { - "1.2.0": ["improved snapping to adjacent lines"], - "1.1.0": ["merged all three for convenience; changed how Join works; added DependencyControl"] + "1.2.0": [ "improved snapping to adjacent lines" ], + "1.1.0": [ "merged all three for convenience; changed how Join works; added DependencyControl" ] } }, - + "ua.JumpToNext": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -125,11 +125,11 @@ } }, "changelog": { - "2.0.0": ["13 macros; Text/Style/Actor/Effect/Layer/CommentedLine x Next/Previous = 12 hotkeys + 1 for GUI version with all 12 options"], - "1.3.0": ["Added DependencyControl"] + "2.0.0": [ "13 macros; Text/Style/Actor/Effect/Layer/CommentedLine x Next/Previous = 12 hotkeys + 1 for GUI version with all 12 options" ], + "1.3.0": [ "Added DependencyControl" ] } }, - + "ua.ScriptCleanup": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -150,10 +150,10 @@ } }, "changelog": { - "5.0.0": ["Check the Updates page"] + "5.0.0": [ "Check the Updates page" ] } }, - + "ua.BlurAndGlow": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -174,10 +174,10 @@ } }, "changelog": { - "2.5.0": ["default blur part of config; cleaned up the code a bit; added DespondencyControl"] + "2.5.0": [ "default blur part of config; cleaned up the code a bit; added DespondencyControl" ] } }, - + "ua.HYDRA": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -198,10 +198,10 @@ } }, "changelog": { - "6.1.0": ["Check the Updates page"] + "6.1.0": [ "Check the Updates page" ] } }, - + "ua.Relocator": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -209,25 +209,26 @@ "description": "Advanced metamorphosis of multidimensional coordinates", "channels": { "master": { - "version": "4.5.2", - "released": "2022-04-24", + "version": "4.6.0", + "released": "2024-01-25", "default": true, "files": [ { "name": ".lua", "url": "@{fileBaseUrl}@{fileName}", - "sha1": "e7a4e9f28363aa2deb27c3eab112dbd7d2d1ac73" + "sha1": "3816b2f156be34bc22a70c79c854e65ac02c3dcb" } ] } }, "changelog": { - "4.5.2": ["Follow user defined rounding for vector clips"], - "4.5.1": ["Support for subpixel vector clips"], - "4.5.0": ["Check the Updates page"] + "4.6.0": [ "Support arbitrary fractions for rounding numbers" ], + "4.5.2": [ "Follow user defined rounding for vector clips" ], + "4.5.1": [ "Support for subpixel vector clips" ], + "4.5.0": [ "Check the Updates page" ] } }, - + "ua.Recalculator": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -248,10 +249,10 @@ } }, "changelog": { - "4.0.0": ["Check the Updates page"] + "4.0.0": [ "Check the Updates page" ] } }, - + "ua.Colorize": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -272,10 +273,10 @@ } }, "changelog": { - "4.5.0": ["Check the Updates page"] + "4.5.0": [ "Check the Updates page" ] } }, - + "ua.Selectrix": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -296,10 +297,10 @@ } }, "changelog": { - "3.4.0": ["Check the Updates page"] + "3.4.0": [ "Check the Updates page" ] } }, - + "ua.ChangeCase": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -320,10 +321,10 @@ } }, "changelog": { - "3.0.0": ["improved; added options; unicode support; added DespondencyControl"] + "3.0.0": [ "improved; added options; unicode support; added DespondencyControl" ] } }, - + "ua.MultiLineEditor": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -344,10 +345,10 @@ } }, "changelog": { - "1.8.0": ["Check the Updates page"] + "1.8.0": [ "Check the Updates page" ] } }, - + "ua.MultiCopy": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -368,10 +369,10 @@ } }, "changelog": { - "4.0.0": ["Check the Updates page"] + "4.0.0": [ "Check the Updates page" ] } }, - + "ua.FadeWorks": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -392,10 +393,10 @@ } }, "changelog": { - "5.0.0": ["Check the Updates page"] + "5.0.0": [ "Check the Updates page" ] } }, - + "ua.Significance": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -416,10 +417,10 @@ } }, "changelog": { - "3.5.0": ["Check the Updates page"] + "3.5.0": [ "Check the Updates page" ] } }, - + "ua.ShiftCut": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -440,10 +441,10 @@ } }, "changelog": { - "3.1.0": ["Check the Updates page"] + "3.1.0": [ "Check the Updates page" ] } }, - + "ua.TimeSigns": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -464,10 +465,10 @@ } }, "changelog": { - "2.8.0": ["Added DespondencyControl"] + "2.8.0": [ "Added DespondencyControl" ] } }, - + "ua.Masquerade": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -488,10 +489,10 @@ } }, "changelog": { - "3.0.0": ["Check the Updates page"] + "3.0.0": [ "Check the Updates page" ] } }, - + "ua.NecrosCopy": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -512,10 +513,10 @@ } }, "changelog": { - "4.1.0": ["Check the Updates page"] + "4.1.0": [ "Check the Updates page" ] } }, - + "ua.EncodeHardsub": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -536,12 +537,12 @@ } }, "changelog": { - "1.2.0": ["fixed an issue with the encode being deleted when not muxing audio; fixed some issues resulting from subtitles not being saved"], - "1.1.0": ["added option to mux the encode with audio"], - "1.0.1": ["Added DespondencyControl"] + "1.2.0": [ "fixed an issue with the encode being deleted when not muxing audio; fixed some issues resulting from subtitles not being saved" ], + "1.1.0": [ "added option to mux the encode with audio" ], + "1.0.1": [ "Added DespondencyControl" ] } }, - + "ua.Multiplexer": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -562,10 +563,10 @@ } }, "changelog": { - "1.1.0": ["Added DespondencyControl"] + "1.1.0": [ "Added DespondencyControl" ] } }, - + "ua.QC": { "url": "@{baseUrl}#@{namespace}", "author": "unanimated", @@ -586,9 +587,9 @@ } }, "changelog": { - "2.9.0": ["Added DependencyControl"] + "2.9.0": [ "Added DependencyControl" ] } } - + } } diff --git a/ua.NecrosCopy.lua b/ua.NecrosCopy.lua index 66d1169..f88f8d8 100644 --- a/ua.NecrosCopy.lua +++ b/ua.NecrosCopy.lua @@ -46,7 +46,7 @@ function fucks(subs,sel) endcom="" repeat t=t:gsub("({[^}]-})%s*$",function(ec) endcom=ec..endcom return "" end) until not t:match("}$") - t=t:gsub("(.)$","{\\fax"..faks2.."}%1") + t=re.sub(t, "(.)$","{\\\\fax"..faks2.."}\\1") if res.grad then vis=nobra(t) diff --git a/ua.Relocator.lua b/ua.Relocator.lua index 2e6a95d..21d5591 100644 --- a/ua.Relocator.lua +++ b/ua.Relocator.lua @@ -25,6 +25,7 @@ function cuts(subs,sel) keyframes=aegisub.keyframes() ATAG="{%*?\\[^}]-}" STAG="^{\\[^}]-}" + STAG2="^{\\\\[^\\}]*?}" failures={} relocated=0 seln=#sel @@ -68,7 +69,7 @@ function relocator(subs,sel,act) {x=6,y=1,width=2,class="dropdown",name="mod",value="round numbers",items=Morphing}, {x=6,y=2,class="label",label="round:"}, {x=7,y=2,class="dropdown",name="rnd",items=Rounding,value="all"}, - {x=7,y=3,class="dropdown",name="rndec",items={"1","0.1","0.01","0.001"},value="1",hint="rounding"}, + {x=7,y=3,class="floatedit",name="rndec",value="0.1",hint="rounding"}, {x=7,y=4,class="dropdown",name="freeze",items=Freezing,value="0"}, {x=6,y=4,class="checkbox",name="frz",label="frz",value=true,hint=""}, {x=6,y=5,class="checkbox",name="frx",label="frx",hint=""}, @@ -422,7 +423,7 @@ function positron(subs,sel) endcom="" repeat text=text:gsub("({[^}]-})%s*$",function(ec) endcom=ec..endcom return "" end) until not text:match("}$") - text=text:gsub("(.)$","{\\fax"..faks2.."}%1") + text=re.sub(text, "(.)$","{\\\\fax"..faks2.."}\\1") vis=nobra(text) orig=text:gsub(STAG,"") tg=text:match(STAG) @@ -1427,7 +1428,6 @@ end function modifier(subs,sel,act) if not ak then cuts(subs,sel) end post=res.post force=res.force xx=res.eks yy=res.wai - if res.rndec then _,rr=res.rndec:gsub("0","") end FR={"frx","fry","frz"} for z,i in ipairs(sel) do progress("Morphing... #"..i-line0.." ["..z.."/"..#sel.."]") @@ -1438,25 +1438,26 @@ function modifier(subs,sel,act) if not poss then nopos=1 end if res.mod=="round numbers" then + local function round_replacer(str) return tostring(round2(str,res.rndec)) end if poss and res.rnd=="all" or poss and res.rnd=="pos" then - text=text:gsub("\\pos%(([%d.-]+),([%d.-]+)%)",function(a,b) return "\\pos("..round(a,rr)..","..round(b,rr)..")" end) + text=re.sub(text,"\\\\pos\\(([\\d.-]+),([\\d.-]+)\\)",round_replacer) end - if text:match("\\org") and res.rnd=="all" or text:match("\\org") and res.rnd=="org" then - text=text:gsub("\\org%(([%d.-]+),([%d.-]+)%)",function(a,b) return "\\org("..round(a,rr)..","..round(b,rr)..")" end) + if re.match(text,"\\\\org") and res.rnd=="all" or re.match(text,"\\\\org") and res.rnd=="org" then + text=re.sub(text,"\\\\org\\(([\\d.-]+),([\\d.-]+)\\)",round_replacer) end - if text:match("\\move") and res.rnd=="all" or text:match("\\move") and res.rnd=="move" then - text=text:gsub("\\move%(([%d.-]+),([%d.-]+),([%d.-]+),([%d.-]+)",function(mo1,mo2,mo3,mo4) - return "\\move("..round(mo1,rr)..","..round(mo2,rr)..","..round(mo3,rr)..","..round(mo4,rr) end) + if re.match(text,"\\\\move") and res.rnd=="all" or re.match(text,"\\\\move") and res.rnd=="move" then + text=re.sub(text,"\\\\move\\(([\\d.-]+),([\\d.-]+),([\\d.-]+),([\\d.-]+)",round_replacer) end - if text:match("\\i?clip") and res.rnd=="all" or text:match("\\i?clip") and res.rnd=="clip" then - for klip in text:gmatch("\\i?clip%([^%)]+%)") do - klip2=klip:gsub("([%d.-]+)",function(c) return round(c,rr) end) - text=text:gsub(esc(klip),klip2) + if re.match(text,"\\\\i?clip") and res.rnd=="all" or re.match(text,"\\\\i?clip") and res.rnd=="clip" then + for klip in re.gmatch(text,"\\\\i?clip\\([^\\)]+\\)") do + klip2=re.sub(klip.str,"([\\d.-]+)",round_replacer) + text=re.sub(text,esc(klip.str),klip2) end end - if text:match("\\p1") and res.rnd=="all" or text:match("\\p1") and res.rnd=="mask" then - tags=text:match(STAG) - text=text:gsub(STAG,"") :gsub("([%d.-]+)",function(m) return round(m,rr) end) + if re.match(text,"\\\\p1") and res.rnd=="all" or re.match(text,"\\\\p1") and res.rnd=="mask" then + tags_match=re.match(text,STAG2) + if tags_match then tags=tags_match[1].str else tags="" end + text=re.sub(re.sub(text,STAG2,""),"([\\d.-]+)",round_replacer) text=tags..text end end @@ -2553,6 +2554,11 @@ end -- reanimatools ---------------------------------------------------------- function esc(str) str=str:gsub("[%%%(%)%[%]%.%-%+%*%?%^%$]","%%%1") return str end function round(n,dec) dec=dec or 0 n=math.floor(n*10^dec+0.5)/10^dec return n end +function round2(n, fraction) + fraction=fraction or 0.1 + n=math.floor(n / fraction + 0.5) * fraction + return n +end function rnd3(n) n=math.floor(n*10^3+0.5)/10^3 return n end function wrap(str) return "{"..str.."}" end function detra(t) return t:gsub("\\t%b()","") end