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:
authorMartin Felke <martin.felke@googlemail.com>2015-01-07 17:14:07 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-01-07 17:22:11 +0300
commite0e9cd0163a62e74d9837becad4e9097228ce60e (patch)
tree9113d0789883de7673d81ee63cdf20b212b13bf3 /source/blender/blenkernel/intern/screen.c
parent14f2597d7e518be552020875e52c5d6804b48a1e (diff)
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.
Diffstat (limited to 'source/blender/blenkernel/intern/screen.c')
-rw-r--r--source/blender/blenkernel/intern/screen.c17
1 files changed, 17 insertions, 0 deletions
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 */