Merge branch 'master' into blender2.8
[blender.git] / source / creator / creator.c
index 1d39fd6f05a9b43f756540f0c9d19c6b36da94f2..ce25a71c6d84f1036ce8854c3a98e58cf842dc98 100644 (file)
 #include "BKE_brush.h"
 #include "BKE_cachefile.h"
 #include "BKE_context.h"
-#include "BKE_depsgraph.h" /* for DAG_init */
 #include "BKE_font.h"
 #include "BKE_global.h"
 #include "BKE_material.h"
 #include "BKE_modifier.h"
+#include "BKE_gpencil_modifier.h"
 #include "BKE_node.h"
+#include "BKE_shader_fx.h"
 #include "BKE_sound.h"
 #include "BKE_image.h"
 #include "BKE_particle.h"
 
+#include "DEG_depsgraph.h"
 
 #include "IMB_imbuf.h"  /* for IMB_init */
 
@@ -79,6 +81,7 @@
 #include "ED_datafiles.h"
 
 #include "WM_api.h"
+#include "WM_toolsystem.h"
 
 #include "RNA_define.h"
 
 #  include "FRS_freestyle.h"
 #endif
 
-/* for passing information between creator and gameengine */
-#ifdef WITH_GAMEENGINE
-#  include "BL_System.h"
-#else /* dummy */
-#  define SYS_SystemHandle int
-#endif
-
 #include <signal.h>
 
 #ifdef __FreeBSD__
@@ -227,7 +223,6 @@ int main(
         )
 {
        bContext *C;
-       SYS_SystemHandle syshandle;
 
 #ifndef WITH_PYTHON_MODULE
        bArgs *ba;
@@ -244,6 +239,11 @@ int main(
        struct CreatorAtExitData app_init_data = {NULL};
        BKE_blender_atexit_register(callback_main_atexit, &app_init_data);
 
+       /* Unbuffered stdout makes stdout and stderr better synchronized, and helps
+        * when stepping through code in a debugger (prints are immediately
+        * visible). */
+       setvbuf(stdout, NULL, _IONBF, 0);
+
 #ifdef WIN32
        /* We delay loading of openmp so we can set the policy here. */
 # if defined(_MSC_VER)
@@ -375,7 +375,9 @@ int main(
        BKE_cachefiles_init();
        BKE_images_init();
        BKE_modifier_init();
-       DAG_init();
+       BKE_gpencil_modifier_init();
+       BKE_shaderfx_init();
+       DEG_register_node_types();
 
        BKE_brush_system_init();
        RE_texture_rng_init();
@@ -383,12 +385,6 @@ int main(
 
        BLI_callback_global_init();
 
-#ifdef WITH_GAMEENGINE
-       syshandle = SYS_GetSystem();
-#else
-       syshandle = 0;
-#endif
-
        /* first test for background */
 #ifndef WITH_PYTHON_MODULE
        ba = BLI_argsInit(argc, (const char **)argv); /* skip binary path */
@@ -396,7 +392,7 @@ int main(
        /* ensure we free on early exit */
        app_init_data.ba = ba;
 
-       main_args_setup(C, ba, &syshandle);
+       main_args_setup(C, ba);
 
        BLI_argsParse(ba, 1, NULL, NULL);
 
@@ -404,7 +400,6 @@ int main(
 
 #else
        G.factory_startup = true;  /* using preferences or user startup makes no sense for py-as-module */
-       (void)syshandle;
 #endif
 
 #ifdef WITH_FFMPEG
@@ -472,7 +467,7 @@ int main(
 #endif
 
        CTX_py_init_set(C, 1);
-       WM_keymap_init(C);
+       WM_keyconfig_init(C);
 
 #ifdef WITH_FREESTYLE
        /* initialize Freestyle */
@@ -519,20 +514,6 @@ int main(
                WM_exit(C);
        }
        else {
-               if (G.fileflags & G_FILE_AUTOPLAY) {
-                       if (G.f & G_SCRIPT_AUTOEXEC) {
-                               if (WM_init_game(C)) {
-                                       return 0;
-                               }
-                       }
-                       else {
-                               if (!(G.f & G_SCRIPT_AUTOEXEC_FAIL_QUIET)) {
-                                       G.f |= G_SCRIPT_AUTOEXEC_FAIL;
-                                       BLI_snprintf(G.autoexec_fail, sizeof(G.autoexec_fail), "Game AutoStart");
-                               }
-                       }
-               }
-
                if (!G.file_loaded) {
                        WM_init_splash(C);
                }