diff options
7 files changed, 91 insertions, 12 deletions
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 43cfa3666e6..a7d8208485d 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -941,6 +941,10 @@ class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel): col.prop(strip.proxy, "timecode") + col = layout.column() + col.operator("sequencer.enable_proxies") + col.operator("sequencer.rebuild_proxy") + class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel): bl_label = "Scene Preview/Render" diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 24e8d6362c1..d14023f6f88 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -240,6 +240,7 @@ struct SeqIndexBuildContext *BKE_sequencer_proxy_rebuild_context(struct Main *bm void BKE_sequencer_proxy_rebuild(struct SeqIndexBuildContext *context, short *stop, short *do_update, float *progress); void BKE_sequencer_proxy_rebuild_finish(struct SeqIndexBuildContext *context, bool stop); +void BKE_sequencer_proxy_set(struct Sequence *seq, bool value); /* ********************************************************************** * seqcache.c * diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index f63f4cf86ae..e27116f07f8 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1644,6 +1644,22 @@ void BKE_sequencer_proxy_rebuild_finish(SeqIndexBuildContext *context, bool stop MEM_freeN(context); } +void BKE_sequencer_proxy_set(struct Sequence *seq, bool value) +{ + if (value) { + seq->flag |= SEQ_USE_PROXY; + if (seq->strip->proxy == NULL) { + seq->strip->proxy = MEM_callocN(sizeof(struct StripProxy), "StripProxy"); + seq->strip->proxy->quality = 90; + seq->strip->proxy->build_tc_flags = SEQ_PROXY_TC_ALL; + seq->strip->proxy->build_size_flags = SEQ_PROXY_IMAGE_SIZE_25; + } + } + else { + seq->flag ^= SEQ_USE_PROXY; + } +} + /*********************** color balance *************************/ static StripColorBalance calc_cb(StripColorBalance *cb_) diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 42c81a30c29..5cee36a22de 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -64,6 +64,7 @@ #include "ED_space_api.h" #include "UI_view2d.h" +#include "UI_interface.h" /* own include */ @@ -3398,6 +3399,72 @@ void SEQUENCER_OT_rebuild_proxy(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER; } +static int sequencer_enable_proxies_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) +{ + return WM_operator_props_dialog_popup(C, op, 10 * UI_UNIT_X, 5 * UI_UNIT_Y); +} + +static int sequencer_enable_proxies_exec(bContext *C, wmOperator *op) +{ + Scene *scene = CTX_data_scene(C); + Editing *ed = BKE_sequencer_editing_get(scene, false); + Sequence *seq; + bool proxy_25 = RNA_boolean_get(op->ptr, "proxy_25"); + bool proxy_50 = RNA_boolean_get(op->ptr, "proxy_50"); + bool proxy_75 = RNA_boolean_get(op->ptr, "proxy_75"); + bool proxy_100 = RNA_boolean_get(op->ptr, "proxy_100"); + + if (ed == NULL || + !(proxy_25 || proxy_50 || proxy_75 || proxy_100)) { + return OPERATOR_FINISHED; + } + + SEQP_BEGIN(ed, seq) + { + if ((seq->flag & SELECT)) { + if (seq->type == SEQ_TYPE_MOVIE) { + if (!seq->strip->proxy) { + BKE_sequencer_proxy_set(seq, true); + } + + if (proxy_25) + seq->strip->proxy->build_size_flags |= SEQ_PROXY_IMAGE_SIZE_25; + if (proxy_50) + seq->strip->proxy->build_size_flags |= SEQ_PROXY_IMAGE_SIZE_50; + if (proxy_75) + seq->strip->proxy->build_size_flags |= SEQ_PROXY_IMAGE_SIZE_75; + if (proxy_100) + seq->strip->proxy->build_size_flags |= SEQ_PROXY_IMAGE_SIZE_100; + } + } + } + SEQ_END + + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); + + return OPERATOR_FINISHED; +} + +void SEQUENCER_OT_enable_proxies(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Enable Proxies"; + ot->idname = "SEQUENCER_OT_enable_proxies"; + ot->description = "Enable selected proxies on all selected Movie strips"; + + /* api callbacks */ + ot->invoke = sequencer_enable_proxies_invoke; + ot->exec = sequencer_enable_proxies_exec; + + /* flags */ + ot->flag = OPTYPE_REGISTER; + + RNA_def_boolean(ot->srna, "proxy_25", false, "25%", ""); + RNA_def_boolean(ot->srna, "proxy_50", false, "50%", ""); + RNA_def_boolean(ot->srna, "proxy_75", false, "75%", ""); + RNA_def_boolean(ot->srna, "proxy_100", false, "100%", ""); +} + /* change ops */ static EnumPropertyItem prop_change_effect_input_types[] = { diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 5f1c9317fd9..461c72961c2 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -131,6 +131,7 @@ void SEQUENCER_OT_copy(struct wmOperatorType *ot); void SEQUENCER_OT_paste(struct wmOperatorType *ot); void SEQUENCER_OT_rebuild_proxy(struct wmOperatorType *ot); +void SEQUENCER_OT_enable_proxies(struct wmOperatorType *ot); /* preview specific operators */ void SEQUENCER_OT_view_all_preview(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 9b5ef18f7cd..33a8a1c5b41 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -88,6 +88,7 @@ void sequencer_operatortypes(void) WM_operatortype_append(SEQUENCER_OT_view_ghost_border); WM_operatortype_append(SEQUENCER_OT_rebuild_proxy); + WM_operatortype_append(SEQUENCER_OT_enable_proxies); WM_operatortype_append(SEQUENCER_OT_change_effect_input); WM_operatortype_append(SEQUENCER_OT_change_effect_type); WM_operatortype_append(SEQUENCER_OT_change_path); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index d4a98fe8b5d..871dd93b525 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -310,18 +310,7 @@ static void rna_Sequence_frame_offset_range(PointerRNA *ptr, int *min, int *max, static void rna_Sequence_use_proxy_set(PointerRNA *ptr, int value) { Sequence *seq = (Sequence *)ptr->data; - if (value) { - seq->flag |= SEQ_USE_PROXY; - if (seq->strip->proxy == NULL) { - seq->strip->proxy = MEM_callocN(sizeof(struct StripProxy), "StripProxy"); - seq->strip->proxy->quality = 90; - seq->strip->proxy->build_tc_flags = SEQ_PROXY_TC_ALL; - seq->strip->proxy->build_size_flags = SEQ_PROXY_IMAGE_SIZE_25; - } - } - else { - seq->flag ^= SEQ_USE_PROXY; - } + BKE_sequencer_proxy_set(seq, value != 0); } static void rna_Sequence_use_translation_set(PointerRNA *ptr, int value) |