diff options
Diffstat (limited to 'source/blender/editors')
8 files changed, 85 insertions, 57 deletions
diff --git a/source/blender/editors/include/ED_sequencer.h b/source/blender/editors/include/ED_sequencer.h index f20ebe81189..c731245949e 100644 --- a/source/blender/editors/include/ED_sequencer.h +++ b/source/blender/editors/include/ED_sequencer.h @@ -29,4 +29,10 @@ #define SEQ_ZOOM_FAC(szoom) ((szoom) > 0.0f) ? (szoom) : ((szoom) == 0.0f) ? (1.0f) : (-1.0f / (szoom)) +struct Scene; +struct Sequence; + +void ED_sequencer_select_sequence_single(struct Scene *scene, struct Sequence *seq, int deselect_all); +void ED_sequencer_deselect_all(struct Scene *scene); + #endif /* __ED_SEQUENCER_H__ */ diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 18769476118..068532a08a2 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -43,6 +43,7 @@ #include "DNA_world_types.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" #include "BKE_context.h" #include "BKE_depsgraph.h" @@ -52,6 +53,7 @@ #include "ED_armature.h" #include "ED_object.h" #include "ED_screen.h" +#include "ED_sequencer.h" #include "ED_util.h" #include "WM_api.h" @@ -568,16 +570,34 @@ static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *UNUS return 0; } -static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *UNUSED(tselem), int set) +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) { -// XXX select_single_seq(seq, 1); + /* 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 (seq->flag & SELECT) - return(1); + if (ed->act_seq == seq && seq->flag & SELECT) { + return 1; + } } return(0); } @@ -678,7 +698,7 @@ int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, TreeEl case TSE_POSEGRP: return tree_element_active_posegroup(C, scene, te, tselem, set); case TSE_SEQUENCE: - return tree_element_active_sequence(te, tselem, set); + return tree_element_active_sequence(C, scene, te, tselem, set); case TSE_SEQUENCE_DUP: return tree_element_active_sequence_dup(scene, te, tselem, set); case TSE_KEYMAP_ITEM: diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index cf236c66e53..72b954b88e7 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -39,6 +39,7 @@ #include "DNA_mesh_types.h" #include "DNA_meta_types.h" #include "DNA_scene_types.h" +#include "DNA_sequence_types.h" #include "DNA_world_types.h" #include "DNA_object_types.h" @@ -54,10 +55,12 @@ #include "BKE_main.h" #include "BKE_report.h" #include "BKE_scene.h" +#include "BKE_sequencer.h" #include "ED_armature.h" #include "ED_object.h" #include "ED_screen.h" +#include "ED_sequencer.h" #include "ED_util.h" #include "WM_api.h" @@ -396,13 +399,13 @@ void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soop /* ******************************************** */ -static void unlinkact_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), TreeStoreElem *tselem) +static void unlinkact_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), TreeStoreElem *tselem, void *UNUSED(arg)) { /* just set action to NULL */ BKE_animdata_set_action(NULL, tselem->id, NULL); } -static void cleardrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), TreeStoreElem *tselem) +static void cleardrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), TreeStoreElem *tselem, void *UNUSED(arg)) { IdAdtTemplate *iat = (IdAdtTemplate *)tselem->id; @@ -410,7 +413,7 @@ static void cleardrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), free_fcurves(&iat->adt->drivers); } -static void refreshdrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), TreeStoreElem *tselem) +static void refreshdrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), TreeStoreElem *tselem, void *UNUSED(arg)) { IdAdtTemplate *iat = (IdAdtTemplate *)tselem->id; FCurve *fcu; @@ -426,7 +429,7 @@ static void refreshdrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te /* --------------------------------- */ -static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) +static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *UNUSED(arg)) { bPoseChannel *pchan = (bPoseChannel *)te->directdata; @@ -442,7 +445,7 @@ static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) pchan->bone->flag &= ~BONE_HIDDEN_P; } -static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) +static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *UNUSED(arg)) { Bone *bone = (Bone *)te->directdata; @@ -458,7 +461,7 @@ static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) bone->flag &= ~BONE_HIDDEN_P; } -static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) +static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *UNUSED(arg)) { EditBone *ebone = (EditBone *)te->directdata; @@ -474,16 +477,23 @@ static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) ebone->flag &= ~BONE_HIDDEN_A; } -static void sequence_cb(int event, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tselem)) +static void sequence_cb(int event, TreeElement *te, TreeStoreElem *tselem, void *scene_ptr) { -// Sequence *seq= (Sequence*) te->directdata; + Sequence *seq = (Sequence *)te->directdata; if (event == 1) { -// XXX select_single_seq(seq, 1); + Scene *scene = (Scene *)scene_ptr; + Editing *ed = BKE_sequencer_editing_get(scene, FALSE); + if (BLI_findindex(ed->seqbasep, seq) != -1) { + ED_sequencer_select_sequence_single(scene, seq, TRUE); + } } + + (void)tselem; } -static void outliner_do_data_operation(SpaceOops *soops, int type, int event, ListBase *lb, - void (*operation_cb)(int, TreeElement *, TreeStoreElem *)) +static void outliner_do_data_operation(SpaceOops *soops, int type, int event, ListBase *lb, + void (*operation_cb)(int, TreeElement *, TreeStoreElem *, void *), + void *arg) { TreeElement *te; TreeStoreElem *tselem; @@ -492,11 +502,11 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li tselem = TREESTORE(te); if (tselem->flag & TSE_SELECTED) { if (tselem->type == type) { - operation_cb(event, te, tselem); + operation_cb(event, te, tselem, arg); } } if (TSELEM_OPEN(tselem, soops)) { - outliner_do_data_operation(soops, type, event, &te->subtree, operation_cb); + outliner_do_data_operation(soops, type, event, &te->subtree, operation_cb, arg); } } } @@ -1013,14 +1023,14 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op) case OUTLINER_ANIMOP_CLEAR_ACT: /* clear active action - using standard rules */ - outliner_do_data_operation(soops, datalevel, event, &soops->tree, unlinkact_animdata_cb); + outliner_do_data_operation(soops, datalevel, event, &soops->tree, unlinkact_animdata_cb, NULL); WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL); ED_undo_push(C, "Unlink action"); break; case OUTLINER_ANIMOP_REFRESH_DRV: - outliner_do_data_operation(soops, datalevel, event, &soops->tree, refreshdrivers_animdata_cb); + outliner_do_data_operation(soops, datalevel, event, &soops->tree, refreshdrivers_animdata_cb, NULL); WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL); //ED_undo_push(C, "Refresh Drivers"); /* no undo needed - shouldn't have any impact? */ @@ -1028,7 +1038,7 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op) break; case OUTLINER_ANIMOP_CLEAR_DRV: - outliner_do_data_operation(soops, datalevel, event, &soops->tree, cleardrivers_animdata_cb); + outliner_do_data_operation(soops, datalevel, event, &soops->tree, cleardrivers_animdata_cb, NULL); WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL); ED_undo_push(C, "Clear Drivers"); @@ -1097,28 +1107,29 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op) if (datalevel == TSE_POSE_CHANNEL) { if (event > 0) { - outliner_do_data_operation(soops, datalevel, event, &soops->tree, pchan_cb); + outliner_do_data_operation(soops, datalevel, event, &soops->tree, pchan_cb, NULL); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); ED_undo_push(C, "PoseChannel operation"); } } else if (datalevel == TSE_BONE) { if (event > 0) { - outliner_do_data_operation(soops, datalevel, event, &soops->tree, bone_cb); + outliner_do_data_operation(soops, datalevel, event, &soops->tree, bone_cb, NULL); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); ED_undo_push(C, "Bone operation"); } } else if (datalevel == TSE_EBONE) { if (event > 0) { - outliner_do_data_operation(soops, datalevel, event, &soops->tree, ebone_cb); + outliner_do_data_operation(soops, datalevel, event, &soops->tree, ebone_cb, NULL); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); ED_undo_push(C, "EditBone operation"); } } else if (datalevel == TSE_SEQUENCE) { if (event > 0) { - outliner_do_data_operation(soops, datalevel, event, &soops->tree, sequence_cb); + Scene *scene = CTX_data_scene(C); + outliner_do_data_operation(soops, datalevel, event, &soops->tree, sequence_cb, scene); } } diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 097823135f3..ff3648fc2b8 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -897,24 +897,16 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i */ te->idcode = seq->type; te->directdata = seq; + te->name = seq->name + 2; - if (seq->type < 7) { + if (seq->type < SEQ_EFFECT) { /* * This work like the sequence. * If the sequence have a name (not default name) * show it, in other case put the filename. */ - if (strcmp(seq->name, "SQ")) - te->name = seq->name; - else { - if ((seq->strip) && (seq->strip->stripdata)) - te->name = seq->strip->stripdata->name; - else - te->name = "SQ None"; - } if (seq->type == SEQ_META) { - te->name = "Meta Strip"; p = seq->seqbase.first; while (p) { outliner_add_element(soops, &te->subtree, (void *)p, te, TSE_SEQUENCE, index); @@ -924,8 +916,6 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i else outliner_add_element(soops, &te->subtree, (void *)seq->strip, te, TSE_SEQ_STRIP, index); } - else - te->name = "Effect"; } else if (type == TSE_SEQ_STRIP) { Strip *strip = (Strip *)idv; diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 97bfe1bafc2..3861e2670f1 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -65,6 +65,7 @@ /* for menu/popup icons etc etc*/ #include "ED_screen.h" +#include "ED_sequencer.h" #include "UI_view2d.h" @@ -246,7 +247,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) BKE_sequencer_sort(scene); if (RNA_boolean_get(op->ptr, "replace_sel")) { - deselect_all_seq(scene); + ED_sequencer_deselect_all(scene); BKE_sequencer_active_set(scene, seq); seq->flag |= SELECT; } @@ -345,7 +346,7 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op) BKE_sequencer_sort(scene); if (RNA_boolean_get(op->ptr, "replace_sel")) { - deselect_all_seq(scene); + ED_sequencer_deselect_all(scene); BKE_sequencer_active_set(scene, seq); seq->flag |= SELECT; } @@ -414,7 +415,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad seq_load_operator_info(&seq_load, op); if (seq_load.flag & SEQ_LOAD_REPLACE_SEL) - deselect_all_seq(scene); + ED_sequencer_deselect_all(scene); if (RNA_struct_property_is_set(op->ptr, "files")) tot_files = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); @@ -595,7 +596,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; if (seq_load.flag & SEQ_LOAD_REPLACE_SEL) - deselect_all_seq(scene); + ED_sequencer_deselect_all(scene); /* main adding function */ @@ -786,7 +787,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) BKE_sequencer_sort(scene); if (RNA_boolean_get(op->ptr, "replace_sel")) { - deselect_all_seq(scene); + ED_sequencer_deselect_all(scene); BKE_sequencer_active_set(scene, seq); seq->flag |= SELECT; } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index b3b4e47ba81..778bddb545a 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -454,7 +454,7 @@ static int seq_is_predecessor(Sequence *pred, Sequence *seq) return 0; } -void deselect_all_seq(Scene *scene) +void ED_sequencer_deselect_all(Scene *scene) { Sequence *seq; Editing *ed = BKE_sequencer_editing_get(scene, FALSE); @@ -2665,7 +2665,7 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) int ofs; Sequence *iseq; - deselect_all_seq(scene); + ED_sequencer_deselect_all(scene); ofs = scene->r.cfra - seqbase_clipboard_frame; seqbase_dupli_recursive(scene, NULL, &nseqbase, &seqbase_clipboard, SEQ_DUPE_UNIQUE_NAME); diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index fd536524c11..19cd7ed4ad4 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -61,7 +61,6 @@ void seq_rectf(struct Sequence *seq, struct rctf *rectf); void boundbox_seq(struct Scene *scene, struct rctf *rect); struct Sequence *find_nearest_seq(struct Scene *scene, struct View2D *v2d, int *hand, const int mval[2]); struct Sequence *find_neighboring_sequence(struct Scene *scene, struct Sequence *test, int lr, int sel); -void deselect_all_seq(struct Scene *scene); void recurs_sel_seq(struct Sequence *seqm); int seq_effect_find_selected(struct Scene *scene, struct Sequence *activeseq, int type, struct Sequence **selseq1, struct Sequence **selseq2, struct Sequence **selseq3, const char **error_str); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 811a89b07a8..3911ec0ef82 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -58,6 +58,7 @@ #include "ED_types.h" #include "ED_screen.h" +#include "ED_sequencer.h" #include "UI_view2d.h" @@ -161,13 +162,13 @@ void select_surround_from_last(Scene *scene) } #endif - -static void UNUSED_FUNCTION(select_single_seq) (Scene * scene, Sequence * seq, int deselect_all) /* BRING BACK */ +void ED_sequencer_select_sequence_single(Scene * scene, Sequence * seq, int deselect_all) { Editing *ed = BKE_sequencer_editing_get(scene, FALSE); if (deselect_all) - deselect_all_seq(scene); + ED_sequencer_deselect_all(scene); + BKE_sequencer_active_set(scene, seq); if ((seq->type == SEQ_IMAGE) || (seq->type == SEQ_MOVIE)) { @@ -359,7 +360,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) else if (left_right) { /* use different logic for this */ float x; - deselect_all_seq(scene); + ED_sequencer_deselect_all(scene); UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL); SEQP_BEGIN (ed, seq) @@ -403,7 +404,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) act_orig = ed->act_seq; if (extend == 0 && linked_handle == 0) - deselect_all_seq(scene); + ED_sequencer_deselect_all(scene); if (seq) { BKE_sequencer_active_set(scene, seq); @@ -442,7 +443,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) /* On Alt selection, select the strip and bordering handles */ if (linked_handle && !ELEM(hand, SEQ_SIDE_LEFT, SEQ_SIDE_RIGHT)) { - if (extend == 0) deselect_all_seq(scene); + if (extend == 0) ED_sequencer_deselect_all(scene); seq->flag |= SELECT; select_surrounding_handles(scene, seq); } @@ -458,13 +459,13 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) switch (sel_side) { case SEQ_SIDE_LEFT: if ((seq->flag & SEQ_LEFTSEL) && (neighbor->flag & SEQ_RIGHTSEL)) { - if (extend == 0) deselect_all_seq(scene); + if (extend == 0) ED_sequencer_deselect_all(scene); seq->flag |= SELECT; select_active_side(ed->seqbasep, SEQ_SIDE_LEFT, seq->machine, seq->startdisp); } else { - if (extend == 0) deselect_all_seq(scene); + if (extend == 0) ED_sequencer_deselect_all(scene); seq->flag |= SELECT; neighbor->flag |= SELECT; @@ -475,13 +476,13 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) break; case SEQ_SIDE_RIGHT: if ((seq->flag & SEQ_RIGHTSEL) && (neighbor->flag & SEQ_LEFTSEL)) { - if (extend == 0) deselect_all_seq(scene); + if (extend == 0) ED_sequencer_deselect_all(scene); seq->flag |= SELECT; select_active_side(ed->seqbasep, SEQ_SIDE_RIGHT, seq->machine, seq->startdisp); } else { - if (extend == 0) deselect_all_seq(scene); + if (extend == 0) ED_sequencer_deselect_all(scene); seq->flag |= SELECT; neighbor->flag |= SELECT; @@ -493,7 +494,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) } } else { - if (extend == 0) deselect_all_seq(scene); + if (extend == 0) ED_sequencer_deselect_all(scene); select_active_side(ed->seqbasep, sel_side, seq->machine, seq->startdisp); } } @@ -686,7 +687,7 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEv return OPERATOR_FINISHED; /* user error as with mesh?? */ if (extend == 0) - deselect_all_seq(scene); + ED_sequencer_deselect_all(scene); mouse_seq->flag |= SELECT; recurs_sel_seq(mouse_seq); |