diff options
author | Richard Antalik <richardantalik@gmail.com> | 2020-01-22 16:54:44 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2020-01-22 17:06:18 +0300 |
commit | 6a49161c8c60cb63d9e3ed8dbe700163ff858436 (patch) | |
tree | 501c050d13bdbcdff7c6152a0946bb99617d5dc5 /source/blender | |
parent | f559e3977e0773382cfb554956fe424f6050d495 (diff) |
VSE: Tool system integration
Add toolbar to sequencer regions.
A bit of refactoring has to be done in RNA space.
Currently there is only cut tool implemented to serve as template for
anybody who would like to add more.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 1 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 28 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 130 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/space_sequencer.c | 53 | ||||
-rw-r--r-- | source/blender/makesrna/RNA_enum_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 23 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_workspace.c | 24 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_toolsystem.h | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_toolsystem.c | 18 |
9 files changed, 235 insertions, 47 deletions
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 33bcd3bc91d..aba3a5d5b8d 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -504,6 +504,7 @@ enum { SEQ_SIDE_LEFT, SEQ_SIDE_RIGHT, SEQ_SIDE_BOTH, + SEQ_SIDE_NO_CHANGE, }; int BKE_sequencer_find_next_prev_edit(struct Scene *scene, int cfra, diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 0754e59cb8a..7377f6a62a1 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -636,6 +636,29 @@ static ARegion *do_versions_add_region(int regiontype, const char *name) return ar; } +static void do_versions_area_ensure_tool_region(Main *bmain, + const short space_type, + const short region_flag) +{ + for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { + for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { + for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { + if (sl->spacetype == space_type) { + ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase; + ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS); + if (!ar) { + ARegion *header = BKE_area_find_region_type(sa, RGN_TYPE_HEADER); + ar = do_versions_add_region(RGN_TYPE_TOOLS, "tools region"); + BLI_insertlinkafter(regionbase, header, ar); + ar->alignment = RGN_ALIGN_LEFT; + ar->flag = region_flag; + } + } + } + } + } +} + static void do_version_bones_split_bbone_scale(ListBase *lb) { for (Bone *bone = lb->first; bone; bone = bone->next) { @@ -3738,7 +3761,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase; /* All spaces that use tools must be eventually added. */ ARegion *ar = NULL; - if (ELEM(sl->spacetype, SPACE_VIEW3D, SPACE_IMAGE) && + if (ELEM(sl->spacetype, SPACE_VIEW3D, SPACE_IMAGE, SPACE_SEQ) && ((ar = do_versions_find_region_or_null(regionbase, RGN_TYPE_TOOL_HEADER)) == NULL)) { /* Add tool header. */ ar = do_versions_add_region(RGN_TYPE_TOOL_HEADER, "tool header"); @@ -4338,6 +4361,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) { /* Keep this block, even when empty. */ + /* Sequencer Tool region */ + do_versions_area_ensure_tool_region(bmain, SPACE_SEQ, RGN_FLAG_HIDDEN); + /* Cloth internal springs */ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) { for (ModifierData *md = ob->modifiers.first; md; md = md->next) { diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index f4d7e9d20ca..a1177454acd 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -103,6 +103,7 @@ EnumPropertyItem prop_side_types[] = { {SEQ_SIDE_LEFT, "LEFT", 0, "Left", ""}, {SEQ_SIDE_RIGHT, "RIGHT", 0, "Right", ""}, {SEQ_SIDE_BOTH, "BOTH", 0, "Both", ""}, + {SEQ_SIDE_NO_CHANGE, "NO_CHANGE", 0, "No change", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -958,6 +959,8 @@ static bool cut_seq_list(Main *bmain, Scene *scene, ListBase *slist, int cutframe, + int channel, + bool use_cursor_position, Sequence *(*cut_seq)(Main *bmain, Scene *, Sequence *, ListBase *, int)) { Sequence *seq, *seq_next_iter; @@ -968,8 +971,8 @@ static bool cut_seq_list(Main *bmain, while (seq && seq != seq_first_new) { seq_next_iter = seq->next; /* we need this because we may remove seq */ seq->tmp = NULL; - if (seq->flag & SELECT) { - if (cutframe > seq->startdisp && cutframe < seq->enddisp) { + if (use_cursor_position) { + if (seq->machine == channel && seq->startdisp < cutframe && seq->enddisp > cutframe) { Sequence *seqn = cut_seq(bmain, scene, seq, slist, cutframe); if (seqn) { if (seq_first_new == NULL) { @@ -977,16 +980,28 @@ static bool cut_seq_list(Main *bmain, } } } - else if (seq->enddisp <= cutframe) { - /* do nothing */ - } - else if (seq->startdisp >= cutframe) { - /* move to tail */ - BLI_remlink(slist, seq); - BLI_addtail(slist, seq); + } + else { + if (seq->flag & SELECT) { + if (cutframe > seq->startdisp && cutframe < seq->enddisp) { + Sequence *seqn = cut_seq(bmain, scene, seq, slist, cutframe); + if (seqn) { + if (seq_first_new == NULL) { + seq_first_new = seqn; + } + } + } + else if (seq->enddisp <= cutframe) { + /* do nothing */ + } + else if (seq->startdisp >= cutframe) { + /* move to tail */ + BLI_remlink(slist, seq); + BLI_addtail(slist, seq); - if (seq_first_new == NULL) { - seq_first_new = seq; + if (seq_first_new == NULL) { + seq_first_new = seq; + } } } } @@ -2154,40 +2169,64 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, false); - int cut_side, cut_hard, cut_frame; - - bool changed; + int cut_side, cut_hard, cut_frame, cut_channel; + bool changed, use_cursor_position, ignore_selection; + bool seq_selected = false; cut_frame = RNA_int_get(op->ptr, "frame"); + cut_channel = RNA_int_get(op->ptr, "channel"); + use_cursor_position = RNA_boolean_get(op->ptr, "use_cursor_position"); cut_hard = RNA_enum_get(op->ptr, "type"); cut_side = RNA_enum_get(op->ptr, "side"); + ignore_selection = RNA_boolean_get(op->ptr, "ignore_selection"); if (cut_hard == SEQ_CUT_HARD) { - changed = cut_seq_list(bmain, scene, ed->seqbasep, cut_frame, cut_seq_hard); + changed = cut_seq_list( + bmain, scene, ed->seqbasep, cut_frame, cut_channel, use_cursor_position, cut_seq_hard); } else { - changed = cut_seq_list(bmain, scene, ed->seqbasep, cut_frame, cut_seq_soft); + changed = cut_seq_list( + bmain, scene, ed->seqbasep, cut_frame, cut_channel, use_cursor_position, cut_seq_soft); } if (changed) { /* got new strips ? */ Sequence *seq; - if (cut_side != SEQ_SIDE_BOTH) { - SEQP_BEGIN (ed, seq) { - if (cut_side == SEQ_SIDE_LEFT) { - if (seq->startdisp >= cut_frame) { - seq->flag &= ~SEQ_ALLSEL; + if (ignore_selection) { + if (use_cursor_position) { + SEQP_BEGIN (ed, seq) { + if (seq->enddisp == cut_frame && seq->machine == cut_channel) { + seq_selected = seq->flag & SEQ_ALLSEL; } } - else { - if (seq->enddisp <= cut_frame) { - seq->flag &= ~SEQ_ALLSEL; + SEQ_END; + if (!seq_selected) { + SEQP_BEGIN (ed, seq) { + if (seq->startdisp == cut_frame && seq->machine == cut_channel) { + seq->flag &= ~SEQ_ALLSEL; + } } + SEQ_END; } } - SEQ_END; } - + else { + if (cut_side != SEQ_SIDE_BOTH) { + SEQP_BEGIN (ed, seq) { + if (cut_side == SEQ_SIDE_LEFT) { + if (seq->startdisp >= cut_frame) { + seq->flag &= ~SEQ_ALLSEL; + } + } + else { + if (seq->enddisp <= cut_frame) { + seq->flag &= ~SEQ_ALLSEL; + } + } + } + SEQ_END; + } + } SEQP_BEGIN (ed, seq) { if (seq->seq1 || seq->seq2 || seq->seq3) { BKE_sequence_calc(scene, seq); @@ -2204,7 +2243,8 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } else { - return OPERATOR_CANCELLED; + /* Passthrough to selection if used as tool. */ + return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; } } @@ -2224,7 +2264,17 @@ static int sequencer_cut_invoke(bContext *C, wmOperator *op, const wmEvent *even cut_side = SEQ_SIDE_BOTH; } } - RNA_int_set(op->ptr, "frame", cut_frame); + + float mouseloc[2]; + UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &mouseloc[0], &mouseloc[1]); + + if (RNA_boolean_get(op->ptr, "use_cursor_position")) { + RNA_int_set(op->ptr, "frame", mouseloc[0]); + } + else { + RNA_int_set(op->ptr, "frame", cut_frame); + } + RNA_int_set(op->ptr, "channel", mouseloc[1]); RNA_enum_set(op->ptr, "side", cut_side); /*RNA_enum_set(op->ptr, "type", cut_hard); */ /*This type is set from the key shortcut */ return sequencer_cut_exec(C, op); @@ -2255,19 +2305,43 @@ void SEQUENCER_OT_cut(struct wmOperatorType *ot) "Frame where selected strips will be cut", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, + "channel", + 0, + INT_MIN, + INT_MAX, + "Channel", + "Channel in which strip will be cut", + INT_MIN, + INT_MAX); RNA_def_enum(ot->srna, "type", prop_cut_types, SEQ_CUT_SOFT, "Type", "The type of cut operation to perform on strips"); + RNA_def_boolean(ot->srna, + "use_cursor_position", + 0, + "Use Cursor Position", + "Cut at position of the cursor instead of playhead"); prop = RNA_def_enum(ot->srna, "side", prop_side_types, SEQ_SIDE_MOUSE, "Side", "The side that remains selected after cutting"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + + prop = RNA_def_boolean( + ot->srna, + "ignore_selection", + false, + "Ignore Selection", + "Make cut event if strip is not selected preserving selection state after cut"); + + RNA_def_property_flag(prop, PROP_HIDDEN); } #undef SEQ_SIDE_MOUSE diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index a06a90fa6e2..81783f9105c 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -110,6 +110,14 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(sa), const Scene *scene) ar->alignment = RGN_ALIGN_RIGHT; ar->flag = RGN_FLAG_HIDDEN; + /* toolbar */ + ar = MEM_callocN(sizeof(ARegion), "tools for sequencer"); + + BLI_addtail(&sseq->regionbase, ar); + ar->regiontype = RGN_TYPE_TOOLS; + ar->alignment = RGN_ALIGN_LEFT; + ar->flag = RGN_FLAG_HIDDEN; + /* preview region */ /* NOTE: if you change values here, also change them in sequencer_init_preview_region */ ar = MEM_callocN(sizeof(ARegion), "preview region for sequencer"); @@ -618,6 +626,23 @@ static void sequencer_header_region_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } +/* *********************** toolbar region ************************ */ +/* add handlers, stuff you only do once or on area/region changes */ +static void sequencer_tools_region_init(wmWindowManager *wm, ARegion *ar) +{ + wmKeyMap *keymap; + + ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE; + ED_region_panels_init(wm, ar); + + keymap = WM_keymap_ensure(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0); + WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap); +} + +static void sequencer_tools_region_draw(const bContext *C, ARegion *ar) +{ + ED_region_panels(C, ar); +} /* *********************** preview region ************************ */ static void sequencer_preview_region_init(wmWindowManager *wm, ARegion *ar) { @@ -832,7 +857,7 @@ void ED_spacetype_sequencer(void) art->draw = sequencer_main_region_draw; art->listener = sequencer_main_region_listener; art->message_subscribe = sequencer_main_region_message_subscribe; - art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_ANIMATION; + art->keymapflag = ED_KEYMAP_TOOL | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_ANIMATION; BLI_addhead(&st->regiontypes, art); @@ -842,7 +867,8 @@ void ED_spacetype_sequencer(void) art->init = sequencer_preview_region_init; art->draw = sequencer_preview_region_draw; art->listener = sequencer_preview_region_listener; - art->keymapflag = ED_KEYMAP_GIZMO | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL; + art->keymapflag = ED_KEYMAP_TOOL | ED_KEYMAP_GIZMO | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | + ED_KEYMAP_GPENCIL; BLI_addhead(&st->regiontypes, art); /* regions: listview/buttons */ @@ -850,12 +876,35 @@ void ED_spacetype_sequencer(void) art->regionid = RGN_TYPE_UI; art->prefsizex = UI_SIDEBAR_PANEL_WIDTH * 1.3f; art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; + art->message_subscribe = ED_area_do_mgs_subscribe_for_tool_ui; art->listener = sequencer_buttons_region_listener; art->init = sequencer_buttons_region_init; art->draw = sequencer_buttons_region_draw; BLI_addhead(&st->regiontypes, art); sequencer_buttons_register(art); + /* regions: tool(bar) */ + art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer tools region"); + art->regionid = RGN_TYPE_TOOLS; + art->prefsizex = 58; /* XXX */ + art->prefsizey = 50; /* XXX */ + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; + art->message_subscribe = ED_region_generic_tools_region_message_subscribe; + art->snap_size = ED_region_generic_tools_region_snap_size; + art->init = sequencer_tools_region_init; + art->draw = sequencer_tools_region_draw; + BLI_addhead(&st->regiontypes, art); + + /* regions: tool header */ + art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer tool header region"); + art->regionid = RGN_TYPE_TOOL_HEADER; + art->prefsizey = HEADERY; + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER; + art->listener = sequencer_main_region_listener; + art->init = sequencer_header_region_init; + art->draw = sequencer_header_region_draw; + art->message_subscribe = ED_area_do_mgs_subscribe_for_tool_header; + BLI_addhead(&st->regiontypes, art); /* regions: header */ art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region"); diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index 5466f396730..c10436ae08e 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -52,6 +52,7 @@ extern const EnumPropertyItem rna_enum_mesh_select_mode_items[]; extern const EnumPropertyItem rna_enum_mesh_select_mode_uv_items[]; extern const EnumPropertyItem rna_enum_mesh_delimit_mode_items[]; extern const EnumPropertyItem rna_enum_space_graph_mode_items[]; +extern const EnumPropertyItem rna_enum_space_sequencer_view_type_items[]; extern const EnumPropertyItem rna_enum_space_type_items[]; extern const EnumPropertyItem rna_enum_space_image_mode_items[]; extern const EnumPropertyItem rna_enum_space_image_mode_all_items[]; diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index d04fc5030f5..a6622356831 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -161,6 +161,13 @@ const EnumPropertyItem rna_enum_space_graph_mode_items[] = { {0, NULL, 0, NULL, NULL}, }; +const EnumPropertyItem rna_enum_space_sequencer_view_type_items[] = { + {SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""}, + {SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Preview", ""}, + {SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SPLITVIEW, "Sequencer/Preview", ""}, + {0, NULL, 0, NULL, NULL}, +}; + #define SACT_ITEM_DOPESHEET \ { \ SACTCONT_DOPESHEET, "DOPESHEET", ICON_ACTION, "Dope Sheet", "Edit all keyframes in scene" \ @@ -4458,17 +4465,6 @@ static void rna_def_space_sequencer(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static const EnumPropertyItem view_type_items[] = { - {SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""}, - {SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Preview", ""}, - {SEQ_VIEW_SEQUENCE_PREVIEW, - "SEQUENCER_PREVIEW", - ICON_SEQ_SPLITVIEW, - "Sequencer/Preview", - ""}, - {0, NULL, 0, NULL, NULL}, - }; - static const EnumPropertyItem display_mode_items[] = { {SEQ_DRAW_IMG_IMBUF, "IMAGE", ICON_SEQ_PREVIEW, "Image Preview", ""}, {SEQ_DRAW_IMG_WAVEFORM, "WAVEFORM", ICON_SEQ_LUMA_WAVEFORM, "Luma Waveform", ""}, @@ -4528,12 +4524,13 @@ static void rna_def_space_sequencer(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SpaceSeq"); RNA_def_struct_ui_text(srna, "Space Sequence Editor", "Sequence editor space data"); - rna_def_space_generic_show_region_toggles(srna, ((1 << RGN_TYPE_UI) | (1 << RGN_TYPE_HUD))); + rna_def_space_generic_show_region_toggles( + srna, (1 << RGN_TYPE_TOOL_HEADER) | (1 << RGN_TYPE_UI) | (1 << RGN_TYPE_TOOLS)); /* view type, fairly important */ prop = RNA_def_property(srna, "view_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "view"); - RNA_def_property_enum_items(prop, view_type_items); + RNA_def_property_enum_items(prop, rna_enum_space_sequencer_view_type_items); RNA_def_property_ui_text( prop, "View Type", "Type of the Sequencer view (sequencer, preview or both)"); RNA_def_property_update(prop, 0, "rna_Sequencer_view_type_update"); diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c index 4d4ab64abb9..32e348ea72f 100644 --- a/source/blender/makesrna/intern/rna_workspace.c +++ b/source/blender/makesrna/intern/rna_workspace.c @@ -152,7 +152,17 @@ static bToolRef *rna_WorkSpace_tools_from_space_node(WorkSpace *workspace, bool }, create); } - +static bToolRef *rna_WorkSpace_tools_from_space_sequencer(WorkSpace *workspace, + int mode, + bool create) +{ + return rna_WorkSpace_tools_from_tkey(workspace, + &(bToolKey){ + .space_type = SPACE_SEQ, + .mode = mode, + }, + create); +} const EnumPropertyItem *rna_WorkSpace_tools_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), @@ -164,6 +174,8 @@ const EnumPropertyItem *rna_WorkSpace_tools_mode_itemf(bContext *UNUSED(C), return rna_enum_context_mode_items; case SPACE_IMAGE: return rna_enum_space_image_mode_all_items; + case SPACE_SEQ: + return rna_enum_space_sequencer_view_type_items; } return DummyRNA_DEFAULT_items; } @@ -335,6 +347,16 @@ static void rna_def_workspace_tools(BlenderRNA *brna, PropertyRNA *cprop) /* return type */ parm = RNA_def_pointer(func, "result", "WorkSpaceTool", "", ""); RNA_def_function_return(func, parm); + + func = RNA_def_function( + srna, "from_space_sequencer", "rna_WorkSpace_tools_from_space_sequencer"); + RNA_def_function_ui_description(func, ""); + parm = RNA_def_enum(func, "mode", rna_enum_space_sequencer_view_type_items, 0, "", ""); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + RNA_def_boolean(func, "create", false, "Create", ""); + /* return type */ + parm = RNA_def_pointer(func, "result", "WorkSpaceTool", "", ""); + RNA_def_function_return(func, parm); } static void rna_def_workspace(BlenderRNA *brna) diff --git a/source/blender/windowmanager/WM_toolsystem.h b/source/blender/windowmanager/WM_toolsystem.h index 620150ba14f..36cb5be7547 100644 --- a/source/blender/windowmanager/WM_toolsystem.h +++ b/source/blender/windowmanager/WM_toolsystem.h @@ -41,8 +41,8 @@ struct wmOperatorType; /* wm_toolsystem.c */ -#define WM_TOOLSYSTEM_SPACE_MASK ((1 << SPACE_IMAGE) | (1 << SPACE_NODE) | (1 << SPACE_VIEW3D)) - +#define WM_TOOLSYSTEM_SPACE_MASK \ + ((1 << SPACE_IMAGE) | (1 << SPACE_NODE) | (1 << SPACE_VIEW3D) | (1 << SPACE_SEQ)) /* Values that define a categoey of active tool. */ typedef struct bToolKey { int space_type; diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c index 3218f8c45e4..8e49e47c492 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.c +++ b/source/blender/windowmanager/intern/wm_toolsystem.c @@ -487,6 +487,8 @@ static bool toolsystem_key_ensure_check(const bToolKey *tkey) break; case SPACE_NODE: return true; + case SPACE_SEQ: + return true; } return false; } @@ -516,6 +518,11 @@ int WM_toolsystem_mode_from_spacetype(ViewLayer *view_layer, ScrArea *sa, int sp mode = 0; break; } + case SPACE_SEQ: { + SpaceSeq *sseq = sa->spacedata.first; + mode = sseq->view; + break; + } } return mode; } @@ -736,6 +743,17 @@ static const char *toolsystem_default_tool(const bToolKey *tkey) case SPACE_NODE: { return "builtin.select_box"; } + case SPACE_SEQ: { + switch (tkey->mode) { + case SEQ_VIEW_SEQUENCE: + return "builtin.select"; + case SEQ_VIEW_PREVIEW: + return "builtin.annotate"; + case SEQ_VIEW_SEQUENCE_PREVIEW: + return "builtin.select"; + } + return "builtin.select_box"; + } } return "builtin.select_box"; |