Skip to content
Snippets Groups Projects
Commit 46b5e138 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

ask if we should remove the temp files
parent 29d84ead
No related branches found
No related tags found
No related merge requests found
// 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;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment