2.5 audio cleanup:
[blender.git] / source / creator / creator.c
index 9bf09a464617a7f765ba8968040faae602c3659f..8896673b6112767095724ec0894ef3a7baa201e3 100644 (file)
@@ -201,17 +201,15 @@ static void print_help(void)
        printf ("\nGame Engine specific options:\n");
        printf ("  -g fixedtime\t\tRun on 50 hertz without dropping frames\n");
        printf ("  -g vertexarrays\tUse Vertex Arrays for rendering (usually faster)\n");
-       printf ("  -g noaudio\t\tNo audio in Game Engine\n");
        printf ("  -g nomipmap\t\tNo Texture Mipmapping\n");
        printf ("  -g linearmipmap\tLinear Texture Mipmapping instead of Nearest (default)\n");
 
        printf ("\nMisc options:\n");
        printf ("  -d\t\tTurn debugging on\n");
-       printf ("  -noaudio\tDisable audio on systems that support audio\n");
        printf ("  -nojoystick\tDisable joystick support\n");
        printf ("  -noglsl\tDisable GLSL shading\n");
        printf ("  -h\t\tPrint this help text\n");
-       printf ("  -y\t\tDisable automatic python script execution (scriptlinks, pydrivers, pyconstraints, pynodes)\n");
+       printf ("  -y\t\tDisable automatic python script execution (pydrivers, pyconstraints, pynodes)\n");
        printf ("  -P <filename>\tRun the given Python script (filename or Blender Text)\n");
 #ifdef WIN32
        printf ("  -R\t\tRegister .blend extension\n");
@@ -267,13 +265,6 @@ int main(int argc, char **argv)
        bContext *C= CTX_create();
        int a, i, stax, stay, sizx, sizy /*XXX, scr_init = 0*/;
 
-#if defined(WIN32) || defined (__linux__)
-       int audio = 1;
-#else
-       int audio = 0;
-#endif
-
-       
 #ifdef WITH_BINRELOC
        br_init( NULL );
 #endif
@@ -313,6 +304,7 @@ int main(int argc, char **argv)
        BLI_where_am_i(bprogname, argv[0]);
        
        RNA_init();
+       RE_engines_init();
 
                /* Hack - force inclusion of the plugin api functions,
                 * see blenpluginapi:pluginapi.c
@@ -461,16 +453,6 @@ int main(int argc, char **argv)
                                        break;
                                case 'n':
                                case 'N':
-                                       if (BLI_strcasecmp(argv[a], "-noaudio") == 0|| BLI_strcasecmp(argv[a], "-nosound") == 0) {
-                                               /**
-                                                       notify the gameengine that no audio is wanted, even if the user didn't give
-                                                       the flag -g noaudio.
-                                               */
-
-                                               SYS_WriteCommandLineInt(syshandle,"noaudio",1);
-                                               audio = 0;
-                                               if (G.f & G_DEBUG) printf("setting audio to: %d\n", audio);
-                                       }
                                        if (BLI_strcasecmp(argv[a], "-nojoystick") == 0) {
                                                /**
                                                        don't initialize joysticks if user doesn't want to use joysticks
@@ -489,11 +471,6 @@ int main(int argc, char **argv)
 #ifndef DISABLE_PYTHON         
                BPY_start_python(argc, argv);
 #endif         
-               /**
-                * NOTE: sound_init_audio() *must be* after start_python,
-                * at least on FreeBSD.
-                * added note (ton): i removed it altogether
-                */
 
                WM_init(C);
                
@@ -501,25 +478,11 @@ int main(int argc, char **argv)
                BLI_where_is_temp( btempdir, 1 ); /* call after loading the .B.blend so we can read U.tempdir */
 
 #ifndef DISABLE_SDL
-#if (defined(WIN32) || defined(WIN64))
-#if defined(FREE_WINDOWS)
-               putenv("SDL_VIDEODRIVER=dummy");
-#else
-               _putenv_s("SDL_VIDEODRIVER", "dummy");
-#endif
-#else
-#ifdef __sgi
-               putenv("SDL_VIDEODRIVER=dummy");
-#else
-               setenv("SDL_VIDEODRIVER", "dummy", 1); /* initializing the video driver can cause crashes on some systems - Campbell */
-#endif
-#endif
+       BLI_setenv("SDL_VIDEODRIVER", "dummy");
 #ifdef __linux__
-               /* On linux the default SDL driver dma often would not play
-                * use alsa if none is set */
-               if ( getenv("SDL_AUDIODRIVER") == NULL) {
-                       setenv("SDL_AUDIODRIVER", "alsa", 1);
-               }
+       /* On linux the default SDL driver dma often would not play
+        * use alsa if none is set */
+       setenv("SDL_AUDIODRIVER", "alsa", 0);
 #endif
 #endif
        }
@@ -528,12 +491,6 @@ int main(int argc, char **argv)
                BPY_start_python(argc, argv);
 #endif         
                BLI_where_is_temp( btempdir, 0 ); /* call after loading the .B.blend so we can read U.tempdir */
-               
-               // (ton) Commented out. I have no idea whats thisfor... will mail around!
-               // SYS_WriteCommandLineInt(syshandle,"noaudio",1);
-        // audio = 0;
-        // sound_init_audio();
-        // if (G.f & G_DEBUG) printf("setting audio to: %d\n", audio);
        }
 #ifndef DISABLE_PYTHON
        /**
@@ -549,6 +506,9 @@ int main(int argc, char **argv)
        BPY_run_ui_scripts(C, 0); /* dont need to reload the first time */
 #endif
        
+       CTX_py_init_set(C, 1);
+       WM_keymap_init(C); /* after BPY_run_ui_scripts() */
+
 #ifdef WITH_QUICKTIME
 
        quicktime_init();
@@ -637,14 +597,8 @@ int main(int argc, char **argv)
                                                Render *re = RE_NewRender(scene->id.name);
 
                                                frame = MIN2(MAXFRAME, MAX2(1, frame));
-#ifndef DISABLE_PYTHON
-                                               if (G.f & G_DOSCRIPTLINKS)
-                                                       BPY_do_all_scripts(SCRIPT_RENDER, 0);
-#endif
+                                               
                                                RE_BlenderAnim(re, scene, frame, frame, scene->frame_step);
-#ifndef DISABLE_PYTHON
-                                               BPY_do_all_scripts(SCRIPT_POSTRENDER, 0);
-#endif
                                        }
                                } else {
                                        printf("\nError: no blend loaded. cannot use '-f'.\n");
@@ -654,15 +608,7 @@ int main(int argc, char **argv)
                                if (CTX_data_scene(C)) {
                                        Scene *scene= CTX_data_scene(C);
                                        Render *re= RE_NewRender(scene->id.name);
-#ifndef DISABLE_PYTHON
-                                       if (G.f & G_DOSCRIPTLINKS)
-                                               BPY_do_all_scripts(SCRIPT_RENDER, 1);
-#endif
                                        RE_BlenderAnim(re, scene, scene->r.sfra, scene->r.efra, scene->frame_step);
-#ifndef DISABLE_PYTHON
-                                       if (G.f & G_DOSCRIPTLINKS)
-                                               BPY_do_all_scripts(SCRIPT_POSTRENDER, 1);
-#endif
                                } else {
                                        printf("\nError: no blend loaded. cannot use '-a'.\n");
                                }