Skip to content

Commit

Permalink
Crop the first frame from animated block textures.
Browse files Browse the repository at this point in the history
For minetest blocks that are not animated crop to the first frame.
See minetest-tools#9
  • Loading branch information
ensonic committed Aug 6, 2017
1 parent 0e61545 commit 10161ed
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions mcresconvert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,20 @@ fi

convert_alphatex() {
if [ -f _n/$2 ]; then
g="_n/$2"
if [ -f "$g.mcmeta" ]; then
if grep -q "animation" "$g.mcmeta"; then
# FIXME: need a list of not animated textures
if echo "$5" | grep -q "grass"; then
w=`file $g |sed 's/.*, \([0-9]*\) x \([0-9]*\).*/\1/'`
convert "$g" -crop ${w}x${w}+0+0 -depth 8 _n/_g.png
g="_n/_g.png"
fi
fi
fi
convert $1 -crop 1x1+$3 -depth 8 -resize ${4}x${4} _n/_c.png
composite -compose Multiply _n/_c.png _n/$2 _n/_i.png
composite -compose Dst_In _n/$2 _n/_i.png -alpha Set $5
composite -compose Multiply _n/_c.png $g _n/_i.png
composite -compose Dst_In $g _n/_i.png -alpha Set $5
echo -e "." >> _n/_tot
echo -e "." >> _n/_counter
fi
Expand Down

0 comments on commit 10161ed

Please sign in to comment.