-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto_convert_ze2_models.sh
executable file
·61 lines (52 loc) · 2.46 KB
/
auto_convert_ze2_models.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Batch model converter script.
# Copyright (C) 2023 KerJoe.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Go to script directory
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
DIR="$(realpath -e -- "$DIR")"
cd ${DIR}
shopt -s extglob
source .venv/bin/activate
mkdir workdir
mkdir workdir/ze2_data_en_us
mkdir workdir/converted_models
mkdir workdir/converted_rooms
mkdir workdir/extracted_models
mkdir workdir/extracted_rooms
for FILE in $(find "workdir/ze2_data_en_us/13-781874508/" -type f); do
if [[ $(head -c 4 "${FILE}") == 'PACK' ]]; then
echo Extracting: ${FILE}
pack/unpacker.py "${FILE}" workdir/extracted_rooms
fi
done
for MODEL in "workdir/extracted_rooms/scenes/room/"*; do
MODEL_BASE=$(basename ${MODEL})
model_converter/blender_exporter.py workdir/converted_rooms/${MODEL_BASE}.blend ${MODEL}/mdl/* ${MODEL}/tex/*
done
CHARACTER_MODEL_FILES="22-1425188142/1587-131694615?(.zip) 22-1425188142/1588-149960206?(.zip) 22-1425188142/1589-492857346?(.zip) 22-1425188142/1590-662806346?(.zip) 22-1425188142/1591-689670353?(.zip) 22-1425188142/1592-743994043?(.zip) 22-1425188142/1593-1526829868?(.zip) 22-1425188142/1594-1611492479?(.zip) 22-1425188142/1595-1780513493?(.zip) 22-1425188142/1596-1874134169?(.zip) 22-1425188142/1597-1984660750?(.zip) 22-1425188142/1598-2076631810?(.zip)"
for MODEL in ${CHARACTER_MODEL_FILES}; do
unzip -o "workdir/ze2_data_en_us/"${MODEL} -d workdir/extracted_models
done
for MODEL in "workdir/extracted_models/scenes/chara/"*; do
MODEL_BASE=$(basename ${MODEL})
for ANIMATION in "" ${MODEL}/*.motion; do
ANIMATION_BASE=$(basename ${ANIMATION} .motion)
if [ -z ${ANIMATION} ]; then
ANIMATION_BASE="base"
fi
model_converter/blender_exporter.py workdir/converted_models/${MODEL_BASE}.${ANIMATION_BASE}.blend ${MODEL}/scene.bsn ${MODEL}/mdl/* ${MODEL}/tex/* ${ANIMATION}
done
done