From e0e9cd0163a62e74d9837becad4e9097228ce60e Mon Sep 17 00:00:00 2001 From: Martin Felke Date: Thu, 8 Jan 2015 01:14:07 +1100 Subject: PyAPI: Call to get the pixel x,y in a text block This allows scripts to request the screen location of any (line, column) pair. --- source/blender/blenkernel/intern/screen.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source/blender/blenkernel/intern/screen.c') diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index b2296151cf7..ad4ed5a0b99 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -402,6 +402,23 @@ ARegion *BKE_area_find_region_active_win(ScrArea *sa) return NULL; } +/** + * \note, ideally we can get the area from the context, + * there are a few places however where this isn't practical. + */ +ScrArea *BKE_screen_find_area_from_space(struct bScreen *sc, SpaceLink *sl) +{ + ScrArea *sa; + + for (sa = sc->areabase.first; sa; sa = sa->next) { + if (BLI_findindex(&sa->spacedata, sl) != -1) { + break; + } + } + + return sa; +} + /* note, using this function is generally a last resort, you really want to be * using the context when you can - campbell * -1 for any type */ -- cgit v1.2.3