diff options
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r-- | source/blender/editors/screen/area.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index f2ecf3d5ea2..b05496fc349 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1796,7 +1796,22 @@ static void region_clear_color(const bContext *C, const ARegion *ar, ThemeColorI } } -void ED_region_panels(const bContext *C, ARegion *ar, const char *context, int contextnr, const bool vertical) +BLI_INLINE bool streq_array_any(const char *s, const char *arr[]) +{ + for (uint i = 0; arr[i]; i++) { + if (STREQ(arr[i], s)) { + return true; + } + } + return false; +} + +/** + * \param contexts: A NULL terminated array of context strings to match against. + * Matching against any of these strings will draw the panel. + * Can be NULL to skip context checks. + */ +void ED_region_panels(const bContext *C, ARegion *ar, const char *contexts[], int contextnr, const bool vertical) { const WorkSpace *workspace = CTX_wm_workspace(C); ScrArea *sa = CTX_wm_area(C); @@ -1844,7 +1859,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, const char *context, int c /* collect panels to draw */ for (pt = ar->type->paneltypes.last; pt; pt = pt->prev) { /* verify context */ - if (context && pt->context[0] && !STREQ(context, pt->context)) { + if (contexts && pt->context[0] && !streq_array_any(pt->context, contexts)) { continue; } |