From 2c072cf441e27a56f7dbb1801af72f7633034a1b Mon Sep 17 00:00:00 2001 From: bendn Date: Sat, 1 Oct 2022 07:07:43 +0700 Subject: [PATCH] feat(storage): add nucleus-team sprites (#5) --- .../blocks/storage/core-nucleus-team-crux.svg | 3 +++ .../storage/core-nucleus-team-malis.svg | 3 +++ .../storage/core-nucleus-team-sharded.svg | 3 +++ _src_/blocks/storage/core-nucleus-team.svg | 4 ++-- diff.sh | 3 ++- export.sh | 20 ++++++++++++------- 6 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 _src_/blocks/storage/core-nucleus-team-crux.svg create mode 100644 _src_/blocks/storage/core-nucleus-team-malis.svg create mode 100644 _src_/blocks/storage/core-nucleus-team-sharded.svg diff --git a/_src_/blocks/storage/core-nucleus-team-crux.svg b/_src_/blocks/storage/core-nucleus-team-crux.svg new file mode 100644 index 00000000..5213060b --- /dev/null +++ b/_src_/blocks/storage/core-nucleus-team-crux.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b529ae66525e77ad69e8be8d15df57a5b6d8920952c876b5358071da7a6f9645 +size 3238 diff --git a/_src_/blocks/storage/core-nucleus-team-malis.svg b/_src_/blocks/storage/core-nucleus-team-malis.svg new file mode 100644 index 00000000..ca7da526 --- /dev/null +++ b/_src_/blocks/storage/core-nucleus-team-malis.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:28526e65fe2b95ceeea17b0851d11187a31c4c0e0b98893f6f3b117775e9347b +size 3238 diff --git a/_src_/blocks/storage/core-nucleus-team-sharded.svg b/_src_/blocks/storage/core-nucleus-team-sharded.svg new file mode 100644 index 00000000..81a2c6d5 --- /dev/null +++ b/_src_/blocks/storage/core-nucleus-team-sharded.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e77f3c609d1769f8395eed890b687bbf218ac57cfa950e903f52ed7eea932d4e +size 3238 diff --git a/_src_/blocks/storage/core-nucleus-team.svg b/_src_/blocks/storage/core-nucleus-team.svg index c4111e88..feccd187 100644 --- a/_src_/blocks/storage/core-nucleus-team.svg +++ b/_src_/blocks/storage/core-nucleus-team.svg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3442e2fd38f782ebc297626a7ed37bbd8208171d5df07dbb4bb08d1d5c7493c7 -size 13078 +oid sha256:96654851ba19d88240841635f87a2ba157450159520fbf9f301592a05b037b54 +size 12184 diff --git a/diff.sh b/diff.sh index 1294c164..e3759589 100755 --- a/diff.sh +++ b/diff.sh @@ -26,10 +26,11 @@ EOF chmod +x simmilarity.py shopt -s globstar for i in **/*.png; do + original_path="$root_path/_original_/$i" + [[ -f $original_path ]] || continue if grep -q -F "$i" "$root_path/diff_overrides"; then continue fi - original_path="$root_path/_original_/$i" rendered_path="$root_path/sprites-override/$i" dissimilarity="$(dssim "$original_path" "$rendered_path" | awk '{print $1}')" if [[ $(bc -l <<<"$dissimilarity <.15") -ne 1 ]]; then diff --git a/export.sh b/export.sh index f6798b57..605dcff7 100755 --- a/export.sh +++ b/export.sh @@ -7,6 +7,8 @@ set -o pipefail size_multiplier="$1" # yep, its a string. +[[ -d sprites-override ]] && rm -rf sprites-override + [[ $2 == "--no" ]] && no_outline=1 root_path="$(pwd)" @@ -41,9 +43,12 @@ function multiply_rounded() { round "$(bc -l <<<"$1*$2")" } -# $1: output_path +# $1: file function multiplied_size() { - multiply_rounded "$(identify -format '%w' "$1")" "$size_multiplier" + local file="$root_path/_original_/$1" + [[ ! -f "$file" ]] && file="${1%.png}.svg" # identifying svg files is costly (800ms) so do it only when necessary + + multiply_rounded "$(identify -format '%w' "$file")" "$size_multiplier" } echo -e "[4] icon.svg ➔ icon.png" @@ -55,19 +60,20 @@ for i in **/*.svg; do while [ "$(jobs -r | wc -l)" -ge 10 ]; do sleep .1; done [[ $i == *"template"* ]] && continue r_path="${i%.svg}.png" # the folder relative to sprites_override, or _original_: units/gamma.png + base="${r_path##*/}" original_path="$root_path/_original_/$r_path" - if [[ -f $original_path ]]; then + + if [[ -f $original_path || $base == *"-team"* ]]; then output_path="$root_path/sprites-override/$r_path" [[ ! -d "${output_path%/*}" ]] && mkdir -p "${output_path%/*}" # dirname #shellcheck disable=SC2143 if [[ -z "$no_outline" && - ( - ($r_path == *"turrets"* && $r_path != *"heat"* && $r_path != *"bases"* && $r_path != *"top"* && $r_path != *"liquid"*) || + (($r_path == *"turrets"* && $base != *"heat"* && $r_path != *"bases"* && $base != *"top"* && $base != *"liquid"*) || (-n $(grep -F "$r_path" "$root_path/manual_outline"))) ]]; then - (render "$(multiplied_size "$original_path")" "$i" "$output_path" && outline "$output_path") & + (render "$(multiplied_size "$r_path")" "$i" "$output_path" && outline "$output_path") & else - render "$(multiplied_size "$original_path")" "$i" "$output_path" & + render "$(multiplied_size "$r_path")" "$i" "$output_path" & fi echo -e "[${size_multiplier}] $r_path"