diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-09-06 17:48:39 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-09-29 16:07:13 +0300 |
commit | c33a005297ea21d0afafea96579d13607b309d7d (patch) | |
tree | 2b3ac0e82933a5febd21c0987c66150700c9137d /source/blender/editors/space_text | |
parent | ef29bf9023f54667db7a0c2898d12a3bce0873ed (diff) |
Texts in Outliner dont activate
Texts in Outliner dont activate on selecting (Text Editor did not change
to selected text) which is a bit inconsistent to other ID types.
ref T90862
Maniphest Tasks: T90862
Differential Revision: https://developer.blender.org/D12412
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r-- | source/blender/editors/space_text/text_draw.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 99fcb2092c3..b541b65d676 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -48,6 +48,9 @@ #include "text_format.h" #include "text_intern.h" +#include "WM_api.h" +#include "WM_types.h" + /******************** text font drawing ******************/ typedef struct TextDrawContext { @@ -1734,6 +1737,23 @@ void text_update_character_width(SpaceText *st) text_font_end(&tdc); } +bool ED_text_activate_in_screen(bContext *C, Text *text) +{ + ScrArea *area = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0); + if (area) { + SpaceText *st = area->spacedata.first; + ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); + st->text = text; + if (region) { + ED_text_scroll_to_cursor(st, region, true); + } + WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text); + return true; + } + + return false; +} + /* Moves the view to the cursor location, * also used to make sure the view isn't outside the file */ void ED_text_scroll_to_cursor(SpaceText *st, ARegion *region, const bool center) |