diff options
author | Richard Antalik <richardantalik@gmail.com> | 2020-01-22 04:07:54 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2020-01-22 04:07:54 +0300 |
commit | a4cf2cf2decc29f2ca829f57254b3087e438eb5a (patch) | |
tree | 62f1fe557a9cfc366c0f36e41e72fb3f03154cc6 /source/blender/editors/space_sequencer/sequencer_add.c | |
parent | 0f7095f826f7bd87ef424fdd62008d366247544f (diff) |
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
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_add.c')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 58 |
1 files changed, 41 insertions, 17 deletions
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); } |