Skip to content

Commit 9f9e1db

Browse files
committed
WIP exporter for ANI using GIMP 2.99.12
Once I figure out how to coerce an object into a Gimp.Int32Array the day will be mine.
1 parent 5971c2f commit 9f9e1db

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

ani_test.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#! /usr/bin/env bash
2+
3+
./gimp_ani.sh Cursor_Error TEST 8 0 0

gimp_ani.sh

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#! /usr/bin/env bash
2+
3+
# Signature
4+
# scene_name windows_name delay hotx hoty
5+
scene_name=$1
6+
windows_name=$2
7+
delay=$3
8+
hotx=$4
9+
hoty=$5
10+
11+
images=(./working/$1/frames/*.png)
12+
first=${images[0]}
13+
unset images[0]
14+
15+
pycode="
16+
try:
17+
img = Gimp.list_images()[0]
18+
19+
loaded_layers = [Gimp.file_load_layer(1, img, Gio.file_new_for_path(i)) for i in '${images[@]}'.split(' ')]
20+
for lay in loaded_layers:
21+
img.insert_layer(lay, None, 0)
22+
23+
layers = img.list_layers()
24+
size = len(layers)
25+
26+
c = Gimp.get_pdb().lookup_procedure('file-ani-save').create_config()
27+
c.set_property('image', img)
28+
c.set_property('file', Gio.file_new_for_path('./icons/nier_cursors_windows/$windows_name.ani'))
29+
c.set_property('drawables', Gimp.ObjectArray.new(Gimp.Drawable, layers, False))
30+
c.set_property('num-drawables', size)
31+
c.set_property('author-name', 'Beinsezii')
32+
c.set_property('cursor-name', 'NieR_$name')
33+
c.set_property('default-delay', $delay)
34+
c.set_property('n-hot-spot-x', size)
35+
c.set_property('n-hot-spot-y', size)
36+
37+
# TODO figure out how to construct a Gimp.Int32Array
38+
# has no constructor
39+
# doesn't like python lists, Gimp.Array, or Gimp.ValueArray
40+
# the fuck do I do. introspection why you do dis
41+
42+
# c.set_property('hot-spot-x', [$hotx] * size)
43+
# c.set_property('hot-spot-y', [$hoty] * size)
44+
45+
Gimp.get_pdb().run_procedure_config('file-ani-save', c)
46+
47+
except Exception as e:
48+
print(f'BEGIN_GIMP_ANI_ERROR\n\n\n{e}\n\n\nEND_GIMP_ANI_ERROR')
49+
"
50+
51+
gimp-2.99 --batch-interpreter python-fu-eval --quit -idfb "$pycode" $first

0 commit comments

Comments
 (0)