[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48010] trunk/blender/source/blender/ blenkernel/intern/movieclip.c: Now updating of resolution should happen nice when clip' s filepath is changing

Sergey Sharybin sergey.vfx at gmail.com
Sun Jun 17 18:40:26 CEST 2012


Revision: 48010
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48010
Author:   nazgul
Date:     2012-06-17 16:40:16 +0000 (Sun, 17 Jun 2012)
Log Message:
-----------
Now updating of resolution should happen nice when clip's filepath is changing

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/movieclip.c

Modified: trunk/blender/source/blender/blenkernel/intern/movieclip.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/movieclip.c	2012-06-17 14:16:26 UTC (rev 48009)
+++ trunk/blender/source/blender/blenkernel/intern/movieclip.c	2012-06-17 16:40:16 UTC (rev 48010)
@@ -451,6 +451,22 @@
 	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 @@
 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,15 +517,8 @@
 	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;
+	movieclip_load_get_szie(clip);
 
-		clip->tracking.camera.focal = 24.0f * width / clip->tracking.camera.sensor_width;
-	}
-
 	movieclip_calc_length(clip);
 
 	return clip;
@@ -1022,6 +1030,9 @@
 	else
 		clip->source = MCLIP_SRC_SEQUENCE;
 
+	clip->lastsize[0] = clip->lastsize[1] = 0;
+	movieclip_load_get_szie(clip);
+
 	movieclip_calc_length(clip);
 }
 




More information about the Bf-blender-cvs mailing list