Commit 20d79613 authored by Breno Rilho Lemos's avatar Breno Rilho Lemos 💬
Browse files

Add resolution and duration options to workflow.sh

parent 14f3cce1
...@@ -33,8 +33,8 @@ if [[ ${PIPESTATUS[0]} -ne 4 ]]; then ...@@ -33,8 +33,8 @@ if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
exit 1 exit 1
fi fi
OPTIONS=hdau:m: OPTIONS=hdau:m:t:r: # t-duration; r-resolution;
LONGOPTS=maxparticles:,help,download,default,url: LONGOPTS=resolution:,duration:,maxparticles:,help,download,default,url:
# -regarding ! and PIPESTATUS see above # -regarding ! and PIPESTATUS see above
# -temporarily store output to be able to check for errors # -temporarily store output to be able to check for errors
...@@ -52,6 +52,8 @@ eval set -- "$PARSED" ...@@ -52,6 +52,8 @@ eval set -- "$PARSED"
############################## ##############################
# Parse Parameters # # Parse Parameters #
############################## ##############################
DURATION=10
RESOLUTION=100
MAX_PARTICLES=0 MAX_PARTICLES=0
HELP=false HELP=false
DOWNLOAD=false DOWNLOAD=false
...@@ -65,7 +67,7 @@ while true; do ...@@ -65,7 +67,7 @@ while true; do
shift shift
break break
;; ;;
-d|--download) -d|--download)
DOWNLOAD=true DOWNLOAD=true
shift shift
;; ;;
...@@ -81,6 +83,14 @@ while true; do ...@@ -81,6 +83,14 @@ while true; do
MAX_PARTICLES="$2" MAX_PARTICLES="$2"
shift 2 shift 2
;; ;;
-t|--duration)
DURATION="$2"
shift 2
;;
-r|--resolution)
RESOLUTION="$2"
shift 2
;;
--) --)
shift shift
break break
...@@ -118,6 +128,10 @@ Usage: ...@@ -118,6 +128,10 @@ Usage:
See example below. See example below.
-m | --maxparticles VALUE -m | --maxparticles VALUE
Get only events for which its number of particles is smaller than VALUE. Get only events for which its number of particles is smaller than VALUE.
-t | --duration VALUE
Set the animation duration in seconds.
-r | --resolution VALUE
Set the animation resolution percentage.
-a | --default -a | --default
Creates a default animation with blender. Creates a default animation with blender.
...@@ -172,7 +186,7 @@ if [ "$DEFAULT" = "true" ]; then ...@@ -172,7 +186,7 @@ if [ "$DEFAULT" = "true" ]; then
# Phase 1: blender animate # # Phase 1: blender animate #
############################## ##############################
pushd ${BLENDER_SCRIPT_DIR} pushd ${BLENDER_SCRIPT_DIR}
blender -noaudio --background -P animate_particles.py -- -radius=0.05 -duration=2 -camera="OverviewCamera" -datafile="d-esd-detail.dat" -simulated_t=0.02 -fps=5 -resolution=100 -stamp_note="Texto no canto" blender -noaudio --background -P animate_particles.py -- -radius=0.05 -duration=${DURATION} -camera="OverviewCamera" -datafile="d-esd-detail.dat" -simulated_t=0.03 -fps=24 -resolution=${RESOLUTION} -stamp_note="Default animation"
popd popd
BLENDER_OUTPUT=. BLENDER_OUTPUT=.
mkdir --verbose -p ${BLENDER_OUTPUT} mkdir --verbose -p ${BLENDER_OUTPUT}
...@@ -245,7 +259,7 @@ elif [ "$DEFAULT" = "false" ]; then ...@@ -245,7 +259,7 @@ elif [ "$DEFAULT" = "false" ]; then
for type in "BarrelCamera" "OverviewCamera" "ForwardCamera"; do for type in "BarrelCamera" "OverviewCamera" "ForwardCamera"; do
echo "Processing ${EVENT_UNIQUE_ID} with $type Camera in blender" echo "Processing ${EVENT_UNIQUE_ID} with $type Camera in blender"
blender -noaudio --background -P animate_particles.py -- -radius=0.05 -duration=1 -camera=${type} -datafile="${LOCAL_FILE_WITH_DATA}" -n_event=${EVENT_ID} -simulated_t=0.01 -fps=5 -resolution=50 -stamp_note="${EVENT_UNIQUE_ID}" blender -noaudio --background -P animate_particles.py -- -radius=0.05 -duration=${DURATION} -camera=${type} -datafile="${LOCAL_FILE_WITH_DATA}" -n_event=${EVENT_ID} -simulated_t=0.03 -fps=24 -resolution=${RESOLUTION} -stamp_note="${EVENT_UNIQUE_ID}"
# Move generated file to final location # Move generated file to final location
mv /tmp/blender/* ${BLENDER_OUTPUT} mv /tmp/blender/* ${BLENDER_OUTPUT}
echo "${type} for event ${EVENT_ID} done." echo "${type} for event ${EVENT_ID} done."
...@@ -257,7 +271,7 @@ elif [ "$DEFAULT" = "false" ]; then ...@@ -257,7 +271,7 @@ elif [ "$DEFAULT" = "false" ]; then
popd popd
echo "EVENT ${EVENT_UNIQUE_ID} DONE with FILE $LOCAL_FILE_WITH_DATA." echo "EVENT ${EVENT_UNIQUE_ID} DONE with FILE $LOCAL_FILE_WITH_DATA."
else else
echo "Too much particles (maximum accepted is $MAX_PARTICLES). Continue." echo "Too many particles (maximum accepted is $MAX_PARTICLES). Continue."
rm $FILE_WITH_DATA rm $FILE_WITH_DATA
continue continue
fi fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment