diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-01-29 01:36:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-01-29 01:36:34 +0300 |
commit | ce2446e3db7c7087efd6bccea203e0d952eab035 (patch) | |
tree | 409e9259f6fa415354828d0af7c728ea318ec53a /source | |
parent | 7114486e8bba4fafb8f4f0dca10140bee1e0c9fb (diff) |
* Was missing checks for scene->ed which crashed blender when using the sequencer for the first time.
* Added WM_OT_tweak_gesture operator for select, drag
* Sequencer select operator now returns OPERATOR_FINISHED|OPERATOR_PASS_THROUGH
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_sequence.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequence.c | 38 | ||||
-rw-r--r-- | source/blender/blenlib/intern/bpath.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 155 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_header.c | 20 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_ops.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_select.c | 56 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 18 |
12 files changed, 179 insertions, 147 deletions
diff --git a/source/blender/blenkernel/BKE_sequence.h b/source/blender/blenkernel/BKE_sequence.h index 5bf0e84c7c4..0960f968c4e 100644 --- a/source/blender/blenkernel/BKE_sequence.h +++ b/source/blender/blenkernel/BKE_sequence.h @@ -140,6 +140,7 @@ struct SeqEffectHandle { void seq_free_sequence(struct Editing *ed, struct Sequence *seq); void seq_free_strip(struct Strip *strip); void seq_free_editing(struct Editing *ed); +struct Editing *seq_give_editing(struct Scene *scene, int alloc); char *give_seqname(struct Sequence *seq); struct ImBuf *give_ibuf_seq(struct Scene *scene, int rectx, int recty, int cfra, int chanshown); struct ImBuf *give_ibuf_seq_threaded(struct Scene *scene, int rectx, int recty, int cfra, int chanshown); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 2ad0c98bb79..4ac25d2750c 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -251,7 +251,7 @@ static void clean_paths(Main *main) } while(scene) { - ed= scene->ed; + ed= seq_give_editing(scene, 0); if(ed) { seq= ed->seqbasep->first; while(seq) { diff --git a/source/blender/blenkernel/intern/sequence.c b/source/blender/blenkernel/intern/sequence.c index 37d8cb1aae6..b32f1c765af 100644 --- a/source/blender/blenkernel/intern/sequence.c +++ b/source/blender/blenkernel/intern/sequence.c @@ -184,6 +184,17 @@ void seq_free_sequence(Editing *ed, Sequence *seq) MEM_freeN(seq); } +Editing *seq_give_editing(Scene *scene, int alloc) +{ + if (scene->ed == NULL && alloc) { + Editing *ed; + + ed= scene->ed= MEM_callocN( sizeof(Editing), "addseq"); + ed->seqbasep= &ed->seqbase; + } + return scene->ed; +} + void seq_free_editing(Editing *ed) { MetaStack *ms; @@ -594,10 +605,10 @@ void sort_seq(Scene *scene) { /* all strips together per kind, and in order of y location ("machine") */ ListBase seqbase, effbase; - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq, *seqt; - ed= scene->ed; + if(ed==NULL) return; seqbase.first= seqbase.last= 0; @@ -1036,14 +1047,11 @@ static int evaluate_seq_frame_gen(Sequence ** seq_arr, ListBase *seqbase, int cf int evaluate_seq_frame(Scene *scene, int cfra) { - Editing *ed; - Sequence *seq_arr[MAXSEQ+1]; - - ed= scene->ed; - if(ed==NULL) return 0; - - return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, cfra); + Editing *ed= seq_give_editing(scene, FALSE); + Sequence *seq_arr[MAXSEQ+1]; + if(ed==NULL) return 0; + return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, cfra); } static int video_seq_is_rendered(Sequence * seq) @@ -2403,12 +2411,12 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene, static ImBuf *give_ibuf_seq_impl(Scene *scene, int rectx, int recty, int cfra, int chanshown) { - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); int count; ListBase *seqbasep; TStripElem *se; - ed= scene->ed; + if(ed==NULL) return NULL; count = BLI_countlist(&ed->metastack); @@ -2818,7 +2826,7 @@ static void free_anim_seq(Sequence *seq) void free_imbuf_seq_except(Scene *scene, int cfra) { - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq; TStripElem *se; int a; @@ -2960,10 +2968,10 @@ static int update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *chan void update_changed_seq_and_deps(Scene *scene, Sequence *changed_seq, int len_change, int ibuf_change) { - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq; - if (!ed) return; + if (ed==NULL) return; for (seq=ed->seqbase.first; seq; seq=seq->next) update_changed_seq_recurs(scene, seq, changed_seq, len_change, ibuf_change); @@ -2972,7 +2980,7 @@ void update_changed_seq_and_deps(Scene *scene, Sequence *changed_seq, int len_ch void free_imbuf_seq_with_ipo(Scene *scene, struct Ipo *ipo) { /* force update of all sequences with this ipo, on ipo changes */ - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq; if(ed==NULL) return; diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 5c8eb5d2aa0..f1057ff3efe 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -201,7 +201,9 @@ static struct bSound *snd_stepdata__internal(struct bSound *snd, int step_next) return snd; } -static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int step_next) { +static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int step_next) +{ + Editing *ed; Sequence *seq; /* Initializing */ @@ -214,11 +216,11 @@ static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int st } while (bpi->seqdata.scene) { - - if (bpi->seqdata.scene->ed) { + ed= seq_give_editing(bpi->seqdata.scene, 0); + if (ed) { if (bpi->seqdata.seqar == NULL) { /* allocate the sequencer array */ - seq_array(bpi->seqdata.scene->ed, &bpi->seqdata.seqar, &bpi->seqdata.totseq, 0); + seq_array(ed, &bpi->seqdata.seqar, &bpi->seqdata.totseq, 0); bpi->seqdata.seq = 0; } diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index f4a3a9770cd..e7dd22b054a 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -1320,11 +1320,10 @@ static void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) } else if(soops->outlinevis==SO_SEQUENCE) { Sequence *seq; - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); int op; - ed= scene->ed; - if(!ed) + if(ed==NULL) return; seq= ed->seqbasep->first; @@ -2129,7 +2128,7 @@ static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *tselem, static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) { Sequence *seq, *p; - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); seq= (Sequence*)te->directdata; if(set==0) { @@ -2139,7 +2138,6 @@ static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeS } // XXX select_single_seq(seq, 1); - ed= scene->ed; p= ed->seqbasep->first; while(p) { if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index cff145c5046..60a7aaebd91 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -143,7 +143,7 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, w static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, TRUE); Scene *sce_seq; char sce_name[MAX_ID_NAME-2]; @@ -230,7 +230,7 @@ void SEQUENCER_OT_add_scene_strip(struct wmOperatorType *ot) static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, TRUE); struct anim *an; char filename[FILE_MAX]; @@ -317,7 +317,7 @@ void SEQUENCER_OT_add_movie_strip(struct wmOperatorType *ot) static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, TRUE); bSound *sound; @@ -415,7 +415,7 @@ void SEQUENCER_OT_add_sound_strip(struct wmOperatorType *ot) static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, TRUE); int tot_images= 1; //XXX FIXME, we need string arrays! @@ -506,7 +506,7 @@ void SEQUENCER_OT_add_image_strip(struct wmOperatorType *ot) static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, TRUE); Sequence *seq; /* generic strip vars */ Strip *strip; diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index ee03aee3fab..0068c03f6f9 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -988,12 +988,12 @@ void drawseqspace(const bContext *C, ARegion *ar) Scene *scene= CTX_data_scene(C); View2D *v2d= &ar->v2d; View2DScrollers *scrollers; - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq; float col[3]; int i; - ed= scene->ed; + if(sseq->mainb != SEQ_DRAW_SEQUENCE) { draw_image_seq(scene, ar, sseq); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index fde72f64efb..6d45195cc02 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -142,27 +142,25 @@ typedef struct TransSeq { Sequence *get_last_seq(Scene *scene) { - Editing *ed; - ed= scene->ed; - if(!ed) return NULL; + Editing *ed= seq_give_editing(scene, FALSE); + if(ed==NULL) return NULL; return ed->act_seq; } void set_last_seq(Scene *scene, Sequence *seq) { - Editing *ed; - ed= scene->ed; - if(!ed) return; + Editing *ed= seq_give_editing(scene, FALSE); + if(ed==NULL) return; ed->act_seq= seq; } Sequence *get_forground_frame_seq(Scene *scene, int frame) { - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq, *best_seq=NULL; int best_machine = -1; - ed= scene->ed; + if(!ed) return NULL; for (seq=ed->seqbasep->first; seq; seq= seq->next) { @@ -191,7 +189,7 @@ void seq_rectf(Sequence *seq, rctf *rectf) static void change_plugin_seq(Scene *scene, char *str) /* called from fileselect */ { - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); struct SeqEffectHandle sh; Sequence *last_seq= get_last_seq(scene); @@ -214,10 +212,10 @@ static void change_plugin_seq(Scene *scene, char *str) /* called from fileselect void boundbox_seq(Scene *scene, rctf *rect) { Sequence *seq; - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); float min[2], max[2]; - ed= scene->ed; + if(ed==NULL) return; min[0]= 0.0; @@ -262,10 +260,10 @@ Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int se /* looks to the left on lr==1, to the right on lr==2 sel - 0==unselected, 1==selected, -1==done care*/ Sequence *seq; - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); - ed= scene->ed; - if(ed==NULL) return 0; + + if(ed==NULL) return NULL; if (sel>0) sel = SELECT; @@ -299,13 +297,13 @@ Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, int sel) /* looks to the left on lr==1, to the right on lr==2 sel - 0==unselected, 1==selected, -1==done care*/ Sequence *seq,*best_seq = NULL; - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); int dist, best_dist; best_dist = MAXFRAME*2; - ed= scene->ed; - if(ed==NULL) return 0; + + if(ed==NULL) return NULL; if (sel) sel = SELECT; @@ -348,15 +346,15 @@ Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, int sel) Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, short mval[2]) { Sequence *seq; - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); float x, y; float pixelx; float handsize; float displen; *hand= 0; - ed= scene->ed; - if(ed==NULL) return 0; + + if(ed==NULL) return NULL; pixelx = (v2d->cur.xmax - v2d->cur.xmin)/(v2d->mask.xmax - v2d->mask.xmin); @@ -471,9 +469,9 @@ static int seq_is_predecessor(Sequence *pred, Sequence *seq) void deselect_all_seq(Scene *scene) { Sequence *seq; - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); - ed= scene->ed; + if(ed==NULL) return; SEQP_BEGIN(ed, seq) { @@ -588,12 +586,12 @@ static void reload_sound_strip(Scene *scene, char *name) static void reload_image_strip(Scene *scene, char *name) { - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq, *seqact; SpaceFile *sfile; Sequence *last_seq= get_last_seq(scene); - ed= scene->ed; + if(last_seq==0 || last_seq->type!=SEQ_IMAGE) return; seqact= last_seq; /* last_seq changes in alloc_sequence */ @@ -626,7 +624,7 @@ static void reload_image_strip(Scene *scene, char *name) void change_sequence(Scene *scene) { - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *last_seq= get_last_seq(scene); Scene *sce; short event; @@ -724,7 +722,7 @@ void change_sequence(Scene *scene) int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequence **selseq1, Sequence **selseq2, Sequence **selseq3, char **error_str) { - Editing *ed = scene->ed; + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq1= 0, *seq2= 0, *seq3= 0, *seq; *error_str= NULL; @@ -792,7 +790,7 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen void reassign_inputs_seq_effect(Scene *scene) { - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq1, *seq2, *seq3, *last_seq = get_last_seq(scene); char *error_msg; @@ -861,6 +859,7 @@ static Sequence *del_seq_find_replace_recurs(Scene *scene, Sequence *seq) static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short deleteall) { + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq, *seqn; Sequence *last_seq = get_last_seq(scene); @@ -875,7 +874,7 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de if(seq==last_seq) set_last_seq(scene, NULL); if(seq->type==SEQ_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1); if(seq->ipo) seq->ipo->id.us--; - seq_free_sequence((Editing *)scene->ed, seq); + seq_free_sequence(ed, seq); } seq= seqn; } @@ -1218,11 +1217,11 @@ static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe int insert_gap(Scene *scene, int gap, int cfra) { Sequence *seq; - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); int done=0; /* all strips >= cfra are shifted */ - ed= scene->ed; + if(ed==NULL) return 0; SEQP_BEGIN(ed, seq) { @@ -1240,11 +1239,11 @@ int insert_gap(Scene *scene, int gap, int cfra) void touch_seq_files(Scene *scene) { Sequence *seq; - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); char str[256]; /* touch all strips with movies */ - ed= scene->ed; + if(ed==NULL) return; if(okee("Touch and print selected movies")==0) return; @@ -1270,9 +1269,9 @@ void touch_seq_files(Scene *scene) void set_filter_seq(Scene *scene) { Sequence *seq; - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); - ed= scene->ed; + if(ed==NULL) return; if(okee("Set Deinterlace")==0) return; @@ -1293,11 +1292,11 @@ void set_filter_seq(Scene *scene) void seq_remap_paths(Scene *scene) { Sequence *seq, *last_seq = get_last_seq(scene); - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); char from[FILE_MAX], to[FILE_MAX], stripped[FILE_MAX]; - ed= scene->ed; - if(ed==NULL || last_seq==NULL) + + if(last_seq==NULL) return; BLI_strncpy(from, last_seq->strip->dir, FILE_MAX); @@ -1335,10 +1334,10 @@ void seq_remap_paths(Scene *scene) void no_gaps(Scene *scene) { - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); int cfra, first= 0, done; - ed= scene->ed; + if(ed==NULL) return; for(cfra= CFRA; cfra<=EFRA; cfra++) { @@ -1376,10 +1375,10 @@ static int seq_get_snaplimit(View2D *v2d) void seq_snap(Scene *scene, short event) { - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq; - ed= scene->ed; + if(ed==NULL) return; /* problem: contents of meta's are all shifted to the same position... */ @@ -1443,10 +1442,13 @@ void seq_snap_menu(Scene *scene) static int sequencer_mute_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq; int selected; + if(ed==NULL) + return OPERATOR_CANCELLED; + selected= RNA_enum_is_equal(op->ptr, "type", "SELECTED"); @@ -1492,10 +1494,13 @@ void SEQUENCER_OT_mute(struct wmOperatorType *ot) static int sequencer_unmute_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq; int selected; + if(ed==NULL) + return OPERATOR_CANCELLED; + selected= RNA_enum_is_equal(op->ptr, "type", "SELECTED"); @@ -1541,9 +1546,12 @@ void SEQUENCER_OT_unmute(struct wmOperatorType *ot) static int sequencer_lock_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq; + if(ed==NULL) + return OPERATOR_CANCELLED; + for(seq= ed->seqbasep->first; seq; seq= seq->next) { if (seq->flag & SELECT) { seq->flag |= SEQ_LOCK; @@ -1574,9 +1582,12 @@ void SEQUENCER_OT_lock(struct wmOperatorType *ot) static int sequencer_unlock_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq; + if(ed==NULL) + return OPERATOR_CANCELLED; + for(seq= ed->seqbasep->first; seq; seq= seq->next) { if (seq->flag & SELECT) { seq->flag &= ~SEQ_LOCK; @@ -1606,9 +1617,12 @@ void SEQUENCER_OT_unlock(struct wmOperatorType *ot) static int sequencer_reload_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq; + if(ed==NULL) + return OPERATOR_CANCELLED; + for(seq= ed->seqbasep->first; seq; seq= seq->next) { if(seq->flag & SELECT) { update_changed_seq_and_deps(scene, seq, 0, 1); @@ -1639,8 +1653,10 @@ void SEQUENCER_OT_reload(struct wmOperatorType *ot) static int sequencer_refresh_all_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); + if(ed==NULL) + return OPERATOR_CANCELLED; free_imbuf_seq(&ed->seqbase); @@ -1680,12 +1696,15 @@ static EnumPropertyItem prop_cut_types[] = { static int sequencer_cut_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); int cut_side, cut_hard, cut_frame; ListBase newlist; int changed; + if(ed==NULL) + return OPERATOR_CANCELLED; + cut_frame= RNA_int_get(op->ptr, "frame"); cut_hard= RNA_enum_get(op->ptr, "type"); cut_side= RNA_enum_get(op->ptr, "side"); @@ -1771,11 +1790,12 @@ void SEQUENCER_OT_cut(struct wmOperatorType *ot) static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); - ListBase new; + ListBase new= {NULL, NULL}; - new.first= new.last= 0; + if(ed==NULL) + return OPERATOR_CANCELLED; recurs_dupli_seq(scene, ed->seqbasep, &new); addlisttolist(ed->seqbasep, &new); @@ -1817,11 +1837,13 @@ void SEQUENCER_OT_add_duplicate(wmOperatorType *ot) static int sequencer_delete_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq; MetaStack *ms; int nothingSelected = TRUE; + if(ed==NULL) + return OPERATOR_CANCELLED; seq=get_last_seq(scene); if (seq && seq->flag & SELECT) { /* avoid a loop since this is likely to be selected */ @@ -1893,7 +1915,7 @@ void SEQUENCER_OT_delete(wmOperatorType *ot) static int sequencer_separate_images_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq, *seq_new, *seq_next; Strip *strip_new; @@ -1905,6 +1927,9 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) // if (!do_clever_numbuts("Separate Images", 1, REDRAW)) // return; + if(ed==NULL) + return OPERATOR_CANCELLED; + seq= ed->seqbasep->first; while (seq) { @@ -1983,11 +2008,12 @@ void SEQUENCER_OT_separate_images(wmOperatorType *ot) static int sequencer_meta_toggle_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *last_seq= get_last_seq(scene); MetaStack *ms; - + if(ed==NULL) + return OPERATOR_CANCELLED; if(last_seq && last_seq->type==SEQ_META && last_seq->flag & SELECT) { /* Enter Metastrip */ @@ -2050,12 +2076,15 @@ void SEQUENCER_OT_meta_toggle(wmOperatorType *ot) static int sequencer_meta_make_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq, *seqm, *next; int tot; + if(ed==NULL) + return OPERATOR_CANCELLED; + /* is there more than 1 select */ tot= 0; seq= ed->seqbasep->first; @@ -2104,7 +2133,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) /* remove all selected from main list, and put in meta */ - seqm= alloc_sequence(((Editing *)scene->ed)->seqbasep, 1, 1); + seqm= alloc_sequence(ed->seqbasep, 1, 1); seqm->type= SEQ_META; seqm->flag= SELECT; @@ -2160,11 +2189,11 @@ static int seq_depends_on_meta(Sequence *seq, Sequence *seqm) static int sequencer_meta_separate_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); - Sequence *seq, *last_seq = get_last_seq(scene); + Sequence *seq, *last_seq = get_last_seq(scene); /* last_seq checks ed==NULL */ - if(last_seq==0 || last_seq->type!=SEQ_META) + if(last_seq==NULL || last_seq->type!=SEQ_META) return OPERATOR_CANCELLED; addlisttolist(ed->seqbasep, &last_seq->seqbase); @@ -2284,7 +2313,7 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *op) View2D *v2d= UI_view2d_fromcontext(C); ScrArea *area= CTX_wm_area(C); bScreen *sc= CTX_wm_screen(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq; int xmin= MAXFRAME*2; @@ -2296,7 +2325,9 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *op) int ymargin= 1; int xmargin= FPS; - + if(ed==NULL) + return OPERATOR_CANCELLED; + for(seq=ed->seqbasep->first; seq; seq=seq->next) { if(seq->flag & SELECT) { xmin= MIN2(xmin, seq->startdisp); diff --git a/source/blender/editors/space_sequencer/sequencer_header.c b/source/blender/editors/space_sequencer/sequencer_header.c index 488d6c716ca..eef59a7dc6b 100644 --- a/source/blender/editors/space_sequencer/sequencer_header.c +++ b/source/blender/editors/space_sequencer/sequencer_header.c @@ -283,7 +283,7 @@ static uiBlock *seq_addmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_un #else uiDefMenuButO(block, "SEQUENCER_OT_add_sound_strip", NULL); #endif - but= uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Color"); + but= uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Add Color Strip"); RNA_enum_set(uiButGetOperatorPtrRNA(but), "type", SEQ_COLOR); uiDefMenuButO(block, "SEQUENCER_OT_add_image_strip", NULL); @@ -312,7 +312,7 @@ static uiBlock *seq_editmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u { ScrArea *sa= CTX_wm_area(C); Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); uiBlock *block= uiBeginBlock(C, handle->region, "seq_editmenu", UI_EMBOSSP, UI_HELV); uiBut *but; @@ -332,7 +332,7 @@ static uiBlock *seq_editmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u uiDefMenuButO(block, "SEQUENCER_OT_add_duplicate", NULL); uiDefMenuButO(block, "SEQUENCER_OT_delete", NULL); - if (ed->act_seq) { + if (ed && ed->act_seq) { switch(ed->act_seq->type) { case SEQ_EFFECT: uiDefMenuSep(block); @@ -359,7 +359,7 @@ static uiBlock *seq_editmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u uiDefMenuButO(block, "SEQUENCER_OT_meta_make", NULL); uiDefMenuButO(block, "SEQUENCER_OT_meta_separate", NULL); - if ((ed && ed->metastack.first) || (ed->act_seq && ed->act_seq->type == SEQ_META)) { + if (ed && (ed->metastack.first || (ed->act_seq && ed->act_seq->type == SEQ_META))) { uiDefMenuSep(block); uiDefMenuButO(block, "SEQUENCER_OT_meta_toggle", NULL); } @@ -393,7 +393,7 @@ void sequencer_header_buttons(const bContext *C, ARegion *ar) ScrArea *sa= CTX_wm_area(C); SpaceSeq *sseq= sa->spacedata.first; Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); uiBlock *block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV); int xco=3, yco= 3; @@ -407,23 +407,23 @@ void sequencer_header_buttons(const bContext *C, ARegion *ar) uiBlockSetEmboss(block, UI_EMBOSSP); xmax= GetButStringLength("View"); - uiDefPulldownBut(block, seq_viewmenu, sa, "View", xco, yco, xmax-3, 24, ""); + uiDefPulldownBut(block, seq_viewmenu, sa, "View", xco, 0, xmax-3, 24, ""); xco+=xmax; xmax= GetButStringLength("Select"); - uiDefPulldownBut(block, seq_selectmenu, sa, "Select", xco, yco, xmax-3, 24, ""); + uiDefPulldownBut(block, seq_selectmenu, sa, "Select", xco, 0, xmax-3, 24, ""); xco+=xmax; xmax= GetButStringLength("Marker"); - uiDefPulldownBut(block, seq_markermenu, sa, "Marker", xco, yco, xmax-3, 24, ""); + uiDefPulldownBut(block, seq_markermenu, sa, "Marker", xco, 0, xmax-3, 24, ""); xco+=xmax; xmax= GetButStringLength("Add"); - uiDefPulldownBut(block, seq_addmenu, sa, "Add", xco, yco, xmax-3, 24, ""); + uiDefPulldownBut(block, seq_addmenu, sa, "Add", xco, 0, xmax-3, 24, ""); xco+=xmax; xmax= GetButStringLength("Strip"); - uiDefPulldownBut(block, seq_editmenu, sa, "Strip", xco, yco, xmax-3, 24, ""); + uiDefPulldownBut(block, seq_editmenu, sa, "Strip", xco, 0, xmax-3, 24, ""); xco+=xmax; } diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 19497ab5fe7..b97bfeb5ca8 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -150,7 +150,9 @@ void sequencer_keymap(wmWindowManager *wm) WM_keymap_add_item(keymap, "SEQUENCER_OT_borderselect", BKEY, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "ANIM_OT_change_frame", LEFTMOUSE, KM_PRESS, 0, 0); - + + WM_keymap_add_item(keymap, "WM_OT_tweak_gesture", SELECTMOUSE, KM_PRESS, 0, 0); + transform_keymap_for_space(wm, keymap, SPACE_SEQ); } diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index acabe762b3c..40535eb0f74 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -79,10 +79,8 @@ /* own include */ #include "sequencer_intern.h" static void BIF_undo_push() {} -static void std_rmouse_transform() {} static void *find_nearest_marker() {return NULL;} static void deselect_markers() {} -static void transform_seq_nomarker() {} @@ -90,9 +88,8 @@ static void transform_seq_nomarker() {} void select_channel_direction(Scene *scene, Sequence *test,int lr) { /* selects all strips in a channel to one direction of the passed strip */ Sequence *seq; - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); - ed= scene->ed; if(ed==NULL) return; seq= ed->seqbasep->first; @@ -159,7 +156,7 @@ void select_surround_from_last(Scene *scene) void select_single_seq(Scene *scene, Sequence *seq, int deselect_all) /* BRING BACK */ { - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); if(deselect_all) deselect_all_seq(scene); @@ -214,21 +211,17 @@ void select_neighbor_from_last(Scene *scene, int lr) } - - - - - - - /* (de)select operator */ static int sequencer_deselect_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq; int desel = 0; - + + if(ed==NULL) + return OPERATOR_CANCELLED; + for(seq= ed->seqbasep->first; seq; seq=seq->next) { if(seq->flag & SEQ_ALLSEL) { desel= 1; @@ -269,9 +262,11 @@ void SEQUENCER_OT_deselect_all(struct wmOperatorType *ot) static int sequencer_select_invert_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq; - + + if(ed==NULL) + return OPERATOR_CANCELLED; for(seq= ed->seqbasep->first; seq; seq=seq->next) { if (seq->flag & SELECT) { @@ -314,14 +309,17 @@ 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= scene->ed; + Editing *ed= seq_give_editing(scene, FALSE); short extend= RNA_enum_is_equal(op->ptr, "type", "EXTEND"); short mval[2]; Sequence *seq,*neighbor; int hand,seldir, shift= 0; // XXX TimeMarker *marker; - + + if(ed==NULL) + return OPERATOR_CANCELLED; + marker=find_nearest_marker(SCE_MARKERS, 1); //XXX - dummy function for now mval[0]= event->x - ar->winrct.xmin; @@ -432,10 +430,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) recurs_sel_seq(seq); } - ED_undo_push(C,"Select Strips, Sequencer"); - - std_rmouse_transform(transform_seq_nomarker); } /* marker transform */ @@ -458,7 +453,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) ED_area_tag_redraw(CTX_wm_area(C)); /* allowing tweaks */ - return OPERATOR_PASS_THROUGH; + return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH; } void SEQUENCER_OT_select(wmOperatorType *ot) @@ -480,12 +475,11 @@ void SEQUENCER_OT_select(wmOperatorType *ot) /* run recursivly to select linked */ static int select_more_less_seq__internal(Scene *scene, int sel, int linked) { - Editing *ed; + Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq, *neighbor; int change=0; int isel; - ed= scene->ed; if(ed==NULL) return 0; if (sel) { @@ -673,15 +667,18 @@ void SEQUENCER_OT_select_linked(wmOperatorType *ot) static int sequencer_borderselect_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); + Editing *ed= seq_give_editing(scene, FALSE); View2D *v2d= UI_view2d_fromcontext(C); Sequence *seq; - Editing *ed=scene->ed; rcti rect; rctf rectf, rq; int val; short mval[2]; - + + if(ed==NULL) + return OPERATOR_CANCELLED; + val= RNA_int_get(op->ptr, "event_type"); rect.xmin= RNA_int_get(op->ptr, "xmin"); rect.ymin= RNA_int_get(op->ptr, "ymin"); @@ -733,10 +730,3 @@ void SEQUENCER_OT_borderselect(wmOperatorType *ot) RNA_def_enum(ot->srna, "type", prop_select_types, 0, "Type", ""); } - - - - - - - diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 9b6aff67da1..d59961465e7 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2299,7 +2299,7 @@ void flushTransNodes(TransInfo *t) /* *** SEQUENCE EDITOR *** */ void flushTransSeq(TransInfo *t) { - ListBase *seqbasep= ((Editing *)t->scene->ed)->seqbasep; + ListBase *seqbasep= seq_give_editing(t->scene, FALSE)->seqbasep; /* Editing null check alredy done */ int a, new_frame; TransData *td= t->data; TransData2D *td2d= t->data2d; @@ -3864,17 +3864,17 @@ static void createTransSeqData(bContext *C, TransInfo *t) View2D *v2d= UI_view2d_fromcontext(C); Scene *scene= CTX_data_scene(C); - Editing *ed= scene->ed; + Editing *ed= seq_give_editing(t->scene, FALSE); TransData *td = NULL; TransData2D *td2d= NULL; TransDataSeq *tdsq= NULL; - - int count=0; - - + if (ed==NULL) { + t->total= 0; + return; + } /* which side of the current frame should be allowed */ if (t->mode == TFM_TIME_EXTEND) { @@ -4400,9 +4400,9 @@ void special_aftertrans_update(TransInfo *t) } if (t->spacetype == SPACE_SEQ) { - - if (!cancelled) { - ListBase *seqbasep= ((Editing *)t->scene->ed)->seqbasep; + Editing *ed= seq_give_editing(t->scene, FALSE); + if (ed && !cancelled) { + ListBase *seqbasep= ed->seqbasep; int a; TransData *td= t->data; TransData2D *td2d= t->data2d; |