diff options
Diffstat (limited to 'source/blender/editors/space_sequencer')
7 files changed, 135 insertions, 91 deletions
diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt index 9dc0b7a4258..9ce5f8e5279 100644 --- a/source/blender/editors/space_sequencer/CMakeLists.txt +++ b/source/blender/editors/space_sequencer/CMakeLists.txt @@ -22,14 +22,16 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../imbuf ../../makesdna ../../makesrna ../../windowmanager ../../../../intern/guardedalloc - ../../../../intern/audaspace/intern +) + +set(INC_SYS ${GLEW_INCLUDE_PATH} ) @@ -46,4 +48,11 @@ set(SRC sequencer_intern.h ) -blender_add_lib(bf_editor_space_sequencer "${SRC}" "${INC}") +if(WITH_AUDASPACE) + list(APPEND INC + ../../../../intern/audaspace/intern + ) + add_definitions(-DWITH_AUDASPACE) +endif() + +blender_add_lib(bf_editor_space_sequencer "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 2ef8fb12965..b105b2507ab 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -70,7 +70,10 @@ #include "UI_view2d.h" #include "BKE_sound.h" -#include "AUD_C-API.h" + +#ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +#endif /* own include */ #include "sequencer_intern.h" @@ -82,6 +85,7 @@ #define SEQPROP_ENDFRAME (1<<1) #define SEQPROP_FILES (1<<2) #define SEQPROP_NOPATHS (1<<3) +#define SEQPROP_NOCHAN (1<<4) #define SELECT 1 @@ -97,6 +101,8 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag) RNA_def_boolean(ot->srna, "replace_sel", 1, "Replace Selection", "replace the current selection"); + RNA_def_boolean(ot->srna, "overlap", 0, "Allow Overlap", "Don't correct overlap on new sequence strips"); + if(flag & SEQPROP_FILES) RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", ""); } @@ -117,19 +123,17 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op, static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, wmEvent *event, int flag) { - ARegion *ar= CTX_wm_region(C); View2D *v2d= UI_view2d_fromcontext(C); - short mval[2]; float mval_v2d[2]; + UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &mval_v2d[0], &mval_v2d[1]); + + /* effect strips dont need a channel initialized from the mouse */ + if(!(flag & SEQPROP_NOCHAN)) { + RNA_int_set(op->ptr, "channel", (int)mval_v2d[1]+0.5f); + } - mval[0]= event->x - ar->winrct.xmin; - mval[1]= event->y - ar->winrct.ymin; - - UI_view2d_region_to_view(v2d, mval[0], mval[1], &mval_v2d[0], &mval_v2d[1]); - - RNA_int_set(op->ptr, "channel", (int)mval_v2d[1]+0.5f); RNA_int_set(op->ptr, "frame_start", (int)mval_v2d[0]); if ((flag & SEQPROP_ENDFRAME) && RNA_property_is_set(op->ptr, "frame_end")==0) @@ -248,7 +252,11 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) seq_active_set(scene, seq); seq->flag |= SELECT; } - + + if(RNA_boolean_get(op->ptr, "overlap") == FALSE) { + if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene); + } + WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -303,6 +311,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad SeqLoadInfo seq_load; Sequence *seq; int tot_files; + const short overlap= RNA_boolean_get(op->ptr, "overlap"); seq_load_operator_info(&seq_load, op); @@ -323,12 +332,20 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad BLI_join_dirfile(seq_load.path, sizeof(seq_load.path), dir_only, file_only); seq= seq_load_func(C, ed->seqbasep, &seq_load); + + if(overlap == FALSE) { + if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene); + } } RNA_END; } else { /* single file */ seq= seq_load_func(C, ed->seqbasep, &seq_load); + + if(overlap == FALSE) { + if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene); + } } if (seq_load.tot_success==0) { @@ -504,7 +521,11 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) /* last active name */ strncpy(ed->act_imagedir, strip->dir, FILE_MAXDIR-1); - + + if(RNA_boolean_get(op->ptr, "overlap") == FALSE) { + if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene); + } + WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -633,25 +654,30 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) BKE_reportf(op->reports, RPT_ERROR, "Sequencer plugin \"%s\" could not load.", path); return OPERATOR_CANCELLED; } - } - else if (seq->type==SEQ_COLOR) { + } else if (seq->type == SEQ_COLOR) { SolidColorVars *colvars= (SolidColorVars *)seq->effectdata; RNA_float_get_array(op->ptr, "color", colvars->col); seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */ + } else if (seq->type == SEQ_ADJUSTMENT) { + seq->blend_mode= SEQ_CROSS; } - // XXX, this conflicts with giving a channel with invoke, perhaps we should have an active channel - // but for now this is much more usable - if(seq->seq1 || seq->seq2 || seq->seq3) { - int chan= MAX3( seq->seq1 ? seq->seq1->machine : 0, - seq->seq2 ? seq->seq2->machine : 0, - seq->seq3 ? seq->seq3->machine : 0); - if(chan < MAXSEQ) - seq->machine= chan; + /* an unset channel is a special case where we automatically go above + * the other strips. */ + if(!RNA_property_is_set(op->ptr, "channel")) { + if(seq->seq1) { + int chan= MAX3( seq->seq1 ? seq->seq1->machine : 0, + seq->seq2 ? seq->seq2->machine : 0, + seq->seq3 ? seq->seq3->machine : 0); + if(chan < MAXSEQ) + seq->machine= chan; + } } - if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene); + if(RNA_boolean_get(op->ptr, "overlap") == FALSE) { + if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene); + } update_changed_seq_and_deps(scene, seq, 1, 1); /* runs calc_sequence */ @@ -675,14 +701,30 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) /* add color */ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEvent *event) { + short is_type_set= RNA_property_is_set(op->ptr, "type"); + int type= -1; + int prop_flag= SEQPROP_ENDFRAME; + if(!ED_operator_sequencer_active(C)) { BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); return OPERATOR_CANCELLED; } - sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME); + if(is_type_set) { + type= RNA_enum_get(op->ptr, "type"); + + /* when invoking an effect strip which uses inputs, + * skip initialzing the channel from the mouse. + * Instead leave the property unset so exec() initializes it to be + * above the strips its applied to. */ + if(get_sequence_effect_num_inputs(type) != 0) { + prop_flag |= SEQPROP_NOCHAN; + } + } + + sequencer_generic_invoke_xy__internal(C, op, event, prop_flag); - if (RNA_property_is_set(op->ptr, "type") && RNA_enum_get(op->ptr, "type")==SEQ_PLUGIN) { + if (is_type_set && type==SEQ_PLUGIN) { if(!RNA_property_is_set(op->ptr, "relative_path")) RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 2f95e8fa64c..594d2942e8f 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -126,6 +126,7 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[ case SEQ_OVERDROP: case SEQ_GLOW: case SEQ_MULTICAM: + case SEQ_ADJUSTMENT: UI_GetThemeColor3ubv(TH_SEQ_EFFECT, col); /* slightly offset hue to distinguish different effects */ @@ -137,6 +138,8 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[ if (seq->type == SEQ_OVERDROP) rgb_byte_set_hue_float_offset(col,0.24); if (seq->type == SEQ_GLOW) rgb_byte_set_hue_float_offset(col,0.28); if (seq->type == SEQ_TRANSFORM) rgb_byte_set_hue_float_offset(col,0.36); + if (seq->type == SEQ_MULTICAM) rgb_byte_set_hue_float_offset(col,0.32); + if (seq->type == SEQ_ADJUSTMENT) rgb_byte_set_hue_float_offset(col,0.40); break; case SEQ_COLOR: @@ -476,7 +479,7 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float if(name[0]=='\0') name= give_seqname(seq); - if(seq->type == SEQ_META) { + if(seq->type == SEQ_META || seq->type == SEQ_ADJUSTMENT) { sprintf(str, "%d | %s", seq->len, name); } else if(seq->type == SEQ_SCENE) { @@ -547,15 +550,17 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa glShadeModel(GL_SMOOTH); glBegin(GL_QUADS); - if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -50); + if(seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; } + else if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -50); else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 0); glColor3ubv(col); glVertex2f(x1,y1); glVertex2f(x2,y1); - - if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 5); + + if(seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; } + else if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 5); else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -5); glColor3ubv((GLubyte *)col); @@ -638,10 +643,12 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline if (G.moving && (seq->flag & SELECT)) { if(seq->flag & SEQ_OVERLAP) { col[0]= 255; col[1]= col[2]= 40; - } else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 120); + } + else + UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 120+outline_tint); } - - UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, outline_tint); + else + UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, outline_tint); glColor3ubv((GLubyte *)col); @@ -964,7 +971,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) /* loop through strips, checking for those that are visible */ for (seq= ed->seqbasep->first; seq; seq= seq->next) { /* boundbox and selection tests for NOT drawing the strip... */ - if ((seq->flag & SELECT) == sel) continue; + if ((seq->flag & SELECT) != sel) continue; else if (seq == last_seq) continue; else if (MIN2(seq->startdisp, seq->start) > v2d->cur.xmax) continue; else if (MAX2(seq->enddisp, seq->start+seq->len) < v2d->cur.xmin) continue; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 92fae3d4820..b7a7b6b5412 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -100,6 +100,7 @@ EnumPropertyItem sequencer_prop_effect_types[] = { {SEQ_COLOR, "COLOR", 0, "Color", "Color effect strip type"}, {SEQ_SPEED, "SPEED", 0, "Speed", "Color effect strip type"}, {SEQ_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""}, + {SEQ_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""}, {0, NULL, 0, NULL, NULL} }; @@ -123,7 +124,8 @@ typedef struct TransSeq { int startstill, endstill; int startdisp, enddisp; int startofs, endofs; - int final_left, final_right; + int anim_startofs, anim_endofs; + /* int final_left, final_right; */ /* UNUSED */ int len; } TransSeq; @@ -191,7 +193,7 @@ void boundbox_seq(Scene *scene, rctf *rect) static int mouse_frame_side(View2D *v2d, short mouse_x, int frame ) { - short mval[2]; + int mval[2]; float mouseloc[2]; mval[0]= mouse_x; @@ -284,7 +286,7 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i } -Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const short mval[2]) +Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[2]) { Sequence *seq; Editing *ed= seq_give_editing(scene, FALSE); @@ -406,6 +408,7 @@ int event_to_efftype(int event) if(event==15) return SEQ_TRANSFORM; if(event==16) return SEQ_COLOR; if(event==17) return SEQ_SPEED; + if(event==18) return SEQ_ADJUSTMENT; return 0; } @@ -517,7 +520,8 @@ static void change_sequence(Scene *scene) "|Glow%x14" "|Transform%x15" "|Color Generator%x16" - "|Speed Control%x17"); + "|Speed Control%x17" + "|Adjustment Layer%x18"); if(event > 0) { if(event==1) { SWAP(Sequence *,last_seq->seq1,last_seq->seq2); @@ -703,15 +707,9 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de while(seq) { seqn= seq->next; if((seq->flag & flag) || deleteall) { - if(seq->type==SEQ_SOUND && seq->sound) { - ((ID *)seq->sound)->us--; /* TODO, could be moved into seq_free_sequence() */ - } - BLI_remlink(lb, seq); if(seq==last_seq) seq_active_set(scene, NULL); if(seq->type==SEQ_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1); - /* if(seq->ipo) seq->ipo->id.us--; */ - /* XXX, remove fcurve */ seq_free_sequence(scene, seq); } seq= seqn; @@ -732,8 +730,10 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) ts.endstill= seq->endstill; ts.startdisp= seq->startdisp; ts.enddisp= seq->enddisp; - ts.startofs= seq->anim_startofs; - ts.endofs= seq->anim_endofs; + ts.startofs= seq->startofs; + ts.endofs= seq->endofs; + ts.anim_startofs= seq->anim_startofs; + ts.anim_endofs= seq->anim_endofs; ts.len= seq->len; /* First Strip! */ @@ -783,7 +783,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) if ((seqn->startstill) && (cutframe == seqn->start + 1)) { seqn->start = ts.start; seqn->startstill= ts.start- cutframe; - seqn->anim_endofs = ts.endofs; + seqn->anim_endofs = ts.anim_endofs; seqn->endstill = ts.endstill; } @@ -792,8 +792,9 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) seqn->start = cutframe; seqn->startstill = 0; seqn->startofs = 0; + seqn->endofs = ts.endofs; seqn->anim_startofs += cutframe - ts.start; - seqn->anim_endofs = ts.endofs; + seqn->anim_endofs = ts.anim_endofs; seqn->endstill = ts.endstill; } @@ -828,6 +829,8 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe) ts.enddisp= seq->enddisp; ts.startofs= seq->startofs; ts.endofs= seq->endofs; + ts.anim_startofs= seq->anim_startofs; + ts.anim_endofs= seq->anim_endofs; ts.len= seq->len; /* First Strip! */ @@ -1084,7 +1087,7 @@ static int seq_get_snaplimit(View2D *v2d) /* fake mouse coords to get the snap value a bit lazy but its only done once pre transform */ float xmouse, ymouse, x; - short mval[2] = {24, 0}; /* 24 screen px snap */ + int mval[2] = {24, 0}; /* 24 screen px snap */ UI_view2d_region_to_view(v2d, mval[0], mval[1], &xmouse, &ymouse); x = xmouse; @@ -1576,14 +1579,13 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op) static int sequencer_cut_invoke(bContext *C, wmOperator *op, wmEvent *event) { Scene *scene = CTX_data_scene(C); - ARegion *ar= CTX_wm_region(C); View2D *v2d= UI_view2d_fromcontext(C); int cut_side= SEQ_SIDE_BOTH; int cut_frame= CFRA; if (ED_operator_sequencer_active(C) && v2d) - cut_side= mouse_frame_side(v2d, event->x - ar->winrct.xmin, cut_frame); + cut_side= mouse_frame_side(v2d, event->mval[0], cut_frame); RNA_int_set(op->ptr, "frame", cut_frame); RNA_enum_set(op->ptr, "side", cut_side); @@ -1706,11 +1708,6 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op)) if (nothingSelected) return OPERATOR_FINISHED; - /* free imbufs of all dependent strips */ - for(seq=ed->seqbasep->first; seq; seq=seq->next) - if(seq->flag & SELECT) - update_changed_seq_and_deps(scene, seq, 1, 0); - /* for effects, try to find a replacement input */ for(seq=ed->seqbasep->first; seq; seq=seq->next) if((seq->type & SEQ_EFFECT) && !(seq->flag & SELECT)) @@ -1787,19 +1784,21 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) /* new seq */ se = give_stripelem(seq, cfra); - seq_new= alloc_sequence(ed->seqbasep, start_ofs, seq->machine); + seq_new= seq_dupli_recursive(scene, scene, seq, SEQ_DUPE_UNIQUE_NAME); + BLI_addtail(&ed->seqbase, seq_new); + + seq_new->start= start_ofs; seq_new->type= SEQ_IMAGE; seq_new->len = 1; seq_new->endstill = step-1; /* new strip */ - seq_new->strip= strip_new= MEM_callocN(sizeof(Strip)*1, "strip"); + strip_new= seq_new->strip; strip_new->len= 1; strip_new->us= 1; - strncpy(strip_new->dir, seq->strip->dir, FILE_MAXDIR-1); /* new stripdata */ - strip_new->stripdata= se_new= MEM_callocN(sizeof(StripElem)*1, "stripelem"); + se_new= strip_new->stripdata; BLI_strncpy(se_new->name, se->name, sizeof(se_new->name)); calc_sequence(scene, seq_new); @@ -1811,8 +1810,6 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) } /* XXX, COPY FCURVES */ - strncpy(seq_new->name+2, seq->name+2, sizeof(seq->name)-2); - seqbase_unique_name_recursive(&scene->ed->seqbase, seq_new); cfra++; start_ofs += step; @@ -2728,14 +2725,15 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); Sequence *seq_act; Sequence *seq_other; + const char *error_msg; if(seq_active_pair_get(scene, &seq_act, &seq_other) == 0) { BKE_report(op->reports, RPT_ERROR, "Must select 2 strips"); return OPERATOR_CANCELLED; } - if(seq_swap(seq_act, seq_other) == 0) { - BKE_report(op->reports, RPT_ERROR, "Strips were not compatible"); + if(seq_swap(seq_act, seq_other, &error_msg) == 0) { + BKE_report(op->reports, RPT_ERROR, error_msg); return OPERATOR_CANCELLED; } @@ -2825,6 +2823,7 @@ void SEQUENCER_OT_view_ghost_border(wmOperatorType *ot) ot->exec= view_ghost_border_exec; ot->modal= WM_border_select_modal; ot->poll= sequencer_view_poll; + ot->cancel= WM_border_select_cancel; /* flags */ ot->flag= 0; diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 9a4796ced5e..209b39662aa 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -61,7 +61,7 @@ void seq_reset_imageofs(struct SpaceSeq *sseq); struct View2D; 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 short mval[2]); +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); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index b2d6ab6f8ca..8d5f372f55e 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -298,7 +298,6 @@ void SEQUENCER_OT_select_inverse(struct wmOperatorType *ot) static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) { - ARegion *ar= CTX_wm_region(C); View2D *v2d= UI_view2d_fromcontext(C); Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -306,8 +305,6 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) short linked_handle= RNA_boolean_get(op->ptr, "linked_handle"); short left_right= RNA_boolean_get(op->ptr, "left_right"); short linked_time= RNA_boolean_get(op->ptr, "linked_time"); - - short mval[2]; Sequence *seq,*neighbor, *act_orig; int hand,sel_side; @@ -318,10 +315,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) marker=find_nearest_marker(SCE_MARKERS, 1); //XXX - dummy function for now - mval[0]= event->x - ar->winrct.xmin; - mval[1]= event->y - ar->winrct.ymin; - - seq= find_nearest_seq(scene, v2d, &hand, mval); + 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) @@ -347,7 +341,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) /* use different logic for this */ float x; deselect_all_seq(scene); - UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, NULL); + UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL); SEQP_BEGIN(ed, seq) { if (x < CFRA) { @@ -489,7 +483,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) /* marker transform */ #if 0 // XXX probably need to redo this differently for 2.5 if (marker) { - short mval[2], xo, yo; + int mval[2], xo, yo; // getmouseco_areawin(mval); xo= mval[0]; yo= mval[1]; @@ -652,20 +646,15 @@ void SEQUENCER_OT_select_less(wmOperatorType *ot) static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event) { Scene *scene= CTX_data_scene(C); - ARegion *ar= CTX_wm_region(C); View2D *v2d= UI_view2d_fromcontext(C); short extend= RNA_boolean_get(op->ptr, "extend"); - short mval[2]; Sequence *mouse_seq; int selected, hand; - - mval[0]= event->x - ar->winrct.xmin; - mval[1]= event->y - ar->winrct.ymin; - + /* this works like UV, not mesh */ - mouse_seq= find_nearest_seq(scene, v2d, &hand, mval); + mouse_seq= find_nearest_seq(scene, v2d, &hand, event->mval); if (!mouse_seq) return OPERATOR_FINISHED; /* user error as with mesh?? */ @@ -837,7 +826,7 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op) rcti rect; rctf rectf, rq; short selecting = (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT); - short mval[2]; + int mval[2]; if(ed==NULL) return OPERATOR_CANCELLED; @@ -882,6 +871,7 @@ void SEQUENCER_OT_select_border(wmOperatorType *ot) ot->invoke= WM_border_select_invoke; ot->exec= sequencer_borderselect_exec; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= ED_operator_sequencer_active; diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 32bd9ce604c..d1df9699fa3 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -66,16 +66,13 @@ ARegion *sequencer_has_buttons_region(ScrArea *sa) { ARegion *ar, *arnew; - - for(ar= sa->regionbase.first; ar; ar= ar->next) - if(ar->regiontype==RGN_TYPE_UI) - return ar; + + ar= BKE_area_find_region_type(sa, RGN_TYPE_UI); + if(ar) return ar; /* add subdiv level; after header */ - for(ar= sa->regionbase.first; ar; ar= ar->next) - if(ar->regiontype==RGN_TYPE_HEADER) - break; - + ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER); + /* is error! */ if(ar==NULL) return NULL; |