From a4cf2cf2decc29f2ca829f57254b3087e438eb5a Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Wed, 22 Jan 2020 02:07:54 +0100 Subject: 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 --- .../editors/space_sequencer/sequencer_add.c | 58 +++++++++++++++------- .../editors/space_sequencer/sequencer_edit.c | 7 +-- .../editors/space_sequencer/sequencer_modifier.c | 13 +++-- .../editors/space_sequencer/sequencer_select.c | 8 +-- .../editors/space_sequencer/space_sequencer.c | 4 ++ 5 files changed, 61 insertions(+), 29 deletions(-) (limited to 'source/blender/editors/space_sequencer') diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 589375530f5..9e8fa6475a0 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -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); } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 57a0d63c35e..f4d7e9d20ca 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -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); } diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.c b/source/blender/editors/space_sequencer/sequencer_modifier.c index f262c6518aa..b90dc5e10ff 100644 --- a/source/blender/editors/space_sequencer/sequencer_modifier.c +++ b/source/blender/editors/space_sequencer/sequencer_modifier.c @@ -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 *************************/ diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index ea93ef2e040..a5bb66ca65f 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -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); diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 6e1b9d62f0e..a06a90fa6e2 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -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 */ -- cgit v1.2.3