Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_sequencer/sequencer_edit.c
| Show First 20 Lines • Show All 323 Lines • ▼ Show 20 Lines | |||||
| /** \name Snap Strips to the Current Frame Operator | /** \name Snap Strips to the Current Frame Operator | ||||
| * \{ */ | * \{ */ | ||||
| static int sequencer_snap_exec(bContext *C, wmOperator *op) | static int sequencer_snap_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Editing *ed = SEQ_editing_get(scene); | Editing *ed = SEQ_editing_get(scene); | ||||
| ListBase *seqbase = SEQ_active_seqbase_get(ed); | |||||
| Sequence *seq; | Sequence *seq; | ||||
| int snap_frame; | int snap_frame; | ||||
| snap_frame = RNA_int_get(op->ptr, "frame"); | snap_frame = RNA_int_get(op->ptr, "frame"); | ||||
| /* Check meta-strips. */ | /* Check meta-strips. */ | ||||
| for (seq = ed->seqbasep->first; seq; seq = seq->next) { | for (seq = ed->seqbasep->first; seq; seq = seq->next) { | ||||
| if (seq->flag & SELECT && !(seq->flag & SEQ_LOCK) && | if (seq->flag & SELECT && !(seq->flag & SEQ_LOCK) && | ||||
| SEQ_transform_sequence_can_be_translated(seq)) { | SEQ_transform_sequence_can_be_translated(seq)) { | ||||
| if ((seq->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) == 0) { | if ((seq->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) == 0) { | ||||
| SEQ_transform_translate_sequence( | SEQ_transform_translate_sequence( | ||||
| scene, seq, (snap_frame - seq->startofs + seq->startstill) - seq->start); | scene, seq, (snap_frame - seq->startofs + seq->startstill) - seq->start); | ||||
| } | } | ||||
| else { | else { | ||||
| if (seq->flag & SEQ_LEFTSEL) { | if (seq->flag & SEQ_LEFTSEL) { | ||||
| SEQ_transform_set_left_handle_frame(seq, snap_frame); | SEQ_transform_set_left_handle_frame(seq, snap_frame); | ||||
| } | } | ||||
| else { /* SEQ_RIGHTSEL */ | else { /* SEQ_RIGHTSEL */ | ||||
| SEQ_transform_set_right_handle_frame(seq, snap_frame); | SEQ_transform_set_right_handle_frame(seq, snap_frame); | ||||
| } | } | ||||
| SEQ_transform_handle_xlimits(seq, seq->flag & SEQ_LEFTSEL, seq->flag & SEQ_RIGHTSEL); | SEQ_transform_handle_xlimits(seq, seq->flag & SEQ_LEFTSEL, seq->flag & SEQ_RIGHTSEL); | ||||
| SEQ_transform_fix_single_image_seq_offsets(seq); | SEQ_transform_fix_single_image_seq_offsets(seq); | ||||
| } | } | ||||
| SEQ_time_update_sequence(scene, seq); | SEQ_time_update_sequence(scene, seqbase, seq); | ||||
| } | } | ||||
| } | } | ||||
| /* Test for effects and overlap. */ | /* Test for effects and overlap. */ | ||||
| for (seq = ed->seqbasep->first; seq; seq = seq->next) { | for (seq = ed->seqbasep->first; seq; seq = seq->next) { | ||||
| if (seq->flag & SELECT && !(seq->flag & SEQ_LOCK)) { | if (seq->flag & SELECT && !(seq->flag & SEQ_LOCK)) { | ||||
| seq->flag &= ~SEQ_OVERLAP; | seq->flag &= ~SEQ_OVERLAP; | ||||
| if (SEQ_transform_test_overlap(ed->seqbasep, seq)) { | if (SEQ_transform_test_overlap(ed->seqbasep, seq)) { | ||||
| SEQ_transform_seqbase_shuffle(ed->seqbasep, seq, scene); | SEQ_transform_seqbase_shuffle(ed->seqbasep, seq, scene); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Recalculate bounds of effect strips, offsetting the keyframes if not snapping any handle. */ | /* Recalculate bounds of effect strips, offsetting the keyframes if not snapping any handle. */ | ||||
| for (seq = ed->seqbasep->first; seq; seq = seq->next) { | for (seq = ed->seqbasep->first; seq; seq = seq->next) { | ||||
| if (seq->type & SEQ_TYPE_EFFECT) { | if (seq->type & SEQ_TYPE_EFFECT) { | ||||
| const bool either_handle_selected = (seq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) != 0; | const bool either_handle_selected = (seq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) != 0; | ||||
| if (seq->seq1 && (seq->seq1->flag & SELECT)) { | if (seq->seq1 && (seq->seq1->flag & SELECT)) { | ||||
| if (!either_handle_selected) { | if (!either_handle_selected) { | ||||
| SEQ_offset_animdata(scene, seq, (snap_frame - seq->startdisp)); | SEQ_offset_animdata(scene, seq, (snap_frame - seq->startdisp)); | ||||
| } | } | ||||
| SEQ_time_update_sequence(scene, seq); | SEQ_time_update_sequence(scene, seqbase, seq); | ||||
| } | } | ||||
| else if (seq->seq2 && (seq->seq2->flag & SELECT)) { | else if (seq->seq2 && (seq->seq2->flag & SELECT)) { | ||||
| if (!either_handle_selected) { | if (!either_handle_selected) { | ||||
| SEQ_offset_animdata(scene, seq, (snap_frame - seq->startdisp)); | SEQ_offset_animdata(scene, seq, (snap_frame - seq->startdisp)); | ||||
| } | } | ||||
| SEQ_time_update_sequence(scene, seq); | SEQ_time_update_sequence(scene, seqbase, seq); | ||||
| } | } | ||||
| else if (seq->seq3 && (seq->seq3->flag & SELECT)) { | else if (seq->seq3 && (seq->seq3->flag & SELECT)) { | ||||
| if (!either_handle_selected) { | if (!either_handle_selected) { | ||||
| SEQ_offset_animdata(scene, seq, (snap_frame - seq->startdisp)); | SEQ_offset_animdata(scene, seq, (snap_frame - seq->startdisp)); | ||||
| } | } | ||||
| SEQ_time_update_sequence(scene, seq); | SEQ_time_update_sequence(scene, seqbase, seq); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| SEQ_sort(SEQ_active_seqbase_get(ed)); | SEQ_sort(SEQ_active_seqbase_get(ed)); | ||||
| DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); | DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); | WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); | ||||
| ▲ Show 20 Lines • Show All 225 Lines • ▼ Show 20 Lines | else { | ||||
| changed = true; | changed = true; | ||||
| } | } | ||||
| /* Effects are only added if we they are in a meta-strip. | /* Effects are only added if we they are in a meta-strip. | ||||
| * In this case, dependent strips will just be transformed and | * In this case, dependent strips will just be transformed and | ||||
| * we can skip calculating for effects. | * we can skip calculating for effects. | ||||
| * This way we can avoid an extra loop just for effects. */ | * This way we can avoid an extra loop just for effects. */ | ||||
| if (!(seq->type & SEQ_TYPE_EFFECT)) { | if (!(seq->type & SEQ_TYPE_EFFECT)) { | ||||
| SEQ_time_update_sequence(scene, seq); | ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); | ||||
| SEQ_time_update_sequence(scene, seqbase, seq); | |||||
| } | } | ||||
| } | } | ||||
| if (changed) { | if (changed) { | ||||
| for (int i = data->num_seq - 1; i >= 0; i--) { | for (int i = data->num_seq - 1; i >= 0; i--) { | ||||
| Sequence *seq = data->seq_array[i]; | Sequence *seq = data->seq_array[i]; | ||||
| SEQ_relations_invalidate_cache_preprocessed(scene, seq); | SEQ_relations_invalidate_cache_preprocessed(scene, seq); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 164 Lines • ▼ Show 20 Lines | case RIGHTMOUSE: { | ||||
| for (int i = 0; i < data->num_seq; i++) { | for (int i = 0; i < data->num_seq; i++) { | ||||
| transseq_restore(data->ts + i, data->seq_array[i]); | transseq_restore(data->ts + i, data->seq_array[i]); | ||||
| } | } | ||||
| for (int i = 0; i < data->num_seq; i++) { | for (int i = 0; i < data->num_seq; i++) { | ||||
| Sequence *seq = data->seq_array[i]; | Sequence *seq = data->seq_array[i]; | ||||
| SEQ_add_reload_new_file(bmain, scene, seq, false); | SEQ_add_reload_new_file(bmain, scene, seq, false); | ||||
| SEQ_time_update_sequence(scene, seq); | ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); | ||||
| SEQ_time_update_sequence(scene, seqbase, seq); | |||||
| } | } | ||||
| MEM_freeN(data->seq_array); | MEM_freeN(data->seq_array); | ||||
| MEM_freeN(data->ts); | MEM_freeN(data->ts); | ||||
| MEM_freeN(data->trim); | MEM_freeN(data->trim); | ||||
| MEM_freeN(data); | MEM_freeN(data); | ||||
| op->customdata = NULL; | op->customdata = NULL; | ||||
| ▲ Show 20 Lines • Show All 936 Lines • ▼ Show 20 Lines | for (seq = ed->seqbasep->first; seq; seq = seq->next) { | ||||
| if ((seq->type & SEQ_TYPE_EFFECT) == 0 && (seq->flag & SELECT)) { | if ((seq->type & SEQ_TYPE_EFFECT) == 0 && (seq->flag & SELECT)) { | ||||
| seq->startofs = seq->endofs = seq->startstill = seq->endstill = 0; | seq->startofs = seq->endofs = seq->startstill = seq->endstill = 0; | ||||
| } | } | ||||
| } | } | ||||
| /* Update lengths, etc. */ | /* Update lengths, etc. */ | ||||
| seq = ed->seqbasep->first; | seq = ed->seqbasep->first; | ||||
| while (seq) { | while (seq) { | ||||
| SEQ_time_update_sequence(scene, seq); | ListBase *seqbase = SEQ_active_seqbase_get(ed); | ||||
| SEQ_time_update_sequence(scene, seqbase, seq); | |||||
| seq = seq->next; | seq = seq->next; | ||||
| } | } | ||||
| for (seq = ed->seqbasep->first; seq; seq = seq->next) { | for (seq = ed->seqbasep->first; seq; seq = seq->next) { | ||||
| if ((seq->type & SEQ_TYPE_EFFECT) == 0 && (seq->flag & SELECT)) { | if ((seq->type & SEQ_TYPE_EFFECT) == 0 && (seq->flag & SELECT)) { | ||||
| if (SEQ_transform_test_overlap(ed->seqbasep, seq)) { | if (SEQ_transform_test_overlap(ed->seqbasep, seq)) { | ||||
| SEQ_transform_seqbase_shuffle(ed->seqbasep, seq, scene); | SEQ_transform_seqbase_shuffle(ed->seqbasep, seq, scene); | ||||
| } | } | ||||
| Show All 26 Lines | |||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Separate Images Operator | /** \name Separate Images Operator | ||||
| * \{ */ | * \{ */ | ||||
| static int sequencer_separate_images_exec(bContext *C, wmOperator *op) | static int sequencer_separate_images_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Editing *ed = SEQ_editing_get(scene); | Editing *ed = SEQ_editing_get(scene); | ||||
| ListBase *seqbase = SEQ_active_seqbase_get(ed); | |||||
| Sequence *seq, *seq_new; | Sequence *seq, *seq_new; | ||||
| Strip *strip_new; | Strip *strip_new; | ||||
| StripElem *se, *se_new; | StripElem *se, *se_new; | ||||
| int start_ofs, timeline_frame, frame_end; | int start_ofs, timeline_frame, frame_end; | ||||
| int step = RNA_int_get(op->ptr, "length"); | int step = RNA_int_get(op->ptr, "length"); | ||||
| seq = ed->seqbasep->first; /* Poll checks this is valid. */ | seq = seqbase->first; /* Poll checks this is valid. */ | ||||
| SEQ_prefetch_stop(scene); | SEQ_prefetch_stop(scene); | ||||
| while (seq) { | while (seq) { | ||||
| if ((seq->flag & SELECT) && (seq->type == SEQ_TYPE_IMAGE) && (seq->len > 1)) { | if ((seq->flag & SELECT) && (seq->type == SEQ_TYPE_IMAGE) && (seq->len > 1)) { | ||||
| Sequence *seq_next; | Sequence *seq_next; | ||||
| /* Remove seq so overlap tests don't conflict, | /* Remove seq so overlap tests don't conflict, | ||||
| * see seq_free_sequence below for the real freeing. */ | * see seq_free_sequence below for the real freeing. */ | ||||
| BLI_remlink(ed->seqbasep, seq); | BLI_remlink(seqbase, seq); | ||||
| /* TODO: remove f-curve and assign to split image strips. | /* TODO: remove f-curve and assign to split image strips. | ||||
| * The old animation system would remove the user of `seq->ipo`. */ | * The old animation system would remove the user of `seq->ipo`. */ | ||||
| start_ofs = timeline_frame = SEQ_transform_get_left_handle_frame(seq); | start_ofs = timeline_frame = SEQ_transform_get_left_handle_frame(seq); | ||||
| frame_end = SEQ_transform_get_right_handle_frame(seq); | frame_end = SEQ_transform_get_right_handle_frame(seq); | ||||
| while (timeline_frame < frame_end) { | while (timeline_frame < frame_end) { | ||||
| /* New seq. */ | /* New seq. */ | ||||
| se = SEQ_render_give_stripelem(seq, timeline_frame); | se = SEQ_render_give_stripelem(seq, timeline_frame); | ||||
| seq_new = SEQ_sequence_dupli_recursive( | seq_new = SEQ_sequence_dupli_recursive(scene, scene, seqbase, seq, SEQ_DUPE_UNIQUE_NAME); | ||||
| scene, scene, ed->seqbasep, seq, SEQ_DUPE_UNIQUE_NAME); | |||||
| seq_new->start = start_ofs; | seq_new->start = start_ofs; | ||||
| seq_new->type = SEQ_TYPE_IMAGE; | seq_new->type = SEQ_TYPE_IMAGE; | ||||
| seq_new->len = 1; | seq_new->len = 1; | ||||
| seq_new->endstill = step - 1; | seq_new->endstill = step - 1; | ||||
| /* New strip. */ | /* New strip. */ | ||||
| strip_new = seq_new->strip; | strip_new = seq_new->strip; | ||||
| strip_new->us = 1; | strip_new->us = 1; | ||||
| /* New stripdata, only one element now. */ | /* New stripdata, only one element now. */ | ||||
| /* Note this assume all elements (images) have the same dimension, | /* Note this assume all elements (images) have the same dimension, | ||||
| * since we only copy the name here. */ | * since we only copy the name here. */ | ||||
| se_new = MEM_reallocN(strip_new->stripdata, sizeof(*se_new)); | se_new = MEM_reallocN(strip_new->stripdata, sizeof(*se_new)); | ||||
| BLI_strncpy(se_new->name, se->name, sizeof(se_new->name)); | BLI_strncpy(se_new->name, se->name, sizeof(se_new->name)); | ||||
| strip_new->stripdata = se_new; | strip_new->stripdata = se_new; | ||||
| SEQ_time_update_sequence(scene, seq_new); | SEQ_time_update_sequence(scene, seqbase, seq_new); | ||||
| if (step > 1) { | if (step > 1) { | ||||
| seq_new->flag &= ~SEQ_OVERLAP; | seq_new->flag &= ~SEQ_OVERLAP; | ||||
| if (SEQ_transform_test_overlap(ed->seqbasep, seq_new)) { | if (SEQ_transform_test_overlap(seqbase, seq_new)) { | ||||
| SEQ_transform_seqbase_shuffle(ed->seqbasep, seq_new, scene); | SEQ_transform_seqbase_shuffle(seqbase, seq_new, scene); | ||||
| } | } | ||||
| } | } | ||||
| /* XXX, COPY FCURVES */ | /* XXX, COPY FCURVES */ | ||||
| timeline_frame++; | timeline_frame++; | ||||
| start_ofs += step; | start_ofs += step; | ||||
| } | } | ||||
| seq_next = seq->next; | seq_next = seq->next; | ||||
| SEQ_sequence_free(scene, seq, true); | SEQ_sequence_free(scene, seq, true); | ||||
| seq = seq_next; | seq = seq_next; | ||||
| } | } | ||||
| else { | else { | ||||
| seq = seq->next; | seq = seq->next; | ||||
| } | } | ||||
| } | } | ||||
| SEQ_sort(SEQ_active_seqbase_get(ed)); | SEQ_sort(seqbase); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); | WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void SEQUENCER_OT_images_separate(wmOperatorType *ot) | void SEQUENCER_OT_images_separate(wmOperatorType *ot) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH_MUTABLE (Sequence *, seq, active_seqbase) { | ||||
| } | } | ||||
| } | } | ||||
| seqm->machine = active_seq ? active_seq->machine : channel_max; | seqm->machine = active_seq ? active_seq->machine : channel_max; | ||||
| strcpy(seqm->name + 2, "MetaStrip"); | strcpy(seqm->name + 2, "MetaStrip"); | ||||
| SEQ_sequence_base_unique_name_recursive(scene, &ed->seqbase, seqm); | SEQ_sequence_base_unique_name_recursive(scene, &ed->seqbase, seqm); | ||||
| seqm->start = meta_start_frame; | seqm->start = meta_start_frame; | ||||
| seqm->len = meta_end_frame - meta_start_frame; | seqm->len = meta_end_frame - meta_start_frame; | ||||
| SEQ_time_update_sequence(scene, seqm); | SEQ_time_update_sequence(scene, active_seqbase, seqm); | ||||
| SEQ_select_active_set(scene, seqm); | SEQ_select_active_set(scene, seqm); | ||||
| if (SEQ_transform_test_overlap(active_seqbase, seqm)) { | if (SEQ_transform_test_overlap(active_seqbase, seqm)) { | ||||
| SEQ_transform_seqbase_shuffle(active_seqbase, seqm, scene); | SEQ_transform_seqbase_shuffle(active_seqbase, seqm, scene); | ||||
| } | } | ||||
| DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); | DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); | WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); | ||||
| ▲ Show 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | |||||
| static const EnumPropertyItem prop_side_lr_types[] = { | static const EnumPropertyItem prop_side_lr_types[] = { | ||||
| {SEQ_SIDE_LEFT, "LEFT", 0, "Left", ""}, | {SEQ_SIDE_LEFT, "LEFT", 0, "Left", ""}, | ||||
| {SEQ_SIDE_RIGHT, "RIGHT", 0, "Right", ""}, | {SEQ_SIDE_RIGHT, "RIGHT", 0, "Right", ""}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| static void swap_sequence(Scene *scene, Sequence *seqa, Sequence *seqb) | static void swap_sequence(Scene *scene, Sequence *seqa, Sequence *seqb) | ||||
| { | { | ||||
| ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); | |||||
| int gap = seqb->startdisp - seqa->enddisp; | int gap = seqb->startdisp - seqa->enddisp; | ||||
| int seq_a_start; | int seq_a_start; | ||||
| int seq_b_start; | int seq_b_start; | ||||
| seq_b_start = (seqb->start - seqb->startdisp) + seqa->startdisp; | seq_b_start = (seqb->start - seqb->startdisp) + seqa->startdisp; | ||||
| SEQ_transform_translate_sequence(scene, seqb, seq_b_start - seqb->start); | SEQ_transform_translate_sequence(scene, seqb, seq_b_start - seqb->start); | ||||
| SEQ_time_update_sequence(scene, seqb); | SEQ_time_update_sequence(scene, seqbase, seqb); | ||||
| seq_a_start = (seqa->start - seqa->startdisp) + seqb->enddisp + gap; | seq_a_start = (seqa->start - seqa->startdisp) + seqb->enddisp + gap; | ||||
| SEQ_transform_translate_sequence(scene, seqa, seq_a_start - seqa->start); | SEQ_transform_translate_sequence(scene, seqa, seq_a_start - seqa->start); | ||||
| SEQ_time_update_sequence(scene, seqa); | SEQ_time_update_sequence(scene, seqbase, seqa); | ||||
| } | } | ||||
| static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, int sel) | static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, int sel) | ||||
| { | { | ||||
| /* sel: 0==unselected, 1==selected, -1==don't care. */ | /* sel: 0==unselected, 1==selected, -1==don't care. */ | ||||
| Sequence *seq, *best_seq = NULL; | Sequence *seq, *best_seq = NULL; | ||||
| Editing *ed = SEQ_editing_get(scene); | Editing *ed = SEQ_editing_get(scene); | ||||
| ▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | static bool seq_is_parent(Sequence *par, Sequence *seq) | ||||
| return ((par->seq1 == seq) || (par->seq2 == seq) || (par->seq3 == seq)); | return ((par->seq1 == seq) || (par->seq2 == seq) || (par->seq3 == seq)); | ||||
| } | } | ||||
| static int sequencer_swap_exec(bContext *C, wmOperator *op) | static int sequencer_swap_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Editing *ed = SEQ_editing_get(scene); | Editing *ed = SEQ_editing_get(scene); | ||||
| Sequence *active_seq = SEQ_select_active_get(scene); | Sequence *active_seq = SEQ_select_active_get(scene); | ||||
| ListBase *seqbase = SEQ_active_seqbase_get(ed); | |||||
| Sequence *seq, *iseq; | Sequence *seq, *iseq; | ||||
| int side = RNA_enum_get(op->ptr, "side"); | int side = RNA_enum_get(op->ptr, "side"); | ||||
| if (active_seq == NULL) { | if (active_seq == NULL) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| seq = find_next_prev_sequence(scene, active_seq, side, -1); | seq = find_next_prev_sequence(scene, active_seq, side, -1); | ||||
| Show All 15 Lines | switch (side) { | ||||
| swap_sequence(scene, seq, active_seq); | swap_sequence(scene, seq, active_seq); | ||||
| break; | break; | ||||
| case SEQ_SIDE_RIGHT: | case SEQ_SIDE_RIGHT: | ||||
| swap_sequence(scene, active_seq, seq); | swap_sequence(scene, active_seq, seq); | ||||
| break; | break; | ||||
| } | } | ||||
| /* XXX: Should be a generic function. */ | /* XXX: Should be a generic function. */ | ||||
| for (iseq = scene->ed->seqbasep->first; iseq; iseq = iseq->next) { | for (iseq = seqbase->first; iseq; iseq = iseq->next) { | ||||
| if ((iseq->type & SEQ_TYPE_EFFECT) && | if ((iseq->type & SEQ_TYPE_EFFECT) && | ||||
| (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) { | (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) { | ||||
| SEQ_time_update_sequence(scene, iseq); | SEQ_time_update_sequence(scene, seqbase, iseq); | ||||
| } | } | ||||
| } | } | ||||
| /* Do this in a new loop since both effects need to be calculated first. */ | /* Do this in a new loop since both effects need to be calculated first. */ | ||||
| for (iseq = scene->ed->seqbasep->first; iseq; iseq = iseq->next) { | for (iseq = seqbase->first; iseq; iseq = iseq->next) { | ||||
| if ((iseq->type & SEQ_TYPE_EFFECT) && | if ((iseq->type & SEQ_TYPE_EFFECT) && | ||||
| (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) { | (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) { | ||||
| /* This may now overlap. */ | /* This may now overlap. */ | ||||
| if (SEQ_transform_test_overlap(ed->seqbasep, iseq)) { | if (SEQ_transform_test_overlap(seqbase, iseq)) { | ||||
| SEQ_transform_seqbase_shuffle(ed->seqbasep, iseq, scene); | SEQ_transform_seqbase_shuffle(seqbase, iseq, scene); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| SEQ_sort(SEQ_active_seqbase_get(ed)); | SEQ_sort(SEQ_active_seqbase_get(ed)); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); | WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); | ||||
| ▲ Show 20 Lines • Show All 297 Lines • ▼ Show 20 Lines | static int sequencer_swap_data_exec(bContext *C, wmOperator *op) | ||||
| if (seq_other->scene_sound) { | if (seq_other->scene_sound) { | ||||
| BKE_sound_remove_scene_sound(scene, seq_other->scene_sound); | BKE_sound_remove_scene_sound(scene, seq_other->scene_sound); | ||||
| } | } | ||||
| seq_act->scene_sound = NULL; | seq_act->scene_sound = NULL; | ||||
| seq_other->scene_sound = NULL; | seq_other->scene_sound = NULL; | ||||
| SEQ_time_update_sequence(scene, seq_act); | ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); | ||||
| SEQ_time_update_sequence(scene, seq_other); | SEQ_time_update_sequence(scene, seqbase, seq_act); | ||||
| SEQ_time_update_sequence(scene, seqbase, seq_other); | |||||
| if (seq_act->sound) { | if (seq_act->sound) { | ||||
| BKE_sound_add_scene_sound_defaults(scene, seq_act); | BKE_sound_add_scene_sound_defaults(scene, seq_act); | ||||
| } | } | ||||
| if (seq_other->sound) { | if (seq_other->sound) { | ||||
| BKE_sound_add_scene_sound_defaults(scene, seq_other); | BKE_sound_add_scene_sound_defaults(scene, seq_other); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | |||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Change Data/Files Operator | /** \name Change Data/Files Operator | ||||
| * \{ */ | * \{ */ | ||||
| static int sequencer_change_path_exec(bContext *C, wmOperator *op) | static int sequencer_change_path_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Editing *ed = SEQ_editing_get(scene); | |||||
| Sequence *seq = SEQ_select_active_get(scene); | Sequence *seq = SEQ_select_active_get(scene); | ||||
| const bool is_relative_path = RNA_boolean_get(op->ptr, "relative_path"); | const bool is_relative_path = RNA_boolean_get(op->ptr, "relative_path"); | ||||
| const bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders"); | const bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders"); | ||||
| int minext_frameme, numdigits; | int minext_frameme, numdigits; | ||||
| if (seq->type == SEQ_TYPE_IMAGE) { | if (seq->type == SEQ_TYPE_IMAGE) { | ||||
| char directory[FILE_MAX]; | char directory[FILE_MAX]; | ||||
| int len; | int len; | ||||
| Show All 39 Lines | if (seq->type == SEQ_TYPE_IMAGE) { | ||||
| /* Reset these else we won't see all the images. */ | /* Reset these else we won't see all the images. */ | ||||
| seq->anim_startofs = seq->anim_endofs = 0; | seq->anim_startofs = seq->anim_endofs = 0; | ||||
| /* Correct start/end frames so we don't move. | /* Correct start/end frames so we don't move. | ||||
| * Important not to set seq->len = len; allow the function to handle it. */ | * Important not to set seq->len = len; allow the function to handle it. */ | ||||
| SEQ_add_reload_new_file(bmain, scene, seq, true); | SEQ_add_reload_new_file(bmain, scene, seq, true); | ||||
| SEQ_time_update_sequence(scene, seq); | ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); | ||||
| SEQ_time_update_sequence(scene, seqbase, seq); | |||||
| /* Invalidate cache. */ | /* Invalidate cache. */ | ||||
| SEQ_relations_free_imbuf(scene, &ed->seqbase, false); | SEQ_relations_free_imbuf(scene, seqbase, false); | ||||
| } | } | ||||
| else if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) { | else if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) { | ||||
| bSound *sound = seq->sound; | bSound *sound = seq->sound; | ||||
| if (sound == NULL) { | if (sound == NULL) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| char filepath[FILE_MAX]; | char filepath[FILE_MAX]; | ||||
| RNA_string_get(op->ptr, "filepath", filepath); | RNA_string_get(op->ptr, "filepath", filepath); | ||||
| ▲ Show 20 Lines • Show All 513 Lines • Show Last 20 Lines | |||||