From 46b5e138cebbf58be7b96b666e360ae51286d38c Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sun, 16 Jan 2005 20:40:07 +0000 Subject: [PATCH] ask if we should remove the temp files --- demos/anim.script | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/demos/anim.script b/demos/anim.script index d4caf9035e..c47bd1d981 100644 --- a/demos/anim.script +++ b/demos/anim.script @@ -1,32 +1,29 @@ // A demo script to save mpeg or gif animations of post-processing views -oldw = General.GraphicsWidth; -oldh = General.GraphicsHeight; +all = GetValue("Animate one view at a time or all views together? -all = GetValue("Animate one view at a time, or all views together (0=one, 1=all)?", 1) ; +0: one at a time, 1: all together", 1) ; + +oldw = General.GraphicsWidth; General.GraphicsWidth = GetValue("Width of animation?", 640); + +oldh = General.GraphicsHeight; General.GraphicsHeight = GetValue("Height of animation?", 640) ; -method = GetValue("Animation method? (0=mpeg_encode, 1=mencoder, 2=whirlgif)?", 0) ; + +method = GetValue("Animation method? + +0: mpeg_encode (MPEG1), 1: mencoder (MPEG4), 2: whirlgif (GIF89)", 0) ; MPEG_ENCODE = 0; MENCODER = 1; WHIRLGIF = 2; Print.JpegQuality = 100; -// Clean-up temp files from previous run -If(method == WHIRLGIF) - System "rm -f /tmp/tmp*.gif" ; -EndIf -If(method == MPEG_ENCODE || method == MENCODER) - System "rm -f /tmp/tmp*.jpg /tmp/tmp.par" ; -EndIf - If(all) For i In {1:PostProcessing.NbViews} View[i-1].TimeStep = 0; EndFor // Use the first view as the reference - frame = View[0].NbTimeStep; For index In {1:View[0].NbTimeStep} Draw; If(method == WHIRLGIF) @@ -102,5 +99,19 @@ If(method == MPEG_ENCODE) System "mpeg_encode /tmp/tmp.par" ; EndIf +// Clean-up temp files? +cleanup = GetValue("Remove temporary files? + +(The final animation has been saved in /tmp/animation.{gif.mpg})", 1); + +If(cleanup) + If(method == WHIRLGIF) + System "rm -f /tmp/tmp*.gif" ; + EndIf + If(method == MPEG_ENCODE || method == MENCODER) + System "rm -f /tmp/tmp*.jpg /tmp/tmp.par" ; + EndIf +EndIf + General.GraphicsWidth = oldw; General.GraphicsHeight = oldh; -- GitLab