-#!/bin/bash
-#Requires Inkscape, Gimp and ~/.gimp*/scripts/png-tga.scm
+#!/bin/sh
+#Requires Inkscape, Gimp and ~/.config/GIMP/*.*/scripts/png-tga.scm
#Exports png images from svg files (to /tga) and converts them to tga.
+# bones_was_here: updated for inkscape 1.2.2 and gimp 2.10.34 / 3.0
+# but script-fu seems broken in gimp 3.0-RC2
+
+set -e
+
if [ ! -d tga ]
then
mkdir tga
fi
-echo "Exporting png images from svg files..."
-inkscape -e tga/background_l2.png -d 90 background_l2.svg
-inkscape -e tga/bigbutton_c.png -d 90 bigbutton_c.svg
-inkscape -e tga/bigbutton_f.png -d 90 bigbutton_f.svg
-inkscape -e tga/bigbutton_n.png -d 90 bigbutton_n.svg
-inkscape -e tga/border.png -d 90 border.svg
-inkscape -e tga/button_c.png -d 45 button_c.svg
-inkscape -e tga/button_f.png -d 45 button_f.svg
-inkscape -e tga/button_n.png -d 45 button_n.svg
-inkscape -e tga/charmapbutton.png -d 45 charmapbutton.svg
-inkscape -e tga/checkbox_n0.png -d 45 checkbox_n0.svg
-inkscape -e tga/checkbox_n1.png -d 45 checkbox_n1.svg
-inkscape -e tga/checkmark.png -d 45 checkmark.svg
-inkscape -e tga/closebutton_c.png -d 90 closebutton_c.svg
-inkscape -e tga/closebutton_f.png -d 90 closebutton_f.svg
-inkscape -e tga/closebutton_n.png -d 90 closebutton_n.svg
-inkscape -e tga/color.png -d 45 color.svg
-inkscape -e tga/crosshairbutton_c.png -d 45 crosshairbutton_c.svg
-inkscape -e tga/crosshairbutton_f.png -d 45 crosshairbutton_f.svg
-inkscape -e tga/cursor.png -d 45 cursor.svg
-inkscape -e tga/inputbox_f.png -d 45 inputbox_f.svg
-inkscape -e tga/inputbox_n.png -d 45 inputbox_n.svg
-inkscape -e tga/radiobutton_c.png -d 45 radiobutton_c.svg
-inkscape -e tga/radiobutton_f.png -d 45 radiobutton_f.svg
-inkscape -e tga/radiobutton_n.png -d 45 radiobutton_n.svg
-inkscape -e tga/scrollbar_n.png -d 45 scrollbar_n.svg
-inkscape -e tga/scrollbar_s.png -d 45 scrollbar_s.svg
-inkscape -e tga/slider_n.png -d 45 slider_n.svg
-inkscape -e tga/slider_s.png -d 45 slider_s.svg
-inkscape -e tga/tooltip.png -d 45 tooltip.svg
+printf "\e[1mExporting png images from svg files...\e[m\n"
+inkscape -o tga/background_l2.png -d 90 background_l2.svg
+inkscape -o tga/bigbutton_c.png -d 90 bigbutton_c.svg
+inkscape -o tga/bigbutton_f.png -d 90 bigbutton_f.svg
+inkscape -o tga/bigbutton_n.png -d 90 bigbutton_n.svg
+inkscape -o tga/border.png -d 90 border.svg
+inkscape -o tga/button_c.png -d 45 button_c.svg
+inkscape -o tga/button_f.png -d 45 button_f.svg
+inkscape -o tga/button_n.png -d 45 button_n.svg
+inkscape -o tga/charmapbutton.png -d 45 charmapbutton.svg
+inkscape -o tga/checkbox_n0.png -d 45 checkbox_n0.svg
+inkscape -o tga/checkbox_n1.png -d 45 checkbox_n1.svg
+inkscape -o tga/checkmark.png -d 45 checkmark.svg
+inkscape -o tga/closebutton_c.png -d 90 closebutton_c.svg
+inkscape -o tga/closebutton_f.png -d 90 closebutton_f.svg
+inkscape -o tga/closebutton_n.png -d 90 closebutton_n.svg
+inkscape -o tga/color.png -d 45 color.svg
+inkscape -o tga/crosshairbutton_c.png -d 45 crosshairbutton_c.svg
+inkscape -o tga/crosshairbutton_f.png -d 45 crosshairbutton_f.svg
+inkscape -o tga/cursor.png -d 45 cursor.svg
+inkscape -o tga/inputbox_f.png -d 45 inputbox_f.svg
+inkscape -o tga/inputbox_n.png -d 45 inputbox_n.svg
+inkscape -o tga/radiobutton_c.png -d 45 radiobutton_c.svg
+inkscape -o tga/radiobutton_f.png -d 45 radiobutton_f.svg
+inkscape -o tga/radiobutton_n.png -d 45 radiobutton_n.svg
+inkscape -o tga/scrollbar_n.png -d 45 scrollbar_n.svg
+inkscape -o tga/scrollbar_s.png -d 45 scrollbar_s.svg
+inkscape -o tga/slider_n.png -d 45 slider_n.svg
+inkscape -o tga/slider_s.png -d 45 slider_s.svg
+inkscape -o tga/tooltip.png -d 45 tooltip.svg
cd tga
-echo "Converting png to tga..."
+printf "\e[1mConverting png to tga...\e[m\n"
#(png-tga fileIn fileOut grayscale alpha0.5)
-gimp -d -f -i \
+gimp -d -f -i --batch-interpreter plug-in-script-fu-eval \
-b '(png-tga "background_l2.png" "background_l2.tga" 0 0)' \
-b '(png-tga "background_l2.png" "background_ingame.tga" 0 0)' \
-b '(png-tga "bigbutton_c.png" "bigbutton_c.tga" 0 0)' \
-b '(png-tga "tooltip.png" "tooltip.tga" 0 0)' \
-b '(gimp-quit 0)'
-echo "Removing png files from /tga ..."
+printf "\e[1mRemoving png files from /tga ...\e[m\n"
rm background_l2.png
rm bigbutton_c.png
rm bigbutton_f.png
rm slider_s.png
rm tooltip.png
-echo "Export complete."
+printf "\e[1;32mExport to ./tga/ complete.\e[m\n"
-#!/bin/bash
-#Requires vi, Inkscape, Gimp and ~/.gimp*/scripts/png-tga.scm
+#!/bin/sh
+#Requires vi, Inkscape, Gimp and ~/.config/GIMP/*.*/scripts/png-tga.scm
#Used when the version number in background_l2.svg is changed.
#Exports png images from background_l2.svg of all color versions,
#converts them to tga and copyies them into wickedx folders in /tga
-echo "Creating folders ..."
+# bones_was_here: updated for inkscape 1.2.2 and gimp 2.10.34 / 3.0
+# but script-fu seems broken in gimp 3.0-RC2
+
+set -e
+
+printf "\e[1mCreating folders ...\e[m\n"
if [ ! -d tga ]
then
mkdir tga
cd ..
-echo "Creating individual color versions of background_l2.svg ..."
+printf "\e[1mCreating individual color versions of background_l2.svg ...\e[m\n"
cp background_l2.svg background_l2_blue.svg
cp background_l2.svg background_l2_green.svg
cp background_l2.svg background_l2_magenta.svg
:quit
EOF
-echo "Exporting png images from svg files..."
-inkscape -e tga/background_l2.png -d 90 background_l2.svg
-inkscape -e tga/background_l2_blue.png -d 90 background_l2_blue.svg
-inkscape -e tga/background_l2_green.png -d 90 background_l2_green.svg
-inkscape -e tga/background_l2_magenta.png -d 90 background_l2_magenta.svg
-inkscape -e tga/background_l2_red.png -d 90 background_l2_red.svg
-inkscape -e tga/background_l2_yellow.png -d 90 background_l2_yellow.svg
+printf "\e[1mExporting png images from svg files...\e[m\n"
+inkscape -o tga/background_l2.png -d 90 background_l2.svg
+inkscape -o tga/background_l2_blue.png -d 90 background_l2_blue.svg
+inkscape -o tga/background_l2_green.png -d 90 background_l2_green.svg
+inkscape -o tga/background_l2_magenta.png -d 90 background_l2_magenta.svg
+inkscape -o tga/background_l2_red.png -d 90 background_l2_red.svg
+inkscape -o tga/background_l2_yellow.png -d 90 background_l2_yellow.svg
rm background_l2_blue.svg
rm background_l2_green.svg
rm background_l2_magenta.svg
rm background_l2_red.svg
rm background_l2_yellow.svg
-echo "Converting png to tga..."
+printf "\e[1mConverting png to tga...\e[m\n"
#(png-tga fileIn fileOut grayscale alpha0.5)
cd tga
-gimp -d -f -i \
+gimp -d -f -i --batch-interpreter plug-in-script-fu-eval \
-b '(png-tga "background_l2.png" "background_l2.tga" 0 0)' \
-b '(png-tga "background_l2_blue.png" "background_l2_blue.tga" 0 0)' \
-b '(png-tga "background_l2_green.png" "background_l2_green.tga" 0 0)' \
-b '(png-tga "background_l2_yellow.png" "background_l2_yellow.tga" 0 0)' \
-b '(gimp-quit 0)'
-echo "Copying tga files to folders and removing temporary files..."
+printf "\e[1mCopying tga files to folders and removing temporary files...\e[m\n"
cp background_l2.tga wickedx/background_l2.tga
cp background_l2.tga wickedx/background_ingame.tga
cp background_l2_blue.tga wickedx_blue/background_l2.tga
rm background_l2_red.tga
rm background_l2_yellow.tga
-echo "Export complete."
+printf "\e[1;32mExport to ./tga/ complete.\e[m\n"