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/makesrna/intern/rna_movieclip.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/makesrna/intern/rna_movieclip.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_movieclip.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c index cc3d5e5ca5e..9b2bcab4604 100644 --- a/source/blender/makesrna/intern/rna_movieclip.c +++ b/source/blender/makesrna/intern/rna_movieclip.c @@ -49,6 +49,11 @@ #include "BKE_depsgraph.h" +#include "ED_clip.h" + +#include "DNA_screen_types.h" +#include "DNA_space_types.h" + static void rna_MovieClip_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { MovieClip *clip = (MovieClip *)ptr->id.data; @@ -65,6 +70,39 @@ static void rna_MovieClip_size_get(PointerRNA *ptr, int *values) values[1] = clip->lastsize[1]; } +static void rna_MovieClipUser_proxy_render_settings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + ID *id = (ID *) ptr->id.data; + MovieClipUser *user = (MovieClipUser *) ptr->data; + + /* when changing render settings of space clip user + * clear cache for clip, so all the memory is available + * for new render settings + */ + if (GS(id->name) == ID_SCR) { + bScreen *screen = (bScreen *) id; + ScrArea *area; + SpaceLink *sl; + + for (area = screen->areabase.first; area; area = area->next) { + for (sl = area->spacedata.first; sl; sl = sl->next) { + if (sl->spacetype == SPACE_CLIP) { + SpaceClip *sc = (SpaceClip *) sl; + + if (&sc->user == user) { + MovieClip *clip = ED_space_clip_get_clip(sc); + + if (clip && (clip->flag & MCLIP_USE_PROXY)) + BKE_movieclip_clear_cache(clip); + + break; + } + } + } + } + } +} + #else static void rna_def_movieclip_proxy(BlenderRNA *brna) @@ -197,13 +235,13 @@ static void rna_def_moviecliUser(BlenderRNA *brna) RNA_def_property_enum_items(prop, clip_render_size_items); RNA_def_property_ui_text(prop, "Proxy render size", "Draw preview using full resolution or different proxy resolutions"); - RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL); + RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClipUser_proxy_render_settings_update"); /* render undistorted */ prop = RNA_def_property(srna, "use_render_undistorted", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "render_flag", MCLIP_PROXY_RENDER_UNDISTORT); RNA_def_property_ui_text(prop, "Render Undistorted", "Render preview using undistorted proxy"); - RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL); + RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClipUser_proxy_render_settings_update"); } static void rna_def_movieClipScopes(BlenderRNA *brna) |