Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2021-09-06 17:48:39 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2021-09-29 16:07:13 +0300
commitc33a005297ea21d0afafea96579d13607b309d7d (patch)
tree2b3ac0e82933a5febd21c0987c66150700c9137d /source/blender/editors/space_text/text_draw.c
parentef29bf9023f54667db7a0c2898d12a3bce0873ed (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/text_draw.c')
-rw-r--r--source/blender/editors/space_text/text_draw.c20
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)