- 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.
This commit is contained in:
Ton Roosendaal
2003-07-19 20:14:07 +00:00
parent 542f05451a
commit 3d691c77cf

View File

@@ -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) {