diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-04-04 13:50:51 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-04-04 13:50:51 +0400 |
commit | 65023edabdde8657728df7d723f9cdfb1859b605 (patch) | |
tree | d5d8338ab8259c20e4f34ed3c4d95ee2365367dd /source/blender/editors/space_clip/clip_editor.c | |
parent | 845aea6864cf4b3aa34d7676f725ab268465e34f (diff) |
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.
Diffstat (limited to 'source/blender/editors/space_clip/clip_editor.c')
-rw-r--r-- | source/blender/editors/space_clip/clip_editor.c | 18 |
1 files changed, 15 insertions, 3 deletions
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); } |