VSE: Add Adjust Last Operation panel to the video sequencer

Add Adjust Last Operation panel to Sequencer.

`OPTYPE_REGISTER` was removed form some operators and few properties were hidden
So they don't show up on the panel

Author: a.monti

Reviewed By: ISS

Differential Revision: http://developer.blender.org/D6210
This commit is contained in:
Richard Antalik 2020-01-22 02:07:54 +01:00
parent 0f7095f826
commit a4cf2cf2de
7 changed files with 65 additions and 30 deletions

View File

@ -228,6 +228,9 @@ class SEQUENCER_MT_view(Menu):
layout.prop(st, "show_region_ui")
layout.operator_context = 'INVOKE_DEFAULT'
if is_sequencer_view:
layout.prop(st, "show_region_hud")
if st.view_type == 'SEQUENCER':
layout.prop(st, "show_backdrop", text="Preview as Backdrop")

View File

@ -96,8 +96,8 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
INT_MAX,
"Start Frame",
"Start frame of the sequence strip",
INT_MIN,
INT_MAX);
-MAXFRAME,
MAXFRAME);
}
if (flag & SEQPROP_ENDFRAME) {
@ -109,8 +109,8 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
INT_MAX,
"End Frame",
"End frame for the color strip",
INT_MIN,
INT_MAX);
-MAXFRAME,
MAXFRAME);
}
RNA_def_int(
@ -312,6 +312,26 @@ static void sequencer_add_apply_replace_sel(bContext *C, wmOperator *op, Sequenc
}
}
static bool seq_effect_add_properties_poll(const bContext *UNUSED(C),
wmOperator *op,
const PropertyRNA *prop)
{
const char *prop_id = RNA_property_identifier(prop);
int type = RNA_enum_get(op->ptr, "type");
/* Hide start/end frames for effect strips that are locked to their parents' location. */
if (BKE_sequence_effect_get_num_inputs(type) != 0) {
if ((STREQ(prop_id, "frame_start")) || (STREQ(prop_id, "frame_end"))) {
return false;
}
}
if ((type != SEQ_TYPE_COLOR) && (STREQ(prop_id, "color"))) {
return false;
}
return true;
}
/* add scene operator */
static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
{
@ -1066,8 +1086,8 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
/* If seq1 is NULL and no error was raised it means the seq is standalone
* (like color strips) and we need to check its start and end frames are valid */
if (seq1 == NULL && end_frame <= start_frame) {
BKE_report(op->reports, RPT_ERROR, "Start and end frame are not set");
return OPERATOR_CANCELLED;
end_frame = start_frame + 1;
RNA_int_set(op->ptr, "frame_end", end_frame);
}
seq = BKE_sequence_alloc(ed->seqbasep, start_frame, channel, type);
@ -1161,6 +1181,8 @@ static int sequencer_add_effect_strip_invoke(bContext *C,
void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot)
{
PropertyRNA *prop;
/* identifiers */
ot->name = "Add Effect Strip";
ot->idname = "SEQUENCER_OT_effect_strip_add";
@ -1171,25 +1193,27 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot)
ot->exec = sequencer_add_effect_strip_exec;
ot->poll = ED_operator_sequencer_active_editable;
ot->poll_property = seq_effect_add_properties_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME | SEQPROP_ENDFRAME);
RNA_def_enum(ot->srna,
"type",
sequencer_prop_effect_types,
SEQ_TYPE_CROSS,
"Type",
"Sequencer effect type");
RNA_def_float_vector(ot->srna,
"color",
3,
NULL,
0.0f,
1.0f,
"Color",
"Initialize the strip with this color (only used when type='COLOR')",
0.0f,
1.0f);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME | SEQPROP_ENDFRAME);
prop = RNA_def_float_color(ot->srna,
"color",
3,
NULL,
0.0f,
1.0f,
"Color",
"Initialize the strip with this color (only used when type='COLOR')",
0.0f,
1.0f);
RNA_def_property_subtype(prop, PROP_COLOR_GAMMA);
}

View File

@ -2326,9 +2326,6 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* to give to transform */
RNA_def_enum(ot->srna, "mode", rna_enum_transform_mode_types, TFM_TRANSLATION, "Mode", "");
}
/* delete operator */
@ -3153,7 +3150,7 @@ void SEQUENCER_OT_strip_jump(wmOperatorType *ot)
ot->poll = sequencer_strip_jump_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->flag = OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "next", true, "Next Strip", "");
@ -4246,5 +4243,5 @@ void SEQUENCER_OT_set_range_to_strips(struct wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
prop = RNA_def_boolean(ot->srna, "preview", false, "Preview", "Set the preview range instead");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN);
}

View File

@ -123,6 +123,8 @@ static int strip_modifier_remove_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_strip_modifier_remove(wmOperatorType *ot)
{
PropertyRNA *prop;
/* identifiers */
ot->name = "Remove Strip Modifier";
ot->idname = "SEQUENCER_OT_strip_modifier_remove";
@ -136,7 +138,8 @@ void SEQUENCER_OT_strip_modifier_remove(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_string(ot->srna, "name", "Name", MAX_NAME, "Name", "Name of modifier to remove");
prop = RNA_def_string(ot->srna, "name", "Name", MAX_NAME, "Name", "Name of modifier to remove");
RNA_def_property_flag(prop, PROP_HIDDEN);
}
/*********************** Move operator *************************/
@ -183,6 +186,8 @@ static int strip_modifier_move_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_strip_modifier_move(wmOperatorType *ot)
{
PropertyRNA *prop;
static const EnumPropertyItem direction_items[] = {
{SEQ_MODIFIER_MOVE_UP, "UP", 0, "Up", "Move modifier up in the stack"},
{SEQ_MODIFIER_MOVE_DOWN, "DOWN", 0, "Down", "Move modifier down in the stack"},
@ -202,8 +207,10 @@ void SEQUENCER_OT_strip_modifier_move(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_string(ot->srna, "name", "Name", MAX_NAME, "Name", "Name of modifier to remove");
RNA_def_enum(ot->srna, "direction", direction_items, SEQ_MODIFIER_MOVE_UP, "Type", "");
prop = RNA_def_string(ot->srna, "name", "Name", MAX_NAME, "Name", "Name of modifier to remove");
RNA_def_property_flag(prop, PROP_HIDDEN);
prop = RNA_def_enum(ot->srna, "direction", direction_items, SEQ_MODIFIER_MOVE_UP, "Type", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
}
/*********************** Copy to selected operator *************************/

View File

@ -312,7 +312,7 @@ void SEQUENCER_OT_select_all(struct wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->flag = OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@ -353,7 +353,7 @@ void SEQUENCER_OT_select_inverse(struct wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->flag = OPTYPE_UNDO;
}
static int sequencer_select_exec(bContext *C, wmOperator *op)
@ -647,7 +647,7 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
ot->poll = ED_operator_sequencer_active;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->flag = OPTYPE_UNDO;
/* properties */
WM_operator_properties_generic_select(ot);
@ -1086,7 +1086,7 @@ void SEQUENCER_OT_select_box(wmOperatorType *ot)
ot->poll = ED_operator_sequencer_active;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->flag = OPTYPE_UNDO;
/* properties */
WM_operator_properties_gesture_box(ot);

View File

@ -869,6 +869,10 @@ void ED_spacetype_sequencer(void)
BLI_addhead(&st->regiontypes, art);
/* regions: hud */
art = ED_area_type_hud(st->spaceid);
BLI_addhead(&st->regiontypes, art);
BKE_spacetype_register(st);
/* set the sequencer callback when not in background mode */

View File

@ -4528,7 +4528,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "SpaceSeq");
RNA_def_struct_ui_text(srna, "Space Sequence Editor", "Sequence editor space data");
rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_UI));
rna_def_space_generic_show_region_toggles(srna, ((1 << RGN_TYPE_UI) | (1 << RGN_TYPE_HUD)));
/* view type, fairly important */
prop = RNA_def_property(srna, "view_type", PROP_ENUM, PROP_NONE);