Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_sequencer/sequencer_add.c
| Show First 20 Lines • Show All 145 Lines • ▼ Show 20 Lines | static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type) | ||||
| Sequence *tgt = NULL; | Sequence *tgt = NULL; | ||||
| Sequence *seq; | Sequence *seq; | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Editing *ed = BKE_sequencer_editing_get(scene, true); | Editing *ed = BKE_sequencer_editing_get(scene, true); | ||||
| int cfra = (int)CFRA; | int cfra = (int)CFRA; | ||||
| int proximity = INT_MAX; | int proximity = INT_MAX; | ||||
| if (!ed || !ed->seqbasep) { | if (!ed || !ed->seqbasep) { | ||||
| return 2; | return 1; | ||||
| } | } | ||||
| for (seq = ed->seqbasep->first; seq; seq = seq->next) { | for (seq = ed->seqbasep->first; seq; seq = seq->next) { | ||||
| if ((type == -1 || seq->type == type) && (seq->enddisp < cfra) && | if ((type == -1 || seq->type == type) && (seq->enddisp < cfra) && | ||||
| (cfra - seq->enddisp < proximity)) { | (cfra - seq->enddisp < proximity)) { | ||||
| tgt = seq; | tgt = seq; | ||||
| proximity = cfra - seq->enddisp; | proximity = cfra - seq->enddisp; | ||||
| } | } | ||||
| } | } | ||||
| if (tgt) { | if (tgt) { | ||||
| return tgt->machine + 1; | return tgt->machine + 1; | ||||
| } | } | ||||
| return 2; | return 1; | ||||
| } | } | ||||
| static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, int flag, int type) | static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, int flag, int type) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| int cfra = (int)CFRA; | int cfra = (int)CFRA; | ||||
| ▲ Show 20 Lines • Show All 399 Lines • ▼ Show 20 Lines | RNA_BEGIN (op->ptr, itemptr, "files") { | ||||
| RNA_string_get(&itemptr, "name", file_only); | RNA_string_get(&itemptr, "name", file_only); | ||||
| BLI_join_dirfile(seq_load.path, sizeof(seq_load.path), dir_only, file_only); | BLI_join_dirfile(seq_load.path, sizeof(seq_load.path), dir_only, file_only); | ||||
| /* Set seq_load.name, otherwise all video/audio files get the same name. */ | /* Set seq_load.name, otherwise all video/audio files get the same name. */ | ||||
| BLI_strncpy(seq_load.name, file_only, sizeof(seq_load.name)); | BLI_strncpy(seq_load.name, file_only, sizeof(seq_load.name)); | ||||
| seq = seq_load_fn(C, ed->seqbasep, &seq_load); | seq = seq_load_fn(C, ed->seqbasep, &seq_load); | ||||
| if (seq) { | if (seq) { | ||||
| sequencer_add_apply_overlap(C, op, seq); | |||||
| if (seq_load.seq_sound) { | if (seq_load.seq_sound) { | ||||
| sequencer_add_apply_overlap(C, op, seq_load.seq_sound); | sequencer_add_apply_overlap(C, op, seq_load.seq_sound); | ||||
| } | } | ||||
| sequencer_add_apply_overlap(C, op, seq); | |||||
| } | } | ||||
| } | } | ||||
| RNA_END; | RNA_END; | ||||
| } | } | ||||
| else { /* Single file./ */ | else { /* Single file./ */ | ||||
| Sequence *seq; | Sequence *seq; | ||||
| seq = seq_load_fn(C, ed->seqbasep, &seq_load); | seq = seq_load_fn(C, ed->seqbasep, &seq_load); | ||||
| if (seq) { | if (seq) { | ||||
| sequencer_add_apply_overlap(C, op, seq); | |||||
| if (seq_load.seq_sound) { | if (seq_load.seq_sound) { | ||||
| sequencer_add_apply_overlap(C, op, seq_load.seq_sound); | sequencer_add_apply_overlap(C, op, seq_load.seq_sound); | ||||
| } | } | ||||
| sequencer_add_apply_overlap(C, op, seq); | |||||
| } | } | ||||
| } | } | ||||
| if (op->customdata) { | if (op->customdata) { | ||||
| MEM_freeN(op->customdata); | MEM_freeN(op->customdata); | ||||
| } | } | ||||
| if (seq_load.tot_success == 0) { | if (seq_load.tot_success == 0) { | ||||
| ▲ Show 20 Lines • Show All 517 Lines • Show Last 20 Lines | |||||