mirror of
https://github.com/smogon/sprites.git
synced 2026-04-25 07:18:19 -05:00
User-configurable compression settings
This commit is contained in:
parent
eb5bde52dd
commit
f8bc65549d
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,3 +2,4 @@ build/
|
|||
.tup
|
||||
node_modules
|
||||
pnpm-debug.log
|
||||
tup.config
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ twittersprite(files, "build/smogon/twittersprites/xy/%B.png")
|
|||
|
||||
tup.foreach_rule(
|
||||
{"src/canonical/trainers/*"},
|
||||
"^ pad trainer %f^ " .. makecmd{pad(80, 80, "%f", "%o"), compresspng("%f", {})},
|
||||
"^ pad trainer %f^ " .. makecmd{pad(80, 80, "%f", "%o"),
|
||||
compresspng{config="TRAINERS"}},
|
||||
{"build/padded-trainers/canonical/%b"}
|
||||
)
|
||||
|
||||
|
|
@ -66,7 +67,8 @@ tup.foreach_rule(
|
|||
for dir in iter{"front", "front-cosmetic", "front-shiny", "front-shiny-cosmetic"} do
|
||||
tup.foreach_rule(
|
||||
rep{"src/canonical/dex/{dir}/*", dir=dir},
|
||||
"^ pad dex %f^ " .. makecmd{pad(120, 120, "%f", "%o"), compresspng("%f", {})},
|
||||
"^ pad dex %f^ " .. makecmd{pad(120, 120, "%f", "%o"),
|
||||
compresspng{config="DEX"}},
|
||||
rep{"build/padded-dex/canonical/{dir}/%b", dir=dir}
|
||||
)
|
||||
end
|
||||
|
|
|
|||
24
Tuprules.lua
24
Tuprules.lua
|
|
@ -13,15 +13,25 @@ function pad(w, h, input, output)
|
|||
}
|
||||
end
|
||||
|
||||
function compresspng(filename, opts)
|
||||
local DEFAULT_OPTIPNG = getconfig("DEFAULT_OPTIPNG")
|
||||
local DEFAULT_ADVPNG = getconfig("DEFAULT_ADVPNG")
|
||||
|
||||
function compresspng(opts)
|
||||
local cmds = {}
|
||||
if opts.optipng then
|
||||
cmds += rep{"optipng -q {opts} {filename}", opts=opts.optipng, filename=filename}
|
||||
local output = opts.output or "%o"
|
||||
local optipng = DEFAULT_OPTIPNG
|
||||
if opts.config then
|
||||
optipng = getconfig(opts.config .. "_OPTIPNG") or optipng;
|
||||
end
|
||||
if opts.advpng then
|
||||
cmds += rep{"advpng -q {opts} {filename}", opts=opts.advpng, filename=filename}
|
||||
local advpng = DEFAULT_ADVPNG
|
||||
if opts.config then
|
||||
advpng = getconfig(opts.config .. "_ADVPNG") or advpng;
|
||||
end
|
||||
if optipng then
|
||||
cmds += rep{"optipng -q {opts} {output}", opts=optipng, output=output}
|
||||
end
|
||||
if advpng then
|
||||
cmds += rep{"advpng -q {opts} {output}", opts=advpng, output=output}
|
||||
end
|
||||
return cmds
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user