[Bf-blender-cvs] [378e5232e88] blender2.8: Fix T58104: Duplicated previews for Matcaps/HDRIs in portable installs

Philipp Oeser noreply at git.blender.org
Wed Dec 5 14:54:44 CET 2018


Commit: 378e5232e88eb99c40025c681c9b28724a370c0f
Author: Philipp Oeser
Date:   Mon Dec 3 20:55:36 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB378e5232e88eb99c40025c681c9b28724a370c0f

Fix T58104: Duplicated previews for Matcaps/HDRIs in portable installs

Reviewers: brecht

Maniphest Tasks: T58104

Differential Revision: https://developer.blender.org/D4028

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

M	source/blender/blenkernel/BKE_appdir.h
M	source/blender/blenkernel/intern/appdir.c
M	source/blender/blenkernel/intern/studiolight.c

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

diff --git a/source/blender/blenkernel/BKE_appdir.h b/source/blender/blenkernel/BKE_appdir.h
index 6162c7b6bf6..8496c56a9c7 100644
--- a/source/blender/blenkernel/BKE_appdir.h
+++ b/source/blender/blenkernel/BKE_appdir.h
@@ -34,6 +34,7 @@ const char *BKE_appdir_folder_id_create(const int folder_id, const char *subfold
 const char *BKE_appdir_folder_id_user_notest(const int folder_id, const char *subfolder);
 const char *BKE_appdir_folder_id_version(const int folder_id, const int ver, const bool do_check);
 
+bool BKE_appdir_app_is_portable_install(void);
 bool BKE_appdir_app_template_any(void);
 bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_len);
 void BKE_appdir_app_templates(struct ListBase *templates);
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index 2848c245553..3643bf54e48 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -229,7 +229,7 @@ static bool get_path_local(
  * Is this an install with user files kept together with the Blender executable and its
  * installation files.
  */
-static bool is_portable_install(void)
+bool BKE_appdir_app_is_portable_install(void)
 {
 	/* detect portable install by the existence of config folder */
 	const int ver = BLENDER_VERSION;
@@ -289,7 +289,7 @@ static bool get_path_user(
 	const char *user_base_path;
 
 	/* for portable install, user path is always local */
-	if (is_portable_install()) {
+	if (BKE_appdir_app_is_portable_install()) {
 		return get_path_local(targetpath, targetpath_len, folder_name, subfolder_name, ver);
 	}
 	user_path[0] = '\0';
diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c
index 5196ae50bab..bd8061a2d8e 100644
--- a/source/blender/blenkernel/intern/studiolight.c
+++ b/source/blender/blenkernel/intern/studiolight.c
@@ -1219,13 +1219,22 @@ void BKE_studiolight_init(void)
 	BLI_addtail(&studiolights, sl);
 
 	/* go over the preset folder and add a studiolight for every image with its path */
+	/* for portable installs (where USER and SYSTEM paths are the same), only go over LOCAL datafiles once */
 	/* Also reserve icon space for it. */
+	if (!BKE_appdir_app_is_portable_install()) {
+		studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,
+		                                      STUDIOLIGHT_LIGHTS_FOLDER,
+		                                      STUDIOLIGHT_TYPE_STUDIO | STUDIOLIGHT_USER_DEFINED);
+		studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,
+		                                      STUDIOLIGHT_WORLD_FOLDER,
+		                                      STUDIOLIGHT_TYPE_WORLD | STUDIOLIGHT_USER_DEFINED);
+		studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,
+		                                      STUDIOLIGHT_MATCAP_FOLDER,
+		                                      STUDIOLIGHT_TYPE_MATCAP | STUDIOLIGHT_USER_DEFINED);
+	}
 	studiolight_add_files_from_datafolder(BLENDER_SYSTEM_DATAFILES, STUDIOLIGHT_LIGHTS_FOLDER, STUDIOLIGHT_TYPE_STUDIO);
-	studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,   STUDIOLIGHT_LIGHTS_FOLDER, STUDIOLIGHT_TYPE_STUDIO | STUDIOLIGHT_USER_DEFINED);
 	studiolight_add_files_from_datafolder(BLENDER_SYSTEM_DATAFILES, STUDIOLIGHT_WORLD_FOLDER,  STUDIOLIGHT_TYPE_WORLD);
-	studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,   STUDIOLIGHT_WORLD_FOLDER,  STUDIOLIGHT_TYPE_WORLD | STUDIOLIGHT_USER_DEFINED);
 	studiolight_add_files_from_datafolder(BLENDER_SYSTEM_DATAFILES, STUDIOLIGHT_MATCAP_FOLDER, STUDIOLIGHT_TYPE_MATCAP);
-	studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,   STUDIOLIGHT_MATCAP_FOLDER, STUDIOLIGHT_TYPE_MATCAP | STUDIOLIGHT_USER_DEFINED);
 
 	/* sort studio lights on filename. */
 	BLI_listbase_sort(&studiolights, studiolight_cmp);



More information about the Bf-blender-cvs mailing list