Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_sequencer/sequencer_edit.c
| Show First 20 Lines • Show All 2,535 Lines • ▼ Show 20 Lines | static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| if (ed == NULL) { | if (ed == NULL) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| BKE_sequence_base_dupli_recursive(scene, scene, &nseqbase, ed->seqbasep, SEQ_DUPE_CONTEXT, 0); | BKE_sequence_base_dupli_recursive(scene, scene, &nseqbase, ed->seqbasep, SEQ_DUPE_CONTEXT, 0); | ||||
| if (nseqbase.first) { | if (nseqbase.first) { | ||||
| Sequence *seq = nseqbase.first; | Sequence *seq = nseqbase.first; | ||||
| /* Rely on the nseqbase list being added at the end. */ | /* Rely on the nseqbase list being added at the end. | ||||
| * Their UUIDs has been re-generated by the BKE_sequence_base_dupli_recursive(), */ | |||||
| BLI_movelisttolist(ed->seqbasep, &nseqbase); | BLI_movelisttolist(ed->seqbasep, &nseqbase); | ||||
| for (; seq; seq = seq->next) { | for (; seq; seq = seq->next) { | ||||
| BKE_sequencer_recursive_apply(seq, apply_unique_name_fn, scene); | BKE_sequencer_recursive_apply(seq, apply_unique_name_fn, scene); | ||||
| } | } | ||||
| 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; | ||||
| ▲ Show 20 Lines • Show All 396 Lines • ▼ Show 20 Lines | static int sequencer_meta_make_exec(bContext *C, wmOperator *op) | ||||
| seqm->flag = SELECT; | seqm->flag = SELECT; | ||||
| seq = ed->seqbasep->first; | seq = ed->seqbasep->first; | ||||
| while (seq) { | while (seq) { | ||||
| next = seq->next; | next = seq->next; | ||||
| if (seq != seqm && (seq->flag & SELECT)) { | if (seq != seqm && (seq->flag & SELECT)) { | ||||
| BKE_sequence_invalidate_cache_composite(scene, seq); | BKE_sequence_invalidate_cache_composite(scene, seq); | ||||
| channel_max = max_ii(seq->machine, channel_max); | channel_max = max_ii(seq->machine, channel_max); | ||||
| /* Sequence is moved within the same edit, no need to re-generate the UUID. */ | |||||
| BLI_remlink(ed->seqbasep, seq); | BLI_remlink(ed->seqbasep, seq); | ||||
| BLI_addtail(&seqm->seqbase, seq); | BLI_addtail(&seqm->seqbase, seq); | ||||
| } | } | ||||
| seq = next; | seq = next; | ||||
| } | } | ||||
| seqm->machine = last_seq ? last_seq->machine : channel_max; | seqm->machine = last_seq ? last_seq->machine : channel_max; | ||||
| BKE_sequence_calc(scene, seqm); | BKE_sequence_calc(scene, seqm); | ||||
| ▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| if (last_seq == NULL || last_seq->type != SEQ_TYPE_META) { | if (last_seq == NULL || last_seq->type != SEQ_TYPE_META) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| for (seq = last_seq->seqbase.first; seq != NULL; seq = seq->next) { | for (seq = last_seq->seqbase.first; seq != NULL; seq = seq->next) { | ||||
| BKE_sequence_invalidate_cache_composite(scene, seq); | BKE_sequence_invalidate_cache_composite(scene, seq); | ||||
| } | } | ||||
| /* This moves strips from meta to parent, sating within same edit and no new strips are | |||||
| * allocated. If the UUID was unique already (as it should) it will stay unique. Nn need to | |||||
| * re-generate the UUIDs.*/ | |||||
| BLI_movelisttolist(ed->seqbasep, &last_seq->seqbase); | BLI_movelisttolist(ed->seqbasep, &last_seq->seqbase); | ||||
| BLI_listbase_clear(&last_seq->seqbase); | BLI_listbase_clear(&last_seq->seqbase); | ||||
| BLI_remlink(ed->seqbasep, last_seq); | BLI_remlink(ed->seqbasep, last_seq); | ||||
| BKE_sequence_free(scene, last_seq, true); | BKE_sequence_free(scene, last_seq, true); | ||||
| /* Empty meta strip, delete all effects depending on it. */ | /* Empty meta strip, delete all effects depending on it. */ | ||||
| ▲ Show 20 Lines • Show All 323 Lines • ▼ Show 20 Lines | static int sequencer_copy_exec(bContext *C, wmOperator *op) | ||||
| BKE_sequencer_free_clipboard(); | BKE_sequencer_free_clipboard(); | ||||
| if (BKE_sequence_base_isolated_sel_check(ed->seqbasep) == false) { | if (BKE_sequence_base_isolated_sel_check(ed->seqbasep) == false) { | ||||
| BKE_report(op->reports, RPT_ERROR, "Please select all related strips"); | BKE_report(op->reports, RPT_ERROR, "Please select all related strips"); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| BKE_sequence_base_dupli_recursive( | /* NOTE: The UUID is re-generated on paste, so we can keep UUID in the clipboard since | ||||
| scene, scene, &seqbase_clipboard, ed->seqbasep, 0, LIB_ID_CREATE_NO_USER_REFCOUNT); | * nobody can reach them anyway. | ||||
| * This reduces chance or running out of UUIDs if a cat falls asleep on Ctrl-C. */ | |||||
| BKE_sequence_base_dupli_recursive(scene, | |||||
| scene, | |||||
| &seqbase_clipboard, | |||||
| ed->seqbasep, | |||||
| 0, | |||||
| (LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_FREE_NO_MAIN)); | |||||
| seqbase_clipboard_frame = scene->r.cfra; | seqbase_clipboard_frame = scene->r.cfra; | ||||
| /* Remove anything that references the current scene. */ | /* Remove anything that references the current scene. */ | ||||
| LISTBASE_FOREACH (Sequence *, seq, &seqbase_clipboard) { | LISTBASE_FOREACH (Sequence *, seq, &seqbase_clipboard) { | ||||
| seq_copy_del_sound(scene, seq); | seq_copy_del_sound(scene, seq); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| * must happen on the clipboard itself, so that copying does user counting | * must happen on the clipboard itself, so that copying does user counting | ||||
| * on the actual data-blocks. */ | * on the actual data-blocks. */ | ||||
| BKE_sequencer_base_clipboard_pointers_restore(&seqbase_clipboard, bmain); | BKE_sequencer_base_clipboard_pointers_restore(&seqbase_clipboard, bmain); | ||||
| BKE_sequence_base_dupli_recursive(scene, scene, &nseqbase, &seqbase_clipboard, 0, 0); | BKE_sequence_base_dupli_recursive(scene, scene, &nseqbase, &seqbase_clipboard, 0, 0); | ||||
| BKE_sequencer_base_clipboard_pointers_store(bmain, &seqbase_clipboard); | BKE_sequencer_base_clipboard_pointers_store(bmain, &seqbase_clipboard); | ||||
| iseq_first = nseqbase.first; | iseq_first = nseqbase.first; | ||||
| /* NOTE: BKE_sequence_base_dupli_recursive() takes care of generating new UUIDs for sequences | |||||
| * in the new list. */ | |||||
| BLI_movelisttolist(ed->seqbasep, &nseqbase); | BLI_movelisttolist(ed->seqbasep, &nseqbase); | ||||
| for (iseq = iseq_first; iseq; iseq = iseq->next) { | for (iseq = iseq_first; iseq; iseq = iseq->next) { | ||||
| /* Make sure, that pasted strips have unique names. */ | /* Make sure, that pasted strips have unique names. */ | ||||
| BKE_sequencer_recursive_apply(iseq, apply_unique_name_fn, scene); | BKE_sequencer_recursive_apply(iseq, apply_unique_name_fn, scene); | ||||
| /* Translate after name has been changed, otherwise this will affect animdata of original | /* Translate after name has been changed, otherwise this will affect animdata of original | ||||
| * strip. */ | * strip. */ | ||||
| BKE_sequence_translate(scene, iseq, ofs); | BKE_sequence_translate(scene, iseq, ofs); | ||||
| ▲ Show 20 Lines • Show All 766 Lines • Show Last 20 Lines | |||||