[Bf-blender-cvs] [76f50cd] master: Fix for clip proxies builder reloading original footage frames

Sergey Sharybin noreply at git.blender.org
Mon Dec 15 18:20:49 CET 2014


Commit: 76f50cd17a019fa226e6cf697abdae40bd625905
Author: Sergey Sharybin
Date:   Mon Dec 15 22:20:06 2014 +0500
Branches: master
https://developer.blender.org/rB76f50cd17a019fa226e6cf697abdae40bd625905

Fix for clip proxies builder reloading original footage frames

This isn't needed if the source is the image sequence.

===================================================================

M	source/blender/blenkernel/BKE_movieclip.h
M	source/blender/blenkernel/intern/movieclip.c
M	source/blender/editors/space_clip/clip_ops.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h
index 341105c..a4aa58e 100644
--- a/source/blender/blenkernel/BKE_movieclip.h
+++ b/source/blender/blenkernel/BKE_movieclip.h
@@ -46,6 +46,7 @@ void BKE_movieclip_unlink(struct Main *bmain, struct MovieClip *clip);
 struct MovieClip *BKE_movieclip_file_add(struct Main *bmain, const char *name);
 void BKE_movieclip_reload(struct MovieClip *clip);
 void BKE_movieclip_clear_cache(struct MovieClip *clip);
+void BKE_movieclip_clear_proxy_cache(struct MovieClip *clip);
 
 struct ImBuf *BKE_movieclip_get_ibuf(struct MovieClip *clip, struct MovieClipUser *user);
 struct ImBuf *BKE_movieclip_get_postprocessed_ibuf(struct MovieClip *clip, struct MovieClipUser *user, int postprocess_flag);
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index f62855e..0e9a7ce 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -525,6 +525,15 @@ static bool put_imbuf_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, i
 	}
 }
 
+static bool moviecache_check_free_proxy(ImBuf *UNUSED(ibuf),
+                                        void *userkey,
+                                        void *UNUSED(userdata))
+{
+	MovieClipImBufCacheKey *key = (MovieClipImBufCacheKey *)userkey;
+
+	return !(key->proxy == IMB_PROXY_NONE && key->render_flag == 0);
+}
+
 /*********************** common functions *************************/
 
 /* only image block itself */
@@ -1167,6 +1176,15 @@ void BKE_movieclip_clear_cache(MovieClip *clip)
 	free_buffers(clip);
 }
 
+void BKE_movieclip_clear_proxy_cache(MovieClip *clip)
+{
+	if (clip->cache && clip->cache->moviecache) {
+		IMB_moviecache_cleanup(clip->cache->moviecache,
+		                       moviecache_check_free_proxy,
+		                       NULL);
+	}
+}
+
 void BKE_movieclip_reload(MovieClip *clip)
 {
 	/* clear cache */
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 787a7fc..9f9ac66 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -1307,7 +1307,14 @@ static void proxy_endjob(void *pjv)
 	if (pj->index_context)
 		IMB_anim_index_rebuild_finish(pj->index_context, pj->stop);
 
-	BKE_movieclip_reload(pj->clip);
+	if (pj->clip->source == MCLIP_SRC_MOVIE) {
+		/* Timecode might have changed, so do a full reload to deal with this. */
+		BKE_movieclip_reload(pj->clip);
+	}
+	else {
+		/* For image sequences we'll preserve original cache. */
+		BKE_movieclip_clear_proxy_cache(pj->clip);
+	}
 
 	WM_main_add_notifier(NC_MOVIECLIP | ND_DISPLAY, pj->clip);
 }




More information about the Bf-blender-cvs mailing list