[Bf-blender-cvs] [bf19bf0] asset-experiments: Merge branch 'master' into asset-experiments

Bastien Montagne noreply at git.blender.org
Fri Apr 10 23:43:04 CEST 2015


Commit: bf19bf0110e9e5a2fcc92e7cbf10b907d4a7f65b
Author: Bastien Montagne
Date:   Fri Apr 10 23:42:43 2015 +0200
Branches: asset-experiments
https://developer.blender.org/rBbf19bf0110e9e5a2fcc92e7cbf10b907d4a7f65b

Merge branch 'master' into asset-experiments

Conflicts:
	source/blender/blenlib/intern/BLI_filelist.c
	source/blender/imbuf/IMB_thumbs.h
	source/blender/imbuf/intern/thumbs.c

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



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

diff --cc source/blender/imbuf/intern/thumbs.c
index a736e77,2318553..f44d0a9
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@@ -297,9 -293,7 +297,9 @@@ void IMB_thumb_makedirs(void
  
  /* create thumbnail for file and returns new imbuf for thumbnail */
  static ImBuf *thumb_create_ex(
-         const char *path, const char *uri, const char *thumb,
-         const char *file_path, const char *blen_group, const char *blen_id,
 -        const char *file_path, const char *uri, const char *thumb, ThumbSize size, ThumbSource source, ImBuf *img)
++        const char *file_path, const char *uri, const char *thumb,
++        const char *blen_group, const char *blen_id,
 +        ThumbSize size, ThumbSource source, ImBuf *img)
  {
  	char desc[URI_MAX + 22];
  	char tpath[FILE_MAX];
@@@ -353,13 -347,13 +353,13 @@@
  				if (img == NULL) {
  					switch (source) {
  						case THB_SOURCE_IMAGE:
- 							img = IMB_loadiffname(path, IB_rect | IB_metadata, NULL);
+ 							img = IMB_loadiffname(file_path, IB_rect | IB_metadata, NULL);
  							break;
  						case THB_SOURCE_BLEND:
 -							img = IMB_thumb_load_blend(file_path);
 +							img = IMB_thumb_load_blend(file_path, blen_group, blen_id);
  							break;
  						case THB_SOURCE_FONT:
- 							img = IMB_thumb_load_font(path, tsize, tsize);
+ 							img = IMB_thumb_load_font(file_path, tsize, tsize);
  							break;
  						default:
  							BLI_assert(0); /* This should never happen */
@@@ -448,7 -442,7 +448,7 @@@ ImBuf *IMB_thumb_create(const char *pat
  	uri_from_filename(path, uri);
  	thumbname_from_uri(uri, thumb_name, sizeof(thumb_name));
  
- 	return thumb_create_ex(path, uri, thumb_name, path, NULL, NULL, size, source, img);
 -	return thumb_create_ex(path, uri, thumb_name, size, source, img);
++	return thumb_create_ex(path, uri, thumb_name, NULL, NULL, size, source, img);
  }
  
  /* read thumbnail for file and returns new imbuf for thumbnail */
@@@ -498,20 -493,12 +499,24 @@@ ImBuf *IMB_thumb_manage(const char *org
  	char path_buff[FILE_MAX];
  	BLI_stat_t st;
  	ImBuf *img = NULL;
 +	char *blen_group = NULL, *blen_id = NULL;
  
- 	file_path = path;
+ 	path = file_path = org_path;
 -	if (source == THB_SOURCE_FONT) {
 +	if (source == THB_SOURCE_BLEND) {
 +		if (BLO_library_path_explode(path, path_buff, &blen_group, &blen_id)) {
 +			if (blen_group) {
 +				if (!blen_id) {
 +					/* No preview for blen groups */
 +					return NULL;
 +				}
 +				file_path = path_buff;  /* path needs to be a valid file! */
 +			}
 +		}
 +	}
++	else if (source == THB_SOURCE_FONT) {
+ 		BLI_snprintf(path_buff, sizeof(path_buff), "%s.%s", org_path, IMB_thumb_load_font_get_language());
+ 		path = path_buff;
+ 	}
  
  	if (BLI_stat(file_path, &st) == -1) {
  		return NULL;
@@@ -554,12 -541,10 +559,10 @@@
  						IMB_thumb_delete(path, THB_NORMAL);
  						IMB_thumb_delete(path, THB_LARGE);
  						IMB_thumb_delete(path, THB_FAIL);
- 						img = thumb_create_ex(
- 						          path, uri, thumb_name, file_path, blen_group, blen_id, size, source, NULL);
 -						img = thumb_create_ex(file_path, uri, thumb_name, size, source, NULL);
++						img = thumb_create_ex(file_path, uri, thumb_name, blen_group, blen_id, size, source, NULL);
  						if (!img) {
  							/* thumb creation failed, write fail thumb */
- 							img = thumb_create_ex(
- 							          path, uri, thumb_name, file_path, blen_group, blen_id, THB_FAIL, source, NULL);
 -							img = thumb_create_ex(file_path, uri, thumb_name, THB_FAIL, source, NULL);
++							img = thumb_create_ex(file_path, uri, thumb_name, blen_group, blen_id, THB_FAIL, source, NULL);
  							if (img) {
  								/* we don't need failed thumb anymore */
  								IMB_freeImBuf(img);
@@@ -570,11 -555,10 +573,10 @@@
  				}
  			}
  			else {
- 				img = thumb_create_ex(path, uri, thumb_name, file_path, blen_group, blen_id, size, source, NULL);
 -				img = thumb_create_ex(file_path, uri, thumb_name, size, source, NULL);
++				img = thumb_create_ex(file_path, uri, thumb_name, blen_group, blen_id, size, source, NULL);
  				if (!img) {
  					/* thumb creation failed, write fail thumb */
- 					img = thumb_create_ex(
- 					          path, uri, thumb_name, file_path, blen_group, blen_id, THB_FAIL, source, NULL);
 -					img = thumb_create_ex(file_path, uri, thumb_name, THB_FAIL, source, NULL);
++					img = thumb_create_ex(file_path, uri, thumb_name, blen_group, blen_id, THB_FAIL, source, NULL);
  					if (img) {
  						/* we don't need failed thumb anymore */
  						IMB_freeImBuf(img);




More information about the Bf-blender-cvs mailing list