[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51894] trunk/blender/source/blender: Change a way how image sequence/movie source is detecting for movie clip

Sergey Sharybin sergey.vfx at gmail.com
Mon Nov 5 11:32:49 CET 2012


Revision: 51894
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51894
Author:   nazgul
Date:     2012-11-05 10:32:47 +0000 (Mon, 05 Nov 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/movieclip.c
    trunk/blender/source/blender/imbuf/IMB_imbuf.h
    trunk/blender/source/blender/imbuf/intern/png.c
    trunk/blender/source/blender/imbuf/intern/readimage.c

Modified: trunk/blender/source/blender/blenkernel/intern/movieclip.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/movieclip.c	2012-11-05 10:15:58 UTC (rev 51893)
+++ trunk/blender/source/blender/blenkernel/intern/movieclip.c	2012-11-05 10:32:47 UTC (rev 51894)
@@ -520,6 +520,24 @@
 	}
 }
 
+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 @@
 	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 @@
 	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);

Modified: trunk/blender/source/blender/imbuf/IMB_imbuf.h
===================================================================
--- trunk/blender/source/blender/imbuf/IMB_imbuf.h	2012-11-05 10:15:58 UTC (rev 51893)
+++ trunk/blender/source/blender/imbuf/IMB_imbuf.h	2012-11-05 10:32:47 UTC (rev 51894)
@@ -103,7 +103,7 @@
  *
  * \attention Defined in readimage.c
  */
-struct ImBuf *IMB_testiffname(const char *filepath, int flags, char colorspace[IM_MAX_SPACE]);
+struct ImBuf *IMB_testiffname(const char *filepath, int flags);
 
 /**
  *

Modified: trunk/blender/source/blender/imbuf/intern/png.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/png.c	2012-11-05 10:15:58 UTC (rev 51893)
+++ trunk/blender/source/blender/imbuf/intern/png.c	2012-11-05 10:32:47 UTC (rev 51894)
@@ -558,7 +558,8 @@
 		MEM_freeN(pixels);
 	if (pixels16)
 		MEM_freeN(pixels16);
-	MEM_freeN(row_pointers);
+	if (row_pointers)
+		MEM_freeN(row_pointers);
 	png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
 
 	return(ibuf);

Modified: trunk/blender/source/blender/imbuf/intern/readimage.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/readimage.c	2012-11-05 10:15:58 UTC (rev 51893)
+++ trunk/blender/source/blender/imbuf/intern/readimage.c	2012-11-05 10:32:47 UTC (rev 51894)
@@ -100,7 +100,8 @@
 		}
 	}
 
-	fprintf(stderr, "%s: unknown fileformat (%s)\n", __func__, descr);
+	if ((flags & IB_test) == 0)
+		fprintf(stderr, "%s: unknown fileformat (%s)\n", __func__, descr);
 
 	return NULL;
 }
@@ -170,11 +171,12 @@
 	return ibuf;
 }
 
-ImBuf *IMB_testiffname(const char *filepath, int flags, char colorspace[IM_MAX_SPACE])
+ImBuf *IMB_testiffname(const char *filepath, int flags)
 {
 	ImBuf *ibuf;
 	int file;
 	char filepath_tx[IB_FILENAME_SIZE];
+	char colorspace[IM_MAX_SPACE];
 
 	imb_cache_filename(filepath_tx, filepath, flags);
 




More information about the Bf-blender-cvs mailing list