diff options
author | Ton Roosendaal <ton@blender.org> | 2003-07-20 00:14:07 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2003-07-20 00:14:07 +0400 |
commit | 3d691c77cf9ce1c09c46966cad8956e78cc73d20 (patch) | |
tree | baaefd04d8bb05209e848a8fa9a5ff67c51597d1 /source/creator | |
parent | 542f05451abea024972513968985495b81679e08 (diff) |
- Blender in background render mode (blender -b) now reacts to CTRL+C
again. You'll have to do it twice... first CTRL+C will send an internal
break (exit render loops)
- I prefer this in foreground mode too, but Python uses it as well, to
escape from loops. We have to fix this once.
Diffstat (limited to 'source/creator')
-rw-r--r-- | source/creator/creator.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/creator/creator.c b/source/creator/creator.c index dd13815c664..04e2c9b95ea 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -86,6 +86,7 @@ #include "SYS_System.h" #include <signal.h> + #ifdef __FreeBSD__ #ifndef __OpenBSD__ #include <floatingpoint.h> @@ -126,6 +127,25 @@ static void fpe_handler(int sig) // printf("SIGFPE trapped\n"); } +/* handling ctrl-c event in console */ +static void blender_esc(int sig) +{ + static int count = 0; + + G.afbreek = 1; /* forces render loop to read queue, not sure if its needed */ + + if (sig == 2) { + if (count) { + printf("\nBlender killed\n"); + exit(2); + } + printf("\nSent an internal break event. Press ^C again to kill Blender\n"); + count++; + } +} + + + static void print_help(void) { printf ("Blender V %d.%02d\n", G.version/100, G.version%100); @@ -202,6 +222,7 @@ int main(int argc, char **argv) argv[1]= firstfilebuf; } } + #endif #ifdef __FreeBSD__ @@ -295,6 +316,10 @@ int main(int argc, char **argv) setuid(getuid()); /* end superuser */ #endif + /* for all platforms, even windos has it! */ + if(G.background) signal(SIGINT, blender_esc); /* ctrl c out bg render */ + + RE_init_render_data(); /* must be called here because R.winpos from default file */ if(G.background==0) { |