diff options
Diffstat (limited to 'source/blender/editors/interface/view2d.c')
-rw-r--r-- | source/blender/editors/interface/view2d.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 84cf5af5414..eb522a1d2b8 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -44,6 +44,7 @@ #include "BLI_utildefines.h" #include "BKE_context.h" +#include "BKE_screen.h" #include "BKE_global.h" @@ -1959,17 +1960,14 @@ View2D *UI_view2d_fromcontext(const bContext *C) /* same as above, but it returns regionwindow. Utility for pulldowns or buttons */ View2D *UI_view2d_fromcontext_rwin(const bContext *C) { - ScrArea *area= CTX_wm_area(C); + ScrArea *sa= CTX_wm_area(C); ARegion *region= CTX_wm_region(C); - if (area == NULL) return NULL; + if (sa == NULL) return NULL; if (region == NULL) return NULL; if (region->regiontype!=RGN_TYPE_WINDOW) { - ARegion *ar= area->regionbase.first; - for(; ar; ar= ar->next) - if(ar->regiontype==RGN_TYPE_WINDOW) - return &(ar->v2d); - return NULL; + ARegion *ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); + return ar ? &(ar->v2d) : NULL; } return &(region->v2d); } |