static int tree_element_active_sequence(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set) { Sequence *seq = (Sequence *) te->directdata; Editing *ed = BKE_sequencer_editing_get(scene, FALSE); if (set) { /* only check on setting */ if (BLI_findindex(ed->seqbasep, seq) != -1) { if (set == 2) { BKE_sequencer_active_set(scene, NULL); } ED_sequencer_deselect_all(scene); if (set == 2 && seq->flag & SELECT) { seq->flag &= ~SELECT; } else { seq->flag |= SELECT; BKE_sequencer_active_set(scene, seq); } } WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene); } else { if (ed->act_seq == seq && seq->flag & SELECT) { return 1; } } return(0); }
void ED_sequencer_select_sequence_single(Scene *scene, Sequence *seq, bool deselect_all) { Editing *ed = BKE_sequencer_editing_get(scene, FALSE); if (deselect_all) ED_sequencer_deselect_all(scene); BKE_sequencer_active_set(scene, seq); if ((seq->type == SEQ_TYPE_IMAGE) || (seq->type == SEQ_TYPE_MOVIE)) { if (seq->strip) BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR); } else if (seq->type == SEQ_TYPE_SOUND_RAM) { if (seq->strip) BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR); } seq->flag |= SELECT; recurs_sel_seq(seq); }
static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *event) { View2D *v2d = UI_view2d_fromcontext(C); Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, FALSE); const bool extend = RNA_boolean_get(op->ptr, "extend"); const bool linked_handle = RNA_boolean_get(op->ptr, "linked_handle"); const bool linked_time = RNA_boolean_get(op->ptr, "linked_time"); bool left_right = RNA_boolean_get(op->ptr, "left_right"); Sequence *seq, *neighbor, *act_orig; int hand, sel_side; TimeMarker *marker; if (ed == NULL) return OPERATOR_CANCELLED; marker = find_nearest_marker(SCE_MARKERS, 1); //XXX - dummy function for now seq = find_nearest_seq(scene, v2d, &hand, event->mval); // XXX - not nice, Ctrl+RMB needs to do left_right only when not over a strip if (seq && linked_time && left_right) left_right = FALSE; if (marker) { int oldflag; /* select timeline marker */ if (extend) { oldflag = marker->flag; if (oldflag & SELECT) marker->flag &= ~SELECT; else marker->flag |= SELECT; } else { /* deselect_markers(0, 0); */ /* XXX, in 2.4x, seq selection used to deselect all, need to re-thnik this for 2.5 */ marker->flag |= SELECT; } } else if (left_right) { /* use different logic for this */ float x; ED_sequencer_deselect_all(scene); UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL); SEQP_BEGIN (ed, seq) { if (x < CFRA) { if (seq->enddisp < CFRA) { seq->flag |= SELECT; recurs_sel_seq(seq); } } else { if (seq->startdisp > CFRA) { seq->flag |= SELECT; recurs_sel_seq(seq); } } } SEQ_END { SpaceSeq *sseq = CTX_wm_space_seq(C); if (sseq && sseq->flag & SEQ_MARKER_TRANS) { TimeMarker *tmarker; for (tmarker = scene->markers.first; tmarker; tmarker = tmarker->next) { if (((x < CFRA) && tmarker->frame < CFRA) || ((x >= CFRA) && tmarker->frame >= CFRA)) { tmarker->flag |= SELECT; } else { tmarker->flag &= ~SELECT; } } } } } else {