diff options
author | Richard Antalik <richardantalik@gmail.com> | 2019-04-29 00:13:41 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2019-04-29 00:50:48 +0300 |
commit | 337cac760ba9d198fc45459f4274a94a87558528 (patch) | |
tree | d9f1c3cb901547ef4434c38c2a390795d0fff8f1 /source/blender/makesrna | |
parent | 1b65ec0a9b9be2aef7db88be3c6deaaa135ab382 (diff) |
VSE: Cache rewrite
This patch implements new cache system.
Aim is to give user more control over cache, so it can be maximally
utilized. This is done through sequencer timeline side panel
in category proxy & cache.
Cached images are also visualized in timeline, controled by
sequencer timeline view->cache menu
Functional changes:
- NOT use IMB_moviecache API
- refactor names of cached image types
- each scene owns 1 sequencer cache
- merge preprocess cache into per-sequencer cache
- cache links images rendered per frame in order as they are created
- add cache content visualization tool
- add RNA properties to control the cache
More info can be found in design notes in blenkernel/intern/seqcache.c
and in https://developer.blender.org/D4443
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D4443
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_camera.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_color.c | 10 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 18 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 84 |
4 files changed, 96 insertions, 21 deletions
diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index ddea98a135a..1f356624f3f 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -124,11 +124,10 @@ static void rna_Camera_background_images_clear(Camera *cam) WM_main_add_notifier(NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, cam); } -static void rna_Camera_dof_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +static void rna_Camera_dof_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr)) { /* TODO(sergey): Can be more selective here. */ - BKE_sequencer_cache_cleanup(); - BKE_sequencer_preprocessed_cache_cleanup(); + BKE_sequencer_cache_cleanup_all(bmain); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); } diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 934847fed50..40ee069657c 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -577,10 +577,6 @@ static void rna_ColorManagedColorspaceSettings_reload_update(Main *bmain, BKE_movieclip_reload(bmain, clip); - /* all sequencers for now, we don't know which scenes are using this clip as a strip */ - BKE_sequencer_cache_cleanup(); - BKE_sequencer_preprocessed_cache_cleanup(); - WM_main_add_notifier(NC_MOVIECLIP | ND_DISPLAY, &clip->id); WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, &clip->id); } @@ -612,21 +608,19 @@ static void rna_ColorManagedColorspaceSettings_reload_update(Main *bmain, } BKE_sequence_invalidate_cache(scene, seq); - BKE_sequencer_preprocessed_cache_cleanup_sequence(seq); } else { SEQ_BEGIN (scene->ed, seq) { BKE_sequence_free_anim(seq); } SEQ_END; - - BKE_sequencer_cache_cleanup(); - BKE_sequencer_preprocessed_cache_cleanup(); } WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL); } } + + BKE_sequencer_cache_cleanup_all(bmain); } static char *rna_ColorManagedSequencerColorspaceSettings_path(PointerRNA *UNUSED(ptr)) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 53cfc0bc3c0..8802eb07149 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1988,22 +1988,21 @@ static void rna_Scene_update_active_object_data(bContext *C, PointerRNA *UNUSED( } } -static void rna_SceneCamera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +static void rna_SceneCamera_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { Scene *scene = (Scene *)ptr->id.data; Object *camera = scene->camera; + BKE_sequencer_cache_cleanup_all(bmain); + if (camera && (camera->type == OB_CAMERA)) { DEG_id_tag_update(&camera->id, ID_RECALC_GEOMETRY); } } -static void rna_SceneSequencer_update(Main *UNUSED(bmain), - Scene *UNUSED(scene), - PointerRNA *UNUSED(ptr)) +static void rna_SceneSequencer_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { - BKE_sequencer_cache_cleanup(); - BKE_sequencer_preprocessed_cache_cleanup(); + BKE_sequencer_cache_cleanup(scene); } static char *rna_ToolSettings_path(PointerRNA *UNUSED(ptr)) @@ -2157,11 +2156,10 @@ static void rna_GPUDOFSettings_blades_set(PointerRNA *ptr, const int value) } } -static void rna_GPUDOFSettings_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +static void rna_GPUDOFSettings_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr)) { /* TODO(sergey): Can be more selective here. */ - BKE_sequencer_cache_cleanup(); - BKE_sequencer_preprocessed_cache_cleanup(); + BKE_sequencer_cache_cleanup_all(bmain); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); } @@ -5608,7 +5606,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_range(prop, 1, SHRT_MAX); RNA_def_property_ui_range(prop, 1, 100, 10, 1); RNA_def_property_ui_text(prop, "Resolution %", "Percentage scale for render resolution"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneSequencer_update"); prop = RNA_def_property(srna, "tile_x", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "tilex"); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 6f524be7473..7daf4474eb6 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -1726,6 +1726,31 @@ static void rna_def_sequence(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting this strip"); rna_def_sequence_modifiers(brna, prop); + prop = RNA_def_property(srna, "cache_raw", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", SEQ_CACHE_STORE_RAW); + RNA_def_property_ui_text(prop, + "Cache Raw", + "Cache raw images read from disk, for faster tweaking of strip " + "parameters at the cost of memory usage"); + + prop = RNA_def_property(srna, "cache_preprocessed", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", SEQ_CACHE_STORE_PREPROCESSED); + RNA_def_property_ui_text( + prop, + "Cache Rreprocessed", + "Cache preprocessed images, for faster tweaking of effects at the cost of memory usage"); + + prop = RNA_def_property(srna, "cache_composite", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", SEQ_CACHE_STORE_COMPOSITE); + RNA_def_property_ui_text(prop, + "Cache Composite", + "Cache intermediate composited images, for faster tweaking of stacked " + "strips at the cost of memory usage"); + + prop = RNA_def_property(srna, "override_cache_settings", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", SEQ_CACHE_OVERRIDE); + RNA_def_property_ui_text(prop, "Override Cache Settings", "Override global cache settings"); + RNA_api_sequence_strip(srna); } @@ -1809,6 +1834,65 @@ static void rna_def_editor(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "proxy_dir"); RNA_def_property_ui_text(prop, "Proxy Directory", ""); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, "rna_SequenceEditor_update_cache"); + + /* cache flags */ + + prop = RNA_def_property(srna, "show_cache", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", SEQ_CACHE_VIEW_ENABLE); + RNA_def_property_ui_text(prop, "Show Cache", "Visualize cached images on the timeline"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "show_cache_final_out", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", SEQ_CACHE_VIEW_FINAL_OUT); + RNA_def_property_ui_text(prop, "Final Images", "Visualize cached complete frames"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "show_cache_raw", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", SEQ_CACHE_VIEW_RAW); + RNA_def_property_ui_text(prop, "Raw Images", "Visualize cached raw images"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "show_cache_preprocessed", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", SEQ_CACHE_VIEW_PREPROCESSED); + RNA_def_property_ui_text(prop, "Preprocessed Images", "Visualize cached preprocessed images"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "show_cache_composite", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", SEQ_CACHE_VIEW_COMPOSITE); + RNA_def_property_ui_text(prop, "Composite Images", "Visualize cached composite images"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "cache_raw", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", SEQ_CACHE_STORE_RAW); + RNA_def_property_ui_text(prop, + "Cache Raw", + "Cache raw images read from disk, for faster tweaking of strip " + "parameters at the cost of memory usage"); + + prop = RNA_def_property(srna, "cache_preprocessed", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", SEQ_CACHE_STORE_PREPROCESSED); + RNA_def_property_ui_text( + prop, + "Cache Preprocessed", + "Cache preprocessed images, for faster tweaking of effects at the cost of memory usage"); + + prop = RNA_def_property(srna, "cache_composite", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", SEQ_CACHE_STORE_COMPOSITE); + RNA_def_property_ui_text(prop, + "Cache Composite", + "Cache intermediate composited images, for faster tweaking of stacked " + "strips at the cost of memory usage"); + + prop = RNA_def_property(srna, "cache_final", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cache_flag", SEQ_CACHE_STORE_FINAL_OUT); + RNA_def_property_ui_text(prop, "Cache Final", "Cache final image for each frame"); + + prop = RNA_def_property(srna, "recycle_max_cost", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0f, SEQ_CACHE_COST_MAX); + RNA_def_property_ui_range(prop, 0.0f, SEQ_CACHE_COST_MAX, 0.1f, 1); + RNA_def_property_float_sdna(prop, NULL, "recycle_max_cost"); + RNA_def_property_ui_text( + prop, "Recycle Up To Cost", "Only frames with cost lower than this value will be recycled"); } static void rna_def_filter_video(StructRNA *srna) |