diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-06-04 23:38:33 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-06-04 23:38:33 +0400 |
commit | 4e338e894f9fb0fa18e5594c2648b05c8f92d4c5 (patch) | |
tree | d5a6c1897d9697fc2599316c54c2b53d3b7d6b21 /source/blender/blenkernel | |
parent | d9589bf0dd7a5bbaa0560704c8fbf1b11ec0166d (diff) |
Cycles: support for image sequences in image/environment texture node.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_blender.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_image.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 38 |
3 files changed, 29 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 24386730ddb..6fccf819d05 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -42,7 +42,7 @@ extern "C" { * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 263 -#define BLENDER_SUBVERSION 8 +#define BLENDER_SUBVERSION 9 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index ac3daef77f7..279ec272fe8 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -157,6 +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); /* sets index offset for multilayer files */ struct RenderPass *BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 3748a474ddd..9dc5463edab 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -2084,8 +2084,7 @@ static void image_initialize_after_load(Image *ima, ImBuf *ibuf) static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame) { struct ImBuf *ibuf; - unsigned short numlen; - char name[FILE_MAX], head[FILE_MAX], tail[FILE_MAX]; + char name[FILE_MAX]; int flag; /* XXX temp stuff? */ @@ -2093,11 +2092,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame) ima->tpageflag |= IMA_TPAGE_REFRESH; ima->lastframe = frame; - BLI_strncpy(name, ima->name, sizeof(name)); - BLI_stringdec(name, head, tail, &numlen); - BLI_stringenc(name, head, tail, numlen, frame); - - BLI_path_abs(name, ID_BLEND_PATH(G.main, &ima->id)); + BKE_image_user_file_path(iuser, ima, frame, name); flag = IB_rect | IB_multilayer; if (ima->flag & IMA_DO_PREMUL) @@ -2209,8 +2204,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame) if (ima->anim == NULL) { char str[FILE_MAX]; - BLI_strncpy(str, ima->name, FILE_MAX); - BLI_path_abs(str, ID_BLEND_PATH(G.main, &ima->id)); + BKE_image_user_file_path(iuser, ima, frame, str); /* FIXME: make several stream accessible in image editor, too*/ ima->anim = openanim(str, IB_rect, 0); @@ -2273,8 +2267,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra) flag |= IB_premul; /* get the right string */ - BLI_strncpy(str, ima->name, sizeof(str)); - BLI_path_abs(str, ID_BLEND_PATH(G.main, &ima->id)); + BKE_image_user_file_path(iuser, ima, cfra, str); /* read ibuf */ ibuf = IMB_loadiffname(str, flag); @@ -2748,6 +2741,29 @@ 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) +{ + 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 { + } + + BLI_stringdec(filepath, head, tail, &numlen); + BLI_stringenc(filepath, head, tail, numlen, frame); + } + + BLI_path_abs(filepath, ID_BLEND_PATH(G.main, &ima->id)); +} + int BKE_image_has_alpha(struct Image *image) { ImBuf *ibuf; |