diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-20 09:27:31 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-20 09:27:31 +0400 |
commit | 170716ca533b250ffa9ae031096bbef9ad7c2976 (patch) | |
tree | 3c20404f22073aab79dc6ff5e9e08cd2f841d951 /source/blender/editors/space_view3d | |
parent | 984d2e42e4a81c1f92dc405ce1b265842bc94b9a (diff) |
use BKE_area_find_region_type in place of inline loops (no functional changes).
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 21 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 12 |
2 files changed, 12 insertions, 21 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index b26883b8fd6..fb67e38cbf7 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -70,16 +70,13 @@ ARegion *view3d_has_buttons_region(ScrArea *sa) { ARegion *ar, *arnew; - - for(ar= sa->regionbase.first; ar; ar= ar->next) - if(ar->regiontype==RGN_TYPE_UI) - return ar; + + ar= BKE_area_find_region_type(sa, RGN_TYPE_UI); + if(ar) return ar; /* add subdiv level; after header */ - for(ar= sa->regionbase.first; ar; ar= ar->next) - if(ar->regiontype==RGN_TYPE_HEADER) - break; - + ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER); + /* is error! */ if(ar==NULL) return NULL; @@ -147,10 +144,10 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C) if(rv3d==NULL) { ScrArea *sa =CTX_wm_area(C); if(sa && sa->spacetype==SPACE_VIEW3D) { - ARegion *ar; - for(ar= sa->regionbase.first; ar; ar= ar->next) - if(ar->regiontype==RGN_TYPE_WINDOW) - return ar->regiondata; + ARegion *ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); + if(ar) { + rv3d= ar->regiondata; + } } } return rv3d; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 804cea57195..1059ad2b19f 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2561,16 +2561,10 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) } if(v3d->lay_used != lay_used) { /* happens when loading old files or loading with UI load */ - ARegion *ar_iter; - ScrArea *sa= CTX_wm_area(C); - /* find header and force tag redraw */ - for(ar_iter= sa->regionbase.first; ar_iter; ar_iter= ar_iter->next) - if(ar_iter->regiontype==RGN_TYPE_HEADER) { - ED_region_tag_redraw(ar_iter); - break; - } - + ScrArea *sa= CTX_wm_area(C); + ARegion *ar_header= BKE_area_find_region_type(sa, RGN_TYPE_HEADER); + ED_region_tag_redraw(ar_header); /* can be NULL */ v3d->lay_used= lay_used; } |