Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Antalik <richardantalik@gmail.com>2021-03-16 20:47:23 +0300
committerRichard Antalik <richardantalik@gmail.com>2021-03-16 20:56:44 +0300
commit04e1feb83051f75317309ec3659b9263a99dbd7e (patch)
treec2e71b1f62233b04bfab8f6f307e6d1838e8daa2 /source/blender/editors/space_sequencer/sequencer_add.c
parente4f347783320d83e43bc650020013e19b2f22c7f (diff)
VSE: Automatic proxy building
Build proxies automatically when added to sequencer timeline and when switching preview size. This behavior can be disabled in user preferences. Reviewed By: sergey, fsiddi Differential Revision: https://developer.blender.org/D10363
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_add.c')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 844dbe6a0a5..63946778a19 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -29,6 +29,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_ghash.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -37,8 +38,10 @@
#include "DNA_mask_types.h"
#include "DNA_scene_types.h"
#include "DNA_sound_types.h"
+#include "DNA_space_types.h"
#include "BKE_context.h"
+#include "BKE_global.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_mask.h"
@@ -55,6 +58,7 @@
#include "SEQ_add.h"
#include "SEQ_effects.h"
+#include "SEQ_proxy.h"
#include "SEQ_relations.h"
#include "SEQ_render.h"
#include "SEQ_select.h"
@@ -548,6 +552,55 @@ static bool sequencer_add_draw_check_fn(PointerRNA *UNUSED(ptr),
return !(STR_ELEM(prop_id, "filepath", "directory", "filename"));
}
+/* Strips are added in context of timeline which has different preview size than actual preview. We
+ * must search for preview area. In most cases there will be only one preview area, but there can
+ * be more with different preview sizes. */
+static IMB_Proxy_Size seq_get_proxy_size_flags(bContext *C)
+{
+ bScreen *screen = CTX_wm_screen(C);
+ IMB_Proxy_Size proxy_sizes = 0;
+ LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+ LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
+ switch (sl->spacetype) {
+ case SPACE_SEQ: {
+ SpaceSeq *sseq = (SpaceSeq *)sl;
+ if (!ELEM(sseq->view, SEQ_VIEW_PREVIEW, SEQ_VIEW_SEQUENCE_PREVIEW)) {
+ continue;
+ }
+ proxy_sizes |= SEQ_rendersize_to_proxysize(sseq->render_size);
+ }
+ }
+ }
+ }
+ return proxy_sizes;
+}
+
+static void seq_build_proxy(bContext *C, Sequence *seq)
+{
+ if (U.sequencer_proxy_setup == USER_SEQ_PROXY_SETUP_AUTOMATIC) {
+ return;
+ }
+
+ /* Enable and set proxy size. */
+ SEQ_proxy_set(seq, true);
+ seq->strip->proxy->build_size_flags = seq_get_proxy_size_flags(C);
+ seq->strip->proxy->build_flags |= SEQ_PROXY_SKIP_EXISTING;
+
+ /* Build proxy. */
+ 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);
+ 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 sequencer_add_movie_multiple_strips(bContext *C,
wmOperator *op,
SeqLoadData *load_data)
@@ -578,6 +631,7 @@ static void sequencer_add_movie_multiple_strips(bContext *C,
load_data->start_frame += seq_movie->enddisp - seq_movie->startdisp;
seq_load_apply_generic_options(C, op, seq_sound);
seq_load_apply_generic_options(C, op, seq_movie);
+ seq_build_proxy(C, seq_movie);
}
}
RNA_END;
@@ -604,6 +658,7 @@ static bool sequencer_add_movie_single_strip(bContext *C, wmOperator *op, SeqLoa
}
seq_load_apply_generic_options(C, op, seq_sound);
seq_load_apply_generic_options(C, op, seq_movie);
+ seq_build_proxy(C, seq_movie);
return true;
}