-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
59 lines (48 loc) · 1.76 KB
/
build.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
#!/bin/bash
# Build script for the uHbench
# ============================
#
# This script is a helper tool to get the rendered files built in one go.
# There is a pretty good chance this will not work on your system, but you can try ;)
#
# First, have all the right tools installed:
# - BLender with Freestyle and Freestyle-SVG-exporter activated in your user.prefs
# - Inkscape
# - ImageMagick
# - XMLStarlet
#
# Then run it with: sh build.sh
# And watch the console for errors.
# Complaints, suggestions or bitcoins, send them to julien [at] xuv.be
# SETTINGS
# --------
FILENAME=uhbench
# This corresponds to the names used for the scenes in the .blend file. Oviously, don't use space in your names.
STEPS=(step0 step1 step2 step3 step4 step5 step6 step7 step8)
BUILD_DIR=build
# BLENDER rendering
# -----------------
for s in ${STEPS[@]}
do
# Launch Blender render for selected scene
blender -b ${FILENAME}.blend -S ${s} --render-output //${BUILD_DIR}/${s}_ -f 1
# Remove extra "fills" in the SVG
# This line should be removed once Freestyle-SVG-exporter handles toggling "Contour Fills" per lineset
xmlstarlet ed -L -N svg="http://www.w3.org/2000/svg" -d "//svg:g[@id='RenderLayer_InLine']/svg:g[@id='fills']" ${BUILD_DIR}/${s}_0001.svg
done
# Clean up remove unused files
echo "Cleaning up..."
rm ${BUILD_DIR}/*.png
# IMAGE rendering
# ---------------
# Generate a gif ;)
echo "Creating animated GIF..."
convert -delay 100 -loop 0 ${BUILD_DIR}/step*.svg ${FILENAME}.gif
# Rendering the png, jpg and pdf
echo "Rendering to PNG"
inkscape -f ${FILENAME}.svg -e ${FILENAME}.png
echo "Rendering to JPG"
inkscape -f ${FILENAME}.svg --export-dpi 300 -e ${FILENAME}.jpg
echo "Rendering to PDF"
inkscape -f ${FILENAME}.svg --export-text-to-path -A ${FILENAME}.pdf
echo "Done."