Last active 10 months ago

jackz's Avatar jackz revised this gist 10 months ago. Go to revision

No changes

jackz's Avatar Jackz revised this gist 6 years ago. Go to revision

No changes

jackz's Avatar Jackz revised this gist 6 years ago. Go to revision

No changes

jackz's Avatar Jackz revised this gist 6 years ago. Go to revision

3 files changed, 83 insertions

render.sh(file created)

@@ -0,0 +1,59 @@
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 +

renderCPU.sh(file created)

@@ -0,0 +1,13 @@
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 +

renderGPU.sh(file created)

@@ -0,0 +1,11 @@
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
Newer Older