Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Fri, 4 May 2018 06:02:11 +0000 (08:02 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 4 May 2018 06:02:11 +0000 (08:02 +0200)
1  2 
source/creator/creator_args.c

index 60f0ae9c54369cdd292a7c3270927a42c3eb44b6,675f2621942d3a03b671391cac9faed0168cc6a0..5d49c954522246c10dfe4aa4dc45fc550cabcf7a
@@@ -59,6 -59,8 +59,6 @@@
  #include "BKE_sound.h"
  #include "BKE_image.h"
  
 -#include "DEG_depsgraph.h"
 -
  #ifdef WITH_FFMPEG
  #include "IMB_imbuf.h"
  #endif
  
  #include "WM_api.h"
  
 -#include "GPU_basic_shader.h"
  #include "GPU_draw.h"
 -#include "GPU_extensions.h"
 -
 -/* for passing information between creator and gameengine */
 -#ifdef WITH_GAMEENGINE
 -#  include "BL_System.h"
 -#else /* dummy */
 -#  define SYS_SystemHandle int
 -#endif
  
  #ifdef WITH_LIBMV
  #  include "libmv-capi.h"
  #  include "CCL_api.h"
  #endif
  
 +#include "DEG_depsgraph.h"
 +#include "DEG_depsgraph_build.h"
 +#include "DEG_depsgraph_debug.h"
 +
  #include "creator_intern.h"  /* own include */
  
  
@@@ -423,6 -430,7 +423,6 @@@ static void arg_py_context_restore
  
  /** \} */
  
 -
  /* -------------------------------------------------------------------- */
  
  /** \name Handle Argument Callbacks
@@@ -504,6 -512,11 +504,6 @@@ static int arg_handle_print_help(int UN
        BLI_argsPrintArgDoc(ba, "--start-console");
        BLI_argsPrintArgDoc(ba, "--no-native-pixels");
  
 -
 -      printf("\n");
 -      printf("Game Engine Specific Options:\n");
 -      BLI_argsPrintArgDoc(ba, "-g");
 -
        printf("\n");
        printf("Python Options:\n");
        BLI_argsPrintArgDoc(ba, "--enable-autoexec");
        BLI_argsPrintArgDoc(ba, "--debug-depsgraph-no-threads");
  
        BLI_argsPrintArgDoc(ba, "--debug-gpumem");
 +      BLI_argsPrintArgDoc(ba, "--debug-gpu-shaders");
        BLI_argsPrintArgDoc(ba, "--debug-wm");
        BLI_argsPrintArgDoc(ba, "--debug-all");
        BLI_argsPrintArgDoc(ba, "--debug-io");
        BLI_argsPrintArgDoc(ba, "--env-system-scripts");
        BLI_argsPrintArgDoc(ba, "--env-system-python");
        printf("\n");
 -      BLI_argsPrintArgDoc(ba, "-nojoystick");
 -      BLI_argsPrintArgDoc(ba, "-noglsl");
        BLI_argsPrintArgDoc(ba, "-noaudio");
        BLI_argsPrintArgDoc(ba, "-setaudio");
  
  
        printf("\n");
        printf("Experimental Features:\n");
 -      BLI_argsPrintArgDoc(ba, "--enable-new-depsgraph");
 -      BLI_argsPrintArgDoc(ba, "--enable-new-basic-shader-glsl");
 +      BLI_argsPrintArgDoc(ba, "--enable-copy-on-write");
  
        /* Other options _must_ be last (anything not handled will show here) */
        printf("\n");
@@@ -710,8 -725,11 +710,11 @@@ static int arg_handle_log_level_set(in
                if (!parse_int_clamp(argv[1], NULL, -1, INT_MAX, &G.log.level, &err_msg)) {
                        printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]);
                }
-               if (G.log.level == -1) {
-                       G.log.level = INT_MAX;
+               else {
+                       if (G.log.level == -1) {
+                               G.log.level = INT_MAX;
+                       }
+                       CLG_level_set(G.log.level);
                }
                return 1;
        }
@@@ -843,7 -861,7 +846,7 @@@ static const char arg_handle_debug_mode
  static const char arg_handle_debug_mode_generic_set_doc_handlers[] =
  "\n\tEnable debug messages for event handling.";
  static const char arg_handle_debug_mode_generic_set_doc_wm[] =
 -"\n\tEnable debug messages for the window manager, also prints every operator call.";
 +"\n\tEnable debug messages for the window manager, shows all operators in search, shows keymap errors.";
  static const char arg_handle_debug_mode_generic_set_doc_jobs[] =
  "\n\tEnable time profiling for background jobs.";
  static const char arg_handle_debug_mode_generic_set_doc_gpu[] =
@@@ -1112,6 -1130,36 +1115,6 @@@ static int arg_handle_register_extensio
        return 0;
  }
  
 -static const char arg_handle_joystick_disable_doc[] =
 -"\n\tDisable joystick support."
 -;
 -static int arg_handle_joystick_disable(int UNUSED(argc), const char **UNUSED(argv), void *data)
 -{
 -#ifndef WITH_GAMEENGINE
 -      (void)data;
 -#else
 -      SYS_SystemHandle *syshandle = data;
 -
 -      /**
 -       * don't initialize joysticks if user doesn't want to use joysticks
 -       * failed joystick initialization delays over 5 seconds, before game engine start
 -       */
 -      SYS_WriteCommandLineInt(*syshandle, "nojoystick", 1);
 -      if (G.debug & G_DEBUG) printf("disabling nojoystick\n");
 -#endif
 -
 -      return 0;
 -}
 -
 -static const char arg_handle_glsl_disable_doc[] =
 -"\n\tDisable GLSL shading."
 -;
 -static int arg_handle_glsl_disable(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
 -{
 -      GPU_extensions_disable();
 -      return 0;
 -}
 -
  static const char arg_handle_audio_disable_doc[] =
  "\n\tForce sound system to None."
  ;
@@@ -1189,8 -1237,10 +1192,8 @@@ static int arg_handle_engine_set(int ar
                else {
                        Scene *scene = CTX_data_scene(C);
                        if (scene) {
 -                              RenderData *rd = &scene->r;
 -
                                if (BLI_findstring(&R_engines, argv[1], offsetof(RenderEngineType, idname))) {
 -                                      BLI_strncpy_utf8(rd->engine, argv[1], sizeof(rd->engine));
 +                                      BLI_strncpy_utf8(scene->r.engine, argv[1], sizeof(scene->r.engine));
                                }
                                else {
                                        printf("\nError: engine not found '%s'\n", argv[1]);
@@@ -1273,13 -1323,23 +1276,13 @@@ static int arg_handle_threads_set(int a
        }
  }
  
 -static const char arg_handle_depsgraph_use_new_doc[] =
 -"\n\tUse new dependency graph."
 -;
 -static int arg_handle_depsgraph_use_new(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
 -{
 -      printf("Using new dependency graph.\n");
 -      DEG_depsgraph_switch_to_new();
 -      return 0;
 -}
 -
 -static const char arg_handle_basic_shader_glsl_use_new_doc[] =
 -"\n\tUse new GLSL basic shader."
 +static const char arg_handle_use_copy_on_write_doc[] =
 +"\n\tUse new dependency graph"
  ;
 -static int arg_handle_basic_shader_glsl_use_new(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
 +static int arg_handle_use_copy_on_write(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
  {
 -      printf("Using new GLSL basic shader.\n");
 -      GPU_basic_shader_use_glsl_set(true);
 +      printf("Using copy on write. This is highly EXPERIMENTAL!\n");
 +      DEG_depsgraph_enable_copy_on_write();
        return 0;
  }
  
@@@ -1345,6 -1405,76 +1348,6 @@@ static int arg_handle_extension_set(in
        }
  }
  
 -static const char arg_handle_ge_parameters_set_doc[] =
 -"Game Engine specific options\n"
 -"\n"
 -"\t'fixedtime'\n"
 -"\t\tRun on 50 hertz without dropping frames.\n"
 -"\t'vertexarrays'\n"
 -"\t\tUse Vertex Arrays for rendering (usually faster).\n"
 -"\t'nomipmap'\n"
 -"\t\tNo Texture Mipmapping.\n"
 -"\t'linearmipmap'\n"
 -"\t\tLinear Texture Mipmapping instead of Nearest (default)."
 -;
 -static int arg_handle_ge_parameters_set(int argc, const char **argv, void *data)
 -{
 -      int a = 0;
 -#ifdef WITH_GAMEENGINE
 -      SYS_SystemHandle syshandle = *(SYS_SystemHandle *)data;
 -#else
 -      (void)data;
 -#endif
 -
 -      /**
 -       * gameengine parameters are automatically put into system
 -       * -g [paramname = value]
 -       * -g [boolparamname]
 -       * example:
 -       * -g novertexarrays
 -       * -g maxvertexarraysize = 512
 -       */
 -
 -      if (argc >= 1) {
 -              const char *paramname = argv[a];
 -              /* check for single value versus assignment */
 -              if (a + 1 < argc && (*(argv[a + 1]) == '=')) {
 -                      a++;
 -                      if (a + 1 < argc) {
 -                              a++;
 -                              /* assignment */
 -#ifdef WITH_GAMEENGINE
 -                              SYS_WriteCommandLineString(syshandle, paramname, argv[a]);
 -#endif
 -                      }
 -                      else {
 -                              printf("Error: argument assignment (%s) without value.\n", paramname);
 -                              return 0;
 -                      }
 -                      /* name arg eaten */
 -
 -              }
 -              else {
 -#ifdef WITH_GAMEENGINE
 -                      SYS_WriteCommandLineInt(syshandle, argv[a], 1);
 -#endif
 -                      /* doMipMap */
 -                      if (STREQ(argv[a], "nomipmap")) {
 -                              GPU_set_mipmap(0); //doMipMap = 0;
 -                      }
 -                      /* linearMipMap */
 -                      if (STREQ(argv[a], "linearmipmap")) {
 -                              GPU_set_mipmap(1);
 -                              GPU_set_linear_mipmap(1); //linearMipMap = 1;
 -                      }
 -
 -
 -              } /* if (*(argv[a + 1]) == '=') */
 -      }
 -
 -      return a;
 -}
 -
  static const char arg_handle_render_frame_doc[] =
  "<frame>\n"
  "\tRender frame <frame> and save it.\n"
@@@ -1378,6 -1508,7 +1381,6 @@@ static int arg_handle_render_frame(int 
                        re = RE_NewSceneRender(scene);
                        BLI_threaded_malloc_begin();
                        BKE_reports_init(&reports, RPT_STORE);
 -
                        RE_SetReports(re, &reports);
                        for (int i = 0; i < frames_range_len; i++) {
                                /* We could pass in frame ranges,
@@@ -1786,7 -1917,7 +1789,7 @@@ static int arg_handle_load_file(int UNU
  }
  
  
 -void main_args_setup(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
 +void main_args_setup(bContext *C, bArgs *ba)
  {
  
  #define CB(a) a##_doc, a
                    CB_EX(arg_handle_debug_mode_generic_set, depsgraph_pretty), (void *)G_DEBUG_DEPSGRAPH_PRETTY);
        BLI_argsAdd(ba, 1, NULL, "--debug-gpumem",
                    CB_EX(arg_handle_debug_mode_generic_set, gpumem), (void *)G_DEBUG_GPU_MEM);
 +      BLI_argsAdd(ba, 1, NULL, "--debug-gpu-shaders",
 +                  CB_EX(arg_handle_debug_mode_generic_set, gpumem), (void *)G_DEBUG_GPU_SHADERS);
  
 -      BLI_argsAdd(ba, 1, NULL, "--enable-new-depsgraph", CB(arg_handle_depsgraph_use_new), NULL);
 -      BLI_argsAdd(ba, 1, NULL, "--enable-new-basic-shader-glsl", CB(arg_handle_basic_shader_glsl_use_new), NULL);
 +      BLI_argsAdd(ba, 1, NULL, "--enable-copy-on-write", CB(arg_handle_use_copy_on_write), NULL);
  
        BLI_argsAdd(ba, 1, NULL, "--verbose", CB(arg_handle_verbosity_set), NULL);
  
        BLI_argsAdd(ba, 2, NULL, "--no-native-pixels", CB(arg_handle_native_pixels_set), ba);
  
        /* third pass: disabling things and forcing settings */
 -      BLI_argsAddCase(ba, 3, "-nojoystick", 1, NULL, 0, CB(arg_handle_joystick_disable), syshandle);
 -      BLI_argsAddCase(ba, 3, "-noglsl", 1, NULL, 0, CB(arg_handle_glsl_disable), NULL);
        BLI_argsAddCase(ba, 3, "-noaudio", 1, NULL, 0, CB(arg_handle_audio_disable), NULL);
        BLI_argsAddCase(ba, 3, "-setaudio", 1, NULL, 0, CB(arg_handle_audio_set), NULL);
  
        /* fourth pass: processing arguments */
 -      BLI_argsAdd(ba, 4, "-g", NULL, CB(arg_handle_ge_parameters_set), syshandle);
        BLI_argsAdd(ba, 4, "-f", "--render-frame", CB(arg_handle_render_frame), C);
        BLI_argsAdd(ba, 4, "-a", "--render-anim", CB(arg_handle_render_animation), C);
        BLI_argsAdd(ba, 4, "-S", "--scene", CB(arg_handle_scene_set), C);