]> git.xonotic.org Git - xonotic/xonotic.git/blob - misc/mediasource/menuskins/wickedx/svg/export_newversion.sh
Merge remote branch 'origin/fruitiex/sev-skin'
[xonotic/xonotic.git] / misc / mediasource / menuskins / wickedx / svg / export_newversion.sh
1 #!/bin/bash
2 #Requires vi, Inkscape, Gimp and ~/.gimp*/scripts/png-tga.scm
3 #Used when the version number in background_l2.svg is changed.
4 #Exports png images from background_l2.svg of all color versions,
5 #converts them to tga and copyies them into wickedx folders in /tga
6
7 echo "Creating folders ..."
8 if [ ! -d tga ]
9 then
10    mkdir tga
11 fi
12
13 cd tga
14
15 if [ ! -d wickedx ]
16 then
17    mkdir wickedx
18 fi
19
20 if [ ! -d wickedx_blue ]
21 then
22    mkdir wickedx_blue
23 fi
24
25 if [ ! -d wickedx_green ]
26 then
27    mkdir wickedx_green
28 fi
29
30 if [ ! -d wickedx_magenta ]
31 then
32    mkdir wickedx_magenta
33 fi
34
35 if [ ! -d wickedx_red ]
36 then
37    mkdir wickedx_red
38 fi
39
40 if [ ! -d wickedx_yellow ]
41 then
42    mkdir wickedx_yellow
43 fi
44
45 cd ..
46
47 echo "Creating individual color versions of background_l2.svg ..."
48 cp background_l2.svg background_l2_blue.svg
49 cp background_l2.svg background_l2_green.svg
50 cp background_l2.svg background_l2_magenta.svg
51 cp background_l2.svg background_l2_red.svg
52 cp background_l2.svg background_l2_yellow.svg
53
54 vi -e background_l2_blue.svg <<-EOF
55 :%s/textures/textures_blue/g
56 :update
57 :quit
58 EOF
59
60 vi -e background_l2_green.svg <<-EOF
61 :%s/textures/textures_green/g
62 :update
63 :quit
64 EOF
65
66 vi -e background_l2_magenta.svg <<-EOF
67 :%s/textures/textures_magenta/g
68 :update
69 :quit
70 EOF
71
72 vi -e background_l2_red.svg <<-EOF
73 :%s/textures/textures_red/g
74 :update
75 :quit
76 EOF
77
78 vi -e background_l2_yellow.svg <<-EOF
79 :%s/textures/textures_yellow/g
80 :update
81 :quit
82 EOF
83
84 echo "Exporting png images from svg files..."
85 inkscape -e tga/background_l2.png -d 90 background_l2.svg
86 inkscape -e tga/background_l2_blue.png -d 90 background_l2_blue.svg
87 inkscape -e tga/background_l2_green.png -d 90 background_l2_green.svg
88 inkscape -e tga/background_l2_magenta.png -d 90 background_l2_magenta.svg
89 inkscape -e tga/background_l2_red.png -d 90 background_l2_red.svg
90 inkscape -e tga/background_l2_yellow.png -d 90 background_l2_yellow.svg
91 rm background_l2_blue.svg
92 rm background_l2_green.svg
93 rm background_l2_magenta.svg
94 rm background_l2_red.svg
95 rm background_l2_yellow.svg
96
97 echo "Converting png to tga..."
98 #(png-tga fileIn fileOut grayscale alpha0.5)
99 cd tga
100 gimp -d -f -i \
101 -b '(png-tga "background_l2.png" "background_l2.tga" 0 0)' \
102 -b '(png-tga "background_l2_blue.png" "background_l2_blue.tga" 0 0)' \
103 -b '(png-tga "background_l2_green.png" "background_l2_green.tga" 0 0)' \
104 -b '(png-tga "background_l2_magenta.png" "background_l2_magenta.tga" 0 0)' \
105 -b '(png-tga "background_l2_red.png" "background_l2_red.tga" 0 0)' \
106 -b '(png-tga "background_l2_yellow.png" "background_l2_yellow.tga" 0 0)' \
107 -b '(gimp-quit 0)'
108
109 echo "Copying tga files to folders and removing temporary files..."
110 cp background_l2.tga wickedx/background_l2.tga
111 cp background_l2.tga wickedx/background_ingame.tga
112 cp background_l2_blue.tga wickedx_blue/background_l2.tga
113 cp background_l2_blue.tga wickedx_blue/background_ingame.tga
114 cp background_l2_green.tga wickedx_green/background_l2.tga
115 cp background_l2_green.tga wickedx_green/background_ingame.tga
116 cp background_l2_magenta.tga wickedx_magenta/background_l2.tga
117 cp background_l2_magenta.tga wickedx_magenta/background_ingame.tga
118 cp background_l2_red.tga wickedx_red/background_l2.tga
119 cp background_l2_red.tga wickedx_red/background_ingame.tga
120 cp background_l2_yellow.tga wickedx_yellow/background_l2.tga
121 cp background_l2_yellow.tga wickedx_yellow/background_ingame.tga
122
123 rm background_l2.png
124 rm background_l2_blue.png
125 rm background_l2_green.png
126 rm background_l2_magenta.png
127 rm background_l2_red.png
128 rm background_l2_yellow.png
129 rm background_l2.tga
130 rm background_l2_blue.tga
131 rm background_l2_green.tga
132 rm background_l2_magenta.tga
133 rm background_l2_red.tga
134 rm background_l2_yellow.tga
135
136 echo "Export complete."