diff options
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 52 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 17 |
2 files changed, 67 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 39e6c632b21..0ddc9a61cad 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -56,7 +56,9 @@ #include "rna_internal.h" +#include "SEQ_proxy.h" #include "SEQ_relations.h" +#include "SEQ_sequencer.h" #include "WM_api.h" #include "WM_types.h" @@ -2236,6 +2238,48 @@ static void rna_SequenceEditor_update_cache(Main *UNUSED(bmain), SEQ_cache_cleanup(scene); } +static void seq_build_proxy(bContext *C, PointerRNA *ptr) +{ + if (U.sequencer_proxy_setup != USER_SEQ_PROXY_SETUP_AUTOMATIC) { + return; + } + + SpaceSeq *sseq = ptr->data; + Scene *scene = CTX_data_scene(C); + ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene, false)); + + GSet *file_list = BLI_gset_new(BLI_ghashutil_strhash_p, BLI_ghashutil_strcmp, "file list"); + wmJob *wm_job = ED_seq_proxy_wm_job_get(C); + ProxyJob *pj = ED_seq_proxy_job_get(C, wm_job); + + LISTBASE_FOREACH (Sequence *, seq, seqbase) { + if (seq->type != SEQ_TYPE_MOVIE) { + continue; + } + + /* Add new proxy size. */ + seq->strip->proxy->build_size_flags |= SEQ_rendersize_to_proxysize(sseq->render_size); + + /* Build proxy. */ + SEQ_proxy_rebuild_context(pj->main, pj->depsgraph, pj->scene, seq, file_list, &pj->queue); + } + + BLI_gset_free(file_list, MEM_freeN); + + if (!WM_jobs_is_running(wm_job)) { + G.is_break = false; + WM_jobs_start(CTX_wm_manager(C), wm_job); + } + + ED_area_tag_redraw(CTX_wm_area(C)); +} + +static void rna_SequenceEditor_render_size_update(bContext *C, PointerRNA *ptr) +{ + seq_build_proxy(C, ptr); + rna_SequenceEditor_update_cache(CTX_data_main(C), CTX_data_scene(C), ptr); +} + static void rna_Sequencer_view_type_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -5325,8 +5369,12 @@ static void rna_def_space_sequencer(BlenderRNA *brna) prop = RNA_def_property(srna, "proxy_render_size", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "render_size"); RNA_def_property_enum_items(prop, proxy_render_size_items); - RNA_def_property_ui_text(prop, "Preview Size", ""); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, "rna_SequenceEditor_update_cache"); + RNA_def_property_ui_text(prop, + "Proxy Render Size", + "Display preview using full resolution or different proxy resolutions"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update( + prop, NC_SPACE | ND_SPACE_SEQUENCER, "rna_SequenceEditor_render_size_update"); prop = RNA_def_property(srna, "use_proxies", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXIES); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index e07d46dbe3e..648b429acf6 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -5378,6 +5378,16 @@ static void rna_def_userdef_system(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; + static const EnumPropertyItem seq_proxy_setup_options[] = { + {USER_SEQ_PROXY_SETUP_MANUAL, "MANUAL", 0, "Manual", "Set up proxies manually"}, + {USER_SEQ_PROXY_SETUP_AUTOMATIC, + "AUTOMATIC", + 0, + "Automatic", + "Build proxies for added movie and image strips in each preview size"}, + {0, NULL, 0, NULL, NULL}, + }; + srna = RNA_def_struct(brna, "PreferencesSystem", NULL); RNA_def_struct_sdna(srna, "UserDef"); RNA_def_struct_nested(brna, srna, "Preferences"); @@ -5445,6 +5455,13 @@ static void rna_def_userdef_system(BlenderRNA *brna) "Disk Cache Compression Level", "Smaller compression will result in larger files, but less decoding overhead"); + /* Sequencer proxy setup */ + + prop = RNA_def_property(srna, "sequencer_proxy_setup", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, seq_proxy_setup_options); + RNA_def_property_enum_sdna(prop, NULL, "sequencer_proxy_setup"); + RNA_def_property_ui_text(prop, "Proxy setup", "When and how proxies are created"); + prop = RNA_def_property(srna, "scrollback", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "scrollback"); RNA_def_property_range(prop, 32, 32768); |