Now updating of resolution should happen nice when clip's filepath is changing

This commit is contained in:
Sergey Sharybin 2012-06-17 16:40:16 +00:00
parent fe20596f9c
commit 0723d75abd

@ -451,6 +451,22 @@ static MovieClip *movieclip_alloc(const char *name)
return clip; 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 /* checks if image was already loaded, then returns same image
* otherwise creates new. * otherwise creates new.
* does not load ibuf itself * 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 *BKE_movieclip_file_add(const char *name)
{ {
MovieClip *clip; MovieClip *clip;
MovieClipUser user = {0}; int file, len;
int file, len, width, height;
const char *libname; const char *libname;
char str[FILE_MAX], strtest[FILE_MAX]; char str[FILE_MAX], strtest[FILE_MAX];
@ -502,14 +517,7 @@ MovieClip *BKE_movieclip_file_add(const char *name)
else else
clip->source = MCLIP_SRC_SEQUENCE; clip->source = MCLIP_SRC_SEQUENCE;
user.framenr = 1; movieclip_load_get_szie(clip);
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_calc_length(clip); movieclip_calc_length(clip);
@ -1022,6 +1030,9 @@ void BKE_movieclip_reload(MovieClip *clip)
else else
clip->source = MCLIP_SRC_SEQUENCE; clip->source = MCLIP_SRC_SEQUENCE;
clip->lastsize[0] = clip->lastsize[1] = 0;
movieclip_load_get_szie(clip);
movieclip_calc_length(clip); movieclip_calc_length(clip);
} }