[Bf-blender-cvs] [f7adb788287] master: Cleanup: remove BLO_update_defaults_userpref_blend

Campbell Barton noreply at git.blender.org
Wed Jul 31 13:52:55 CEST 2019


Commit: f7adb788287665092fa2811de2ba70341aab3294
Author: Campbell Barton
Date:   Wed Jul 31 21:46:13 2019 +1000
Branches: master
https://developer.blender.org/rBf7adb788287665092fa2811de2ba70341aab3294

Cleanup: remove BLO_update_defaults_userpref_blend

Merge into BKE_blendfile_userdef_from_defaults

===================================================================

M	source/blender/blenkernel/intern/blendfile.c
M	source/blender/blenloader/BLO_readfile.h
M	source/blender/blenloader/CMakeLists.txt
M	source/blender/blenloader/intern/versioning_defaults.c
M	source/blender/windowmanager/intern/wm_files.c

===================================================================

diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index 813275e097d..08630bf4e9f 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -43,15 +43,18 @@
 #include "BKE_blender_version.h"
 #include "BKE_blendfile.h"
 #include "BKE_bpath.h"
+#include "BKE_colorband.h"
 #include "BKE_context.h"
 #include "BKE_global.h"
 #include "BKE_ipo.h"
+#include "BKE_keyconfig.h"
 #include "BKE_layer.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
 #include "BKE_report.h"
 #include "BKE_scene.h"
 #include "BKE_screen.h"
+#include "BKE_studiolight.h"
 #include "BKE_workspace.h"
 
 #include "BLO_readfile.h"
@@ -579,6 +582,32 @@ UserDef *BKE_blendfile_userdef_from_defaults(void)
     }
   }
 
+  /* default so DPI is detected automatically */
+  userdef->dpi = 0;
+  userdef->ui_scale = 1.0f;
+
+#ifdef WITH_PYTHON_SECURITY
+  /* use alternative setting for security nuts
+   * otherwise we'd need to patch the binary blob - startup.blend.c */
+  userdef->flag |= USER_SCRIPT_AUTOEXEC_DISABLE;
+#else
+  userdef->flag &= ~USER_SCRIPT_AUTOEXEC_DISABLE;
+#endif
+
+  /* System-specific fonts directory. */
+  BKE_appdir_font_folder_default(userdef->fontdir);
+
+  userdef->memcachelimit = min_ii(BLI_system_memory_max_in_megabytes_int() / 2, 4096);
+
+  /* Init weight paint range. */
+  BKE_colorband_init(&userdef->coba_weight, true);
+
+  /* Default to left click select. */
+  BKE_keyconfig_pref_set_select_mouse(userdef, 0, true);
+
+  /* Default studio light. */
+  BKE_studiolight_default(userdef->light_param, userdef->light_ambient);
+
   return userdef;
 }
 
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index cc3ea3f2122..8944dfdb711 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -165,7 +165,6 @@ void BLO_main_expander(BLOExpandDoitCallback expand_doit_func);
 void BLO_expand_main(void *fdhandle, struct Main *mainvar);
 
 /* Update defaults in startup.blend & userprefs.blend, without having to save and embed it */
-void BLO_update_defaults_userpref_blend(void);
 void BLO_update_defaults_startup_blend(struct Main *mainvar, const char *app_template);
 void BLO_update_defaults_workspace(struct WorkSpace *workspace, const char *app_template);
 
diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt
index 8ab93ba382c..1520c7b82b8 100644
--- a/source/blender/blenloader/CMakeLists.txt
+++ b/source/blender/blenloader/CMakeLists.txt
@@ -77,12 +77,6 @@ if(WITH_BUILDINFO)
   add_definitions(-DWITH_BUILDINFO)
 endif()
 
-if(WITH_PYTHON)
-  if(WITH_PYTHON_SECURITY)
-    add_definitions(-DWITH_PYTHON_SECURITY)
-  endif()
-endif()
-
 if(WITH_INTERNATIONAL)
   add_definitions(-DWITH_INTERNATIONAL)
 endif()
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 2a7a7eddb79..14230752d1f 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -40,54 +40,16 @@
 #include "DNA_meshdata_types.h"
 
 #include "BKE_appdir.h"
-#include "BKE_brush.h"
-#include "BKE_colorband.h"
 #include "BKE_colortools.h"
-#include "BKE_idprop.h"
-#include "BKE_keyconfig.h"
 #include "BKE_layer.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
 #include "BKE_node.h"
-#include "BKE_paint.h"
 #include "BKE_screen.h"
-#include "BKE_studiolight.h"
 #include "BKE_workspace.h"
 
 #include "BLO_readfile.h"
 
-/**
- * Update in-memory preferences with system specific values.
- */
-void BLO_update_defaults_userpref_blend(void)
-{
-  /* default so DPI is detected automatically */
-  U.dpi = 0;
-  U.ui_scale = 1.0f;
-
-#ifdef WITH_PYTHON_SECURITY
-  /* use alternative setting for security nuts
-   * otherwise we'd need to patch the binary blob - startup.blend.c */
-  U.flag |= USER_SCRIPT_AUTOEXEC_DISABLE;
-#else
-  U.flag &= ~USER_SCRIPT_AUTOEXEC_DISABLE;
-#endif
-
-  /* System-specific fonts directory. */
-  BKE_appdir_font_folder_default(U.fontdir);
-
-  U.memcachelimit = min_ii(BLI_system_memory_max_in_megabytes_int() / 2, 4096);
-
-  /* Init weight paint range. */
-  BKE_colorband_init(&U.coba_weight, true);
-
-  /* Default to left click select. */
-  BKE_keyconfig_pref_set_select_mouse(&U, 0, true);
-
-  /* Default studio light. */
-  BKE_studiolight_default(U.light_param, U.light_ambient);
-}
-
 /**
  * Rename if the ID doesn't exist.
  */
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 587905bab0d..9b4994421f9 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -353,7 +353,7 @@ static void wm_window_match_do(bContext *C,
 }
 
 /* in case UserDef was read, we re-initialize all, and do versioning */
-static void wm_init_userdef(Main *bmain, const bool read_userdef_from_memory)
+static void wm_init_userdef(Main *bmain)
 {
   /* versioning is here */
   UI_init_userdef(bmain);
@@ -367,11 +367,6 @@ static void wm_init_userdef(Main *bmain, const bool read_userdef_from_memory)
     SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_FLAG_SCRIPT_AUTOEXEC);
   }
 
-  /* avoid re-saving for every small change to our prefs, allow overrides */
-  if (read_userdef_from_memory) {
-    BLO_update_defaults_userpref_blend();
-  }
-
   MEM_CacheLimiter_set_maximum(((size_t)U.memcachelimit) * 1024 * 1024);
   BKE_sound_init(bmain);
 
@@ -787,16 +782,6 @@ void wm_homefile_read(bContext *C,
    * '{BLENDER_SYSTEM_SCRIPTS}/startup/bl_app_templates_system/{app_template}' */
   char app_template_config[FILE_MAX];
 
-  /* Indicates whether user preferences were really load from memory.
-   *
-   * This is used for versioning code, and for this we can not rely on use_factory_settings
-   * passed via argument. This is because there might be configuration folder
-   * exists but it might not have userpref.blend and in this case we fallback to
-   * reading home file from memory.
-   *
-   * And in this case versioning code is to be run.
-   */
-  bool read_userdef_from_memory = false;
   eBLOReadSkip skip_flags = 0;
 
   if (use_data == false) {
@@ -968,7 +953,6 @@ void wm_homefile_read(bContext *C,
         UserDef *userdef_default = BKE_blendfile_userdef_from_defaults();
         BKE_blender_userdef_app_template_data_set_and_free(userdef_default);
         skip_flags &= ~BLO_READ_SKIP_USERDEF;
-        read_userdef_from_memory = true;
       }
     }
 
@@ -1019,7 +1003,6 @@ void wm_homefile_read(bContext *C,
       if (userdef_template == NULL) {
         /* we need to have preferences load to overwrite preferences from previous template */
         userdef_template = BKE_blendfile_userdef_from_defaults();
-        read_userdef_from_memory = true;
       }
       if (userdef_template) {
         BKE_blender_userdef_app_template_data_set_and_free(userdef_template);
@@ -1043,7 +1026,7 @@ void wm_homefile_read(bContext *C,
 
   if (use_userdef) {
     /* check userdef before open window, keymaps etc */
-    wm_init_userdef(bmain, read_userdef_from_memory);
+    wm_init_userdef(bmain);
     reset_app_template = true;
   }



More information about the Bf-blender-cvs mailing list