Add some convenience operators to sequencer proxy panel:

Enable proxies for all selected movie strips (won't do recursive
enabling for metastrips yet)
Generate proxies operator here, as well as in strip menu
This commit is contained in:
Antonis Ryakiotakis 2015-01-29 12:36:23 +01:00
parent eb150ef337
commit e0fa282340
7 changed files with 91 additions and 12 deletions

View File

@ -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"

View File

@ -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
*

View File

@ -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_)

View File

@ -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[] = {

View File

@ -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);

View File

@ -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);

View File

@ -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)