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:
Diffstat (limited to 'source/blender/editors/space_sequencer')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c55
-rw-r--r--source/blender/editors/space_sequencer/sequencer_proxy.c89
2 files changed, 60 insertions, 84 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;
}
diff --git a/source/blender/editors/space_sequencer/sequencer_proxy.c b/source/blender/editors/space_sequencer/sequencer_proxy.c
index 24fa4ad7a17..e44afde371a 100644
--- a/source/blender/editors/space_sequencer/sequencer_proxy.c
+++ b/source/blender/editors/space_sequencer/sequencer_proxy.c
@@ -49,98 +49,25 @@
/* Own include. */
#include "sequencer_intern.h"
-/*--------------------------------------------------------------------*/
-/** \name Proxy Job Manager
+/* -------------------------------------------------------------------- */
+/** \name Rebuild Proxy and Timecode Indices Operator
* \{ */
-typedef struct ProxyBuildJob {
- struct Main *main;
- struct Depsgraph *depsgraph;
- Scene *scene;
- ListBase queue;
- int stop;
-} ProxyJob;
-
-static void proxy_freejob(void *pjv)
-{
- ProxyJob *pj = pjv;
-
- BLI_freelistN(&pj->queue);
-
- MEM_freeN(pj);
-}
-
-/* Only this runs inside thread. */
-static void proxy_startjob(void *pjv, short *stop, short *do_update, float *progress)
-{
- ProxyJob *pj = pjv;
- LinkData *link;
-
- for (link = pj->queue.first; link; link = link->next) {
- struct SeqIndexBuildContext *context = link->data;
-
- SEQ_proxy_rebuild(context, stop, do_update, progress);
-
- if (*stop) {
- pj->stop = 1;
- fprintf(stderr, "Canceling proxy rebuild on users request...\n");
- break;
- }
- }
-}
-
-static void proxy_endjob(void *pjv)
-{
- ProxyJob *pj = pjv;
- Editing *ed = SEQ_editing_get(pj->scene, false);
- LinkData *link;
-
- for (link = pj->queue.first; link; link = link->next) {
- SEQ_proxy_rebuild_finish(link->data, pj->stop);
- }
-
- SEQ_relations_free_imbuf(pj->scene, &ed->seqbase, false);
-
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, pj->scene);
-}
-
static void seq_proxy_build_job(const bContext *C, ReportList *reports)
{
- wmJob *wm_job;
- ProxyJob *pj;
- struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
Scene *scene = CTX_data_scene(C);
Editing *ed = SEQ_editing_get(scene, false);
ScrArea *area = CTX_wm_area(C);
Sequence *seq;
- GSet *file_list;
if (ed == NULL) {
return;
}
- wm_job = WM_jobs_get(CTX_wm_manager(C),
- CTX_wm_window(C),
- scene,
- "Building Proxies",
- WM_JOB_PROGRESS,
- WM_JOB_TYPE_SEQ_BUILD_PROXY);
-
- pj = WM_jobs_customdata_get(wm_job);
-
- if (!pj) {
- pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job");
-
- pj->depsgraph = depsgraph;
- pj->scene = scene;
- pj->main = CTX_data_main(C);
+ wmJob *wm_job = ED_seq_proxy_wm_job_get(C);
+ ProxyJob *pj = ED_seq_proxy_job_get(C, wm_job);
- WM_jobs_customdata_set(wm_job, pj, proxy_freejob);
- WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | ND_SEQUENCER);
- WM_jobs_callbacks(wm_job, proxy_startjob, NULL, NULL, proxy_endjob);
- }
-
- file_list = BLI_gset_new(BLI_ghashutil_strhash_p, BLI_ghashutil_strcmp, "file list");
+ GSet *file_list = BLI_gset_new(BLI_ghashutil_strhash_p, BLI_ghashutil_strcmp, "file list");
bool selected = false; /* Check for no selected strips */
SEQ_CURRENT_BEGIN (ed, seq) {
@@ -182,12 +109,6 @@ static void seq_proxy_build_job(const bContext *C, ReportList *reports)
ED_area_tag_redraw(area);
}
-/** \} */
-
-/* -------------------------------------------------------------------- */
-/** \name Rebuild Proxy and Timecode Indices Operator
- * \{ */
-
static int sequencer_rebuild_proxy_invoke(bContext *C,
wmOperator *op,
const wmEvent *UNUSED(event))