diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-12 18:26:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-12 18:26:38 +0300 |
commit | 760e79d8092a121b9d0e1cd02019478c808acae9 (patch) | |
tree | dfd5050507b6a3c87a7314abd805fc792083c947 /source/blender/blenkernel/intern/screen.c | |
parent | ec4ce908db6124037c4dfd927f22a9eec0ba4d52 (diff) |
WM: rename BKE_regiontype_from_id
This returns the first as a fallback, causing confusing usage.
Renamed and added a version of the function that doesn't.
Diffstat (limited to 'source/blender/blenkernel/intern/screen.c')
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 2b1cf0a01df..6723e826cdb 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -107,7 +107,7 @@ SpaceType *BKE_spacetype_from_id(int spaceid) return NULL; } -ARegionType *BKE_regiontype_from_id(SpaceType *st, int regionid) +ARegionType *BKE_regiontype_from_id_or_first(SpaceType *st, int regionid) { ARegionType *art; @@ -119,6 +119,18 @@ ARegionType *BKE_regiontype_from_id(SpaceType *st, int regionid) return st->regiontypes.first; } +ARegionType *BKE_regiontype_from_id(SpaceType *st, int regionid) +{ + ARegionType *art; + + for (art = st->regiontypes.first; art; art = art->next) { + if (art->regionid == regionid) { + return art; + } + } + return NULL; +} + const ListBase *BKE_spacetypes_list(void) { @@ -185,7 +197,7 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar) /* use optional regiondata callback */ if (ar->regiondata) { - ARegionType *art = BKE_regiontype_from_id(st, ar->regiontype); + ARegionType *art = BKE_regiontype_from_id_or_first(st, ar->regiontype); if (art && art->duplicate) newar->regiondata = art->duplicate(ar->regiondata); @@ -295,7 +307,7 @@ void BKE_area_region_free(SpaceType *st, ARegion *ar) uiList *uilst; if (st) { - ARegionType *art = BKE_regiontype_from_id(st, ar->regiontype); + ARegionType *art = BKE_regiontype_from_id_or_first(st, ar->regiontype); if (art && art->free) art->free(ar); |