diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-06-17 20:40:16 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-06-17 20:40:16 +0400 |
commit | 0723d75abd90d39d17bf6ca0451805ed386053c6 (patch) | |
tree | 6b9dda843939408a6d2283a4f712590dce011186 /source/blender | |
parent | fe20596f9c7a2418a149cdc5ad5c7802851d4b23 (diff) |
Now updating of resolution should happen nice when clip's filepath is changing
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 68adb599c6c..90b56e20669 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -451,6 +451,22 @@ static MovieClip *movieclip_alloc(const char *name) return clip; } +static void movieclip_load_get_szie(MovieClip *clip) +{ + int width, height; + MovieClipUser user = {0}; + + user.framenr = 1; + BKE_movieclip_get_size(clip, &user, &width, &height); + + if (width && height) { + clip->tracking.camera.principal[0] = ((float)width) / 2.0f; + clip->tracking.camera.principal[1] = ((float)height) / 2.0f; + + clip->tracking.camera.focal = 24.0f * width / clip->tracking.camera.sensor_width; + } +} + /* checks if image was already loaded, then returns same image * otherwise creates new. * does not load ibuf itself @@ -458,8 +474,7 @@ static MovieClip *movieclip_alloc(const char *name) MovieClip *BKE_movieclip_file_add(const char *name) { MovieClip *clip; - MovieClipUser user = {0}; - int file, len, width, height; + int file, len; const char *libname; char str[FILE_MAX], strtest[FILE_MAX]; @@ -502,14 +517,7 @@ MovieClip *BKE_movieclip_file_add(const char *name) else clip->source = MCLIP_SRC_SEQUENCE; - user.framenr = 1; - BKE_movieclip_get_size(clip, &user, &width, &height); - if (width && height) { - clip->tracking.camera.principal[0] = ((float)width) / 2.0f; - clip->tracking.camera.principal[1] = ((float)height) / 2.0f; - - clip->tracking.camera.focal = 24.0f * width / clip->tracking.camera.sensor_width; - } + movieclip_load_get_szie(clip); movieclip_calc_length(clip); @@ -1022,6 +1030,9 @@ void BKE_movieclip_reload(MovieClip *clip) else clip->source = MCLIP_SRC_SEQUENCE; + clip->lastsize[0] = clip->lastsize[1] = 0; + movieclip_load_get_szie(clip); + movieclip_calc_length(clip); } |