render.sh
· 1.4 KiB · Bash
Raw
#!/bin/bash
#category: setup arguments
main_setup() {
if [ $# -eq 0 ]; then
echo "Please specify a .blend file"
exit
fi
#category: modify arguments
blend_file=$1
shift
zip_file=${blend_file%".blend"}
zip_file=${zip_file#"blends/"}
if [[ $# -ge 2 ]]; then
framearg="--render-frame ${1}..${2}"
shift 2
else
framearg="-a"
fi
if [[ ! $blend_file == *.blend ]]; then
blend_file=${blend_file}.blend
fi
if [[ ! -e $blend_file ]]; then
if [ ! -f "blends/$blend_file" ] ; then
echo "Blend file missing, and not found in blends folder"
exit
else
blend_file="blends/$blend_file"
echo "Found blend file in blends folder"
fi
fi
}
#category: clean up & archive
checkTmp() {
#check if files were generated
if [ -z "$(ls -A /home/ezra/tmp)" ]; then
echo "No files were generated in ~/tmp" | tee -a logs/blender.log
exit
fi
}
#if pre-existing .zip, make new
createZip() {
if [[ -e "zips/${zip_file}.zip" ]]; then
counter=1
# until a zip file doesnt exist, then keep looping
until [ ! -e "zips/${zip_file} (${counter}).zip" ]
do
((counter++))
done
#todo: add duplicate"
zip_file="${zip_file} (${counter})"
fi
zip -j -r "zips/${zip_file}.zip" /home/ezra/tmp/* &&
rm /home/ezra/tmp/*.png
}
1 | #!/bin/bash |
2 | #category: setup arguments |
3 | main_setup() { |
4 | if [ $# -eq 0 ]; then |
5 | echo "Please specify a .blend file" |
6 | exit |
7 | fi |
8 | #category: modify arguments |
9 | blend_file=$1 |
10 | shift |
11 | zip_file=${blend_file%".blend"} |
12 | zip_file=${zip_file#"blends/"} |
13 | if [[ $# -ge 2 ]]; then |
14 | framearg="--render-frame ${1}..${2}" |
15 | shift 2 |
16 | else |
17 | framearg="-a" |
18 | fi |
19 | |
20 | if [[ ! $blend_file == *.blend ]]; then |
21 | blend_file=${blend_file}.blend |
22 | fi |
23 | |
24 | if [[ ! -e $blend_file ]]; then |
25 | if [ ! -f "blends/$blend_file" ] ; then |
26 | echo "Blend file missing, and not found in blends folder" |
27 | exit |
28 | else |
29 | blend_file="blends/$blend_file" |
30 | echo "Found blend file in blends folder" |
31 | fi |
32 | fi |
33 | } |
34 | |
35 | #category: clean up & archive |
36 | checkTmp() { |
37 | #check if files were generated |
38 | if [ -z "$(ls -A /home/ezra/tmp)" ]; then |
39 | echo "No files were generated in ~/tmp" | tee -a logs/blender.log |
40 | exit |
41 | fi |
42 | } |
43 | #if pre-existing .zip, make new |
44 | createZip() { |
45 | if [[ -e "zips/${zip_file}.zip" ]]; then |
46 | counter=1 |
47 | # until a zip file doesnt exist, then keep looping |
48 | until [ ! -e "zips/${zip_file} (${counter}).zip" ] |
49 | do |
50 | ((counter++)) |
51 | done |
52 | #todo: add duplicate" |
53 | zip_file="${zip_file} (${counter})" |
54 | fi |
55 | zip -j -r "zips/${zip_file}.zip" /home/ezra/tmp/* && |
56 | rm /home/ezra/tmp/*.png |
57 | } |
58 | |
59 | |
60 |
renderCPU.sh
· 416 B · Bash
Raw
#!/bin/bash
. "./render.sh"
#category: setup arguments
main_setup $@
echo "Running CPU Blend for $blend_file ($(blender -b --version))" | tee logs/blender.log
# run blender
(blender -b "$blend_file" -noaudio --render-output "/home/ezra/tmp/" -P python_scripts/settings.py -P -y ${framearg} | tee -a logs/blender.log ) 3>&1 1>&2 2>&3 | tee logs/blender_errors.log
#category: clean up & archive
checkTmp
createZip
1 | #!/bin/bash |
2 | . "./render.sh" |
3 | #category: setup arguments |
4 | main_setup $@ |
5 | echo "Running CPU Blend for $blend_file ($(blender -b --version))" | tee logs/blender.log |
6 | # run blender |
7 | (blender -b "$blend_file" -noaudio --render-output "/home/ezra/tmp/" -P python_scripts/settings.py -P -y ${framearg} | tee -a logs/blender.log ) 3>&1 1>&2 2>&3 | tee logs/blender_errors.log |
8 | |
9 | #category: clean up & archive |
10 | checkTmp |
11 | createZip |
12 | |
13 | |
14 |
renderGPU.sh
· 454 B · Bash
Raw
#!/bin/bash
. "./render.sh"
#category: setup arguments
main_setup "$@"
echo "Running GPU Blend for $blend_file ($(blender -b --version))" | tee logs/blender.log
# run blender
(blender -b "$blend_file" -noaudio --render-output "/home/ezra/tmp/" -E CYCLES -P python_scripts/settings.py -P python_scripts/render_gpu.py -y ${framearg} | tee -a logs/blender.log ) 3>&1 1>&2 2>&3 | tee logs/blender_errors.log
#category: clean up & archive
checkTmp
createZip
1 | #!/bin/bash |
2 | . "./render.sh" |
3 | #category: setup arguments |
4 | main_setup "$@" |
5 | echo "Running GPU Blend for $blend_file ($(blender -b --version))" | tee logs/blender.log |
6 | # run blender |
7 | (blender -b "$blend_file" -noaudio --render-output "/home/ezra/tmp/" -E CYCLES -P python_scripts/settings.py -P python_scripts/render_gpu.py -y ${framearg} | tee -a logs/blender.log ) 3>&1 1>&2 2>&3 | tee logs/blender_errors.log |
8 | |
9 | #category: clean up & archive |
10 | checkTmp |
11 | createZip |