diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 2a45d89bad4..2a50960bb7d 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -224,7 +224,7 @@ struct ImBuf *BKE_sequencer_give_ibuf_seqbase(const SeqRenderData *context, * * sequencer color space functions * ********************************************************************** */ - +int BKE_seq_proxy_context_count(struct Sequence *seq, struct Scene *scene); void BKE_sequencer_imbuf_to_sequencer_space(struct Scene *scene, struct ImBuf *ibuf, bool make_float); @@ -479,6 +479,11 @@ typedef struct SeqLoadInfo { #define SEQ_LOAD_SOUND_CACHE (1 << 3) #define SEQ_LOAD_SYNC_FPS (1 << 4) #define SEQ_LOAD_SOUND_MONO (1 << 5) +#define SEQ_LOAD_USE_PROXY (1 << 6) +#define SEQ_LOAD_PROXY_SIZE_25 (1 << 7) +#define SEQ_LOAD_PROXY_SIZE_50 (1 << 8) +#define SEQ_LOAD_PROXY_SIZE_75 (1 << 9) +#define SEQ_LOAD_PROXY_SIZE_100 (1 << 10) /* seq_dupli' flags */ #define SEQ_DUPE_UNIQUE_NAME (1 << 0) diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index ea53726a94d..eeb7b5938a9 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -2058,7 +2058,7 @@ static bool seq_proxy_multiview_context_invalid(Sequence *seq, Scene *scene, con /** * This returns the maximum possible number of required contexts */ -static int seq_proxy_context_count(Sequence *seq, Scene *scene) +int BKE_seq_proxy_context_count(Sequence *seq, Scene *scene) { int num_views = 1; @@ -2097,12 +2097,12 @@ bool BKE_sequencer_proxy_rebuild_context(Main *bmain, Scene *scene, Sequence *seq, struct GSet *file_list, - ListBase *queue) + ListBase *queue, + int num_files) { SeqIndexBuildContext *context; Sequence *nseq; LinkData *link; - int num_files; int i; if (!seq->strip || !seq->strip->proxy) { @@ -2113,8 +2113,6 @@ bool BKE_sequencer_proxy_rebuild_context(Main *bmain, return true; } - num_files = seq_proxy_context_count(seq, scene); - for (i = 0; i < num_files; i++) { if (seq_proxy_multiview_context_invalid(seq, scene, i)) { continue; @@ -5250,6 +5248,22 @@ static void seq_load_apply(Main *bmain, Scene *scene, Sequence *seq, SeqLoadInfo seq->sound->flags |= SOUND_FLAGS_CACHING; } } + if (seq_load->flag & SEQ_LOAD_USE_PROXY) { + seq->strip->proxy = MEM_callocN(sizeof(struct StripProxy), "StripProxy"); + seq->flag |= SEQ_LOAD_USE_PROXY; + if (seq_load->flag & SEQ_LOAD_PROXY_SIZE_25) { + seq->strip->proxy->build_size_flags |= IMB_PROXY_25; + } + if (seq_load->flag & SEQ_LOAD_PROXY_SIZE_50) { + seq->strip->proxy->build_size_flags |= IMB_PROXY_50; + } + if (seq_load->flag & SEQ_LOAD_PROXY_SIZE_75) { + seq->strip->proxy->build_size_flags |= IMB_PROXY_75; + } + if (seq_load->flag & SEQ_LOAD_PROXY_SIZE_100) { + seq->strip->proxy->build_size_flags |= IMB_PROXY_100; + } + } seq_load->tot_success++; } @@ -5610,7 +5624,6 @@ static Sequence *seq_dupli(const Scene *scene_src, seq->tmp = seqn; seqn->strip = MEM_dupallocN(seq->strip); - seqn->stereo3d_format = MEM_dupallocN(seq->stereo3d_format); /* XXX: add F-Curve duplication stuff? */ diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index c8ced692f6e..017adfa22bb 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -751,9 +751,6 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) fsmenu_add_windows_folder( fsmenu, FS_CATEGORY_OTHER, &FOLDERID_UserProfiles, NULL, ICON_COMMUNITY, FS_INSERT_LAST); - fsmenu_add_windows_folder( - fsmenu, FS_CATEGORY_OTHER, &FOLDERID_Objects3D, NULL, ICON_FILE_3D, FS_INSERT_LAST); - fsmenu_add_windows_folder( fsmenu, FS_CATEGORY_OTHER, &FOLDERID_SkyDrive, NULL, ICON_URL, FS_INSERT_LAST); } diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index d3179095e24..2418017a8f0 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -33,6 +33,7 @@ #include "BLI_utildefines.h" #include "BLT_translation.h" +#include "BLI_ghash.h" #include "DNA_scene_types.h" #include "DNA_mask_types.h" @@ -69,6 +70,7 @@ /* own include */ #include "sequencer_intern.h" +#include typedef struct SequencerAddData { ImageFormatData im_format; @@ -251,7 +253,26 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, bContext *C, wmOperato RNA_property_boolean_get(op->ptr, prop)) { seq_load->flag |= SEQ_LOAD_SYNC_FPS; } - + if ((prop = RNA_struct_find_property(op->ptr, "use_proxy")) && + RNA_property_boolean_get(op->ptr, prop)) { + seq_load->flag |= SEQ_LOAD_USE_PROXY; + } + if ((prop = RNA_struct_find_property(op->ptr, "build_25")) && + RNA_property_boolean_get(op->ptr, prop)) { + seq_load->flag |= SEQ_LOAD_PROXY_SIZE_25; + } + if ((prop = RNA_struct_find_property(op->ptr, "build_50")) && + RNA_property_boolean_get(op->ptr, prop)) { + seq_load->flag |= SEQ_LOAD_PROXY_SIZE_50; + } + if ((prop = RNA_struct_find_property(op->ptr, "build_75")) && + RNA_property_boolean_get(op->ptr, prop)) { + seq_load->flag |= SEQ_LOAD_PROXY_SIZE_75; + } + if ((prop = RNA_struct_find_property(op->ptr, "build_100")) && + RNA_property_boolean_get(op->ptr, prop)) { + seq_load->flag |= SEQ_LOAD_PROXY_SIZE_100; + } /* always use this for ops */ seq_load->flag |= SEQ_LOAD_FRAME_ADVANCE; @@ -473,7 +494,7 @@ static int sequencer_add_movieclip_strip_invoke(bContext *C, wmOperator *op, con sequencer_generic_invoke_xy__internal(C, op, 0, SEQ_TYPE_MOVIECLIP); return sequencer_add_movieclip_strip_exec(C, op); - // needs a menu + // needs a seq // return WM_menu_invoke(C, op, event); } @@ -591,6 +612,8 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad { Scene *scene = CTX_data_scene(C); /* only for sound */ Editing *ed = BKE_sequencer_editing_get(scene, true); + Main *bmain = CTX_data_main(C); + struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); SeqLoadInfo seq_load; int tot_files; @@ -599,16 +622,16 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad if (seq_load.flag & SEQ_LOAD_REPLACE_SEL) { ED_sequencer_deselect_all(scene); } - + GSet *file_list = BLI_gset_new(BLI_ghashutil_strhash_p, BLI_ghashutil_strcmp, "file list"); tot_files = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); - if (tot_files > 1) { + Sequence *seq; + /* multiple files */ char dir_only[FILE_MAX]; char file_only[FILE_MAX]; RNA_BEGIN (op->ptr, itemptr, "files") { - Sequence *seq; RNA_string_get(op->ptr, "directory", dir_only); RNA_string_get(&itemptr, "name", file_only); @@ -618,6 +641,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad BLI_strncpy(seq_load.name, file_only, sizeof(seq_load.name)); seq = seq_load_func(C, ed->seqbasep, &seq_load); + if (seq) { sequencer_add_apply_overlap(C, op, seq); if (seq_load.seq_sound) { @@ -629,9 +653,9 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad } else { Sequence *seq; - /* single file */ seq = seq_load_func(C, ed->seqbasep, &seq_load); + if (seq) { sequencer_add_apply_overlap(C, op, seq); if (seq_load.seq_sound) { @@ -650,11 +674,38 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad return OPERATOR_CANCELLED; } - BKE_sequencer_sort(scene); + BLI_gset_free(file_list, MEM_freeN); + BKE_sequencer_sort(scene); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); - + Sequence *seq; + file_list = BLI_gset_new(BLI_ghashutil_strhash_p, BLI_ghashutil_strcmp, "file list"); + int num_files = BKE_seq_proxy_context_count(seq, scene); + + SEQP_BEGIN (ed, seq) { + if ((seq->flag & SEQ_LOAD_USE_PROXY)) { + seq->flag &= SEQ_LOAD_USE_PROXY; + seq->flag |= SEQ_USE_PROXY; + if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE)) { + + ListBase queue = {NULL, NULL}; + LinkData *link; + short stop = 0, do_update; + float progress; + BKE_sequencer_proxy_rebuild_context( + bmain, depsgraph, scene, seq, file_list, &queue, num_files); + + for (link = queue.first; link; link = link->next) { + struct SeqIndexBuildContext *context = link->data; + BKE_sequencer_proxy_rebuild(context, &stop, &do_update, &progress); + BKE_sequencer_proxy_rebuild_finish(context, 0); + } + BKE_sequencer_free_imbuf(scene, &ed->seqbase, false); + } + } + } + SEQ_END; return OPERATOR_FINISHED; } @@ -708,6 +759,7 @@ static int sequencer_add_movie_strip_invoke(bContext *C, if (ed && ed->seqbasep && ed->seqbasep->first) { RNA_boolean_set(op->ptr, "use_framerate", false); } + RNA_boolean_set(op->ptr, "use_proxy", true); /* This is for drag and drop */ if ((RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) || @@ -785,6 +837,11 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot) true, "Use Movie Framerate", "Use framerate from the movie to keep sound and video in sync"); + RNA_def_boolean(ot->srna, "use_proxy", true, "Use Proxy", "Use proxy for this strip"); + RNA_def_boolean(ot->srna, "build_25", true, "25%", "Build 25% proxy resolution"); + RNA_def_boolean(ot->srna, "build_50", true, "50%", "Build 50% proxy resolution"); + RNA_def_boolean(ot->srna, "build_75", true, "75%", "Build 75% proxy resolution"); + RNA_def_boolean(ot->srna, "build_100", true, "100%", "Build 100% proxy resolution"); } /* add sound operator */ diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index ca2a5eaa54f..f95a66f66da 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -215,10 +215,13 @@ static void seq_proxy_build_job(const bContext *C, ReportList *reports) } file_list = BLI_gset_new(BLI_ghashutil_strhash_p, BLI_ghashutil_strcmp, "file list"); + int num_files = BKE_seq_proxy_context_count(seq, scene); + SEQP_BEGIN (ed, seq) { if ((seq->flag & SELECT)) { + bool success = BKE_sequencer_proxy_rebuild_context( - pj->main, pj->depsgraph, pj->scene, seq, file_list, &pj->queue); + pj->main, pj->depsgraph, pj->scene, seq, file_list, &pj->queue, num_files); if (!success) { BKE_reportf(reports, RPT_ERROR, "Could not build proxy for strip %s", seq->name); } @@ -3715,6 +3718,7 @@ static int sequencer_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op)) } file_list = BLI_gset_new(BLI_ghashutil_strhash_p, BLI_ghashutil_strcmp, "file list"); + int num_files = BKE_seq_proxy_context_count(seq, scene); SEQP_BEGIN (ed, seq) { if ((seq->flag & SELECT)) { @@ -3722,8 +3726,8 @@ static int sequencer_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op)) LinkData *link; short stop = 0, do_update; float progress; - - BKE_sequencer_proxy_rebuild_context(bmain, depsgraph, scene, seq, file_list, &queue); + BKE_sequencer_proxy_rebuild_context( + bmain, depsgraph, scene, seq, file_list, &queue, num_files); for (link = queue.first; link; link = link->next) { struct SeqIndexBuildContext *context = link->data;