Fix #31747, broken image sequence loading after r47432.

The image file name function was updating the iuser->framenr using a supposed cfra parameter. However, the actual cfra is unknown when loading movies or sequences, so the iuser->framenr value itself was passed in its place, leading to incremental addition of the iuser frame offset. Removed the cfra parameter altogether from the image path function. This should instead be done separately if necessary, it's not an inherent part of constructing the image file name.
This commit is contained in:
Lukas Toenne 2012-06-10 07:35:45 +00:00
parent 0d6ffd925d
commit 0586705b63
3 changed files with 11 additions and 15 deletions

@ -53,7 +53,8 @@ int rna_Object_is_deform_modified(void *ob, void *scene, int settings);
void BLI_timestr(double _time, char *str);
void rna_ColorRamp_eval(void *coba, float position, float color[4]);
void rna_Scene_frame_set(void *scene, int frame, float subframe);
void BKE_image_user_file_path(void *iuser, void *ima, int cfra, char *path);
void BKE_image_user_frame_calc(void *iuser, int cfra, int fieldnr);
void BKE_image_user_file_path(void *iuser, void *ima, char *path);
}
@ -105,7 +106,8 @@ static inline bool BKE_object_is_deform_modified(BL::Object self, BL::Scene scen
static inline string image_user_file_path(BL::ImageUser iuser, BL::Image ima, int cfra)
{
char filepath[1024];
BKE_image_user_file_path(iuser.ptr.data, ima.ptr.data, cfra, filepath);
BKE_image_user_frame_calc(iuser.ptr.data, cfra, 0);
BKE_image_user_file_path(iuser.ptr.data, ima.ptr.data, filepath);
return string(filepath);
}

@ -157,7 +157,7 @@ void BKE_image_assign_ibuf(struct Image *ima, struct ImBuf *ibuf);
void BKE_image_user_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr);
void BKE_image_user_check_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr);
int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, int fieldnr);
void BKE_image_user_file_path(struct ImageUser *iuser, struct Image *ima, int cfra, char *path);
void BKE_image_user_file_path(struct ImageUser *iuser, struct Image *ima, char *path);
/* sets index offset for multilayer files */
struct RenderPass *BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser);

@ -2092,7 +2092,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
ima->tpageflag |= IMA_TPAGE_REFRESH;
ima->lastframe = frame;
BKE_image_user_file_path(iuser, ima, frame, name);
BKE_image_user_file_path(iuser, ima, name);
flag = IB_rect | IB_multilayer;
if (ima->flag & IMA_DO_PREMUL)
@ -2204,7 +2204,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
if (ima->anim == NULL) {
char str[FILE_MAX];
BKE_image_user_file_path(iuser, ima, frame, str);
BKE_image_user_file_path(iuser, ima, str);
/* FIXME: make several stream accessible in image editor, too*/
ima->anim = openanim(str, IB_rect, 0);
@ -2267,7 +2267,8 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
flag |= IB_premul;
/* get the right string */
BKE_image_user_file_path(iuser, ima, cfra, str);
BKE_image_user_frame_calc(iuser, cfra, 0);
BKE_image_user_file_path(iuser, ima, str);
/* read ibuf */
ibuf = IMB_loadiffname(str, flag);
@ -2741,21 +2742,14 @@ void BKE_image_user_check_frame_calc(ImageUser *iuser, int cfra, int fieldnr)
}
}
void BKE_image_user_file_path(ImageUser *iuser, Image *ima, int cfra, char *filepath)
void BKE_image_user_file_path(ImageUser *iuser, Image *ima, char *filepath)
{
BLI_strncpy(filepath, ima->name, FILE_MAX);
if (ima->source == IMA_SRC_SEQUENCE) {
char head[FILE_MAX], tail[FILE_MAX];
unsigned short numlen;
int frame;
if(iuser) {
BKE_image_user_frame_calc(iuser, cfra, 0);
frame = iuser->framenr;
}
else {
}
int frame = iuser->framenr;
BLI_stringdec(filepath, head, tail, &numlen);
BLI_stringenc(filepath, head, tail, numlen, frame);