Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_edit.c')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c187
1 files changed, 94 insertions, 93 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 86c438c616e..415bb5898a9 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -54,6 +54,7 @@
#include "RNA_prototypes.h"
/* For menu, popup, icons, etc. */
+#include "ED_fileselect.h"
#include "ED_keyframing.h"
#include "ED_numinput.h"
#include "ED_outliner.h"
@@ -81,6 +82,7 @@ typedef struct TransSeq {
int anim_startofs, anim_endofs;
/* int final_left, final_right; */ /* UNUSED */
int len;
+ float content_start;
} TransSeq;
/** \} */
@@ -173,6 +175,11 @@ bool sequencer_edit_poll(bContext *C)
return (SEQ_editing_get(CTX_data_scene(C)) != NULL);
}
+bool sequencer_editing_initialized_and_active(bContext *C)
+{
+ return ED_operator_sequencer_active(C) && sequencer_edit_poll(C);
+}
+
#if 0 /* UNUSED */
bool sequencer_strip_poll(bContext *C)
{
@@ -259,7 +266,7 @@ static int sequencer_gap_remove_exec(bContext *C, wmOperator *op)
const bool do_all = RNA_boolean_get(op->ptr, "all");
const Editing *ed = SEQ_editing_get(scene);
- SEQ_edit_remove_gaps(scene, ed->seqbasep, CFRA, do_all);
+ SEQ_edit_remove_gaps(scene, ed->seqbasep, scene->r.cfra, do_all);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
@@ -298,7 +305,7 @@ static int sequencer_gap_insert_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
const int frames = RNA_int_get(op->ptr, "frames");
const Editing *ed = SEQ_editing_get(scene);
- SEQ_transform_offset_after_frame(scene, ed->seqbasep, frames, CFRA);
+ SEQ_transform_offset_after_frame(scene, ed->seqbasep, frames, scene->r.cfra);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
@@ -364,8 +371,6 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
else { /* SEQ_RIGHTSEL */
SEQ_time_right_handle_frame_set(scene, seq, snap_frame);
}
- SEQ_transform_handle_xlimits(
- scene, seq, seq->flag & SEQ_LEFTSEL, seq->flag & SEQ_RIGHTSEL);
SEQ_transform_fix_single_image_seq_offsets(scene, seq);
}
}
@@ -375,7 +380,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT && !SEQ_transform_is_locked(channels, seq)) {
seq->flag &= ~SEQ_OVERLAP;
- if (SEQ_transform_test_overlap(ed->seqbasep, seq)) {
+ if (SEQ_transform_test_overlap(scene, ed->seqbasep, seq)) {
SEQ_transform_seqbase_shuffle(ed->seqbasep, seq, scene);
}
}
@@ -388,17 +393,20 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
if (seq->seq1 && (seq->seq1->flag & SELECT)) {
if (!either_handle_selected) {
- SEQ_offset_animdata(scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(seq)));
+ SEQ_offset_animdata(
+ scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(scene, seq)));
}
}
else if (seq->seq2 && (seq->seq2->flag & SELECT)) {
if (!either_handle_selected) {
- SEQ_offset_animdata(scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(seq)));
+ SEQ_offset_animdata(
+ scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(scene, seq)));
}
}
else if (seq->seq3 && (seq->seq3->flag & SELECT)) {
if (!either_handle_selected) {
- SEQ_offset_animdata(scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(seq)));
+ SEQ_offset_animdata(
+ scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(scene, seq)));
}
}
}
@@ -416,7 +424,7 @@ static int sequencer_snap_invoke(bContext *C, wmOperator *op, const wmEvent *UNU
int snap_frame;
- snap_frame = CFRA;
+ snap_frame = scene->r.cfra;
RNA_int_set(op->ptr, "frame", snap_frame);
return sequencer_snap_exec(C, op);
@@ -468,6 +476,7 @@ typedef struct SlipData {
static void transseq_backup(TransSeq *ts, Sequence *seq)
{
+ ts->content_start = SEQ_time_start_frame_get(seq);
ts->start = seq->start;
ts->machine = seq->machine;
ts->startofs = seq->startofs;
@@ -598,7 +607,7 @@ static void sequencer_slip_recursively(Scene *scene, SlipData *data, int offset)
}
/* Make sure, that each strip contains at least 1 frame of content. */
-static void sequencer_slip_apply_limits(SlipData *data, int *offset)
+static void sequencer_slip_apply_limits(const Scene *scene, SlipData *data, int *offset)
{
for (int i = 0; i < data->num_seq; i++) {
if (data->trim[i]) {
@@ -607,12 +616,12 @@ static void sequencer_slip_apply_limits(SlipData *data, int *offset)
int seq_content_end = seq_content_start + seq->len + seq->anim_startofs + seq->anim_endofs;
int diff = 0;
- if (seq_content_start >= SEQ_time_right_handle_frame_get(seq)) {
- diff = SEQ_time_right_handle_frame_get(seq) - seq_content_start - 1;
+ if (seq_content_start >= SEQ_time_right_handle_frame_get(scene, seq)) {
+ diff = SEQ_time_right_handle_frame_get(scene, seq) - seq_content_start - 1;
}
- if (seq_content_end <= SEQ_time_left_handle_frame_get(seq)) {
- diff = SEQ_time_left_handle_frame_get(seq) - seq_content_end + 1;
+ if (seq_content_end <= SEQ_time_left_handle_frame_get(scene, seq)) {
+ diff = SEQ_time_left_handle_frame_get(scene, seq) - seq_content_end + 1;
}
*offset += diff;
}
@@ -644,7 +653,7 @@ static int sequencer_slip_exec(bContext *C, wmOperator *op)
transseq_backup(data->ts + i, data->seq_array[i]);
}
- sequencer_slip_apply_limits(data, &offset);
+ sequencer_slip_apply_limits(scene, data, &offset);
sequencer_slip_recursively(scene, data, offset);
MEM_freeN(data->seq_array);
@@ -690,7 +699,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even
applyNumInput(&data->num_input, &offset_fl);
int offset = round_fl_to_int(offset_fl);
- sequencer_slip_apply_limits(data, &offset);
+ sequencer_slip_apply_limits(scene, data, &offset);
sequencer_slip_update_header(scene, area, data, offset);
RNA_int_set(op->ptr, "offset", offset);
@@ -722,7 +731,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even
UI_view2d_region_to_view(v2d, mouse_x, 0, &mouseloc[0], &mouseloc[1]);
offset = mouseloc[0] - data->init_mouseloc[0];
- sequencer_slip_apply_limits(data, &offset);
+ sequencer_slip_apply_limits(scene, data, &offset);
sequencer_slip_update_header(scene, area, data, offset);
RNA_int_set(op->ptr, "offset", offset);
@@ -799,7 +808,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even
applyNumInput(&data->num_input, &offset_fl);
int offset = round_fl_to_int(offset_fl);
- sequencer_slip_apply_limits(data, &offset);
+ sequencer_slip_apply_limits(scene, data, &offset);
sequencer_slip_update_header(scene, area, data, offset);
RNA_int_set(op->ptr, "offset", offset);
@@ -1047,7 +1056,7 @@ static int sequencer_reload_exec(bContext *C, wmOperator *op)
SEQ_add_reload_new_file(bmain, scene, seq, !adjust_length);
if (adjust_length) {
- if (SEQ_transform_test_overlap(ed->seqbasep, seq)) {
+ if (SEQ_transform_test_overlap(scene, ed->seqbasep, seq)) {
SEQ_transform_seqbase_shuffle(ed->seqbasep, seq, scene);
}
}
@@ -1410,14 +1419,14 @@ static int sequencer_split_exec(bContext *C, wmOperator *op)
if (ignore_selection) {
if (use_cursor_position) {
LISTBASE_FOREACH (Sequence *, seq, SEQ_active_seqbase_get(ed)) {
- if (SEQ_time_right_handle_frame_get(seq) == split_frame &&
+ if (SEQ_time_right_handle_frame_get(scene, seq) == split_frame &&
seq->machine == split_channel) {
seq_selected = seq->flag & SEQ_ALLSEL;
}
}
if (!seq_selected) {
LISTBASE_FOREACH (Sequence *, seq, SEQ_active_seqbase_get(ed)) {
- if (SEQ_time_left_handle_frame_get(seq) == split_frame &&
+ if (SEQ_time_left_handle_frame_get(scene, seq) == split_frame &&
seq->machine == split_channel) {
seq->flag &= ~SEQ_ALLSEL;
}
@@ -1429,12 +1438,12 @@ static int sequencer_split_exec(bContext *C, wmOperator *op)
if (split_side != SEQ_SIDE_BOTH) {
LISTBASE_FOREACH (Sequence *, seq, SEQ_active_seqbase_get(ed)) {
if (split_side == SEQ_SIDE_LEFT) {
- if (SEQ_time_left_handle_frame_get(seq) >= split_frame) {
+ if (SEQ_time_left_handle_frame_get(scene, seq) >= split_frame) {
seq->flag &= ~SEQ_ALLSEL;
}
}
else {
- if (SEQ_time_right_handle_frame_get(seq) <= split_frame) {
+ if (SEQ_time_right_handle_frame_get(scene, seq) <= split_frame) {
seq->flag &= ~SEQ_ALLSEL;
}
}
@@ -1457,7 +1466,7 @@ static int sequencer_split_invoke(bContext *C, wmOperator *op, const wmEvent *ev
View2D *v2d = UI_view2d_fromcontext(C);
int split_side = RNA_enum_get(op->ptr, "side");
- int split_frame = CFRA;
+ int split_frame = scene->r.cfra;
if (split_side == SEQ_SIDE_MOUSE) {
if (ED_operator_sequencer_active(C) && v2d) {
@@ -1695,8 +1704,10 @@ static int sequencer_delete_exec(bContext *C, wmOperator *op)
static int sequencer_delete_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *region = CTX_wm_region(C);
+ Scene *scene = CTX_data_scene(C);
+ ListBase *markers = &scene->markers;
- if (region->regiontype == RGN_TYPE_WINDOW) {
+ if (region->regiontype == RGN_TYPE_WINDOW && !BLI_listbase_is_empty(markers)) {
/* Bounding box of 30 pixels is used for markers shortcuts,
* prevent conflict with markers shortcuts here.
*/
@@ -1761,7 +1772,7 @@ static int sequencer_offset_clear_exec(bContext *C, wmOperator *UNUSED(op))
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if ((seq->type & SEQ_TYPE_EFFECT) == 0 && (seq->flag & SELECT)) {
- if (SEQ_transform_test_overlap(ed->seqbasep, seq)) {
+ if (SEQ_transform_test_overlap(scene, ed->seqbasep, seq)) {
SEQ_transform_seqbase_shuffle(ed->seqbasep, seq, scene);
}
}
@@ -1820,12 +1831,12 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
/* TODO: remove f-curve and assign to split image strips.
* The old animation system would remove the user of `seq->ipo`. */
- start_ofs = timeline_frame = SEQ_time_left_handle_frame_get(seq);
- frame_end = SEQ_time_right_handle_frame_get(seq);
+ start_ofs = timeline_frame = SEQ_time_left_handle_frame_get(scene, seq);
+ frame_end = SEQ_time_right_handle_frame_get(scene, seq);
while (timeline_frame < frame_end) {
/* New seq. */
- se = SEQ_render_give_stripelem(seq, timeline_frame);
+ se = SEQ_render_give_stripelem(scene, seq, timeline_frame);
seq_new = SEQ_sequence_dupli_recursive(scene, scene, seqbase, seq, SEQ_DUPE_UNIQUE_NAME);
@@ -1847,7 +1858,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
if (step > 1) {
seq_new->flag &= ~SEQ_OVERLAP;
- if (SEQ_transform_test_overlap(seqbase, seq_new)) {
+ if (SEQ_transform_test_overlap(scene, seqbase, seq_new)) {
SEQ_transform_seqbase_shuffle(seqbase, seq_new, scene);
}
}
@@ -1906,11 +1917,9 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
SEQ_prefetch_stop(scene);
if (active_seq && active_seq->type == SEQ_TYPE_META && active_seq->flag & SELECT) {
- /* Enter meta-strip. */
- SEQ_meta_stack_alloc(ed, active_seq);
- SEQ_seqbase_active_set(ed, &active_seq->seqbase);
- SEQ_channels_displayed_set(ed, &active_seq->channels);
+ /* Deselect active meta seq. */
SEQ_select_active_set(scene, NULL);
+ SEQ_meta_stack_set(scene, active_seq);
}
else {
/* Exit meta-strip if possible. */
@@ -1918,11 +1927,9 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
}
- MetaStack *ms = SEQ_meta_stack_active_get(ed);
- SEQ_seqbase_active_set(ed, ms->oldbasep);
- SEQ_channels_displayed_set(ed, ms->old_channels);
- SEQ_select_active_set(scene, ms->parseq);
- SEQ_meta_stack_free(ed, ms);
+ /* Display parent meta. */
+ Sequence *meta_parent = SEQ_meta_stack_pop(ed);
+ SEQ_select_active_set(scene, meta_parent);
}
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
@@ -1977,8 +1984,8 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
BLI_addtail(&seqm->seqbase, seq);
SEQ_relations_invalidate_cache_preprocessed(scene, seq);
channel_max = max_ii(seq->machine, channel_max);
- meta_start_frame = min_ii(SEQ_time_left_handle_frame_get(seq), meta_start_frame);
- meta_end_frame = max_ii(SEQ_time_right_handle_frame_get(seq), meta_end_frame);
+ meta_start_frame = min_ii(SEQ_time_left_handle_frame_get(scene, seq), meta_start_frame);
+ meta_end_frame = max_ii(SEQ_time_right_handle_frame_get(scene, seq), meta_end_frame);
}
}
@@ -1988,7 +1995,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
seqm->start = meta_start_frame;
seqm->len = meta_end_frame - meta_start_frame;
SEQ_select_active_set(scene, seqm);
- if (SEQ_transform_test_overlap(active_seqbase, seqm)) {
+ if (SEQ_transform_test_overlap(scene, active_seqbase, seqm)) {
SEQ_transform_seqbase_shuffle(active_seqbase, seqm, scene);
}
@@ -2048,7 +2055,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
LISTBASE_FOREACH (Sequence *, seq, active_seqbase) {
if (seq->flag & SELECT) {
seq->flag &= ~SEQ_OVERLAP;
- if (SEQ_transform_test_overlap(active_seqbase, seq)) {
+ if (SEQ_transform_test_overlap(scene, active_seqbase, seq)) {
SEQ_transform_seqbase_shuffle(active_seqbase, seq, scene);
}
}
@@ -2087,12 +2094,12 @@ static bool strip_jump_internal(Scene *scene,
const bool do_center)
{
bool changed = false;
- int timeline_frame = CFRA;
+ int timeline_frame = scene->r.cfra;
int next_frame = SEQ_time_find_next_prev_edit(
scene, timeline_frame, side, do_skip_mute, do_center, false);
if (next_frame != timeline_frame) {
- CFRA = next_frame;
+ scene->r.cfra = next_frame;
changed = true;
}
@@ -2159,17 +2166,18 @@ static const EnumPropertyItem prop_side_lr_types[] = {
static void swap_sequence(Scene *scene, Sequence *seqa, Sequence *seqb)
{
- int gap = SEQ_time_left_handle_frame_get(seqb) - SEQ_time_right_handle_frame_get(seqa);
+ int gap = SEQ_time_left_handle_frame_get(scene, seqb) -
+ SEQ_time_right_handle_frame_get(scene, seqa);
int seq_a_start;
int seq_b_start;
- seq_b_start = (seqb->start - SEQ_time_left_handle_frame_get(seqb)) +
- SEQ_time_left_handle_frame_get(seqa);
+ seq_b_start = (seqb->start - SEQ_time_left_handle_frame_get(scene, seqb)) +
+ SEQ_time_left_handle_frame_get(scene, seqa);
SEQ_transform_translate_sequence(scene, seqb, seq_b_start - seqb->start);
SEQ_relations_invalidate_cache_preprocessed(scene, seqb);
- seq_a_start = (seqa->start - SEQ_time_left_handle_frame_get(seqa)) +
- SEQ_time_right_handle_frame_get(seqb) + gap;
+ seq_a_start = (seqa->start - SEQ_time_left_handle_frame_get(scene, seqa)) +
+ SEQ_time_right_handle_frame_get(scene, seqb) + gap;
SEQ_transform_translate_sequence(scene, seqa, seq_a_start - seqa->start);
SEQ_relations_invalidate_cache_preprocessed(scene, seqa);
}
@@ -2195,13 +2203,17 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i
switch (lr) {
case SEQ_SIDE_LEFT:
- if (SEQ_time_right_handle_frame_get(seq) <= SEQ_time_left_handle_frame_get(test)) {
- dist = SEQ_time_right_handle_frame_get(test) - SEQ_time_left_handle_frame_get(seq);
+ if (SEQ_time_right_handle_frame_get(scene, seq) <=
+ SEQ_time_left_handle_frame_get(scene, test)) {
+ dist = SEQ_time_right_handle_frame_get(scene, test) -
+ SEQ_time_left_handle_frame_get(scene, seq);
}
break;
case SEQ_SIDE_RIGHT:
- if (SEQ_time_left_handle_frame_get(seq) >= SEQ_time_right_handle_frame_get(test)) {
- dist = SEQ_time_left_handle_frame_get(seq) - SEQ_time_right_handle_frame_get(test);
+ if (SEQ_time_left_handle_frame_get(scene, seq) >=
+ SEQ_time_right_handle_frame_get(scene, test)) {
+ dist = SEQ_time_left_handle_frame_get(scene, seq) -
+ SEQ_time_right_handle_frame_get(scene, test);
}
break;
}
@@ -2266,7 +2278,7 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op)
if ((iseq->type & SEQ_TYPE_EFFECT) &&
(seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
/* This may now overlap. */
- if (SEQ_transform_test_overlap(seqbase, iseq)) {
+ if (SEQ_transform_test_overlap(scene, seqbase, iseq)) {
SEQ_transform_seqbase_shuffle(seqbase, iseq, scene);
}
}
@@ -2316,7 +2328,7 @@ static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op))
switch (active_seq->type) {
case SEQ_TYPE_IMAGE:
- se = SEQ_render_give_stripelem(active_seq, scene->r.cfra);
+ se = SEQ_render_give_stripelem(scene, active_seq, scene->r.cfra);
break;
case SEQ_TYPE_MOVIE:
se = active_seq->strip->stripdata;
@@ -2527,8 +2539,8 @@ static int sequencer_paste_exec(bContext *C, wmOperator *op)
else {
int min_seq_startdisp = INT_MAX;
LISTBASE_FOREACH (Sequence *, seq, &seqbase_clipboard) {
- if (SEQ_time_left_handle_frame_get(seq) < min_seq_startdisp) {
- min_seq_startdisp = SEQ_time_left_handle_frame_get(seq);
+ if (SEQ_time_left_handle_frame_get(scene, seq) < min_seq_startdisp) {
+ min_seq_startdisp = SEQ_time_left_handle_frame_get(scene, seq);
}
}
/* Paste strips relative to the current-frame. */
@@ -2574,7 +2586,7 @@ static int sequencer_paste_exec(bContext *C, wmOperator *op)
* strip. */
SEQ_transform_translate_sequence(scene, iseq, ofs);
/* Ensure, that pasted strips don't overlap. */
- if (SEQ_transform_test_overlap(ed->seqbasep, iseq)) {
+ if (SEQ_transform_test_overlap(scene, ed->seqbasep, iseq)) {
SEQ_transform_seqbase_shuffle(ed->seqbasep, iseq, scene);
}
}
@@ -2626,12 +2638,12 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
Sequence *seq_other;
const char *error_msg;
- if (SEQ_select_active_get_pair(scene, &seq_act, &seq_other) == 0) {
+ if (SEQ_select_active_get_pair(scene, &seq_act, &seq_other) == false) {
BKE_report(op->reports, RPT_ERROR, "Please select two strips");
return OPERATOR_CANCELLED;
}
- if (SEQ_edit_sequence_swap(seq_act, seq_other, &error_msg) == 0) {
+ if (SEQ_edit_sequence_swap(scene, seq_act, seq_other, &error_msg) == false) {
BKE_report(op->reports, RPT_ERROR, error_msg);
return OPERATOR_CANCELLED;
}
@@ -2858,7 +2870,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "directory", directory);
if (is_relative_path) {
- /* TODO(campbell): shouldn't this already be relative from the filesel?
+ /* TODO(@campbellbarton): shouldn't this already be relative from the filesel?
* (as the 'filepath' is) for now just make relative here,
* but look into changing after 2.60. */
BLI_path_rel(directory, BKE_main_blendfile_path(bmain));
@@ -3056,13 +3068,14 @@ void SEQUENCER_OT_change_scene(struct wmOperatorType *ot)
* \{ */
/** Comparison function suitable to be used with BLI_listbase_sort(). */
-static int seq_cmp_time_startdisp_channel(const void *a, const void *b)
+static int seq_cmp_time_startdisp_channel(void *thunk, const void *a, const void *b)
{
+ const Scene *scene = thunk;
Sequence *seq_a = (Sequence *)a;
Sequence *seq_b = (Sequence *)b;
- int seq_a_start = SEQ_time_left_handle_frame_get(seq_a);
- int seq_b_start = SEQ_time_left_handle_frame_get(seq_b);
+ int seq_a_start = SEQ_time_left_handle_frame_get(scene, seq_a);
+ int seq_b_start = SEQ_time_left_handle_frame_get(scene, seq_b);
/* If strips have the same start frame favor the one with a higher channel. */
if (seq_a_start == seq_b_start) {
@@ -3076,20 +3089,7 @@ static int sequencer_export_subtitles_invoke(bContext *C,
wmOperator *op,
const wmEvent *UNUSED(event))
{
- Main *bmain = CTX_data_main(C);
- if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
- char filepath[FILE_MAX];
-
- if (BKE_main_blendfile_path(bmain)[0] == '\0') {
- BLI_strncpy(filepath, "untitled", sizeof(filepath));
- }
- else {
- BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
- }
-
- BLI_path_extension_replace(filepath, sizeof(filepath), ".srt");
- RNA_string_set(op->ptr, "filepath", filepath);
- }
+ ED_fileselect_ensure_default_filepath(C, op, ".srt");
WM_event_add_fileselect(C, op);
@@ -3108,7 +3108,7 @@ static bool seq_get_text_strip_cb(Sequence *seq, void *user_data)
ListBase *channels = SEQ_channels_displayed_get(ed);
/* Only text strips that are not muted and don't end with negative frame. */
if ((seq->type == SEQ_TYPE_TEXT) && !SEQ_render_is_muted(channels, seq) &&
- (SEQ_time_right_handle_frame_get(seq) > cd->scene->r.sfra)) {
+ (SEQ_time_right_handle_frame_get(cd->scene, seq) > cd->scene->r.sfra)) {
BLI_addtail(cd->text_seq, MEM_dupallocN(seq));
}
return true;
@@ -3124,7 +3124,7 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op)
FILE *file;
char filepath[FILE_MAX];
- if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+ if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
BKE_report(op->reports, RPT_ERROR, "No filename given");
return OPERATOR_CANCELLED;
}
@@ -3155,7 +3155,7 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- BLI_listbase_sort(&text_seq, seq_cmp_time_startdisp_channel);
+ BLI_listbase_sort_r(&text_seq, seq_cmp_time_startdisp_channel, scene);
/* Open and write file. */
file = BLI_fopen(filepath, "w");
@@ -3170,15 +3170,16 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op)
timecode_str_start,
sizeof(timecode_str_start),
-2,
- FRA2TIME(max_ii(SEQ_time_left_handle_frame_get(seq) - scene->r.sfra, 0)),
+ FRA2TIME(max_ii(SEQ_time_left_handle_frame_get(scene, seq) - scene->r.sfra, 0)),
+ FPS,
+ USER_TIMECODE_SUBRIP);
+ BLI_timecode_string_from_time(
+ timecode_str_end,
+ sizeof(timecode_str_end),
+ -2,
+ FRA2TIME(SEQ_time_right_handle_frame_get(scene, seq) - scene->r.sfra),
FPS,
USER_TIMECODE_SUBRIP);
- BLI_timecode_string_from_time(timecode_str_end,
- sizeof(timecode_str_end),
- -2,
- FRA2TIME(SEQ_time_right_handle_frame_get(seq) - scene->r.sfra),
- FPS,
- USER_TIMECODE_SUBRIP);
fprintf(
file, "%d\n%s --> %s\n%s\n\n", iter++, timecode_str_start, timecode_str_end, data->text);
@@ -3244,8 +3245,8 @@ static int sequencer_set_range_to_strips_exec(bContext *C, wmOperator *op)
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT) {
selected = true;
- sfra = min_ii(sfra, SEQ_time_left_handle_frame_get(seq));
- efra = max_ii(efra, SEQ_time_right_handle_frame_get(seq) - 1);
+ sfra = min_ii(sfra, SEQ_time_left_handle_frame_get(scene, seq));
+ efra = max_ii(efra, SEQ_time_right_handle_frame_get(scene, seq) - 1);
}
}
@@ -3397,8 +3398,8 @@ static int sequencer_strip_transform_fit_exec(bContext *C, wmOperator *op)
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT && seq->type != SEQ_TYPE_SOUND_RAM) {
- const int timeline_frame = CFRA;
- StripElem *strip_elem = SEQ_render_give_stripelem(seq, timeline_frame);
+ const int timeline_frame = scene->r.cfra;
+ StripElem *strip_elem = SEQ_render_give_stripelem(scene, seq, timeline_frame);
if (strip_elem == NULL) {
continue;