4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
33 /* for setuid / getuid */
35 #include <sys/types.h>
39 /* This little block needed for linking to Blender... */
41 #include "MEM_guardedalloc.h"
44 #include "BLI_winstuff.h"
47 #include "GEN_messaging.h"
50 #include "DNA_scene_types.h"
52 #include "BLI_blenlib.h"
54 #include "BKE_utildefines.h"
55 #include "BKE_blender.h"
56 #include "BKE_context.h"
58 #include "BKE_global.h"
60 #include "BKE_material.h"
61 #include "BKE_packedFile.h"
62 #include "BKE_scene.h"
64 #include "BKE_report.h"
66 #include "IMB_imbuf.h" // for quicktime_init
68 #ifndef DISABLE_PYTHON
69 #include "BPY_extern.h"
72 #include "RE_pipeline.h"
74 //XXX #include "playanim_ext.h"
75 #include "ED_datafiles.h"
76 #include "UI_interface.h"
81 #include "GPU_extensions.h"
83 /* for passing information between creator and gameengine */
84 #include "SYS_System.h"
89 # include <sys/types.h>
90 # include <floatingpoint.h>
91 # include <sys/rtprio.h>
100 extern char * build_date;
101 extern char * build_time;
102 extern char * build_platform;
103 extern char * build_type;
106 /* Local Function prototypes */
107 static void print_help(void);
108 static void print_version(void);
110 /* for the callbacks: */
112 extern int pluginapi_force_ref(void); /* from blenpluginapi:pluginapi.c */
114 char bprogname[FILE_MAXDIR+FILE_MAXFILE]; /* from blenpluginapi:pluginapi.c */
115 char btempdir[FILE_MAXDIR+FILE_MAXFILE];
117 /* Initialise callbacks for the modules that need them */
118 static void setCallbacks(void);
120 #if defined(__sgi) || defined(__alpha__)
121 static void fpe_handler(int sig)
123 // printf("SIGFPE trapped\n");
127 /* handling ctrl-c event in console */
128 static void blender_esc(int sig)
130 static int count = 0;
132 G.afbreek = 1; /* forces render loop to read queue, not sure if its needed */
136 printf("\nBlender killed\n");
139 printf("\nSent an internal break event. Press ^C again to kill Blender\n");
144 static void print_version(void)
147 printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
148 printf ("\tbuild date: %s\n", build_date);
149 printf ("\tbuild time: %s\n", build_time);
150 printf ("\tbuild revision: %s\n", build_rev);
151 printf ("\tbuild platform: %s\n", build_platform);
152 printf ("\tbuild type: %s\n", build_type);
154 printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
158 static void print_help(void)
160 printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
161 printf ("Usage: blender [args ...] [file] [args ...]\n");
162 printf ("\nRender options:\n");
163 printf (" -b <file>\tRender <file> in background (doesn't load the user defaults .B.blend file)\n");
164 printf (" -a render frames from start to end (inclusive), only works when used after -b\n");
165 printf (" -S <name>\tSet scene <name>\n");
166 printf (" -f <frame>\tRender frame <frame> and save it\n");
167 printf (" -s <frame>\tSet start to frame <frame> (use before the -a argument)\n");
168 printf (" -e <frame>\tSet end to frame <frame> (use before the -a argument)\n");
169 printf (" -o <path>\tSet the render path and file name.\n");
170 printf (" Use // at the start of the path to\n");
171 printf (" render relative to the blend file.\n");
172 printf (" The # characters are replaced by the frame number, and used to define zero padding.\n");
173 printf (" ani_##_test.png becomes ani_01_test.png\n");
174 printf (" test-######.png becomes test-000001.png\n");
175 printf (" When the filename has no #, The suffix #### is added to the filename\n");
176 printf (" The frame number will be added at the end of the filename.\n");
177 printf (" eg: blender -b foobar.blend -o //render_ -F PNG -x 1 -a\n");
178 printf ("\nFormat options:\n");
179 printf (" -F <format>\tSet the render format, Valid options are...\n");
180 printf (" \tTGA IRIS HAMX JPEG MOVIE IRIZ RAWTGA\n");
181 printf (" \tAVIRAW AVIJPEG PNG BMP FRAMESERVER\n");
182 printf (" (formats that can be compiled into blender, not available on all systems)\n");
183 printf (" \tHDR TIFF EXR MULTILAYER MPEG AVICODEC QUICKTIME CINEON DPX DDS\n");
184 printf (" -x <bool>\tSet option to add the file extension to the end of the file.\n");
185 printf (" -t <threads>\tUse amount of <threads> for rendering (background mode only).\n");
186 printf (" [1-8], 0 for systems processor count.\n");
187 printf ("\nAnimation playback options:\n");
188 printf (" -a <options> <file(s)>\tPlayback <file(s)>, only operates this way when -b is not used.\n");
189 printf (" -p <sx> <sy>\tOpen with lower left corner at <sx>, <sy>\n");
190 printf (" -m\t\tRead from disk (Don't buffer)\n");
191 printf (" -f <fps> <fps-base>\t\tSpecify FPS to start with\n");
192 printf (" -j <frame>\tSet frame step to <frame>\n");
194 printf ("\nWindow options:\n");
195 printf (" -w\t\tForce opening with borders (default)\n");
196 printf (" -W\t\tForce opening without borders\n");
197 printf (" -p <sx> <sy> <w> <h>\tOpen with lower left corner at <sx>, <sy>\n");
198 printf (" \tand width and height <w>, <h>\n");
199 printf ("\nGame Engine specific options:\n");
200 printf (" -g fixedtime\t\tRun on 50 hertz without dropping frames\n");
201 printf (" -g vertexarrays\tUse Vertex Arrays for rendering (usually faster)\n");
202 printf (" -g noaudio\t\tNo audio in Game Engine\n");
203 printf (" -g nomipmap\t\tNo Texture Mipmapping\n");
204 printf (" -g linearmipmap\tLinear Texture Mipmapping instead of Nearest (default)\n");
206 printf ("\nMisc options:\n");
207 printf (" -d\t\tTurn debugging on\n");
208 printf (" -noaudio\tDisable audio on systems that support audio\n");
209 printf (" -nojoystick\tDisable joystick support\n");
210 printf (" -noglsl\tDisable GLSL shading\n");
211 printf (" -h\t\tPrint this help text\n");
212 printf (" -y\t\tDisable automatic python script execution (scriptlinks, pydrivers, pyconstraints, pynodes)\n");
213 printf (" -P <filename>\tRun the given Python script (filename or Blender Text)\n");
215 printf (" -R\t\tRegister .blend extension\n");
217 printf (" -v\t\tPrint Blender version and exit\n");
218 printf (" --\t\tEnds option processing. Following arguments are \n");
219 printf (" \t\t passed unchanged. Access via Python's sys.argv\n");
220 printf ("\nEnvironment Variables:\n");
221 printf (" $HOME\t\t\tStore files such as .blender/ .B.blend .Bfs .Blog here.\n");
223 printf (" $TEMP\t\tStore temporary files here.\n");
225 printf (" $TMP or $TMPDIR\tStore temporary files here.\n");
226 printf (" $BF_TIFF_LIB\t\tUse an alternative libtiff.so for loading tiff image files.\n");
229 printf (" $SDL_AUDIODRIVER\tLibSDL audio driver - alsa, esd, alsa, dma.\n");
231 printf (" $IMAGEEDITOR\t\tImage editor executable, launch with the IKey from the file selector.\n");
232 printf (" $WINEDITOR\t\tText editor executable, launch with the EKey from the file selector.\n");
233 printf (" $PYTHONHOME\t\tPath to the python directory, eg. /usr/lib/python.\n");
234 printf ("\nNote: Arguments must be separated by white space. eg:\n");
235 printf (" \"blender -ba test.blend\"\n");
236 printf (" ...will ignore the 'a'\n");
237 printf (" \"blender -b test.blend -f8\"\n");
238 printf (" ...will ignore 8 because there is no space between the -f and the frame value\n");
239 printf ("Note: Arguments are executed in the order they are given. eg:\n");
240 printf (" \"blender -b test.blend -f 1 -o /tmp\"\n");
241 printf (" ...may not render to /tmp because '-f 1' renders before the output path is set\n");
242 printf (" \"blender -b -o /tmp test.blend -f 1\"\n");
243 printf (" ...may not render to /tmp because loading the blend file overwrites the output path that was set\n");
244 printf (" \"blender -b test.blend -o /tmp -f 1\" works as expected.\n\n");
248 double PIL_check_seconds_timer(void);
250 /* XXX This was here to fix a crash when running python scripts
251 * with -P that used the screen.
253 * static void main_init_screen( void )
255 setscreen(G.curscreen);
257 if(G.main->scene.first==0) {
258 set_scene( add_scene("1") );
262 int main(int argc, char **argv)
264 SYS_SystemHandle syshandle;
265 bContext *C= CTX_create();
266 int a, i, stax, stay, sizx, sizy /*XXX, scr_init = 0*/;
268 #if defined(WIN32) || defined (__linux__)
281 /* patch to ignore argument finder gives us (pid?) */
282 if (argc==2 && strncmp(argv[1], "-psn_", 5)==0) {
283 extern int GHOST_HACK_getFirstFile(char buf[]);
284 static char firstfilebuf[512];
288 if (GHOST_HACK_getFirstFile(firstfilebuf)) {
290 argv[1]= firstfilebuf;
301 signal (SIGFPE, fpe_handler);
305 signal (SIGFPE, fpe_handler);
308 // copy path to executable in bprogname. playanim and creting runtimes
311 BLI_where_am_i(bprogname, argv[0]);
313 /* Hack - force inclusion of the plugin api functions,
314 * see blenpluginapi:pluginapi.c
316 pluginapi_force_ref();
320 initglobals(); /* blender.c */
322 syshandle = SYS_GetSystem();
323 GEN_init_messaging_system();
325 /* first test for background */
327 G.f |= G_DOSCRIPTLINKS; /* script links enabled by default */
329 for(a=1; a<argc; a++) {
331 /* Handle unix and windows style help requests */
332 if ((!strcmp(argv[a], "--help")) || (!strcmp(argv[a], "/?"))){
337 /* end argument processing after -- */
338 if (!strcmp( argv[a], "--")){
343 /* Handle long version request */
344 if (!strcmp(argv[a], "--version")){
349 /* Handle -* switches */
350 else if(argv[a][0] == '-') {
352 case 'a': /* -b was not given, play an animation */
354 /* exception here, see below, it probably needs happens after qt init? */
357 // XXX playanim(argc-1, argv+1);
367 G.f &= ~G_DOSCRIPTLINKS;
371 printf ("-y was used to disable script links because,\n");
372 printf ("\t-p being taken, Ton was of the opinion that Y\n");
373 printf ("\tlooked like a split (disabled) snake, and also\n");
374 printf ("\twas similar to a python's tongue (unproven).\n\n");
376 printf ("\tZr agreed because it gave him a reason to add a\n");
377 printf ("\tcompletely useless text into Blender.\n\n");
379 printf ("\tADDENDUM! Ton, in defense, found this picture of\n");
380 printf ("\tan Australian python, exhibiting her (his/its) forked\n");
381 printf ("\tY tongue. It could be part of an H Zr retorted!\n\n");
382 printf ("\thttp://www.users.bigpond.com/snake.man/\n");
399 setuid(getuid()); /* end superuser */
402 /* for all platforms, even windos has it! */
403 if(G.background) signal(SIGINT, blender_esc); /* ctrl c out bg render */
405 /* background render uses this font too */
406 BKE_font_register_builtin(datatoc_Bfont, datatoc_Bfont_size);
410 if(G.background==0) {
411 for(a=1; a<argc; a++) {
412 if(argv[a][0] == '-') {
414 case 'p': /* prefsize */
416 printf ("-p requires four arguments\n");
428 WM_setprefsize(stax, stay, sizx, sizy);
431 G.f |= G_DEBUG; /* std output printf's */
432 printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
433 MEM_set_memory_debug();
435 printf("Build: %s %s %s %s\n", build_date, build_time, build_platform, build_type);
437 #endif // NAN_BUILDINFO
438 for (i = 0; i < argc; i++) {
439 printf("argv[%d] = %s\n", i, argv[i]);
443 G.f |= G_SWAP_EXCHANGE;
446 /* with borders XXX OLD CRUFT!*/
449 /* borderless, win + linux XXX OLD CRUFT */
450 /* XXX, fixme mein, borderless on OSX */
453 /* Registering filetypes only makes sense on windows... */
455 RegisterBlendExtension(argv[0]);
460 if (BLI_strcasecmp(argv[a], "-noaudio") == 0|| BLI_strcasecmp(argv[a], "-nosound") == 0) {
462 notify the gameengine that no audio is wanted, even if the user didn't give
466 SYS_WriteCommandLineInt(syshandle,"noaudio",1);
468 if (G.f & G_DEBUG) printf("setting audio to: %d\n", audio);
470 if (BLI_strcasecmp(argv[a], "-nojoystick") == 0) {
472 don't initialize joysticks if user doesn't want to use joysticks
473 failed joystick initialization delays over 5 seconds, before game engine start
475 SYS_WriteCommandLineInt(syshandle,"nojoystick",1);
476 if (G.f & G_DEBUG) printf("disabling nojoystick\n");
478 if (BLI_strcasecmp(argv[a], "-noglsl") == 0)
479 GPU_extensions_disable();
485 #ifndef DISABLE_PYTHON
486 BPY_start_python(argc, argv);
489 * NOTE: sound_init_audio() *must be* after start_python,
490 * at least on FreeBSD.
491 * added note (ton): i removed it altogether
497 BLI_where_is_temp( btempdir, 1 ); /* call after loading the .B.blend so we can read U.tempdir */
501 /* On linux the default SDL driver dma often would not play
502 * use alsa if none is set */
503 if ( getenv("SDL_AUDIODRIVER") == NULL) {
504 setenv("SDL_AUDIODRIVER", "alsa", 1);
510 #ifndef DISABLE_PYTHON
511 BPY_start_python(argc, argv);
513 BLI_where_is_temp( btempdir, 0 ); /* call after loading the .B.blend so we can read U.tempdir */
515 // (ton) Commented out. I have no idea whats thisfor... will mail around!
516 // SYS_WriteCommandLineInt(syshandle,"noaudio",1);
518 // sound_init_audio();
519 // if (G.f & G_DEBUG) printf("setting audio to: %d\n", audio);
521 #ifndef DISABLE_PYTHON
523 * NOTE: the U.pythondir string is NULL until WM_init() is executed,
524 * so we provide the BPY_ function below to append the user defined
525 * pythondir to Python's sys.path at this point. Simply putting
526 * WM_init() before BPY_start_python() crashes Blender at startup.
527 * Update: now this function also inits the bpymenus, which also depend
530 BPY_post_start_python();
532 BPY_run_ui_scripts(C);
535 #ifdef WITH_QUICKTIME
539 #endif /* WITH_QUICKTIME */
541 /* dynamically load libtiff, if available */
543 if (!G.have_libtiff && (G.f & G_DEBUG)) {
544 printf("Unable to load: libtiff.\n");
545 printf("Try setting the BF_TIFF_LIB environment variable if you want this support.\n");
546 printf("Example: setenv BF_TIFF_LIB /usr/lib/libtiff.so\n");
549 /* OK we are ready for it */
551 for(a=1; a<argc; a++) {
552 if (G.afbreek==1) break;
554 if(argv[a][0] == '-') {
556 case '-': /* -- ends argument processing */
560 case 'p': /* prefsize */
567 gameengine parameters are automaticly put into system
568 -g [paramname = value]
572 -g maxvertexarraysize = 512
577 char* paramname = argv[a];
578 /* check for single value versus assignment */
579 if (a+1 < argc && (*(argv[a+1]) == '='))
586 SYS_WriteCommandLineString(syshandle,paramname,argv[a]);
589 printf("error: argument assignment (%s) without value.\n",paramname);
595 SYS_WriteCommandLineInt(syshandle,argv[a],1);
598 if (!strcmp(argv[a],"nomipmap"))
600 GPU_set_mipmap(0); //doMipMap = 0;
603 if (!strcmp(argv[a],"linearmipmap"))
605 GPU_set_linear_mipmap(1); //linearMipMap = 1;
609 } /* if (*(argv[a+1]) == '=') */
610 } /* if(++a < argc) */
615 if (CTX_data_scene(C)) {
616 Scene *scene= CTX_data_scene(C);
619 int frame= MIN2(MAXFRAME, MAX2(1, atoi(argv[a])));
620 Render *re= RE_NewRender(scene->id.name);
621 #ifndef DISABLE_PYTHON
622 if (G.f & G_DOSCRIPTLINKS)
623 BPY_do_all_scripts(SCRIPT_RENDER, 0);
625 RE_BlenderAnim(re, scene, frame, frame, scene->frame_step);
626 #ifndef DISABLE_PYTHON
627 BPY_do_all_scripts(SCRIPT_POSTRENDER, 0);
631 printf("\nError: no blend loaded. cannot use '-f'.\n");
635 if (CTX_data_scene(C)) {
636 Scene *scene= CTX_data_scene(C);
637 Render *re= RE_NewRender(scene->id.name);
638 #ifndef DISABLE_PYTHON
639 if (G.f & G_DOSCRIPTLINKS)
640 BPY_do_all_scripts(SCRIPT_RENDER, 1);
642 RE_BlenderAnim(re, scene, scene->r.sfra, scene->r.efra, scene->frame_step);
643 #ifndef DISABLE_PYTHON
644 if (G.f & G_DOSCRIPTLINKS)
645 BPY_do_all_scripts(SCRIPT_POSTRENDER, 1);
648 printf("\nError: no blend loaded. cannot use '-a'.\n");
653 set_scene_name(argv[a]);
658 if (CTX_data_scene(C)) {
659 Scene *scene= CTX_data_scene(C);
660 int frame= MIN2(MAXFRAME, MAX2(1, atoi(argv[a])));
661 if (a < argc) (scene->r.sfra) = frame;
663 printf("\nError: no blend loaded. cannot use '-s'.\n");
668 if (CTX_data_scene(C)) {
669 Scene *scene= CTX_data_scene(C);
670 int frame= MIN2(MAXFRAME, MAX2(1, atoi(argv[a])));
671 if (a < argc) (scene->r.efra) = frame;
673 printf("\nError: no blend loaded. cannot use '-e'.\n");
678 if (CTX_data_scene(C)) {
679 Scene *scene= CTX_data_scene(C);
680 int fstep= MIN2(MAXFRAME, MAX2(1, atoi(argv[a])));
681 if (a < argc) (scene->frame_step) = fstep;
683 printf("\nError: no blend loaded. cannot use '-j'.\n");
688 #ifndef DISABLE_PYTHON
692 BPY_run_python_script(C, argv[a], NULL);
696 /* If we're not running in background mode, then give python a valid screen */
697 if ((G.background==0) && (scr_init==0)) {
701 BPY_run_python_script(C, argv[a], NULL);
703 else printf("\nError: you must specify a Python script after '-P '.\n");
706 printf("This blender was built without python support\n");
707 #endif /* DISABLE_PYTHON */
712 if (CTX_data_scene(C)) {
713 Scene *scene= CTX_data_scene(C);
714 BLI_strncpy(scene->r.pic, argv[a], FILE_MAXDIR);
716 printf("\nError: no blend loaded. cannot use '-o'.\n");
719 printf("\nError: you must specify a path after '-o '.\n");
725 if (CTX_data_scene(C)==NULL) {
726 printf("\nError: no blend loaded. order the arguments so '-F ' is after the blend is loaded.\n");
728 Scene *scene= CTX_data_scene(C);
729 if (!strcmp(argv[a],"TGA")) scene->r.imtype = R_TARGA;
730 else if (!strcmp(argv[a],"IRIS")) scene->r.imtype = R_IRIS;
731 else if (!strcmp(argv[a],"HAMX")) scene->r.imtype = R_HAMX;
733 else if (!strcmp(argv[a],"DDS")) scene->r.imtype = R_DDS;
735 else if (!strcmp(argv[a],"JPEG")) scene->r.imtype = R_JPEG90;
736 else if (!strcmp(argv[a],"MOVIE")) scene->r.imtype = R_MOVIE;
737 else if (!strcmp(argv[a],"IRIZ")) scene->r.imtype = R_IRIZ;
738 else if (!strcmp(argv[a],"RAWTGA")) scene->r.imtype = R_RAWTGA;
739 else if (!strcmp(argv[a],"AVIRAW")) scene->r.imtype = R_AVIRAW;
740 else if (!strcmp(argv[a],"AVIJPEG")) scene->r.imtype = R_AVIJPEG;
741 else if (!strcmp(argv[a],"PNG")) scene->r.imtype = R_PNG;
742 else if (!strcmp(argv[a],"AVICODEC")) scene->r.imtype = R_AVICODEC;
743 else if (!strcmp(argv[a],"QUICKTIME")) scene->r.imtype = R_QUICKTIME;
744 else if (!strcmp(argv[a],"BMP")) scene->r.imtype = R_BMP;
745 else if (!strcmp(argv[a],"HDR")) scene->r.imtype = R_RADHDR;
746 else if (!strcmp(argv[a],"TIFF")) scene->r.imtype = R_TIFF;
748 else if (!strcmp(argv[a],"EXR")) scene->r.imtype = R_OPENEXR;
749 else if (!strcmp(argv[a],"MULTILAYER")) scene->r.imtype = R_MULTILAYER;
751 else if (!strcmp(argv[a],"MPEG")) scene->r.imtype = R_FFMPEG;
752 else if (!strcmp(argv[a],"FRAMESERVER")) scene->r.imtype = R_FRAMESERVER;
753 else if (!strcmp(argv[a],"CINEON")) scene->r.imtype = R_CINEON;
754 else if (!strcmp(argv[a],"DPX")) scene->r.imtype = R_DPX;
756 else if (!strcmp(argv[a],"JP2")) scene->r.imtype = R_JP2;
758 else printf("\nError: Format from '-F' not known or not compiled in this release.\n");
761 printf("\nError: no blend loaded. cannot use '-x'.\n");
769 RE_set_max_threads(atoi(argv[a]));
771 printf("Warning: threads can only be set in background mode\n");
774 printf("\nError: you must specify a number of threads between 0 and 8 '-t '.\n");
777 case 'x': /* extension */
780 if (CTX_data_scene(C)) {
781 Scene *scene= CTX_data_scene(C);
782 if (argv[a][0] == '0') {
783 scene->r.scemode &= ~R_EXTENSION;
784 } else if (argv[a][0] == '1') {
785 scene->r.scemode |= R_EXTENSION;
787 printf("\nError: Use '-x 1' or '-x 0' To set the extension option.\n");
790 printf("\nError: no blend loaded. order the arguments so '-o ' is after '-x '.\n");
793 printf("\nError: you must specify a path after '- '.\n");
800 /* Make the path absolute because its needed for relative linked blends to be found */
801 char filename[FILE_MAXDIR + FILE_MAXFILE];
803 BLI_strncpy(filename, argv[a], sizeof(filename));
804 BLI_convertstringcwd(filename);
807 int retval = BKE_read_file(C, argv[a], NULL, NULL);
808 // XXX sound_initialize_sounds();
810 /*we successfully loaded a blend file, get sure that
812 if (retval!=0) G.relbase_valid = 1;
814 /* happens for the UI on file reading too (huh? (ton))*/
815 // XXX BKE_reset_undo();
816 // BKE_write_undo("original"); /* save current state */
818 /* we are not running in background mode here, but start blender in UI mode with
819 a file - this should do everything a 'load file' does */
820 WM_read_file(C, filename, NULL);
826 /* actually incorrect, but works for now (ton) */
833 /*XXX if (scr_init==0) {
837 screenmain();*/ /* main display loop */
840 } /* end of int main(argc,argv) */
842 static void error_cb(char *err)
845 printf("%s\n", err); /* XXX do this in WM too */
848 static void mem_error_cb(char *errorStr)
850 fprintf(stderr, "%s", errorStr);
854 static void setCallbacks(void)
856 /* Error output from the alloc routines: */
857 MEM_set_error_callback(mem_error_cb);
862 BLI_setErrorCallBack(error_cb); /* */
863 // XXX BLI_setInterruptCallBack(blender_test_break);