[Bf-blender-cvs] [a4274a632a] app-templates: Fix BKE_appdir_app_template_id_search and splash loading

Campbell Barton noreply at git.blender.org
Thu Mar 23 19:48:26 CET 2017


Commit: a4274a632a7b526281df55cd4e5904764cf331d6
Author: Campbell Barton
Date:   Fri Mar 24 05:48:40 2017 +1100
Branches: app-templates
https://developer.blender.org/rBa4274a632a7b526281df55cd4e5904764cf331d6

Fix BKE_appdir_app_template_id_search and splash loading

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

M	source/blender/blenkernel/intern/appdir.c
M	source/blender/windowmanager/intern/wm_operators.c

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

diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index 4cacdbffc9..8438d582fd 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -681,8 +681,9 @@ bool BKE_appdir_app_template_any(void)
 bool BKE_appdir_app_template_id_search(char *path, size_t path_len, const char *app_template)
 {
 	for (int i = 0; i < 2; i++) {
-		BLI_join_dirfile(path, sizeof(path), app_template_directory_search[i], app_template);
-		const char *filepath_startup_template = BKE_appdir_folder_id(app_template_directory_id[i], path);
+		char subdir[FILE_MAX];
+		BLI_join_dirfile(subdir, sizeof(subdir), app_template_directory_search[i], app_template);
+		const char *filepath_startup_template = BKE_appdir_folder_id(app_template_directory_id[i], subdir);
 		if (filepath_startup_template) {
 			BLI_strncpy(path, filepath_startup_template, path_len);
 			return path;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 0d47d39d5d..981ef60fad 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1766,15 +1766,17 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
 	/* overwrite splash with template image */
 	if (U.app_template[0] != '\0') {
 		ImBuf *ibuf_template = NULL;
-		char temp_path[FILE_MAX];
-		BLI_join_dirfile(temp_path, sizeof(temp_path), "app_templates", U.app_template);
-		const char *filepath_template = BKE_appdir_folder_id(BLENDER_DATAFILES, temp_path);
+		char splash_filepath[FILE_MAX];
+		char template_directory[FILE_MAX];
 
-		if (filepath_template) {
+		if (BKE_appdir_app_template_id_search(
+		        template_directory, sizeof(template_directory),
+		        U.app_template))
+		{
 			BLI_join_dirfile(
-			        temp_path, sizeof(temp_path), filepath_template,
+			        splash_filepath, sizeof(splash_filepath), template_directory,
 			        (U.pixelsize == 2) ? "splash_2x.png" : "splash.png");
-			ibuf_template = IMB_loadiffname(temp_path, IB_rect, NULL);
+			ibuf_template = IMB_loadiffname(splash_filepath, IB_rect, NULL);
 			if (ibuf_template) {
 				const int x_expect = ibuf_template->x;
 				const int y_expect = 230 * (int)U.pixelsize;
@@ -1784,7 +1786,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
 				}
 				else {
 					printf("Splash expected %dx%d found %dx%d, ignoring: %s\n",
-					       x_expect, y_expect, ibuf_template->x, ibuf_template->y, temp_path);
+					       x_expect, y_expect, ibuf_template->x, ibuf_template->y, splash_filepath);
 				}
 				IMB_freeImBuf(ibuf_template);
 			}




More information about the Bf-blender-cvs mailing list