diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-11-05 14:32:47 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-11-05 14:32:47 +0400 |
commit | 316d33ea0b9d9d5a28f689a30879a28b599a7e0c (patch) | |
tree | d0352a6ffbba56a18a559740d44eed40b4786c98 /source/blender/blenkernel | |
parent | 71b8469e3b48d179c18b36d1c45c56a5d14e1180 (diff) |
Change a way how image sequence/movie source is detecting for movie clip
Use IMB_testiffname to check whether file could be handled by ImBuf or
whether it should be handled by anim routines.
It solves the issue when file without extension is used for movie clip.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 4bd6676608e..6e8f2697ee1 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -520,6 +520,24 @@ static void movieclip_load_get_szie(MovieClip *clip) } } +static void detect_clip_source(MovieClip *clip) +{ + ImBuf *ibuf; + char name[FILE_MAX]; + + BLI_strncpy(name, clip->name, sizeof(name)); + BLI_path_abs(name, G.main->name); + + ibuf = IMB_testiffname(name, IB_rect | IB_multilayer); + if (ibuf) { + clip->source = MCLIP_SRC_SEQUENCE; + IMB_freeImBuf(ibuf); + } + else { + clip->source = MCLIP_SRC_MOVIE; + } +} + /* checks if image was already loaded, then returns same image * otherwise creates new. * does not load ibuf itself @@ -565,10 +583,7 @@ MovieClip *BKE_movieclip_file_add(const char *name) clip = movieclip_alloc(libname); BLI_strncpy(clip->name, name, sizeof(clip->name)); - if (BLI_testextensie_array(name, imb_ext_movie)) - clip->source = MCLIP_SRC_MOVIE; - else - clip->source = MCLIP_SRC_SEQUENCE; + detect_clip_source(clip); movieclip_load_get_szie(clip); if (clip->lastsize[0]) { @@ -1082,10 +1097,7 @@ void BKE_movieclip_reload(MovieClip *clip) clip->tracking.stabilization.ok = FALSE; /* update clip source */ - if (BLI_testextensie_array(clip->name, imb_ext_movie)) - clip->source = MCLIP_SRC_MOVIE; - else - clip->source = MCLIP_SRC_SEQUENCE; + detect_clip_source(clip); clip->lastsize[0] = clip->lastsize[1] = 0; movieclip_load_get_szie(clip); |