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.
This commit is contained in:
Campbell Barton
2010-11-05 09:01:00 +00:00
parent e179c92a27
commit e202aa6e66
2 changed files with 18 additions and 26 deletions

View File

@@ -1571,15 +1571,10 @@ static void image_create_multilayer(Image *ima, ImBuf *ibuf, int framenr)
/* common stuff to do with images after loading */ /* common stuff to do with images after loading */
static void image_initialize_after_load(Image *ima, ImBuf *ibuf) static void image_initialize_after_load(Image *ima, ImBuf *ibuf)
{ {
/* preview is NULL when it has never been used as an icon before */ /* preview is NULL when it has never been used as an icon before */
if(G.background==0 && ima->preview==NULL) if(G.background==0 && ima->preview==NULL)
BKE_icon_changed(BKE_icon_getid(&ima->id)); 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 */ /* fields */
if (ima->flag & IMA_FIELDS) { if (ima->flag & IMA_FIELDS) {
if(ima->flag & IMA_STD_FIELD) de_interlace_st(ibuf); 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->tpageflag |= IMA_TPAGE_REFRESH;
ima->lastframe= frame; 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_strncpy(name, ima->name, sizeof(name));
BLI_stringdec(name, head, tail, &numlen);
BLI_stringenc(name, head, tail, numlen, frame);
if(ima->id.lib) if(ima->id.lib)
BLI_path_abs(name, ima->id.lib->filepath); BLI_path_abs(name, ima->id.lib->filepath);
else else
@@ -1753,8 +1747,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
return ibuf; 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) static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
{ {
struct ImBuf *ibuf; struct ImBuf *ibuf;
@@ -2002,11 +1995,6 @@ static ImBuf *image_get_ibuf_threadsafe(Image *ima, ImageUser *iuser, int *frame
/* XXX temp stuff? */ /* XXX temp stuff? */
if(ima->lastframe != frame) { if(ima->lastframe != frame) {
ima->tpageflag |= IMA_TPAGE_REFRESH; 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; 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 */ /* only 1 layer/pass stored in imbufs, no exrhandle anim storage, no saving */
ibuf= image_load_sequence_multilayer(ima, iuser, frame); 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) { else if(ima->source==IMA_SRC_FILE) {

View File

@@ -137,21 +137,28 @@ static void image_info(Image *ima, ImBuf *ibuf, char *str)
if(ibuf->rect_float) { if(ibuf->rect_float) {
if(ibuf->channels!=4) { 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) else if(ibuf->depth==32)
strcat(str, " RGBA float"); ofs+= sprintf(str+ofs, " RGBA float");
else else
strcat(str, " RGB float"); ofs+= sprintf(str+ofs, " RGB float");
} }
else { else {
if(ibuf->depth==32) if(ibuf->depth==32)
strcat(str, " RGBA byte"); ofs+= sprintf(str+ofs, " RGBA byte");
else else
strcat(str, " RGB byte"); ofs+= sprintf(str+ofs, " RGB byte");
} }
if(ibuf->zbuf || ibuf->zbuf_float) 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);
}
} }