From e202aa6e6609d957db48c0ae8bbce54c0aa454f0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 5 Nov 2010 09:01:00 +0000 Subject: [PATCH] dont change the file paths of sequence images, this is weak design because you can easily have 2 image users with different frame numbers so this ends up being which ever was last loaded. Modified to image user template to show the current filename of the image. --- source/blender/blenkernel/intern/image.c | 25 ++++--------------- .../editors/space_image/image_buttons.c | 19 +++++++++----- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 1345c6c9b61..2719563f829 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1571,15 +1571,10 @@ static void image_create_multilayer(Image *ima, ImBuf *ibuf, int framenr) /* common stuff to do with images after loading */ static void image_initialize_after_load(Image *ima, ImBuf *ibuf) { - - /* preview is NULL when it has never been used as an icon before */ if(G.background==0 && ima->preview==NULL) BKE_icon_changed(BKE_icon_getid(&ima->id)); - - /* stringcodes also in ibuf, ibuf->name is used to retrieve original (buttons) */ - BLI_strncpy(ibuf->name, ima->name, FILE_MAX); - + /* fields */ if (ima->flag & IMA_FIELDS) { if(ima->flag & IMA_STD_FIELD) de_interlace_st(ibuf); @@ -1604,11 +1599,10 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame) ima->tpageflag |= IMA_TPAGE_REFRESH; ima->lastframe= frame; - - BLI_stringdec(ima->name, head, tail, &numlen); - BLI_stringenc(ima->name, head, tail, numlen, frame); BLI_strncpy(name, ima->name, sizeof(name)); - + BLI_stringdec(name, head, tail, &numlen); + BLI_stringenc(name, head, tail, numlen, frame); + if(ima->id.lib) BLI_path_abs(name, ima->id.lib->filepath); else @@ -1753,8 +1747,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame) return ibuf; } -/* cfra used for # code, Image can only have this # for all its users - * warning, 'iuser' can be NULL */ +/* warning, 'iuser' can be NULL */ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra) { struct ImBuf *ibuf; @@ -2002,11 +1995,6 @@ static ImBuf *image_get_ibuf_threadsafe(Image *ima, ImageUser *iuser, int *frame /* XXX temp stuff? */ if(ima->lastframe != frame) { ima->tpageflag |= IMA_TPAGE_REFRESH; - if(ibuf) { - /* without this the image name only updates - * on first load which is quite confusing */ - BLI_strncpy(ima->name, ibuf->name, sizeof(ima->name)); - } } ima->lastframe = frame; } @@ -2109,9 +2097,6 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r) /* only 1 layer/pass stored in imbufs, no exrhandle anim storage, no saving */ ibuf= image_load_sequence_multilayer(ima, iuser, frame); } - - if(ibuf) - BLI_strncpy(ima->name, ibuf->name, sizeof(ima->name)); } else if(ima->source==IMA_SRC_FILE) { diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index bbc8925a152..e245dfba275 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -137,21 +137,28 @@ static void image_info(Image *ima, ImBuf *ibuf, char *str) if(ibuf->rect_float) { if(ibuf->channels!=4) { - sprintf(str+ofs, "%d float channel(s)", ibuf->channels); + ofs+= sprintf(str+ofs, "%d float channel(s)", ibuf->channels); } else if(ibuf->depth==32) - strcat(str, " RGBA float"); + ofs+= sprintf(str+ofs, " RGBA float"); else - strcat(str, " RGB float"); + ofs+= sprintf(str+ofs, " RGB float"); } else { if(ibuf->depth==32) - strcat(str, " RGBA byte"); + ofs+= sprintf(str+ofs, " RGBA byte"); else - strcat(str, " RGB byte"); + ofs+= sprintf(str+ofs, " RGB byte"); } if(ibuf->zbuf || ibuf->zbuf_float) - strcat(str, " + Z"); + ofs+= sprintf(str+ofs, " + Z"); + + if(ima->source==IMA_SRC_SEQUENCE) { + char *file= BLI_last_slash(ibuf->name); + if(file==NULL) file= ibuf->name; + else file++; + sprintf(str+ofs, ", %s", file); + } }