From 65023edabdde8657728df7d723f9cdfb1859b605 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 4 Apr 2013 09:50:51 +0000 Subject: Changes to cache invalidation policy for movie clips - When changing clip in clip editor, remove all frames from it's cache to free memory for new clip. - When changing proxy render settings, free cache as well. --- source/blender/editors/space_clip/clip_editor.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/space_clip/clip_editor.c') diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index b3b6251645c..08d0af817a8 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -528,6 +528,7 @@ MovieClip *ED_space_clip_get_clip(SpaceClip *sc) void ED_space_clip_set_clip(bContext *C, bScreen *screen, SpaceClip *sc, MovieClip *clip) { MovieClip *old_clip; + bool old_clip_visible = false; if (!screen && C) screen = CTX_wm_screen(C); @@ -546,9 +547,15 @@ void ED_space_clip_set_clip(bContext *C, bScreen *screen, SpaceClip *sc, MovieCl if (sl->spacetype == SPACE_CLIP) { SpaceClip *cur_sc = (SpaceClip *) sl; - if (cur_sc != sc && cur_sc->view != SC_VIEW_CLIP) { - if (cur_sc->clip == old_clip || cur_sc->clip == NULL) { - cur_sc->clip = clip; + if (cur_sc != sc) { + if (cur_sc->view == SC_VIEW_CLIP) { + if (cur_sc->clip == old_clip) + old_clip_visible = true; + } + else { + if (cur_sc->clip == old_clip || cur_sc->clip == NULL) { + cur_sc->clip = clip; + } } } } @@ -556,6 +563,11 @@ void ED_space_clip_set_clip(bContext *C, bScreen *screen, SpaceClip *sc, MovieCl } } + /* If clip is no longer visible on screen, free memory used by it's cache */ + if (old_clip && old_clip != clip && !old_clip_visible) { + BKE_movieclip_clear_cache(old_clip); + } + if (C) WM_event_add_notifier(C, NC_MOVIECLIP | NA_SELECTED, sc->clip); } -- cgit v1.2.3